When the power goes out in your home, is there a way, once power is restored, to automatically reauthorize cloud based integrations?
I have noticed that when the power goes out due to a thunderstorm or, breaker trip, whatever, when Home Assistant starts restarts automatically some of my cloud based integrations remain offline, and therefore uncontrollable via my dashboards…
The only way I have found to fix this issue is to manually do a “reload” of the integration. This usually sends my last known good credentials to the various cloud providers and brings them back in synch so that HA can read their status and otherwise control them. The integrations I have found that cause most of these issues are, GOVEE, CYNC, TUYA, and sometimes August.
I understand some of these integrations are poorly designed and cloud based integrations suck. Most times you are stuck with the cloud and it is what it is.
Has anyone thought of a solution to this issue? What I could see is something like a WatchDog, that after a HA restart, if xx cloud integration doesn’t get data both directions after 10 minutes after a restart, then reload the offending integration.
If you get Spook on HACS you can just set your problematic entities to force a reload on HA restarting. As @MaxK mentioned, you could make it a bit smarter by first polling if the entity is in trouble first. Some of the issue might not be the integration as much as when it loads, it may be loading too early, so this method could be used to say “5 minutes after HA restarts, reload Tuya” (for example).
I suspect HA is loading up faster than your router is starting back up, so HA doesn’t have Internet yet. Like @MaxK mentioned, you can do a service call to reload specific integrations. I have a similar automation setup for a sketchy integration that loses connectivity if the Internet briefly drops out.
You shouldn’t need Spook (I’m aware of it but never used it). Most? integrations can be reloaded with the ‘homeassistant.reload_config_entry’ service call.
Agree with @brooksben11 on this one, there is a strong dependency from a connectivity perspective, those many not start as quickly or be available soon after a power failure.
If your HA instance is up before the full internet connectivity is resorted, you will have these problems. I my case DNS took longer to become available than my HA instance and have to reboot it again after a power-outage to get cloud services working again.
Does anyone have an automation for this? I’m not sure where to even begin but its literally preventing me from ever making HA replace my ISY because my ISY can recover if it boots up be fore my modem and HA ridiculously can’t. Been trying to replace for 4 years now but this is 100% a showstopper.
I’ve been putzing around with trying some stuff but I don’t see any “homeassistant” entities like wifi or communication or anything.
Basically if HA boots before the network, then HA simply won’t load at all until I fully reboot. Can’t access the web interface and none of the automations run. Not sure what state it is in at that point or what needs to be restarted. Also not sure why we don’t simply have a check/retry service built in from day 1 to simply retry to connect to wifi if not available.
HA has no issues recovering from a reboot.
Your integrations might have issues.
We could even out this on the side and say, why isn’t your router booting faster?
Set ut the automation with event Home Assistant start, reload integration.
No reason the be so angry. It’s just an automation you need to set up.
Surely you know how to set up an automation after four years?
Raspberry pi boots in like 2 mins tops… modem take longer because they have to register with the cable company and those take easily 6-10 mins to register with Comcast which is pretty common behavior.
To be fair, I’m not even sure it’s the internet causing the issue. But I know that after a power outage, and the internet comes back, I can’t even access homeassistant.local and the pi light is just red. It’s almost like the OS won’t even boot if there is no internet or something. So really this automation probably won’t even trigger since its more or less dead in the water. So maybe I’m barking up the wrong tree but there does seem to be a few scattered posts about this potentially being the issue. Or maybe it just doesn’t run well on a Pi4. I Could try ssh’ing into the pi or maybe hook up a monitor to it before it fails to see if I see anything on the console as to what state it is in. But it works fine if I unplug and plug back in after the internet is up.
Maybe I just need to add a delay to the startup of HA to wait 7 mins after powering up before loading. Or maybe I need some sort of delayed relay outlet that waits 5-10 mins after getting power before it enables power to go through.
Thx for that… I also got some ideas from ChatGPT that I’m trying to put together. Something with the “ping icmp” integration that will restart HA every 10 mins if there’s no connection. I’ll post it when I get it worked out and tested
So coincidentally, the construction down the block from me just hit a power line and knocked out my power for about an hour or so. It just came back on and I immediately started monitoring what my HA was doing.
Oddly, it comes right up after the power outage and I was able to load the dashboard. Some devices weren’t reporting yet. So I refreshed a few more times and eventually it stopped responding. It’s like it came up, couldn’t do or load some things… and just crapped out. So I rebooted manually and now it all works.
So still inconclusive as to what is going on, but seems like it does at least initially start, but then decides to die. So maybe some integration causes it to hang if it can’t get wifi or I dunno.