Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit 81e9b96

Browse files
committed
Added debug logging to EnergyUsageSensor
1 parent 66bd621 commit 81e9b96

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

custom_components/ohme/sensor.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,12 +291,15 @@ def _handle_coordinator_update(self) -> None:
291291
# Ensure we have data, then ensure value is going up and above 0
292292
if self.coordinator.data and self.coordinator.data['batterySoc']:
293293
new_state = self.coordinator.data['batterySoc']['wh']
294+
_LOGGER.debug("EnergyUsageSensor: Raw Wh reading %s", new_state)
294295

295296
# Let the state reset to 0, but not drop otherwise
296297
if not new_state or new_state <= 0:
298+
_LOGGER.debug("EnergyUsageSensor: Resetting Wh reading to 0")
297299
self._state = 0
298300
else:
299301
self._state = max(0, self._state or 0, new_state)
302+
_LOGGER.debug("EnergyUsageSensor: New state is %s", self._state)
300303

301304
self.async_write_ha_state()
302305

0 commit comments

Comments
 (0)