Skip to content

Commit

Permalink
Reduce size of get_statistics_during_period WS API response
Browse files Browse the repository at this point in the history
  • Loading branch information
emontnemery committed Nov 15, 2022
1 parent 096ef85 commit d794f4e
Show file tree
Hide file tree
Showing 12 changed files with 586 additions and 589 deletions.
2 changes: 1 addition & 1 deletion homeassistant/components/demo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ async def _insert_sum_statistics(
statistic_id = metadata["statistic_id"]

last_stats = await get_instance(hass).async_add_executor_job(
get_last_statistics, hass, 1, statistic_id, False
get_last_statistics, hass, 1, statistic_id, False, {"sum"}
)
if statistic_id in last_stats:
sum_ = last_stats[statistic_id][0]["sum"] or 0
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/energy/websocket_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@ async def ws_get_fossil_energy_consumption(
end_time,
statistic_ids,
"hour",
True,
{"energy": UnitOfEnergy.KILO_WATT_HOUR},
{"mean", "sum"},
)

def _combine_sum_statistics(
Expand Down
Loading

0 comments on commit d794f4e

Please sign in to comment.