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 077a435 commit 90720f0Copy full SHA for 90720f0
plugwise_usb/nodes/helpers/counter.py
@@ -261,7 +261,8 @@ def energy(self) -> float | None:
261
return None
262
if self._pulses == 0:
263
return 0.0
264
- pulses_per_s = self._pulses / float(HOUR_IN_SECONDS)
+ # Handle both positive and negative pulses values
265
+ pulses_per_s = abs(self._pulses / float(HOUR_IN_SECONDS))
266
corrected_pulses = HOUR_IN_SECONDS * (
267
(
268
@@ -276,8 +277,6 @@ def energy(self) -> float | None:
276
277
+ self._calibration.off_tot
278
)
279
calc_value = corrected_pulses / PULSES_PER_KW_SECOND / HOUR_IN_SECONDS
- # Guard for minor negative miscalculations
280
- calc_value = max(calc_value, 0.0)
281
return calc_value
282
283
@property
0 commit comments