Hi, I was wondering if someone could help me with this. Reading through the forums the for condition where I have it won’t work but I don’t know how to format to get it to work.
What I’m after is for a condition that if the state of the sensor is off for 30 seconds then the light turns off. Is this doable or should I just use 2 automations, one for on and the other for off with a trigger?
- alias: 'Front Porch Auto Light On/Off'
trigger:
- platform: state
entity_id: binary_sensor.doorbell_person_detected
action:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.doorbell_person_detected
state: "on"
- condition: sun
after: sunset
after_offset: "-01:00:00"
sequence:
- service: light.turn_on
entity_id: light.entry_light
- conditions:
- condition: state
entity_id: binary_sensor.doorbell_person_detected
state: "off"
for:
seconds: 30
sequence:
- service: light.turn_off
entity_id: light.entry_light