When Home Assistant restarts after a power outage, is there anyway to automatically reauthorize cloud based integrations

Greeting fellow Home Assistant friends…

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.

Thanks,

MM

You can use an automation after startup to check the status of the integration and reload it.

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.