In reverse and probably random order to you points
Probably my poor python skills causing you problem. Here is my brain dump…
make sure you are running via python 3 and not python 2, world is a python transition and not sure where everyone is.
run ‘python3’ with nothing else and may sure you see:
Python 3.8.5 (default, Jul 28 2020, 12:59:40)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
basically some version of 3 should work.
quit()
…
I think I got a little too fancy with a python library to colorize the output to the screen.
try:
pip3 install rich
pip3 install web-socket-client
then
python3 ws04.py
(fingers crossed, hopeful!)
so far I am pretty happy with the Shelly hardware overall. I have yet to need to rely on the Shelly Flood sensor. But if you have a good wifi system in place, I think it is a good route. That said, this is a perfect use case where lower power long battery life zigbee end devices should shine. After my one test unit from Shelly, I bought a set of additional flood sensors, but have yet to install them.
In the picture below is a report on how often the shelly flood reports it’s battery status. Trying to address a couple of your questions. So, basically the Shelly flood reports it battery status about on average say once a day. So putting a ‘expire_after:’ of less than 86,400 seconds (yes the MQTT unavailable timeout is in seconds) would be unhelpful for the Shelly Flood. My bad for my original example.
I do not thing the availability of the ‘expire_after:’ options for sensors is consistent in HA. MQTT sensors YES, ZHA sensors, I do not think so. SUX!
I struggle with this ‘monitoring’ problem. I have cobbled together a mess of several solutions that monitors whether different sensors are running or not. HA could really do a better top down solution for this. Hoping!!
So, if you can figure out my crappy code ws04.py running, hopefully it will give you a view into your PIR sensors. I have two different PIR sensors that I am testing with ZHA.
In the picture below, I have a Ikea motion sensor and a Aqara motion sensor attached to ZHA. Both, from a back of the envelope standpoint, seem to be working fine. The picture shows that both are attached directly to the coordinator, both are ‘online’, and the Ikea last spoke with the coordinator 119 minutes ago, and the Aquara spoke 24 minutes ago. Both seem correct, as this about about the period since a human as near either. Now, both MAY wake up and talk to the coordinator for other reasons, say battery level or light level or something else. So you need to combine this ZHA web socket view of zigbee sensors with the HA state change and event change info to get a more complete picture. Complicated? Yes!
To your point, of checking in with the mothership, this is why I am trying to collect ZHA info over time with my little python programs. in theory, ws04.py should collect ‘check in’ time info over time, so you can see how often your various zigbee sensors say ‘hello’.