Add service integration.reload

Just checked and it is available for Config flow.

Needs a lot of rework in my config… a lot.
But it is possible :wink:

No. For integrations that are purely in YAML and do not create a config entry on startup this service does nothing.

It also won’t work for integrations that are configured in YAML but create a config entry (at least not hte way you want it to). There are some integrations that do this. But when they do that they use your YAML config to define the config entry on startup. So like if you set a url field in the YAML then there’s probably a corresponding url field in the config entry.

For integrations like this when you call homeassistant.reload_config_entry it sets up the integration all over again starting from the config entry. But it won’t do the extra step it does at startup where it reads in your YAML and uses that to define the config entry. It doesn’t look at your YAML at all.

When it comes to YAML configuration, the things listed on Developer Tools → YAML are the only things that support reloading your YAML without a restart. For everything else you must restart HA.

4 Likes

I misunderstood the question. Sorry about that. I assumed it was still creating a config entry, just doing the configuration via YAML.

Thanks for that. It’s a pity, but at least I can stop my playing and trying around.

Technically, I don’t understand, why the yaml could not be reloaded and partially re-parsed for such integrations, but most probably only, because no one has implemented it. :joy:

1 Like

Thanks for this, Sky - Just what I needed for the LG integration that looses Ice+ control.

No problem, there is now actually an easier way to reload integration, you can just call a service with one of the entities that the integration is using. For example

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

That I need to do an automation with a script, the problem is that since 2022.8 the Switchbot bot doesn’t work without reload the bluetooth integration in my RPi4, but the bluetooth integration doesn’t have any entity in there…so I have to reload with the older one method below?

Do you know the bluetooth id integration?

Thanks in advance

It exist already and I used it. It works. I had a Huawei LTE dropping integration which I keep up with this reload.

Check this:

Follow the link at solved by Frenck.

3 Likes

config/.storage/core.config_entries no longer seems to exist, but you can get the url by opening your browser development tools and watching the network tab while manually performing the reload you want. If there’s a “proper” way, I couldn’t find it, and this way is pretty easy.

it still exists. The .storage folder is hidden.

so you have to ssh? I don’t see a way to see it in File editor. in that case watching the network tab is way easier.

You can see it in the vscode addon if you change your folder location via the command pallet.

image
image

You can see it in a samba share w/ the samba share addon.

You can see it in SSH w/ SCP (I believe this can only be done via the community addon but it might be doable in the official addon)

I’m going to try this out using Node Red:

Will see if this helps keep my ZHA devices connected:

Fingers crossed.

you have to give it an entity and not a device for it to reload. Also the integration it’s reloading must be in Home Assistant under integrations.

Well, that’s a shame - there are no entities that appear to match apart from ‘hub’:

I don’t think that’s the same as the HubZ Smart Home Controller I’m trying to reload:

Looks like I can’t use Node-Red to reload this one. In fact, there is no individual entity or corresponding entity id for this controller, so you have to search for the entry_id in .storage/core.config_entries. Guess I’m adding an automation!

I can’t get it to work at all. I first of all check my syntax using the Developer tools. I select the service, check the box to use an entry ID rather than an area, device, or entity, and click call:

It’s the same in YAML mode:

The documentation supports entry_id, but the system does not.

Do I need to raise a ticket for this?

no, entry_id is the entry_id, it has nothing to do with device or entity_id’s.

it also doesn’t need to be redacted as it’s just a value that HA uses to identify the item

to get the entry_id, put this in developer tools → template

{{ config_entry_id('switch.laundry') }}
1 Like

I’ll state this again to be clear. With the correct and valid entry_id in the Developer tools, the general message returned is The service requires a target, please select a target from the picker for the UI mode, or This service requires a target, please define a target entity_id, device_id, or area_id under target: or data: for YAML mode.

Do I need to raise a bug report?

just do this

service: homeassistant.reload_config_entry
target: {}
data:
  entry_id: 8955375327824e14ba89e4b29cc3ec9a

and if you can’t send an empty target via node-red, don’t use node-red. Your automation is so simple you wouldn’t even need node red.

trigger:
- platform: time
  at: "02:15"
action:
- service: homeassistant.reload_config_entry
  target: {}
  data:
    entry_id: 8955375327824e14ba89e4b29cc3ec9a

I have tested your syntax and it worked:

service: homeassistant.reload_config_entry
target: {}
data:
  entry_id: 5819b5e0e0061f4346afed4f65e9811d

I’ve added the details to an automation and will test.