Skip to content

Commit 47a964e

Browse files
committed
Make use of improved energy_log_update() output logic
1 parent 3ba634b commit 47a964e

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
@@ -449,18 +449,17 @@ async def get_missing_energy_logs(self) -> None:
449449
log_address = self._current_log_address
450450
prev_address_timestamp: datetime | None = None
451451
while total_addresses > 0:
452-
await self.energy_log_update(log_address)
453-
if log_address == self._current_log_address:
454-
if self._last_collected_energy_timestamp is None:
455-
# Handle case with no data in slot 0
456-
_LOGGER.debug(
457-
"Energy data collected from the current log address is None, stopping collection"
458-
)
459-
break
452+
if not await self.energy_log_update(log_address):
453+
# Handle case with None-data in all address slots
454+
_LOGGER.debug(
455+
"Energy None-data collected from log address %s, stopping collection",
456+
log_address,
457+
)
458+
break
460459

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

0 commit comments

Comments
 (0)