You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def parse_voltage(self, data):
"""Parse battery level data sent by gateway."""
if 'voltage' not in data and 'battery_voltage' not in data:
return False
if 'voltage' in data:
voltage_key = 'voltage'
else:
voltage_key = 'battery_voltage'
max_volt = 3300
min_volt = 2800
voltage = data[voltage_key]
voltage = min(voltage, max_volt)
voltage = max(voltage, min_volt)
percent = ((voltage - min_volt) / (max_volt - min_volt)) * 100
self._device_state_attributes[ATTR_BATTERY_LEVEL] = round(percent, 1)
return True
The text was updated successfully, but these errors were encountered:
Hey there @Danielhiversen, @syssi, mind taking a look at this issue as its been labeled with a integration (xiaomi_aqara) you are listed as a codeowner for? Thanks!
This is a automatic comment generated by codeowners-mention to help ensure issues and pull requests are seen by the right people.
homeassistant/components/xiaomi_aqara/init.py
line 295:
def parse_voltage(self, data):
changed to:
The text was updated successfully, but these errors were encountered: