Logbook shows every device and automation turned off and then on

I have been having issues with time based automations that trigger off the of how long something has been in a state, or anything that needs to run for extended periods.

Looking in the logbook I see that at the same time these automations fail I have a flood of every device and automation I have reporting being turned off, and then turned on. Sprinkled in between are messages the automations are unavailable. There aren’t any clues as to what triggered the cascade. The devices never actually turn off, which the history confirms, and some of them can’t be like buttons. There are even weird entries during that time like my MacBook audio output being changed when it had been asleep for hours.

Any idea where to start looking at what is causing this?

Does this coincide with a restart?

All entities change to unknown during a restart.

That was my first thought, but my last restart shows 7PM last night where as this happened last at 8:11 this morning

Do you have an uptime sensor?

Make sure Home Assistant is not restarting for some reason.

Check the logs and the config/home-assistant.log.1 file (last log before a restart) for issues.

I have the start_time sensor installed which shows the last start time as 7PM last night. I’ll install this one and see if it agrees though

I’m not familiar with that integration / sensor platform. But if it records the time Home assistant started then random restarts probably aren’t your issue.

I agree, and it doesn’t feel like a restart. It only spans a few seconds, but it resets every automation in the process

Okay, I discovered what is triggering it. It is whenever a automation is edited. Is this to be expected because of the way automations get merged into a single yaml and reloaded? If so that makes it a confusing process to determine what out of dozens of automations may be effected each time a new automation is added or edited.

Using the UI editor?

I don’t use it. Does it automatically reload automations when you save a new one?

When you use the Automation Editor to create/modify an automation, the moment you click the Save button, the Reload Automations service is automatically executed. That’s probably what you’re seeing in the logbook.

In addition, when automations are reloaded, any that might have been in progress (executing a delay, wait_template, repeat, etc) are immediately cancelled.

FWIW, there’s no concept of an incremental Reload Automations in Home Assistant (where only new/modified automations are loaded and all others are left undisturbed). Maybe some day it will be implemented but I’m merely speculating; have no idea what sort of technical challenges are involved.

I’ve been wondering why HA handles things by lumping them all in one yaml file like that. Besides the issue I’ve just run into I’ve had poorly designed blueprints take down all automations when input they didn’t expect was configured in them.

Thank you for the help guys, glad I at least know what’s been causing it. I have a few automations I’ve been controlling by turning them on and off as a lazy man’s way out of using helpers, and I see now why that isn’t a more common method

In this case it’s not the physical arrangement (my automations are in multiple files) but the (monolithic) way an entire domain (like automation) is managed. Basically, wherever Home Assistant permits a domain to be reloaded, it reloads everything in that domain.

Odd, that seems really over the top. I’m not a dev though, so like you said I have no idea behind the reasoning for that design

My guess would be that it’s simpler; incremental reloading is more complex to design and implement.

It used to be that you had to restart Home Assistant to get the job done.

Not trying to hijack this thread (and might even create a new one), but is there a way to NOT have the automations reloads show up in the logbook?

Really muddies the water when automations are updated and the logbook is flooded w/ these notices.

Prefer it to show either only the automation updated - or just hide all ‘turned on’ / ‘turned off’ notices in the automation domain from the logbook.

Or perhaps a way of filtering out specific entries when displaying the logbook.

Agreed. Something better than showing automation reloads in the logbook - TBH, feels like items (scripts, automations, groups, etc.) being reloaded shouldn’t be shown at all…

Created a feature request here: Disable Automation On/Off/Unavailable Logbook Entries