I’m hoping someone has some advice for me here. I’m new to HA but a long time Homeseer user, in the process of migrating to HA. I’ve got a simple scenario here and I’m having trouble finding the right solution.
Desired action: Pressing a button triggers an automation that turns on a light for exactly ten minutes, then turns it off. Pressing the button again within the 10 minute window restarts the 10 minute timer.
In Homeseer, each time an “event” is triggered with some delayed action (in this case, turning the light off after 10 minutes) a new temporary event is created to turn off the light at a specific time. This temporary event can be easily deleted if it exists and the button press event runs again, so it effectively does what I need it to do.
In HA, I’ve been reading about two methods:
-
service.automation_off then service.automation_on with the stop_actions set to True. This seems to work but I have to call it in a separate automation – I am assuming calling those services within an automation will stop it completely, which is not what I want to do.
-
There’s some talk about having the automation call a script, and then controlling that with some call to cancel/stop a running script. If I was going to do that I’d rather just make the two automations since that seems easier to me. One automation has the button trigger. The other has a ten minute light on action. The first stops/starts the second, then calls the second for the light sequence.
I was hoping there’s some other way I am not familiar with yet.
Finally, one thing I’ve noticed that I guess is intended behavior but it doesn’t seem right to me. If I trigger the automation to turn on the light for 10 minutes, and a few minutes into it I trigger the same automation, the light will still turn off 10 minutes from the first trigger, not 10 minutes from the second trigger. In other words, triggering an automation again that’s already running with a delay doesn’t seem to have any effect.

my action are preset mode, no on off. And I don’t understand his automation and all sequences