Generic Motion Sensor battery reporting

I have 10 Iris V2 motion sensors, and a few other ones (Z-wave)
But I've noticed that every single one of them using the Generic Zigbee driver is reporting 87% battery left.

I hadn't really noticed this until I just paired an ST motion sensor, and the battery dropped almost instantly from 100% to 87%.

New battery in ST motion sensor.

My Iris V2 also using Generic Motion Sensor driver.

Maybe @chuck.schwer or @mike.maxwell could help here please?

Cheers

@Royski
I have the same thing, I have about 4 Samsung Smartthings motion sensors using the generic Zigbee drivers. They all report 87% battery, even the one I only setup a week ago. the others have been running since October 2019. I have 2 door/window contact sensors also Samsung Smartthings and these both show 85% battery?

1 Like

What I want to know is the actual volts being reported by the device. It would be helpful if going forward the HE system supplied driver battery reporting description text included the actual voltage.

The issues for calculating percentage are:

  • What is the minimum operating voltage for the specific device being used with the driver. Consider that some drivers are generic, supporting many different manufacturer devices and models.

  • Different battery types have varying initial fully charged voltages.

Approximate max values for AA batteries
Rechargeable: 1.2V
Lithium: 1.7V
Alkaline: 1.5V

Zigbee battery percentage generally uses this formula or something similar. Voltage is reported as a two digit number: 30 = 3.0volts

def descriptionText
def value
def minVolts = 20
def maxVolts = 30
def pct = (((rawValue - minVolts) / (maxVolts - minVolts)) * 100).toInteger()
value = Math.min(100, pct)
descriptionText = "${device.displayName} battery is ${value}%"
if (txtEnable) log.info "${descriptionText}"
sendEvent(name:"battery", value:value, descriptionText:descriptionText, unit: "%", isStateChange: true)
2 Likes

Mine are also showing 87%, except for 2 which are both showing 75%.

Then of course there's the Yale Zigbee Lock that is showing 192%!!!

1 Like

On the bright side, you should never be able to be locked out! :smiley:

:rofl:

1 Like

Zigbee devices generally only report battery levels in "tiers" (bins/buckets of ranges), though how these are divided will depend on the device firmware. In my experience, there is often one around 87-88% as reported by the native Hubitat drivers. Here is an explanation from ST, but it's just as applicable here because this is something done by the device itself, not the driver:

My suspicion is that your batteries were at or near the highest tier when installed, then after minimal use (not too surprising if the top tier is fully charged only, as in JDRoberts' example) dropped down to the next one.

Of course, the driver does decide the percentage to display, often based on minimum vs. maximum voltage calculations as described above (in code that was apparently lifted nearly verbatim from one of Hubitat's own drivers as if they aren't aware of how it works :slight_smile: ). But (not directing this towards you) even if you were able to adjust the min and max, I think you'd still run into the problems with batteries having different discharge curves (the differences extend beyond "new" and "dead" voltage differences) and the fact that most devices still report level according to the tier/range it falls into, not what you might consider a truly "raw" value--but still, there's enough variation among manufacturers here that some adjustment is often necessary. You can see this in lots of public ST DTHs. We just have no idea what Hubitat is doing under the hood with different manufacturers' devices since we can't see it, though I suppose it's apparent no accommodations were made if we see a level at 192% as above. :laughing:

In any case, I suspect this is one of varied reasons (coupled with a couple more reasons in my rambling paragraph above) that battery reporting is often considered unreliable.

1 Like

I've seen my Iris v2 sensors show 100%, 87% (this seems to be the most common), 75%, 49%, 37% (in freezing temps), and 24%, usually they drop off after being at 24% for little while and when I remove the batteries and put them back in I get no lights so the battery gets replaced (that's with Lithium batteries). My rechargeable batteries often won't last long enough to get below 87% before they stop responding and need to be recharged so they only get used in easy to get at sensors.

I have one sensor in the freezer that has always been 37% (the last 4 months at least) until this morning when it alerted that it was down to 24% so I'll probably need to replace that battery soon, I also have two sensors in our shed which during the winter will get as low as 37% or 24% but then in the spring they come back up to 87% or 75%.

1 Like

The code, from the Iris V3 keypad driver, was for the benefit of users who may not know how the number was calculated, and this is likely the most simple method. Obviously the Hubitat staff knows how to calculate it.

When you get a number like 192% it's clear the min and max volts to not match the device's voltage. For example: a device reports 6V with a driver coded for 3V. Many driver battery calculations show over voltages as 100%. I have two motion sensors using 4 AA batteries reporting 100% for over 1 year.

Battery percentage in my opinion is an arbitrary number. What's really needed is the reported battery voltage, along with the mostly unavailable device minimum voltage.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.