Reduce size of get_statistics_during_period WS API response (#82131)
This commit is contained in:
parent
bb64b39d0e
commit
607a0e7697
12 changed files with 588 additions and 591 deletions
|
@ -591,7 +591,7 @@ class TibberDataCoordinator(DataUpdateCoordinator):
|
|||
)
|
||||
|
||||
last_stats = await get_instance(self.hass).async_add_executor_job(
|
||||
get_last_statistics, self.hass, 1, statistic_id, True
|
||||
get_last_statistics, self.hass, 1, statistic_id, True, {}
|
||||
)
|
||||
|
||||
if not last_stats:
|
||||
|
@ -613,7 +613,7 @@ class TibberDataCoordinator(DataUpdateCoordinator):
|
|||
else home.hourly_consumption_data
|
||||
)
|
||||
|
||||
from_time = dt_util.parse_datetime(hourly_data[0]["from"])
|
||||
from_time = hourly_data[0]["from"]
|
||||
if from_time is None:
|
||||
continue
|
||||
start = from_time - timedelta(hours=1)
|
||||
|
@ -624,7 +624,8 @@ class TibberDataCoordinator(DataUpdateCoordinator):
|
|||
None,
|
||||
[statistic_id],
|
||||
"hour",
|
||||
True,
|
||||
None,
|
||||
{"sum"},
|
||||
)
|
||||
_sum = stat[statistic_id][0]["sum"]
|
||||
last_stats_time = stat[statistic_id][0]["start"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue