Automation to notify when integration stops working

I have a Meross integration which started acting up recently and devices keep going offline (even though it says they are connected in the logs) while I have raised the issue with the owner, I need a way to fix their availability with some automation

It looks like this when they stop responding:

I created an automation like so but it never triggers:

- id: '1627152370529'
  alias: Meross is unavailable
  description: ''
  - platform: state
    entity_id: switch.recliners
    to: Unavailable
    for: 0:05:00
  condition: []
  - service: notify.mobile_app_sm_g998b
      message: Meross is unavailable for more than 5 mins
  mode: single

Any ideas why it is not triggering, I’m thinking the trigger logic but it looks good to me

Because you are using:

to: Unavailable

When you should be using:

to: unavailable

As shown in your screen-shot of the state.

Letter case (upper or lower) is important.

Another alternative if you have a lot of entities that needed attention in case they are unavailable-

It will create an entity called sensor.unavailable_entities that updates once every 60 seconds.You’ll also have the option to set an automation to notify you if some devices became unavailable.

Doh it’s with a capital U when you click on its history so I just used that.
Updated it and will see if it works now :slight_smile:

Yeah you can only trust the state shown in the Developer Tools States Menu as Lovelace will prettyfy some states.

Apparently there is also a way to reload an integration without full HA restart.
Any idea how that achieved?

It’s done via the UI (Integrations > The integration > Overflow menu > Reload). Currently, there’s no service call to do that (you can check that by examining the list of available service calls in Developer Tools > Services).

well, there is actually, for config entry integrations:

    alias: Reload integration
    mode: restart
      service: homeassistant.reload_config_entry
        entry_id: >
          {% set mapper =
             'Luftdaten Roosendaal T':'08dc2eb8057b11ebaf313de78a26ad7c',
             'Luftdaten Rotterdam P':'c6a0d358ef29c38385928de7375f1281',
             'Luftdaten Rotterdam T':'01644083c1d0f7e30cee3dd55625012e',
             'Luftdaten Tilburg P':'9565788c086e11eba8da7ba5c092109c',
             'Luftdaten Tilburg T':'850adf05086e11eb9835bd2520ff1bf8',
             'Philips Hue 1':'7afbac0fccdd4e478fcd82fae86fabc5',
             'Philips Hue 2':'a4ed6f6c6f4e4c2bb00940672dfd731e',
             'Synology Dsm':'fd8b44750830460c98e7938ae3881367',
             'Xbox':'e8cd7b63b43040dd0c7e86ddf685abe6'} %}
          {% set state = states('input_select.select_integration') %}
          {% set id = mapper[state] if state in mapper %}


Where do you get the ids?

Not really dedicated to reloading integrations, is it?

It appears that its ability to reload an integration was an afterthought because the user is required to supply an identifier that isn’t readily available unless they explore the hidden registry files.

Even Updating Add-Ons don’t require hard-to-find identifiers:

Screenshot from 2021-07-25 10-33-10
Screenshot from 2021-07-25 10-32-58

Nevertheless, I appreciate you posting that and the only thing left unsaid is explaining to the OP where to find the integration’s identifier.

Exactly, where indeed.

They are located in a file in a hidden directory where the average user is not supposed to be exploring.


Look for the integration’s name and then use its entry_id.

To be clear, this only applies to integrations that are initially configured via the UI and not YAML.

1 Like

wouldnt say an after thought, (this was developed after my FR was issued) but indeed, things should become more obvious, and I hope they will.

  1. Your original request suggested a far more intuitive way of calling a dedicated integration.reload service.

  2. I agree with Kane610’s comment.

FWIW, there’s a PR in the works to provide new templating functions to access registry data. Whenever it becomes available, it may offer a means of acquiring the entry_id using the integration’s name (assuming it’s unique).

Found it, thanks

But homeassistant.reload_config_entry doesn’t seem to work for me