What I want to create is a switch that will turn on at a button press or when a binary_sensor is off. But as long as the binary sensor is off the switch has to stay on. Also I want the switch to always extend it’s state by 5 minutes before turning off again.
This is the automation I got (which isn’t working like I want to):
alias: 1e badkamer ventilator aan
trigger:
- platform: state
entity_id: binary_sensor.1e_badkamer_warm_water
- platform: event
event_type: deconz_event
event_data:
id: 1e_badkamer_dimmer
event: 4001
action:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.1e_badkamer_warm_water
state: "off"
sequence:
- service: switch.turn_on
entity_id: switch.1e_badkamer_ventilator
- wait_template: "{{ is_state('binary_sensor.1e_badkamer_warm_water', 'on') }}"
default:
- service: switch.turn_on
entity_id: switch.1e_badkamer_ventilator
- delay:
minutes: 5
- service: switch.turn_off
entity_id: switch.1e_badkamer_ventilator
Can someone help put me out here?