File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -456,8 +456,19 @@ async def get_missing_energy_logs(self) -> None:
456456
457457 while total_addresses > 0 :
458458 await self .energy_log_update (log_address )
459- # Check if the most recent timestamp of an earlier address is recent
459+ # Check if the most recent timestamp of the current address is recent
460460 # (within 2/4 * log_interval plus 5 mins margin)
461+ if (
462+ log_address == self ._current_log_address
463+ and self ._last_collected_energy_timestamp is not None
464+ and (
465+ datetime .now (tz = UTC ) - self ._last_collected_energy_timestamp
466+ ).total_seconds () // 60 > (factor * log_interval ) + 5 # minutes
467+ ):
468+ _LOGGER .debug ("Energy data collected is outdated, stopping collection" )
469+ break
470+
471+ # Check if the most recent timestamp of an earlier address is recent
461472 if (
462473 log_address != self ._current_log_address
463474 and self ._last_collected_energy_timestamp is not None
You can’t perform that action at this time.
0 commit comments