Skip to content

Commit cdcc6bf

Browse files
committed
Clean-up _update_log_interval()
1 parent 8fcd603 commit cdcc6bf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

plugwise_usb/nodes/helpers/pulses.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -517,9 +517,7 @@ def _update_log_interval(self) -> None:
517517
delta1.total_seconds() / MINUTE_IN_SECONDS
518518
)
519519
break
520-
if not self._log_production:
521-
return
522-
address, slot = calc_log_address(address, slot, -1)
520+
523521
if (
524522
self._log_interval_consumption is not None
525523
and self._last_log_consumption_timestamp is not None
@@ -531,12 +529,14 @@ def _update_log_interval(self) -> None:
531529

532530
if not self._log_production:
533531
return
532+
534533
# Update interval of production
535534
last_prod_address, last_prod_slot = self._last_log_reference(
536535
is_consumption=False
537536
)
538537
if last_prod_address is None or last_prod_slot is None:
539538
return
539+
540540
last_prod_timestamp = self._logs[last_prod_address][last_prod_slot].timestamp
541541
address, slot = calc_log_address(last_prod_address, last_prod_slot, -1)
542542
while self._log_exists(address, slot):
@@ -548,7 +548,7 @@ def _update_log_interval(self) -> None:
548548
delta2.total_seconds() / MINUTE_IN_SECONDS
549549
)
550550
break
551-
address, slot = calc_log_address(address, slot, -1)
551+
552552
if (
553553
self._log_interval_production is not None
554554
and self._last_log_production_timestamp is not None

0 commit comments

Comments
 (0)