@@ -107,6 +107,16 @@ def collected_logs(self) -> int:
107107 counter += len (self ._logs [address ])
108108 return counter
109109
110+ @property
111+ def consumption_last_hourly_reset (self ) -> datetime | None :
112+ """Consumption last hourly reset."""
113+ return self ._cons_last_hourly_reset
114+
115+ @property
116+ def production_last_hourly_reset (self ) -> datetime | None :
117+ """Production last hourly reset."""
118+ return self ._prod_last_hourly_reset
119+
110120 @property
111121 def hourly_reset_time (self ) -> datetime | None :
112122 """Provide the device hourly pulse reset time, using in testing."""
@@ -172,23 +182,6 @@ def collected_pulses(
172182 self , from_timestamp : datetime , is_consumption : bool
173183 ) -> tuple [int | None , datetime | None ]:
174184 """Calculate total pulses from given timestamp."""
175-
176- # Sync from_timestamp with the device pulsecounter reset-time
177- # This syncs the hourly/daily reset of energy counters with the corresponding device pulsecounter reset
178- if is_consumption :
179- if self ._cons_last_hourly_reset is not None :
180- from_timestamp = from_timestamp + timedelta (
181- minutes = self ._cons_last_hourly_reset .minute ,
182- seconds = self ._cons_last_hourly_reset .second ,
183- microseconds = self ._cons_last_hourly_reset .microsecond ,
184- )
185- elif self ._prod_last_hourly_reset is not None :
186- from_timestamp = from_timestamp + timedelta (
187- minutes = self ._prod_last_hourly_reset .minute ,
188- seconds = self ._prod_last_hourly_reset .second ,
189- microseconds = self ._prod_last_hourly_reset .microsecond ,
190- )
191-
192185 _LOGGER .debug (
193186 "collected_pulses | %s | from_timestamp=%s | is_cons=%s | _log_production=%s" ,
194187 self ._mac ,
0 commit comments