Power blackout HA restarts but no zigbee sensors are available

After a power blackout my HA (installed on a RPi3) restarts but all of my zigbee sensors are not reconnected to the zigbee mesh network again so my HA alarmo addon doesn’t work anymore. All of the sensors use ZHA to connect to the zigbee hub (sonoff one). Do I have to use another way for my sensors to connect to the zigbee network? Do I have to run some script to make the reconnection of the sensors “manually”?

Thanks a lot!

How long are you waiting?

End devices (I assume that’s what you mean by “sensors”) can show as “unavailable” for some time after the system restarts, and some entities can take longer than others - battery levels, for example, may have a low priority. Sensors should re-connect immediately when they are triggered, however, so a motion sensor will re-connect if motion is detected.

I may be wrong, but I don’t think you can force them to reconnect. In a Zigbee network, end devices contact their parent router, not the other way round.

There is a “trigger when unavailable” option in Alarmo which you might be able to use to make Alarmo try again after an interval, or at least send you a notification.

I wait sometimes a couple of hours. It seems that, as you say, sensors and other end devices reconnect when they are triggered, but sometimes I have some open/close sensors reconnected with the wrong status (door closed but the status is “opened”).

If I unplug the sonoff usb zigbee hub and then plug it again in my RPI almost all of the sensors reconnects inmediately.

It’ very important that after a power outage every sensor gets back to normal operation because the other way my home alarm system will not work properly.

I’ve just tried it, and my experience is similar to yours.

The binary sensors for my contact sensors became “unavailable” very briefly after a power outage and then they all took the value “closed”, including one which was open before the outage and one that was opened during the outage (both these windows were still open when power was restored).

LQI vatues for all the sensors were “unavailable” for about half an hour after the restart. When they returned, the two open windows still showed “closed”. I have contact sensors from several different manufacturers, including Philips Hue, so this sounds like a Zigbee thing.

This is a bit concerning - like you I use ZHA and Alarmo, but the alarm is no good if the sensor values are wrong.

Thinking about it, I’m not sure there’s anything to be done about this. A UPS for the RPi would preserve the sensor values and keep Alarmo running, but all the Zigbee routers in the house would be down so the contact sensors would be unreachable. When power came on again they would still have the status they had before the outage, and they would keep it until the corresponding doors/wingows were opened or closed.

If the power cut went on for some time, the sensors would eventually be flagged as “unavailable” anyway - in my system this happens after six hours, which I think is the default for ZHA.

In my case I have sensors from two brands, and yes, definitely is a zigbee issue. I have motion sensors that goes the same and also some relay switches that after reconnect the status of lights are wrong. Do you think it’s possible to do sth after HA reboot in order to check that all of the sensors are in it’s correct state and connection?

I already have an automation that runs after a restart to check that switches are in the correct position. The idea is that you can’t tell how long the system may have been down, so the automation checks time, light levels, occupancy etc. and resets everything as best it can - that works quite well.

I don’t think it’s possible to do this with sensor entities, though - they get their values from the device they’re associated with. A contact sensor won’t change unless the window actually opens.

The more I think about it, the more a UPS seems to be the least worst option.