Validate battery percentage range on manual edit; clamp HA values to 0-100

This commit is contained in:
2026-06-10 12:31:11 -05:00
parent a9835fee1e
commit 17bad3f36b
4 changed files with 50 additions and 0 deletions
+1
View File
@@ -49,6 +49,7 @@ class HaPoller:
for device in devices:
pct = self._client.get_state(device.ha_entity_id)
if pct is not None:
pct = max(0, min(100, pct))
for battery in device.installed_batteries():
if battery.battery_percentage != pct:
battery.battery_percentage = pct