So I have the following automation which is designed to turn off all the interior lights if there hasn’t been any motion in the living room after 11pm for more than 10 mins. This actually works, but the issue is if there is no motion after 10pm to 11pm, it doesn’t trigger because the 10 mins has past and it hasn’t reach 11pm yet. Even after 11pm, it still doesn’t trigger because its now more than 45+ mins (not 10).
How do I get this to trigger if it’s ‘more’ than 10mins after 11pm? Is there such thing as a ‘longer than’ trigger?
id: '1625027487005'
alias: Lighting - Good Night
description: ''
trigger:
- platform: state
entity_id: binary_sensor.living_motion_sensor
for: '00:10:00'
to: 'off'
condition:
- condition: state
entity_id: light.interior_lights
state: 'on'
- condition: not
conditions:
- condition: time
before: '23:00:00'
after: '05:00:00'
action:
- service: light.turn_off
target:
entity_id: light.interior_lights
mode: single
I use Timers for each room, and then evaluate the logic when the timer.finished event has fired.
Every time there is motion I issue the cancel timer service call, followed by the start timer service call - whether it is daytime or not, it doesn’t hurt anything, and then when the timer fires - I can decide whether the conditions have been met to turn the light off - using the choose option.
EDIT:
Also just noticed your automation is in single mode, and when dealing with things like Motion sensing - you should really have this set to restart.