Skip to content

Commit

Permalink
Added a fix to charge state calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-r committed Jan 1, 2024
1 parent ca4bdb3 commit ccdae3d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion custom_components/ohme/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def _calculate_state(self) -> bool:
power = self.coordinator.data["power"]["watt"]

# No last reading to go off, use power draw based state only - this lags
if not self._last_reading:
if not self._last_reading or not self._last_reading['power']:
_LOGGER.debug("Last reading not found, default to power > 0")
return power > 0

Expand Down

0 comments on commit ccdae3d

Please sign in to comment.