Add service integration.reload

Reloading all integrations is basically a restart.

There is a homeassistant.restart service.

What is this sporadic issue?

1 Like

A purist would say, ā€œDonā€™t do that, find the root of the issue!ā€, but we have to live in the real world!

1 Like

The issue is mostly with the Tuya, VeSync, & Overkiz integrations, but sometimes also with Hue.

Every few weeks some device(s) stops following the scheduled automations. More often than not, reloading the integration once resolves this issue.

This is not a reauthentication problem.

Iā€™d rather not restart the whole thing if i can get away with it, but If necessary I could schedule a 3am reboot weekly. (Iā€™ve had problems in the past with scheduling reboots bricking my whole system so im fairly reticent to go that route.)

With so many integrations giving you issues this is more likely a networking issue. Iā€™ve never read of issues with the Hue integration on the forum (even though I donā€™t use it).

Perhaps, but I already attempted to find a correlation with network issues. No Dice.

Hue has problems so infrequently but I added it to my list for completion purposes.

Thanks, this helped me out reload the efergy (power monitoring) integrations whenever the sensors decide to go unavailable.

See the following post where I try to come up with a way to do this in lovelace with a card & a script. Integration Reload w/Card & Script - no luck so far. I may have missed it above but the service call with an entity_id does not seem to support templates for the entity_id.

Please do this feature.

After a power outage, some integrations stop working so this feature will be amazing ā€¦ as I donā€™t need to check if they work or not.
Some integrations require a reload from time to time.

Itā€™s already available on many integrations.

Whatā€™s about the homeassistant.reload_config_entry action?

nevermind, this was already posted multiple times above :see_no_evil:

1 Like

Iā€™m using node-red to do this by leaving the entity_id empty and writing the entry_id in the data field.

This type of comment does not help; worse, it is misleading.

The majority of integrations cannot reload programmatically (using actions that can be used in automation); some examples of integrations that Iā€™m using that donā€™t have this capability are Broadlink, Ecoflow-cloud, Landroid-cloud, Midea Smart AC, Roborock, Smartthings, Watchman and many more; like 99% of all integrations.

Please do your research before chastising people for ā€œunhelpfulā€ comments.

Even though you listed mostly custom integrations (not made by HA), every single integration you listed can be reloaded with an automation using homeassistant.reload_config_entry action.

This action reloads the broadlink integration.

- action: homeassistant.reload_config_entry
  target:
    entity_id: remote.bonus_room_remote

Every integration that is set up in the UI can be reloaded with this service.

The yaml heavy hitters (Most used) can all be reloaded with their own service.

At this point, the only integrations that cannot be reloaded are old yaml integrations that havenā€™t seen updates in years.

3 Likes

I get your point; however, you are missing my point.

To reiterate, I want (and Iā€™m not alone) a way to reload an integration.

Currently, what is available is helpful, but it has a couple of flows, such as the need to specify all the entities/devices related to integration.

I would expect something like this:

action: homeassistant.reload_integration
target:
  integration_id: smartthings

This will allow us to write feature-proof automation; whenever a new device is added or removed, the automation doesnā€™t need to be updated.

No. You just use a single entity from the integration and it will reload the entire thing. If you have multiple integrations of it, then youā€™d need multiple entities.

Hmm, maybe it is a bug in that case; I just retested (now) using:

action: homeassistant.reload_config_entry
data: {}
target:
  entity_id: switch.0_lv1_power_outlet_1

this being an entity part of the HomeKit devices. Only that entity was reset, not even all entities part of the same device. All the other devices from the HomeKit devices list have not been reloaded.

To reiterate, even if this will work ā€¦ this is not a future-proof solution as when this entity is deleted you will need to update the automation.

It depends on the integration, if each device creates a separate instance of the integration, then youā€™d need to add all the devices. But that doesnā€™t make any sense because theyā€™d have a different connection and thereā€™d be no reason to reload them all if youā€™re having issues with 1.

Did you read the link I posted? I donā€™t think so, you can also use the entry_id. You donā€™t need to use entity_id, you can use anything target accepts.

Iā€™ve read the documentation, however; you are missing my point or unwilling to understand what Iā€™m saying.

When an issue happens it happens with one or multiple integrations (for example after a power outage). I rarely had issues with only one device.

For the stuff that is working on Home Assistant, please consider adding the ability to reload an integration that is based only on an integration identifier.

Iā€™m not missing the point, you keep moving the bar even though you can do exactly what youā€™re saying. You can reload integrations, entry_id is akin to integration name.

After a power outage, I have 3 integrations that need to be reloaded because they donā€™t recover, guess what I use? This service with 3 entry_ids.

Sorry that the current implementation doesnā€™t meet your standards.

Hereā€™s a script that will reload all config entries associated with an integration.

reload_integration:
  alias: Reload an entire integration
  mode: parallel
  fields:
    integration:
      description: Integration
      selector:
        text:
  variables:
    entities: "{{ integration_entities(integration) }}"
  sequence:
  - condition: template
    value_template: "{{ entities | count > 0 }}"
  - action: homeassistant.reload_config_entry
    target:
      entity_id: "{{ entities }}"

using itā€¦

action: script.reload_integration
data:
  integration: smartthings

or if you want to reload just a specific config entry without needing to know the entry_idā€¦

reload_config:
  alias: Reload an instance of an integration
  mode: parallel
  fields:
    entry:
      description: Config to reload
      selector:
        config_entry:
  sequence:
  - condition: template
    value_template: "{{ entry is defined and entry }}"
  - action: homeassistant.reload_config_entry
    target:
      entry_id: "{{ entry }}"

Both usable from the UI.

3 Likes

Any update on this?
For me the above does seem to ā€œworkā€ and reload the entries.
However what it doesnā€™t do and what I need is the same as clicking reload on the integration entries.


(sorry fot the german screenshot)
I need this as it seems like this is what triggers a reconnect to the API for this cloud based integreation. Reloading the associated config entries dos not help solving the issue.