I have an automation that I want to run when HA restarts after a power outage. But at the moment I cannot see a way to detect when that has happened. I’ve tried setting a toggle when the shutdown event fires so I can check it at start up and run the automation (which includes re-setting the toggle) but that doesn’t work because the by the time the shutdown event is triggered the system is sufficiently far through shutting down that the toggle doesn’t get set.
So could we have a binary sensor or some such toggle set by the system when a shutdown is requested that we can then check on startup and reset via a start up automation please.