Skip to content

Commit

Permalink
Fix None comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-r committed Nov 13, 2024
1 parent 504ccff commit c51196c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion custom_components/ohme/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c51196c

Please sign in to comment.