How can I make Tuya Integration Retry Connection?

I am having some frequent power outages and I noticed that when it happens, after the device restarts and home assistant boots, most of the time I still don’t have internet. Then, Tuya integration fails and by result I can’t control my lights. But after internet comes back, if I go on the settings and restart the Tuya integration, it works just fine.

As a matter of fact, a secondary problem is that my Apple TV is my Homehub (via Home Assistant bridge), and it also happens to start before home assistant is properly booted (and Tuya is failed). So all devices are without response. But fixing home assistant Tuya integration does not recover Homehub, so I have to reboot my Apple TV. A hard reboot (cant just restart) via a Smart Plug that I dedicated only for that it.

So to summarize, I am looking for a way to make my setup more robust to these power outages: For starters, couldn’t Tuya integration just retry every x seconds after failed, like many other integrations such as Radio and Metereology? Secondly, after Tuya is integration is correctly started, could home assistant trigger a power off + power on to my apple TV plug, to make sure homekit is properly started?

What can I do about these things?

Thanks

You can have an automation where the offline device (or something else) is the trigger, and then use Home Assistant Core Integration: Reload Core Integration as the action, where you choose the device you need to reload. I have a setup with this for some Tuya devices as well for XX minutes after a specific smart switch comes online to refresh common offenders.