Automating "if X and Y then Z"

What would be the best way to automate the following …

If a switch.heater is On AND a binary_sensor.door is Open, then make a light.office_g flash for 60 seconds (then stop flashing & turn off light)

I have created this automation, but the light only flashes once then stays on. This happens when I turn the heater on and the door is closed (but the last bit might be due to the door sensor’s “state” being unavailable at the moment. I am not clear what mode: single is / does, and perhaps I need to use the wait. function anyway?

TIA

- id: '1603976523007'
  alias: Office Heater / Door Open
  description: ''
  trigger:
  - platform: device
    type: turned_on
    device_id: 102bfa9c191511eb9c74b399ec0b41e1
    entity_id: switch.shelly1_a4cf12f45ef5
    domain: switch
  - type: opened
    platform: device
    device_id: 96537959152611eb83c399c2b12bc837
    entity_id: binary_sensor.shellydw2_483fda460cfa_door
    domain: binary_sensor
  condition: []
  action:
  - type: flash
    device_id: 7723b39c153b11eb812b518ca555f2df
    entity_id: light.office_g
    domain: light
  mode: single

Duplicate your triggers in your condition block. This will ensure that both items are in the state you want.

1 Like

Many thanks (again!) - works perfectly :grinning:

1 Like