Show battery_level as a percent vs a decimal (#18328)

This commit is contained in:
Chris Kacerguis 2018-11-10 14:30:03 -06:00 committed by Anders Melchiorsen
parent f236e14bd6
commit 667b41dd4a

View File

@ -271,7 +271,7 @@ class WirelessTagBaseSensor(Entity):
def device_state_attributes(self): def device_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return { return {
ATTR_BATTERY_LEVEL: self._tag.battery_remaining, ATTR_BATTERY_LEVEL: int(self._tag.battery_remaining*100),
ATTR_VOLTAGE: '{:.2f}V'.format(self._tag.battery_volts), ATTR_VOLTAGE: '{:.2f}V'.format(self._tag.battery_volts),
ATTR_TAG_SIGNAL_STRENGTH: '{}dBm'.format( ATTR_TAG_SIGNAL_STRENGTH: '{}dBm'.format(
self._tag.signal_strength), self._tag.signal_strength),