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: