Add service integration.reload

Ouch, sorry, I wanted to quote @sender

If reloading the integration fixes it then yes this will work. Itā€™s an HA service so it can be called from nodered or from HA. Just feed it either the ID of an entity created by that integration or the ID of the config entry itself (which you can get from the .storage/core.config_entries file.

Do you have a way to detect the failure though? I assume you want to trigger the reload when a failure in the integration is detected and not have to click a button to fix it manually. Then you can tie that trigger up to the service call in your flow.

Just as an aside, you might want to look into Zigbee. Most Xiaomi Aqara stuff actually uses Zigbee to communicate with the hub. If youā€™re using their sensors and things you donā€™t need the Aqara hub or app at all, you can just connect all that stuff directly to Home Assistant using one of the options for Zigbee.

I have like 25 Xiaomi Aqara motion sensors, Temp/Humidity sensors, light sensors, door sensors and outlets in my house. I donā€™t own an Aqara hub, they all just talk to Zigbee2MQTT. Iā€™ve never had to reload an integration, they have just worked without issue for like a year now.

Thanks. I will definitely look into getting rid of the Xiaomi gateway. In the meantime Iā€™ll try to get it fixed with Nodered

Let me know if it works. Else, if I have time I will share my flow.

Can you please share it? I canā€™t make it work. Thanks a million!

Show your flow, as said, canā€™t access now.

I have a similar issue with Tuya v2 integration that started late in 2021. I can control the devices (mostly smart outlets), but couldnā€™t get an update on their statuses. An integration restart would resolve it temporarily. I was able to use an automation that would use a service call to Home Assistant Core Integration: Reload config entry and add the list of devices that needed it. A stopgap measure for sure, but it does the trick. I now need to figure out how to run this on a schedule instead of firing off every 2 literal hours, as I have it now.

2 Likes

this works! Thank you!

For everyone who looks for the entry_idā€¦ you can find it here:
~/.storage/core.config_entries

yeah, but as stated several times above, you no longer need an actual entry_id, but can suffice with an entity belonging to that entry_id

+1

Have 2 integrations that need to be related sometimesā€¦ Have worked around it - you can reload it through REST API and using the integration ID.

Having the option available through REST API and Integration ID should make this relatively easy to implement.

homeassistant.reload_config_entry worked for me and my use case. I use the basic automations from HA so I didnā€™t need a config ID as the entity was present in the UI when you set the target

I could only find config_entry IDs for integrations added via the GUI config flow, not for integrations that are activated/configured only via yaml, this is an issue. Looking for a way to automate the restart of the KEF integration

The service ā€œhomeassistant.reload_config_entryā€ does not work for me.
It does not reload the integration. So I guess I will try with the REST Api now.

I have no idea of what Iā€™m doing. What do I use to navigate to that location? File editor?

if you have no idea of what you are doing, please stay away from the hidden files in .storage

theyā€™re hidden with a purposeā€¦
I small typo and you are in trouble.

if anything, never edit resource files with anything else than a plain text editor, because it should not add other characters than the code under any circumstance.

What if the reload automation doensā€™t work becuase it cannot find the integration and the integration isnā€™t listed in core.config_entries.

I have 2 airco units from Airconwithme integration. Inthesishome, and I have replaced some files making it a local connect.

the climate devices are both active and work fine. When it starts the integration it says starting integration.inthesishomelocal .

When trying it through the native automation it shows the following in the log:

  File "/usr/src/homeassistant/homeassistant/components/homeassistant/__init__.py", line 262, in async_handle_reload_config_entry
    raise ValueError("There were no matching config entries to reload")
ValueError: There were no matching config entries to reload

using:

service: homeassistant.reload_config_entry
data: {}
target:
  entity_id:
    - climate.kantoor

Restart Home Assistant. Thereā€™s a reason why itā€™s not listed, and hacking around at things to try and poke it is at best likely to break things.

And what could this reason be? I honestly donā€™t know. It is a integration just like any other, this integration I canā€™t see in the file. I can see everything else. Iā€™m not poking around, it is as described in the various articles belonging to the integration.

not a core integration, so custom. And, apparently, not following core HA guidelines for registering as integration.

This service is only for integrations that use 100% core code guidelines.
you should file an issue at the integration repo

1 Like