Skip to content

Commit 5e05af2

Browse files
committed
Add warning-logging for _update_log_direction()
1 parent 8c7d65e commit 5e05af2

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

plugwise_usb/nodes/helpers/pulses.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,10 @@ def _update_log_direction(
518518
or double slots containing consumption and production data.
519519
Single slots containing production data only is NOT supported/tested.
520520
"""
521+
_LOGGER.warning(
522+
"_update_log_direction | log_production before=%s",
523+
self._log_production,
524+
)
521525
prev_timestamp = self._check_prev_production(address, slot, timestamp)
522526
next_timestamp = self._check_next_production(address, slot, timestamp)
523527
if self._first_prev_log_processed and self._first_next_log_processed:
@@ -526,6 +530,12 @@ def _update_log_direction(
526530
self._log_production = (prev_timestamp == timestamp) ^ (
527531
next_timestamp == timestamp
528532
)
533+
_LOGGER.warning(
534+
"_update_log_direction | prev_timestamp=%s | next_timestamp=%s | log_production after=%s",
535+
prev_timestamp,
536+
next_timestamp,
537+
self._log_production,
538+
)
529539

530540
def _check_prev_production(
531541
self, address: int, slot: int, timestamp: datetime
@@ -552,10 +562,15 @@ def _check_prev_production(
552562
self._reset_log_references()
553563
elif self._log_production is None:
554564
self._log_production = False
565+
_LOGGER.warning(
566+
"_check_prev_production | log_production=%s",
567+
self._log_production,
568+
)
555569
return prev_timestamp
556570

557571
if self._first_prev_log_processed:
558572
self._first_prev_log_processed = False
573+
_LOGGER.warning("_check_prev_production | reset _first_prev_log_processed")
559574
return None
560575

561576
def _check_next_production(
@@ -583,10 +598,15 @@ def _check_next_production(
583598
self._logs[next_address][next_slot].is_consumption = True
584599
elif self._log_production is None:
585600
self._log_production = False
601+
_LOGGER.warning(
602+
"_check_next_production | log_production=%s",
603+
self._log_production,
604+
)
586605
return next_timestamp
587606

588607
if self._first_next_log_processed:
589608
self._first_next_log_processed = False
609+
_LOGGER.warning("_check_next_production | reset _first_next_log_processed")
590610
return None
591611

592612
def _update_log_interval(self) -> None:

0 commit comments

Comments
 (0)