Automate restart of buggy integration

I am running into issues with the Rainforest Eagle integration.
I reported the bug at Rainforest Eagle power demand sensor stalls and stops collecting data · Issue #78853 · home-assistant/core · GitHub .

This is a legacy device. The manufacturer isn’t offering support anymore for the revision of the hardware I have , the RFA-Z109 .
The integration for it frequently fails to retrieve data from it.
A simple workaround is to restart the integration for it manually. That fixes it every time. I’d like to automate that task.

I read through the thread below.

It seems there are many people having issues with other buggy integrations. The suggested workaround is to restart all of HA. I don’t like that solution as my Rpi 3B+ takes some time to restart HA, and it puts every integration offline for some time during the HA restart. An OS reboot is even longer.

I’m looking for a way to automatically and periodcally restart the integration only. Once a day is probably good enough, but since I already reboot the device itself every 3 hours with a smartplug due to a separate bug with it, I would want to restart the integration at the same time, if there was a way to do so. I can’t find a corresponding action in HA, though.

You can use a shell command to reload an integration via the home assistant API, see:

Thanks. How did you figure out the URL for a particular integration ?

I tried clicking on the “device” link on the Eagle integration, and it gave me
http://homeassistant.local:8123/config/devices/device/e2ffe9059dcda09474bfaf8ada6d6c35

The “entities” link gave me
http://homeassistant.local:8123/config/entities?historyBack=1&config_entry=7569e33bddc0843248eeb3e2361ec32c

I haven’t used it, I just linked you to it. I suggest you ask there.

Select an entity that belongs to the integration and then use the homeassistant.reload_config_entry service call.

2 Likes

This doesn’t always work for me. Sometimes it does and sometimes a full reboot is needed to get it running correctly again.

@Taras ,
Thanks. I just tried that, I’ll report if it works in the long run or not. I can’t tell in the short term since the behavior is random and not happening daily.

Which approach doesn’t always work for you ? The shell command, or the reload_config.entry ?

Reload config entry.
But it’s the Tuya v2 integration…

It depends on integration, service call above imitates what you manually can do on integrations page. So, some integrations are not able to recover even after you reload them. It would depend on error type and how it is handled internally