From eac87e3972db5f1ced49c8a0f8e77b7332605955 Mon Sep 17 00:00:00 2001 From: Daniel Raper Date: Thu, 2 May 2024 23:14:12 +0100 Subject: [PATCH] Remove one way on SOC --- custom_components/ohme/sensor.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/custom_components/ohme/sensor.py b/custom_components/ohme/sensor.py index 091e29b..099e1d3 100644 --- a/custom_components/ohme/sensor.py +++ b/custom_components/ohme/sensor.py @@ -525,10 +525,7 @@ def icon(self): def _handle_coordinator_update(self) -> None: """Get value from data returned from API by coordinator""" if self.coordinator.data and self.coordinator.data['car'] and self.coordinator.data['car']['batterySoc']: - new_state = self.coordinator.data['car']['batterySoc']['percent'] or self.coordinator.data['batterySoc']['percent'] - - # Don't let it go backwards unless to 0 - self._state = 0 if new_state == 0 else max(new_state, self._state or 0) + self._state = self.coordinator.data['car']['batterySoc']['percent'] or self.coordinator.data['batterySoc']['percent'] self._last_updated = utcnow() self.async_write_ha_state()