The idea is to switch a light on after a trigger.
Then there starts a timeout of 5 min and switches the light off.
Everytime the trigger is newly set, the old timeout is canceled and it starts again.
So the light keeps being on unless no trigger is startet and the 5 min timebox is done.
Do you guys have an idea to realize this with HA automations?
The easiest would be a turn on then delay, turn off, and set the mode of the automation to restart.
But the better option is to use a timer since that is more resilient
In the automation that Johannes posted, yes. (take not of the last line, that is the important one).
With a timer, you need to tell it to do so, but most likely the automation is written in such a way anyways
The status of an automation doesn’t survive a restart of HA.
So you trigger a walkway light at dawn and want it to stay on for say 4 h. After a delay of four hours the light is switched off. Now imagine HA is restarted (power failure, updates, …). The automation is then also restarted, however, your light is on and the automation with “trigger at dawn” is not executed. Timers can be set up in such way that they survive a restart and get restored.
In your case that’s not an issue, at worst you would suddenly be in the dark, but any movement will switch on the light.
Speaking of restart, it is good practice to also trigger automations with “HA start” and handle this accordingly.