Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions homeassistant/components/xiaomi_aqara/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from homeassistant.components.discovery import SERVICE_XIAOMI_GW
from homeassistant.const import (
ATTR_BATTERY_LEVEL,
ATTR_VOLTAGE,
CONF_HOST,
CONF_MAC,
CONF_PORT,
Expand Down Expand Up @@ -323,6 +324,7 @@ def parse_voltage(self, data):
max_volt = 3300
min_volt = 2800
voltage = data[voltage_key]
self._device_state_attributes[ATTR_VOLTAGE] = round(voltage/1000.0, 2)
voltage = min(voltage, max_volt)
voltage = max(voltage, min_volt)
percent = ((voltage - min_volt) / (max_volt - min_volt)) * 100
Expand Down