WTH is there no "reload integration" service?

Hmm, you’re reloading a UI-configured device-bound integration.
My need is the reload of a YAML-configured device-less integration without a device_id (from .storage)…

2 Likes

Well you beat me here

Have you gotten anywhere with this issue? I need to reload the “Onkyo” Integration, which is also a YAML-configured integration. Calling

service: homeassistant.reload_config_entry
target: {}
data: 
  entity_id: media_player.receiver

returns a “unknown error”, perhaps either because this doesn’t work for YAML-integrations or because the Onkyo integration does not create unique IDs for the media_player entities and has no option to do so.

And yeah, there is already a open github issue for the Onkyo integration because it requires the Onkyo receiver to be powered and connected while Home Assistant reboots, if its not, entities for Zone2 and Zone3 are getting deleted. This is rather frustrating and there seems to be no solution.

Any suggestions on how to automate this to occur for a specific device/config entry after a restart of Home Assistant?
I have an automation to restart the HA host weekly and have an integration that tends to need a reload to properly display the data in my dashboard.
I’d like to reload that integration after the restart, and once everything is up and running again.

That being said…

automation:
  - id: hass_reload_device_integration
    trigger:
      - platform: homeassistant
        id: startup
        event: start
    action:
      - service: homeassistant.reload_config_entry
        target:
          entity_id: cover.garage_door 

Obviously use an entity id from the integration you want to reload.

1 Like

This doesn’t work for the Onkyo integration. Calling

service: homeassistant.reload_config_entry
target: 
  entity_id: media_player.receiver
data: {}

Creates following log entry:

Logger: homeassistant.helpers.script.websocket_api_script
Source: components/homeassistant/__init__.py:268
First occurred: 12. März 2023, 16:44:19 (8 occurrences)
Last logged: 17:46:19

websocket_api script: Error executing script. Unexpected error for call_service at pos 1: There were no matching config entries to reload
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 684, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1808, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1845, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 762, in admin_handler
    await result
  File "/usr/src/homeassistant/homeassistant/components/homeassistant/__init__.py", line 268, 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

This solution neither works for integrations that create no entities, nor for integrations that create no unique IDs (I guess).

1 Like

The “entry_id” is in the diagnostics file of the integration page.

What does this mean? I have no idea to get that information from the Integrations page.

1 Like

My usecase is that of an Axis IP camera which I only turn on when alarm is enabled. I ended up doing a script that powers the camera on using a smart socket, waits 40s and then calls the reload_config_entry service.

While using the reload_config_entry works (on the device entity), the notification warning in the UI does not go away (I wish it did, because if the service does exactly the same as clicking the reload button then it should probably disappear). Is that expected ?

Did anyone ever figure out how to reload a yaml integration???

Also hoping someone finally figured out how to reload a yaml integration

@m00str One man’s pain may be another’s pleasure or at least in my case, my GOAL.

I’d LOVE to be rid of the 2 EXTRA and bogus Zones the Onkyo integration generated!

Btw if you haven’t looked yet you might want to consider moving to the HACS version of the Onkyo integration. He added async support that and HOPEFULLY will eventually generate unique IDs.

—T

here is what worked for me:

Go to:

  • Settings:
    image

  • Devices & Services
    image

  • Click on the integration you want to restart, in my case it was Tuya
    image

  • Click on the right top 3 dots and then Download diagnostics
    image

  • This will download a JSON file and the file name contains the entry_id.
    In this example, it is dabdb61cd4818b4fcdf5aab4066f51e5
    image

  • another way to get his entry_id is by clicking on the devices or entities link in the integration screen:
    image

  • this will lead you to the devices page with a URL containing the config_entry parameter, like this:
    image

  • then you can do a call like this:

service: homeassistant.reload_config_entry
data:
  entry_id: dabdb61cd4818b4fcdf5aab4066f51e5

I hope it helps!

3 Likes

Sorry for the late answer, but i tried out two different HACS integrations.
This One seems to be just a revamp of the old configuration.yaml based integration but with the new async backend but
This one additionally has the config flow added, which means you can now set it up through the UI, it generates unique IDs so you can just deactivate the entities of zone2 and zone3. This HACS integration is probably the best for you, since you dont want those additional zones.
The second one has a few quirks regarding zone2 / zone3 but if you dont use those, it shouldnt bother you!

1 Like

entry_id: by itself now generates an error as of HA 2024.6.3:

This service requires a target, please define a target entity_id, device_id, or area_id under target: or data:

instead of using the entry_id, use an entity or device from the integration.

That’s occasionally impossible to do like in the case where the integration failed to load at startup and the entities/devices have ceased to exist, but a reload will then get it going. Yes I know, that particular integration needs to be fixed but in the interim if there was a reload integration service call without having to reference devices/entities when the integration requires a reload, then that service call could be automated.

And we are right back to where we started with the WTH in September 2022…

I don’t know why they removed the ability to use entry_id by itself. It should not require a device/entity_id. An entry_id is required when a device/entity_id is part of more that one integration but specifying just the entry_id should reload the integration and all of it’s config entries in one go. In the case of integrations with multiple config entries, you need to list each and every one of its devices or entities.

The current solution is inadequate and has not been given enough thought and planning.

the entity doesn’t need to exist, it just needs a config entry, which it will have regardless if it exists in the states table or not.

You’re likely encountering a bug.

I just retried it with 2024.6.4 and there’s no error now so the bug was only in 2024.6.3.

service: homeassistant.reload_config_entry
target: {}
data:
  entry_id: b17b75dde717d3fea6e75d6f4e98bb31

image

image