diff --git a/custom_components/ohme/sensor.py b/custom_components/ohme/sensor.py index 50f634d..2ad81ff 100644 --- a/custom_components/ohme/sensor.py +++ b/custom_components/ohme/sensor.py @@ -253,7 +253,7 @@ def _handle_coordinator_update(self) -> None: self._state = 0 else: # Allow a significant (90%+) drop, even if we dont hit exactly 0 - if new_state > 0 and self._state > 0 and (new_state / self._state) < 0.1: + if self._state and self._state > 0 and new_state > 0 and (new_state / self._state) < 0.1: self._state = new_state else: self._state = max(0, self._state or 0, new_state)