Add service integration.reload

I’m experiencing problems with my Tado integration. After a restart of home assistant core. My Tado sensors are up but my Tado climate devices are often unavailable. With a manual reload of the Tado integration this is fixed. I would be great that I can automate this.

+1 from me. I can see why this is very useful for a lot of people!

Meanwhile, I do a integration reload through the API with curl.

My Meross integration is unavailable every time the internet goes down, it won’t become available after the internet comes up, so I do a reload through the API.

Example:

curl -X POST \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
http://192.168.2.100:8123/api/config/config_entries/entry/INTEGRATION_ID/reload

The integration id you can find with “Inspect Element” --> “Network” in your browser.

A service integration.reload would be most welcome, meanwhile the API is the next best thing…

More information on the API you find here: https://developers.home-assistant.io/docs/api/rest/
My 2 cents,
Frank.

10 Likes

Salus also have problem with load on start.
Reload integration service would be nice.

ABSOLUTELY WOULD BE !

1 Like

Hi fripsy and welcome to the community!

Thanks for the solution you are proposing, it seems it’s gonna solve my ZHA integration going down every now and then :slight_smile:

Would you be so kind to help me on how exactly I can implement this? I have found my integration ID following your guidelines but not sure how to call the curl/REST API from my automation.

Here is what I try to achieve:

 - alias: 'Reload ZHA integration'
   trigger:
     platform: time
     at: '02:00:00'
   condition:
   action:
     curl: -X POST\
     -H "Authorization: Bearer MY_TOKEN" \
     -H "Content-Type: application/json" \
     http://192.168.0.18:8123/api/config/config_entries/entry/MY_INTEGRATION_ID/reload

Obviously the above is not valid but I just wanted to demonstrate where I want to go.
I found that I can use the rest_command integration for that so will it be this in my case? Not sure…
config.yaml

rest_command:
  reload_ZHA:
    url: http://192.168.0.18:8123/api/config/config_entries/entry/MY_INTEGRATION_ID/reload
    method: POST
    headers:
      authorization: 'Bearer MY_TOKEN'
      content-type: 'application/json'

Many thanks in advance!

Hi George,

Sorry for this late answer, was kind of busy these last days…

First, I don’t think that “curl” in the action part works, I created a shell_command in configuration.yaml, like this:

shell_command:
  reload_meross: curl -X POST -H "Authorization: Bearer YOUR_TOKEN" -H "Content-Type: application/json" 
http://192.168.2.100:8123/api/config/config_entries/entry/INTEGRATION_ID/reload

My automation:

- id: '1607095320880'
  alias: Reload Meross
  description: ''
  trigger:
  - platform: state
    entity_id: switch.kitchen_led_mss210_main_channel
    to: unavailable
    for: 00:05:00
  condition: []
  action:
  - service: shell_command.reload_meross
    data: {}
  mode: single

I did the automation through de UI, hence the odd ID…
I can’t comment on the rest command, I never used it, so I didn’t look into that.

Hope this helps,
F.

6 Likes

This would be very nice. I have an integration, Solax, setup via YAML (there’s no UI config available) and the only way to reload it now, is to restart the core.

1 Like

Hi guys,

Until the integration reloader is fully integrated in HA, I’m using an auto reboot script after startup and for the Ikea integration, I’m using a presence detection script.

So: if rebooted by an external cause, HA automatically reboots itself again. All internally automated reboots switch a toggle (Auto reboot) to “no” . So when you reboot HA by internal automation, you prevent a boot-loop. External reboots, caused by power outs etc will set off a second boot, to reconnect the intergrations.

I also have a ping/network presence entity which monitors the Ikea hub. The hub intermittently disconnects shortly and when it does that, HA reboots once. This seems to solve the known Ikea integration problem. A bit of a hassle, but it seems to work for me.

And it doesn’t… so anyone got any news in the integration reload part?

Thanks.

TonkaNL

1 Like

I too think this would be a great addition - could then be used to fix my Xiaomi devices that drop off the
ZHA network via a watchdog style automation that restarts the integration service if device/s are offline.

1 Like

Hi Guys,

Any news on this front? I’ve looked around on Github also, but if I’m not mistaken, there’s no new “reload integration service” available yet, right?

Thanks!

TonkaNL

This would be a great addition to the services. It would solve my problems like: my bulb accidentally got disconnected or my Zigbee Devices suddenly lost connection.

1 Like

+1 - this would be a great function

2 Likes

I have the same problem
The xiaomi integration become disconnected after 2 hours

1 Like

Hi all, the same for me.
I have 2 Xiaomi gateway: one of them is disconnected from home assistant after a couple of hours. I can reload this integration manually through UI.
The other one is always connected.
Can you help me write down an automatic reload of integration every 2 hours?
The @Mariusthvdb integration.reload didn’t work
Thanks

That’s because it doesn’t exist… hence the feature request :wink:

@Mariusthvdb I had a lot to looking for :rofl:

To reset the IKEA connection automatically, I’m using this in an automation:

- alias: "Keep IKEA running" 
  mode: single
  description: 'Check IKEA HUB down'
  trigger:
  - platform: state
    entity_id: switch.kerstverlichting # use any entity that is an IKEA device 
    to: unavailable
    for: 00:05:00
  condition: []
  action:
  - service: rest_command.reload_ikea
    data: {}

An this in the configuration.yaml

rest_command:
  reload_ikea:
    url: http://[IP]:8123/api/config/config_entries/entry/[Config Entry]/reload 
    method: POST
    headers:
      authorization: 'Bearer [Long-Lived Access Token]’
      content-type: 'application/json'

IP: is your home assistant IP
Config Entry: is the unique config entry for your Tradfri and can be found in your directory config/.storage/core.config_entries. Search for Tradfri and use code Identity
Long-Lived Access Token can be created in the HA menu under your instance name

21 Likes

that would be very nice, but unfortunately I can not get it to work, keep getting the client error. using either http or https.

also tried the https://homeassistant:8123 variant, which works fine in rest sensors, same error though.

rest_command:
  reload_ikea:
    url: http://192.168.1.71:8123/api/config/config_entries/entry/00identity3c7edc4ff/reload
    method: POST
    headers:
      authorization: !secret api_bearer_token
      content-type: application/json

identity as found in:

            {
                "entry_id": "377entry_id951",
                "version": 1,
                "domain": "tradfri",
                "title": "192.168.1.99",
                "data": {
                    "gateway_id": "7Gatewayherea2",
                    "host": "192.168.1.99",
                    "identity": "00identity3c7edc4ff", ##<<-----------
                    "import_groups": false,
                    "key": "IJMTKEYHEREH"
                },
                "options": {},
                "system_options": {
                    "disable_new_entities": false
                },
                "source": "zeroconf",
                "connection_class": "unknown",
                "unique_id": "66:UN:iQ:UE:ID:6D"
            },