Connect lost

Hello

I use a Shelly Display and Shelly Dimmer 3 to control 6 dimmable LEDs. At certain times I control the lamps with Shelly Motion 2. The programming for this is set via NodeRed.

After restarting HA, the motion detector usually works without any problems, but suddenly it is no longer accessible (according to the status in NodeRed). Only after restarting HA does it work again.

What could be the reason for this?
Is it possible to automate the restart?

This appears to be a known current issue, relating to HA and Shelly battery powered devices following recent HA updates.

https://community.home-assistant.io/t/shelly-devices-randomly-disconnects/738519

There is an open and ongoing discussion on Github that you may wish to follow (it may eventually result in a successful conclusion).

https://github.com/home-assistant/core/issues/119002

Restarting the system solution is, I read, a service call Home Assistant Core: Reload Config Entry, as indicated in the above.

Thank you, the service call would certainly be a temporary solution. But it should automatically monitor the status. In other words, if it detects that the motion detector is no longer accessible, it should restart automatically.

But how can I realise this? :wink:

If the integration you are using creates an entity as a sensor for the motion detector, then I would expect the sensor state value to be “on” for motion “off” for no motion, and “unavailable” or “unknown”.

“unknown” is what most sensors start life as as HA fires up, until the integration loads and performs its first update of the sensor state value.

“unavailable” is what most sensor values show when the integration wants to perform an update but can’t (is there motion or no? oops I can’t seem to talk to the device, so we just have to say ‘unavailable’). WiFi and battery devices are notorious for going ‘unavailable’, and you will find many techniques for dealing with this.

The Events: state node you appear to be using has ‘ignore state change events when’ setting, so you can just ignore when the device has gone ‘unavailable’. Conversly, you could set the node just to output when the device goes from a known state to ‘unavailble’.
This would be:
ignore previous as all three states, and current equals previous.

Then the node should only fire when state goes from (known on/off) to (unavailable) and you could then use this to fire the restart service call perhaps?

It reads quite complicated. Let’s see if I can figure it out, thanks.

In an event state set the motion sensor and use unavailable for the state. In a call service also with the motion sensor as the entity use:

image

For completeness… This is what it looks like when the device is no longer accessible and requires a restart of HA.

unaviable

The GitHub issue that @Biscuit referred to above speculates that another integration could be causing the issue (caused by blocking the event loop by another integration). The following guide can help track down this issue:

2024.5+: Tracking down instability issues caused by integrations.

2 Likes

Problem solved.
Shelly Motion2 gone and a motion detector from Sonoff. Works perfectly.