Skip to content

Commit d9d7e33

Browse files
committed
Make use of improved energy_log_update() output logic
1 parent 2025ccc commit d9d7e33

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

plugwise_usb/nodes/circle.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -450,18 +450,17 @@ async def get_missing_energy_logs(self) -> None:
450450
log_address = self._current_log_address
451451
prev_address_timestamp: datetime | None = None
452452
while total_addresses > 0:
453-
await self.energy_log_update(log_address)
454-
if log_address == self._current_log_address:
455-
if self._last_collected_energy_timestamp is None:
456-
# Handle case with no data in slot 0
457-
_LOGGER.debug(
458-
"Energy data collected from the current log address is None, stopping collection"
459-
)
460-
break
453+
if not await self.energy_log_update(log_address):
454+
# Handle case with None-data in all address slots
455+
_LOGGER.debug(
456+
"Energy None-data collected from log address %s, stopping collection",
457+
log_address,
458+
)
459+
break
461460

462461
# Check if the most recent timestamp of an earlier address is recent
463462
# (within 2/4 * log_interval plus 5 mins margin)
464-
else:
463+
if log_address != self._current_log_address:
465464
log_interval = self.energy_consumption_interval
466465
_LOGGER.debug("log_interval: %s", log_interval)
467466
_LOGGER.debug(

0 commit comments

Comments
 (0)