consider an actions block with:
actions:
- action: light.turn_on
target: &voordeur
entity_id:
- light.voordeur_buiten_lamp
- light.poort_lamp
- delay: >
{{states('input_number.presence_timer')|int}}
- action: light.turn_off
target: *voordeur
and a related condition like:
conditions:
>
{{(now() - trigger.from_state.last_changed).total_seconds() >
states('input_number.presence_timer')|int}}
would these be interchangeable (and ave the identical effect) so I could do:
actions:
- action: light.turn_on
target: &voordeur
entity_id:
- light.voordeur_buiten_lamp
- light.poort_lamp
- >
{{(now() - trigger.from_state.last_changed).total_seconds() >
states('input_number.presence_timer')|int}}
- action: light.turn_off
target: *voordeur
something tells me it is not the same, but I can't find the exact issue. what it should boil down to is that the lights are turned on, triggered by a motion detection, and that after the last detection has been off, for the set time, the lights turn off.
the simple delay seems to also work properly, because if during the delay the trigger fires again the automation is restarted...
it also has the advantage of being way more understandable because simple..