Battery Level Message on Zigbee-Button Example Needed

I have been monitoring the zigbee-button example (one-button-battery) for battery updates, but I don’t seem to be getting any specific “battery” messages. What should I be looking for? I do get the battery level when I first add the button and replace the battery, but it doesn’t seem like I get any battery level in between.

Regards,
Jose

What device?

Some devices require that you bind to the power cluster and will setup a default reporting on attribute 0x20 and/or 0x21. Some devices you’ll need to setup reporting yourself. Some will send power reports outside of the reporting schedule (as you said when powered up.)

I have one device that says it supports cluster 0x0002 but no attributes return a value other than error. It lies.

1 Like

@csstup : Sorry I should have mentioned it is the Philips hue smart button. This is what I get periodically, but I cant decipher anything about battery level:

 <ZigbeeDevice: 5c156745-3f17-4853-8aa5-b29b9be2a0d2 [0x5CA3] (Kitchen Button)> received Zigbee message: < ZigbeeMessageRx || type: 0x02, < AddressHeader || src_addr: 0x5CA3, src_endpoint: 0x00, dest_addr: 0x0000, dest_endpoint: 0x00, profile: 0x0000, cluster: Basic >, lqi: 0xD2, rssi: -85, body_length: 0x000B, < ZDOMessageBody || < ZDOHeader || seqno: 0x45 >, GenericBody:  C9 CF 06 02 00 97 6D 28 00 00 > >

Also, I noticed that in the init.lua there is a do_configure function that seems to be configuring PowerConfiguration (for Battery Level):

local function do_configure(self, device)
  device:send(PowerConfiguration.attributes.BatteryVoltage:configure_reporting(device, 30, 21600, 1))
...
end

But I am not getting any PowerConfiguration events occurring…

I also switched it to :

local function do_configure(self, device)
  device:send(PowerConfiguration.attributes.BatteryPercentageRemaining:configure_reporting(device, 30, 21600, 1))
...
end

But no dice.

The only time I see the event is when I take off/on the battery:

Any ideas? Thanks for any help,
Jose

  • Some devices support Battery Percentage, some support Battery Voltage, some both. If an attribute is not supported and you try and configure reporting on it, the device will generally return an error (UNSUPPORTED_ATTRIBUTE or the like).
  • Note that setting a report config can only happen when the device is listening. On battery powered Zigbee devices, this is usually when joined, or when woken up (like installing the battery or pressing the button).
  • The do_configure() logic will only happen for sleepy devices during pairing, so if you’re making a change to the driver, re-pair it to make sure the device gets your new settings.
  • The 3 parameters to configure reporting are min seconds, max seconds and delta. You can read it like “Send a report for this attribute every MAX seconds or when DELTA (in .05V or .5% units, so 1 = .05V or 0.5%, 2 = .1V or 1%, etc) change occurs from the last report, BUT never more frequent than MIN seconds”.

So unless the battery level changes more than 1 delta unit, you’re only going to get a battery update every 21600 seconds or 6 hours. And never more frequent than 30 seconds.

If you want to test your logic, set it to something like (30, 60, 1). It will send an update every 60 seconds regardless of change.

1 Like

Hi @josep1972

When the configuration is sent to the device it has to reply as success or failure or unsupported attribute.
If you don’t see the answer, not has been configured.

I would send a binding request before the configuration.

device:send(device_management.build_bind_request(device, PowerConfiguration.ID, self.environment_info.hub_zigbee_eui))
  device:send(PowerConfiguration.attributes.BatteryVoltage:configure_reporting(device, 30, 3600, 1))

@Mariano_Colmenarejo and @csstup Thank you for all your help. @csstup was correct in that the device is a sleepy zigbee so my config was not being called. I re-paired and saw it working as it should: received “SUCCESS” for ConfigurationReportingResponse to AttributeReportingConfiguration and now I receive attribute changes to battery level.

Regards,
Jose

1 Like