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 2738abd commit 27bd8caCopy full SHA for 27bd8ca
plugwise_usb/nodes/helpers/counter.py
@@ -263,7 +263,11 @@ def energy(self) -> float | None:
263
if self._pulses == 0:
264
return 0.0
265
# Handle both positive and negative pulses values
266
- pulses_per_s = abs(self._pulses / float(HOUR_IN_SECONDS))
+ negative = False
267
+ if self._pulses < 0:
268
+ negative = True
269
+
270
+ pulses_per_s = abs(self._pulses) / float(HOUR_IN_SECONDS)
271
corrected_pulses = HOUR_IN_SECONDS * (
272
(
273
@@ -278,6 +282,8 @@ def energy(self) -> float | None:
278
282
+ self._calibration.off_tot
279
283
)
280
284
calc_value = corrected_pulses / PULSES_PER_KW_SECOND / HOUR_IN_SECONDS
285
+ if negative:
286
+ calc_value = -calc_value
281
287
return calc_value
288
289
@property
0 commit comments