I am working on an Automation that in it’s basic form will turn on lights following a motion detection. I am planning on having a delay before the lights turn off of a specified value. When the time is up, the lights go off.
I’ll have some other conditions that will apply (time of day, day, sun position, lux, etc.) but I see 2 solutions to this problem and I’m looking for pros / cons to each.
Solution #1 - Single Automation that Restarts on a Motion Trigger
- id: '1637293261926' alias: Motion Lights (No Lux) - Hallway description: '' trigger: - type: motion platform: device device_id: bfcb6cb207346179b1382f413e5aaddb entity_id: binary_sensor.hallway_motion domain: binary_sensor condition: - condition: time after: input_datetime.motionstarttime_downstairs before: input_datetime.motionstoptime_downstairs action: - service: light.turn_on target: entity_id: light.hallway_ceiling_light_1 data: brightness_pct: 100 transition: 3 - wait_template: '' continue_on_timeout: true timeout: 00:05:00 - service: light.turn_off target: entity_id: light.hallway_ceiling_light_1 data: transition: 3 mode: restart
Solution #2 - Two Automations … one that triggers on motion and starts (or restarts) a timer and a second that listens for the timer completing and then turning the lights off.
Any opinions on the more elegant / fail safe solution?