How do I display a list of last seen ZHA zigbee devices?

Hello, my goal is to display a list, as in this topic of all my ZHA zigbee devices sorted by last_seen order.

I’ve found a way to get the last_seen value(visible in ZHA integration ,but not exposed as an entity) in this other topic

It uses SQL integration, but it needs one entity for each zigbee device.

I currently have these problems :

  1. I’m searching how to scan dynamically through zigbee devices with an SQL query that returns couples [IEEE ID / last_seen timestamp] of all my devices.

  2. I need a way to retreive the zigbee device “friendly name” from the IEEE ID

  3. Integrate that in a markdown card

I think it could be useful for other users

1 Like

I have the same question.

The lack of this feature does always bring me back to Z2M. With over 100 Zigbee devices, it is crucial to have an overview of failing / missing devices.

Look here https://github.com/dmulcahey/zha-network-card
This card allows you to Display the devices by last seen.

I moved away from ZHA to all Zigbee2MQTT a while back, but when I was focused on ZHA I tried to find some ways to get a better ‘real time’ look at devices. The code I wrote at link below might give you some ideas. Unfortunately (or fortunately depending on your needs) Zigbee seems to focus on low power over communications frequency by devices, this both for battery and mains it seems, however seems rooted on the battery based devices model. So depending on how often a devices chooses to ‘check in’ is limiting factor to a full view of your network. Zigbee2MQTT does seems to do a better job of tracking last seen, however it too is limited by how often a device ‘checks in’.

Good hunting!