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?
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.
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?
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: