We all learning and nubs Just take small steps each evolution. A couple routes you could go.
- Do an alert outside HA. Take a look at the simple example I wrote, ws02.py. And then use something like the code I link below to give you a iOS or Android alert.
ws02.py just prints out the current ZHA view of all of its zigbee devices every 5 seconds in JSON format. This should give you a feel for how you read a HA websocket and what the ZHA JSON data looks like. The parsing examples I show using JQ app to extract out subsets of the ZHA JSON data should give you a feel for how to get to the data you want in the ZHA websocket output. Python’s JSON libraries can do the same extract and filtering that the JQ app does.
You can look at the ‘last seen’ and ‘online’ values for each of your zigbee devices and used these to help determine the devices states. You could mash this up with the code I show below to create an app outside of HA that alerts you when the age of a device exceeds a selected value.
I wrote a simple python script for monitoring whether MQTT bluetooth sensors drop off, it is a bit different a flow, but it might give you an idea of how to do an alert outside of HA when a sensor goes rogue. I use a iOS and Android alerting service called ‘Pushover’ in this app to alert me when a MQTT value has not updated for a period:
- If you want to create a HA sensor, using AppDaemon is the route I know. There maybe other ways. However, you need to be able to call a HA websocket in the environment you are running, I think you can do this with javascript within HA (as the ZHA Network Card example shows) however I do not know how or if you can create a HA sensor using this route. I am not familiar with how to call websockets using python within HA, I am not sure all the necessary libraries are available in HA’s python. So this is why I recommended the AppDaemon route.
I would familiarize yourself with how AppDaemon works/runs apps by creating a simple dummy sensor from their examples. After you are comfortable with creating a HA sensor within App Daemon that updates on a regular period, I would then add in the ZHA websocket calling logic similar to the code in ws02.py combined with your logic to check the age of zigbee devices and then set some type of state in the HA sensor that you create to show the dead zigbee device info to HA.
Good hunting!