@@ -463,7 +463,6 @@ async def _get_initial_energy_logs(self) -> None:
463463 )
464464 total_addresses = 11
465465 log_address = self ._current_log_address
466- prev_address_timestamp : datetime | None = None
467466 while total_addresses > 0 :
468467 result , empty_log = await self .energy_log_update (log_address )
469468 if result and empty_log :
@@ -474,43 +473,6 @@ async def _get_initial_energy_logs(self) -> None:
474473 )
475474 break
476475
477- # Check if the most recent timestamp of an earlier address is recent
478- # (within 2/4 * log_interval plus 5 mins margin)
479- log_interval = self .energy_consumption_interval
480- factor = 2 if self .energy_production_interval is not None else 4
481-
482- if log_interval is not None :
483- max_gap_minutes = (factor * log_interval ) + 5
484- if log_address == self ._current_log_address :
485- if (
486- self ._last_collected_energy_timestamp is not None
487- and (
488- datetime .now (tz = UTC ) - self ._last_collected_energy_timestamp
489- ).total_seconds ()
490- // 60
491- > max_gap_minutes
492- ):
493- _LOGGER .debug (
494- "Energy data collected from the current log address is outdated, stopping collection"
495- )
496- break
497- elif (
498- prev_address_timestamp is not None
499- and self ._last_collected_energy_timestamp is not None
500- and (
501- prev_address_timestamp - self ._last_collected_energy_timestamp
502- ).total_seconds ()
503- // 60
504- > max_gap_minutes
505- ):
506- _LOGGER .debug (
507- "Collected energy data is outdated, stopping collection"
508- )
509- break
510-
511- if self ._last_collected_energy_timestamp is not None :
512- prev_address_timestamp = self ._last_collected_energy_timestamp
513-
514476 log_address , _ = calc_log_address (log_address , 1 , - 4 )
515477 total_addresses -= 1
516478
0 commit comments