I’m trying to create an automation where
- the light will turn on if motion is detected 30 min before sunset to 11pm.
- if no motion is detected for 10 min, the light turns off.
I tried combining both in the same automation. I also make #1 separate to troubleshoot. Both do not work.
alias: Chandelier On/Off Sunset
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.front_door_motion_sensor
to: "on"
id: motionActive
- platform: state
entity_id:
- binary_sensor.front_door_motion_sensor
to: "off"
id: motionInactive
for:
hours: 0
minutes: 10
seconds: 0
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: motionActive
sequence:
- choose:
- conditions:
- condition: time
before: "23:00:00"
- condition: sun
after: sunset
after_offset: "-00:30:00"
sequence:
- service: light.turn_on
target:
entity_id: light.chandelier_light
data: {}
- conditions:
- condition: trigger
id: motionInactive
sequence:
- service: light.turn_off
data: {}
target:
entity_id: light.chandelier_light
mode: restart
alias: Chandelier Light On Sunset
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.front_door_motion_sensor
to: "on"
id: motionActive
condition:
- condition: sun
after: sunset
after_offset: "-00:30:00"
- condition: time
before: "23:00:00"
action:
- service: light.turn_on
target:
entity_id: light.chandelier_light
data: {}
mode: restart