ZHA show last_seen, LQI and RSSI as entity attributes

@fantangelo Borrowed your appdaemon code and made some changes and made it hacs compatible

TY this has worked perfectly for me

3 Likes

Thanks for improving the script. It’s a lot easier to use now.
cheers

1 Like

How do we install this via hacs?

Voted for this as well.

Having the same problem that with ZHA I can not display the “last seen” attribute in my LoveLace ui.

Found a solution.

You can configure ZHA now and set battery and main powered devices as unavailable after a certain period in seconds. For example, 7200 second for two hours. After that, the device gets the value “unavailable”.

You can trigger an automation on this change. For example, when your PIR LQI sensor did not update for 2 hours and gets the state “unavailable” you can send yourself a message that the device is offline.
Only thing is, that the automation get’s pretty long when you have a lot of devices you need to add as a trigger. But it should work.

1 Like

Ideally last seen would be exposed like it is for some other integrations, but using the ZHA timeouts on something like LSI is a a good solution until/unless it is made available.

Yeah, last_seen would be much better. Hopefully it is added soon.

2 Likes

Easy access to last_seen, like with RSSI and LQI, would be amazing and would enable better tracking and device health monitoring
Please, please, please consider adding this

2 Likes

@le_top as workaround do you think can get RSSI/LQI values via “zha-toolkit” for use in automation?

Thanks Hedda,
I have moved on to z2m.

It can, here is an example - zha-toolkit/script_use_zha_devices.yaml at f8a8f5243188afcd9cdcdfbf71029fb1c3ac356a · mdeweerd/zha-toolkit · GitHub .

EDIT: I updated zha_devices to optionally select just one device - will be in zha-toolkit >= 0.8.40 .

I’d recommend monitoring the primary or battery sensors for going unavailable since the lqi ones are a bit unreliable, especially after you restart some services, they can take a while to populate.

Also The Watchman off Hacs is great for monitoring all sensors to see and report when they go unavailable.