Is there a way to get the value of a specific attribute in a Zigbee cluster?

I have a Zigbee smartplug that is able to measure the active power value. I can see this value correctly in the device’s actual state, but it’s not refreshing fast enough for my need (every 30 seconds or so). When I use the Zigbee panel, however, I’m able to select the proper cluster and attribute and then continuously click the “Get Zigbee Attribute” button as quickly as I need to get the value.

Is there a way for me to poll for the value faster either via the HTTP API or using a service just like I was doing with the button? The sensor’s cluster was ElectricalMeasurement (Endpoint id: 1, Id: 0x0b04, Type: in) and the attribute was active_power (id: 0x050b)

It should update whenever the value changes. Is it no doing that?

When I look at the States section of the developer tools yes, it does. But the value only updates every 30 seconds. If I use the “Get Zigbee Attribute” button, I can get it every 1 second by clicking the button fast enough. I’d like to be able to get that value at a rate of 1 second, possibly using some Python code.

Why? If it always shows the latest value, why do you have to hammer the update?

Because it doesn’t always show the latest value. It only updates the value every 30 seconds, but the value changes way more often than that when I manually use the Zigbee button to get the attribute’s value. I’m surprised there isn’t a zha.get_zigbee_cluster_attribute like there is a zha.set_zigbee_cluster_attribute

You said it changes when the value changes.

Lol I think maybe I’m not explaining myself properly, I’m sorry :sweat_smile:

In the state panel the value updates every 30 seconds but this update rate is too slow for what I need. Given that it’s possible to get a newer updated value by using the Get Zigbee Attribute button, is it possible to perform that button’s action from within the context of an automation?

My objective is to be able to retrieve the smartplug’s value every 1 second

Did you found a solution? I too need to get a value from a ZHA device.
In my case is the brightness value of a transitioning light bulb, it only show the finale value in state, so if I start a transition from 1 to brightness 255 for 60sec(by pressing the dim_up button), the state value is instantaneously set to 255. I want to get the current value as I release the dim button to stop the transition and set the correct value.

I don’t understand why isn’t there a “zha.get_zigbee_cluster_attribute”!

Thank you,

Hey Math, I wasn’t able to find a solution unfortunately. I gave up a while ago because there was no way to get that attribute

I have exactly the same problem with the same device !
If somebody find a solution, i’m interested !
Is exist a service to “read attribute” ? We can do it manually with ZHA:
2020-12-07 20:16:30 DEBUG (MainThread) [homeassistant.components.zha.api] Read attribute for: cluster_id: [2820] cluster_type: [in] endpoint_id: [1] attribute: [1291] manufacturer: [None] response: [509] failure: [{}],

I edited and services.yaml of ZHA, now it works !
You can check here:

Hey @Kalypox - this is exactly what I’m looking for. How do you deal with ZHA/HA updates? Doesn’t it override your code?


I’ve totaly abandoned ZHA. I use now Zigbee2MQTT and it works really really really better :wink:
I use a little nodered script for “read” attributes. But I think you can with automations.

Did anyone find a solution to this without editing the code manually? Like @sk229 said, a ZHA update would overwrite the custom code.