Auto reboot when entity not found

Hi, I am struggling with a problem I cannot solve. Sometimes my meross entities lose contact with home assistant and become unavailable. The problems gets solved restarting Home Assistant and Meross comes to live again.

This problem is common with another users and there is no solution yet from the creator of the component Alberto Geniola.

I am trying to automatize the rebooting with no success. Cannot play with null values, cannot play with triggers and conditions. I am not able to tell the home assistant to reboot if meross component goes down.

Can anyone help me? Thank you in advance and sorry for my “Spanglish”

You can use the trigger state and configure it so that it triggers if the entity state switches to unavailable (not null).
As an action you choose homeassistant.restart and thats it if I understand you right.

alias: reboot on unavailable
description: ''
trigger:
  - platform: state
    entity_id: input_boolean.test_switch
    to: unavailable
condition: []
action:
  - service: homeassistant.restart
mode: single

You can always go to the developer tools to see and play around with the states of each entity.

Thank you. I´ll give a try and comment results!

Did you try only reloading the meross integration from the UI? If that works you could have a look at this:

so HA would be constantly available.

Yes, you understood me perfecty. This solution did not work :frowning:

Does the Automation not trigger or is HA not restarting? Also in the Title you said “entity not found” but in your text you are saying unavailable. Could you describe what’s happening with more details?

The automation dont trigger I think
It is in Spanish but you can see and read “no disponible” (not available)

And the second image you can see the switch in gray

this is the entity I used in the automation. Its state is unavailable but HA does not restart.

Thank you very much for your help and spended time

not available2

No problem.
For me if an entity has this icon and says not available, it is still an entity with the state of unavailable
as I said, you can see that in the developer tools. How does your automation look like?

Developer tools when I paste the automation, says:

“This template does not listen for any events and will not update automatically.”

description: ‘’
trigger:

  • platform: state
    entity_id: sensor.aire_comedor_mss310_main_channel
    to: unavailable
    for: 00:05:00
    condition: []
    action:
  • service: homeassistant.restart
    mode: single

Templates and Automations are not the same. I meant the state tab of the developer tools where you can look up the state of the entity you want to use. Please format your code by going into an empty row and clicking </>. But the Automation you posted works fine at my end. The only thing I could imagine right now is that the state does not change if the entity becomes unavailable. Go to the developer tools next time it happens and check the state.

Understood. I made these changes. I´ll wait until they became unavailable and see what happens.

trigger:

  • platform: state
    entity_id: sensor.aire_comedor_mss310_main_channel
    to: unavailable
    for: 00:05:00
    from: ‘on’
  • platform: state
    entity_id: sensor.aire_comedor_mss310_main_channel
    from: ‘off’
    to: unavailable
    for: 00:05:00
    condition: []
    action:
  • service: homeassistant.restart

*formatting :wink:

Working like a charm!!!

I have been watching the system all this week. When meross goes unavailable system restarts automatically and comes again to live.

Thank you again

I am new to HA with little coding experience. I am interested in enabling this for my meross smart items. Could someone please talk me through how to add this code? TIA