Battery "%" missing

It seems some device drivers do not report battery as a % and some do. Can this be changed so that they all report the same?

In making a dashboard for my batteries devices you can see some do, and some do not (makes for an ugly and inconsistent dash)

Built in drivers that (I have found ) do not send % are

Generic Zigbee Motion Sensor
Generic Zigbee Moisture Sensor
SmartThings Multipurpose Sensor V5

Also for some Devs if you could add it would be great (observation not complaint)

Roomba @aaron
Ring Range Extender @bcopeland
b-hyve @dman2306 :wink:

1 Like

Contact the OP of the device drivers having an issue and ask them to change the event command to something like the following

 sendEvent(name:"battery", value:value, descriptionText:descriptionText, unit: "%", isStateChange: true)

The command is likely missing the unit "%"

Edit: Just noticed you already did that, anyhow above is the fix.

1 Like

Top 3 are built in HE drivers, so I kinda am asking the OP.

But thanks for posting that hope it helps get it done. :wink:

1 Like

BTW I prefer the actual Volts for battery reporting rather than the arbitrary calculated %

How did you get the icons that small? Is that a different program/skin/mod/whatever-you-call-it?

The icons are easy just go to Setting (gear) > Grid and adjust the Icon size there

1 Like

The stock driver -which uses @bcopeland's code, IIRC- is the same way.

1 Like

THe Generic Zigbee Motiion Sensor driver definitely sends the % in the unit field, where it belongs.

image

Just like the generic zigbee contact sensor.

image

I think this is a tile problem and not a driver problem.

Are you using HubConnect? If so there is a fix.

This is @csteele 's fix for the HubConnect app.

Remote Client -- Line 577 is Replaced with:

        currentAttributes << [name: "${it}", value: device.currentValue("${it}"), unit: it == "temperature" ? "°"+getTemperatureScale() : it == "power" ? "W" :  it == "voltage" ? "V" : it == "battery" ? "%" : ""]

Server Instance -- Line 895 is Replaced with:

       currentAttributes << [name: (String) "${it}", value: device.currentValue("${it}"), unit: it == "temperature" ? "°"+getTemperatureScale() : it == "power" ? "W" :  it == "voltage" ? "V" : it == "battery" ? "%" : ""]
1 Like

That fixes all but the custom drivers then those are on that hub

1 Like

Have tried a refresh or sync on the offending devices?

Edit: I guess if all was fixed except the custom drivers on that hub a refresh or sync will do nothing.

I know for motion sensors there is an issue with the tile. It puts the battery in the secondary (tile name) slot instead of the tertiary

Any chance you selected Attribute / battery instead of Battery for the Tile Template?
The Attribute / battery Template drops the "%".

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