From c51196cb07cbfd5e401fe7afdd20de255ee3145b Mon Sep 17 00:00:00 2001 From: Daniel Raper Date: Wed, 13 Nov 2024 11:56:22 +0000 Subject: [PATCH] Fix None comparison --- custom_components/ohme/sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)