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