Skip to content

Commit 62294f0

Browse files
committed
Revert some more changes
1 parent 90e680b commit 62294f0

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

plugwise_usb/nodes/helpers/pulses.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def collected_pulses(
175175
return (None, None)
176176

177177
if (
178-
log_pulses, reset := self._collect_pulses_from_logs(from_timestamp, is_consumption)
178+
log_pulses := self._collect_pulses_from_logs(from_timestamp, is_consumption)
179179
) is None:
180180
_LOGGER.debug("collected_pulses | %s | log_pulses:None", self._mac)
181181
return (None, None)
@@ -228,7 +228,7 @@ def collected_pulses(
228228

229229
def _collect_pulses_from_logs(
230230
self, from_timestamp: datetime, is_consumption: bool
231-
) -> tuple[int, bool] | None:
231+
) -> int | None:
232232
"""Collect all pulses from logs.
233233
234234
And return True when the from_timestamp rolls over to the next log_interval.
@@ -239,13 +239,15 @@ def _collect_pulses_from_logs(
239239

240240
timestamp: datetime | None = None
241241
if is_consumption:
242+
timestamp = self._last_log_consumption_timestamp
242243
if self._last_log_consumption_timestamp is None:
243244
_LOGGER.debug(
244245
"_collect_pulses_from_logs | %s | self._last_log_consumption_timestamp=None",
245246
self._mac,
246247
)
247248
return None
248249
else:
250+
timestamp = self._last_log_production_timestamp
249251
if self._last_log_production_timestamp is None:
250252
_LOGGER.debug(
251253
"_collect_pulses_from_logs | %s | self._last_log_production_timestamp=None",
@@ -275,6 +277,13 @@ def _collect_pulses_from_logs(
275277
if from_timestamp > self._last_log_consumption_timestamp or from_timestamp > self._last_log_production_timestamp:
276278
self._hourly_reset = True
277279

280+
_LOGGER.debug(
281+
"_collect_pulses_from_logs | log_pulses=%s | is_consumption=%s | from %s to %s",
282+
log_pulses,
283+
is_consumption,
284+
from_timestamp,
285+
timestamp,
286+
)
278287
return log_pulses
279288

280289
def update_pulse_counter(

0 commit comments

Comments
 (0)