Automation turn off after restarting HA

Hi

I have noticed issues with my automations when I restart HA. It’s not frequent but if I was to restart HA successfully in a short period of time say in 2 mins around 3-5 times, my automations turn off and I get no errors in my log.

I suspect it’s something to do with sql because before I installed the recorder component I used to face this issue quite often however after installing recorder with sql lite things have become better but I still get issues here and there.

Any ideas?

That’s a deliberate self protection feature, in case the problem is one of the automations is causing it to crash.

There are two options. The first is, don’t keep restarting HA back to back :wink: The other is to add the following line under the alias line for your automation:

initial_state: 'on'
8 Likes

This happened to me as well. I was in the process of doing some major cleanup of errors in my logs, restarting frequently in a short period of time, when suddenly all Automations were disabled. Quite the feature. Just went through and added initial_state: 'on' to each of the entries to ensure this doesn’t happen again.

Sorry to drag this up but I thought of a way that might make it quicker instead of adding initial state: ‘on’ to all your automations (if you have a load it’s a lengthy process). It may help someone in the future.

Edit:

Just use automation.turn_on and apply it to group.all_automations.

service: automation.turn_on

{
"entity_id": "group.all_automations"
}

Hope this helps someone.

Why wouldn’t you just use the group that has all your automations already?

There’s no reason to create another group for them

1 Like

Well quite frankly because I didn’t know there was one :).

Btw, You can call the service ‘service: automation.turn_on‘ without an entity ID and it will turn on all automations.

4 Likes

a bit weird and sad that HA decides to turn off automations when you deliberately restart HA or the device due to maintenance and or development and that without any notifications whatsoever.

My automations work without problems so HA shouldn’t touch them. It took me a day to find out why some automations were suddenly turned off :confounded:.

One of the worst possible features HA possesses imho.

Other than that I am truly happy with all HA can do :smiling_face_with_three_hearts:

2 Likes

Even worse, there might be automations you had turned off yourself, and after restart, you can’t tell which ones were turned off by HA and which ones should really be off.

I see the same happening with input_boolean entities as well, they’re just all off when I restart HA multiple times quickly, which drives me really crazy. Using initial_state: on is no option in that case, because I want the previous state to be maintained.

I think I’ll open an issue to discuss with the core developers.

1 Like

For me it took also a day to realize why all switches stopped working. The reason for several restarts was several power outages due to a snow storm.