#If close or open combined

1 messages · Page 1 of 1 (latest)

haughty delta
#

I have 2 automations, one is saying when door sensor is closed, then switch on something. and another one the opposite, if door is open then there off something. Can I combinee this to single automation ?

alias: Windows 1 Close
description: ""
triggers:
  - type: not_opened
    domain: binary_sensor
    trigger: device
conditions: []
actions:
  - type: turn_on
    domain: light
mode: single
alias: Windows 1 Open
description: ""
triggers:
  - type: opened
    domain: binary_sensor
    trigger: device
conditions: []
actions:
  - type: turn_off
    domain: light
mode: single
short leaf
haughty delta
# short leaf you add both triggers and add an ID to both of them then in actions you use a ch...

Like that ?

alias: Window 1
description: ""
triggers:
  - type: opened
    domain: binary_sensor
    trigger: device
    id: W1Open
  - type: not_opened
    domain: binary_sensor
    trigger: device
    id: W1Close
conditions: []
actions:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - W1Open
        sequence:
          - type: turn_off
            domain: light
      - conditions:
          - condition: trigger
            id:
              - W1Close
        sequence:
          - type: turn_on
            domain: light
mode: single
haughty delta
#

thank you