mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
Fix Tibber stats (#88025)
This commit is contained in:
parent
16a5275461
commit
e96210fced
@ -636,13 +636,20 @@ class TibberDataCoordinator(DataUpdateCoordinator[None]):
|
|||||||
|
|
||||||
statistics = []
|
statistics = []
|
||||||
|
|
||||||
|
last_stats_time_dt = (
|
||||||
|
dt_util.utc_from_timestamp(last_stats_time)
|
||||||
|
if last_stats_time
|
||||||
|
else None
|
||||||
|
)
|
||||||
|
|
||||||
for data in hourly_data:
|
for data in hourly_data:
|
||||||
if data.get(sensor_type) is None:
|
if data.get(sensor_type) is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
from_time = dt_util.parse_datetime(data["from"])
|
from_time = dt_util.parse_datetime(data["from"])
|
||||||
if from_time is None or (
|
if from_time is None or (
|
||||||
last_stats_time is not None and from_time <= last_stats_time
|
last_stats_time_dt is not None
|
||||||
|
and from_time <= last_stats_time_dt
|
||||||
):
|
):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user