What happens to automations when system restarts?

HA updates are released quite often, which is great, but what happens to the automations that are running during the restart of the system?

Example 1: an automation that turns the lights on sunset and then using “wait for trigger” waits for 11pm to shut off the lights. What’s going to happen if I restart HA at 9pm, after sunset?

Example 2: motion activated lights with a 30 minute delay (wait for time to pass). What happens is the system restarts during those 30 minutes after trigger?

Thanks!

The automations are cancelled and the actions after your waits will not occur.

The only way around this is to not use long wait times in automations.

Instead of long wait for triggers, use separate automations with those triggers.

For long delays, store the time you want the next action to occur in an input_datetime and create a time triggered automation. e.g.

trigger:
  - platform: time
    at: input_datetime.driveway_lights_moment_off
3 Likes

Aaah, I actually had it like that (separate automations) before and just cleaned it up. Wanted to have less automation entries. Lol.

The entire automation integration is restarted so, like tom_l explained, any in-progress automations are immediately terminated.

You should know that this also happens after executing Reload Automations. If you use the Automation Editor to create or modify an automation, the moment you click the Save button it automatically executes Reload Automations.

BTW, if you use the suggestion to employ a Time Trigger based on an Input Datetime, you’re not obligated to put it into a separate automation; it can be in the same automation provided you employ a choose to distinguish which trigger was responsible for triggering the automation.

1 Like

I’d be surprised if it can’t still be one automation. That’s what trigger IDs are for.

I’ve started using trigger IDs and a corresponding “choose” action for most all automations, even the simple single trigger ones. Makes coming back and adding functionality a little easier.

1 Like

Didn’t quite get the “choose” idea, but read this blog post and got it now.

1 Like

Indeed. This is the simple solution:

But adding more triggers and some action logic is also an option.

I know this is an older post, but I too have this problem with fans and heated towel rails etc in mid automation that then remain on post a restart.

I solved this for me using Node-RED and the “inject once after 30 seconds” and then setting things off.

I don’t care if I cut short once in a while the towel rail heat or the the toilet fan run on timer.