Skip to content

Commit 0d5d64b

Browse files
committed
Remove debug-logging, correct for double production logs
1 parent 43c7655 commit 0d5d64b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

plugwise_usb/nodes/helpers/pulses.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -892,25 +892,25 @@ def _logs_missing(self, from_timestamp: datetime) -> list[int] | None:
892892
# Power consumption logging, so we need at least 4 logs.
893893
return None
894894

895-
# Collect any missing address in current range
896-
count = 0
895+
# Collect any missing address in current range, within MAX_LOG_HOURS timeframe
897896
address = last_address
898-
_LOGGER.debug(
899-
"_logs_missing | %s | last_address=%s", self._mac, last_address
900-
)
897+
count = 0
901898
slot = last_slot
899+
if self._log_production:
900+
MAX_LOG_HOURS = 2 * MAX_LOG_HOURS # this requires production_interval == consumption_interval
901+
902902
while not (
903903
(address == first_address and slot == first_slot)
904904
or count > MAX_LOG_HOURS
905905
):
906906
address, slot = calc_log_address(address, slot, -1)
907907
if address in missing:
908908
continue
909-
_LOGGER.debug("address=%s, slot=%s", address, slot)
909+
910910
if not self._log_exists(address, slot):
911-
_LOGGER.debug("Address-slot without log: %s, %s", address, slot)
912911
missing.append(address)
913912
continue
913+
914914
if self._logs[address][slot].timestamp <= from_timestamp:
915915
break
916916

0 commit comments

Comments
 (0)