Montoring Device Status

Hi all!

Has anyone come up with a nice solution to monitor the status of all your z2m devices? I have a couple of door sensors and one plug that occasionally drop offline due to some range issues.

I currently use z2m assistant to check the device status, but has someone come up with a nice way to present this in Home Assistant, or some other way ?

About a week ago i moved off a CC2531 and onto a LAUNCHXL-CC26X2R1 and this has been noticably better, but id still like a way to keep an eye on it!

I think people tend to come up with their own solutions.

My network is all Xiaomi sensors that report in with a ‘heartbeat’ every 50 minutes or so.

I have a Node-Red flow subscribed to /zigbee2mqtt/# that writes every message to a MySQL database. I run a query against the database that groups by device and by hour (1= 1 or more messages in an hour, 0 = no messages in the hour). I then sum all the hourly status reports. 24 for each sensor means that all is well - the sensor has reported at least once every hour.

That was very similar to the approach i was going to take, so i guess that means I was on the right track.

Ive got the device and the timestamp into the database, but in my case im only storing the timestamp of the last checkin

How did you then present the information ?

My presentation is fairly primitive. I leave a terminal session open to MySQL and just push every now and again to re-run the query.

One day I’ll get around to writing a PHP front end or something to put it up on an internal web page.

I got this setup for simple reporting purposes:


actually, there is a quite elegant solution using grafana. Below a screenshot of some alerts I get on my phone through my telegram bot.

Home automation has two important aspects, GUI app of interacting with devices but also history, log database and charts dashboards, and for that task Grafana is the leader of both free and non free solutions probably. It offers all the tooling to set alerts depending on conditions, like minimum or even number of occurences of messages and so on.
You would need to have in addition influx as a database, I’m sure there are lots of youtube videos on how to achieve that with node red or other, I’m using my own python scripts, but this is a pretty standard solution. If anyone is interested and would like to use my python services to forward z2m messages to influx, I’ll provide help. I even added features to select mqtt subscriptions force types and discard unnecessary fields, also filter messages based on the last_seen value, which makes sense so that your entries do not get injected again on every subsciptions to mqtt for saved topics.

1 Like

I’m also using influxdb/grafana, but you actually don’t need to.
How about including the “linkquality” topics (that at least all of my devices use) into your homeautomation system and setting up a rule that alerts you when one of those drops to zero? Then you’ll know if a device has lost connection with the coordinator.