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?
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.
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.
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.
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…