Can I write an automation to reload/restart an integration?

1 Like


:man_shrugging:

This will restart Home Assistant, which is probably fine in the middle of the night, when you are typically ok about having the system out for a couple of minutes (although I would definitely add a “Party mode” helper to suspend the execution when I have guests at home).
As I understood, the point here was about restart an integration everytime some specific sensor (or a number of sensors) is unavailable, which is OK to happen a few times during the day as this probably will cause unavailability of a few sensors for just a couple of seconds (and not minutes) and will fix the problem right at the time it shows the first symptoms.

+1 here to reloading an integration. In my case it’s for the Deako lights that seem to just stop responding after midnight. No idea why, bugs already submitted but the integration is mostly dead at this point. The most annoying part is the integration doesn’t even return ‘unavailable’, it’ll say a light is on when in fact it isn’t. The Deako integration seems to falsely report back the status of lights until you reload it and then it’s fine.

That is not a core integration is it?

Unfortunately not, it’s a custom integration as the company does not officially support HA but the folks that built it aren’t particularly active either.

homeassistant.reload_config_entry

Yes, this is the right service to load the integration. I use it for UniFi integration that doesn’t load by itself after updating Home Assistant, and integration clients aren’t at home, which causes problems when people are at home.
Hopefully the automation will work properly .

alias: "Po Restartu Home Assistant "
description: |-
  provede po restartování HA
  - znovu načtení integrace UniFi
trigger:
  - platform: homeassistant
    event: start
condition: []
action:
  - service: homeassistant.reload_config_entry
    data: {}
    target:
      entity_id: update.unifi_network_application_update
mode: single

2 Likes

Thank you, this was the solution to auto-recover my Tractive integration.

same here. Thanks for your thoughts!

Is there any way to reload UI integration i have problem in Tuya integration
I notes after reloaded it back working as normal,
thanks

Yes, call the service homeassistant.reload_config_entry

1 Like

thanks, but this for individual entity
Is there a way to Full reload the integration ?

Reloading the config for one entity also reloads the config for its integration

top Thanks for the info

This does not seem to work for Adax integration. Reloading it with target as one entity fails to bring the integration online if there is an issue. Yet, reloading it from the integrations page works, but this does not help with my automation. Is there anything I can do?

The trouble is that (as I understand it) this statement is not universally true for all integrations

The source may give some clues.

1 Like

Hi Stasharo,

Thanks for this script, I am getting these error would you please be able to assist?

3430 |
3431 | alias: Restart Tuya
----------^
3432 | description: ‘’
3433 | trigger:

I have resolved this with the following with a time based automation (Below)

Home Assistant 2023.5.2
Supervisor 2023.04.1
Operating System 10.1
Frontend 20230503.3 - latest

Name of Automation : Restart Tuya
Trigger:
Mode: fixed time
At time: 08:30 AM (set the time after the unit is on, or else it will not work)
Actions: Call Service
Service: Home Assistant Core Integration: Reload config entry
Entity: climate.rcdf (this is how I have mine, choose your appropriate one)

Hope this helps someone else.

3 Likes

Hi! How do you “auto-recover” the Tractive Integration, do you want to share your automation? :slight_smile:

Thanks