We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 06ad566 commit 2a75755Copy full SHA for 2a75755
plugwise_usb/nodes/helpers/counter.py
@@ -260,8 +260,10 @@ def energy(self) -> float | None:
260
"""Total energy (in kWh) since last reset."""
261
if self._pulses is None or self._calibration is None:
262
return None
263
+
264
if self._pulses == 0:
265
return 0.0
266
267
# Handle both positive and negative pulses values
268
negative = False
269
if self._pulses < 0:
@@ -284,6 +286,7 @@ def energy(self) -> float | None:
284
286
calc_value = corrected_pulses / PULSES_PER_KW_SECOND / HOUR_IN_SECONDS
285
287
if negative:
288
calc_value = -calc_value
289
290
return calc_value
291
292
@property
0 commit comments