mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-12-10 09:58:06 +00:00
2.7 KiB
2.7 KiB
author, authorURL, title
| author | authorURL | title |
|---|---|---|
| Erik Montnemery | https://github.com/emontnemery | Changes to long term statistics APIs |
Some changes have been made to the long-term statistics-related APIs to reduce response size and database load.
The changes are implemented in this PR.
This affects authors of code calling the following WS APIs:
recorder/statistics_during_period- A new optional parameter
typeshas been added, which allows providing a list of statistics characteristics to include in the response. Possible values are:"last_reset","max","mean","min","state","sum" - Timestamps
start,endandlast_resetare now an integer number of ms since the UNIX epoch instead of ISO-formatted strings. The new format means the timestamps can be passed directly to jsDate()constructor. - The
statistic_idis no longer repeated for each list item in the returned map. This was not used because the return type is a map, keyed bystatistic_id.
- A new optional parameter
This affects authors of code calling the following Python APIs:
homeassistant.recorder.statistics.get_last_short_term_statistics- A new parameter
typeshas been added, which allows providing a set of statistics characteristics to include in the response. Possible values are:"last_reset","max","mean","min","state","sum" - Timestamps
start,endandlast_resetare now andatetimeobjects instead of ISO-formatted strings. - The
statistic_idis no longer repeated for each list item in the returned map. This was not used because the return type is a map, keyed bystatistic_id.
- A new parameter
homeassistant.recorder.statistics.get_latest_short_term_statistics- A new parameter
typeshas been added, which allows providing a set of statistics characteristics to include in the response. Possible values are:"last_reset","max","mean","min","state","sum" - Timestamps
start,endandlast_resetare now andatetimeobjects instead of ISO-formatted strings. - The
statistic_idis no longer repeated for each list item in the returned map. This was not used because the return type is a map, keyed bystatistic_id.
- A new parameter
homeassistant.recorder.statistics.statistics_during_period- A new parameter
typeshas been added, which allows providing a set of statistics characteristics to include in the response. Possible values are:"last_reset","max","mean","min","state","sum" - Timestamps
start,endandlast_resetare now andatetimeobjects instead of ISO-formatted strings. - The
statistic_idis no longer repeated for each list item in the returned map. This was not used because the return type is a map, keyed bystatistic_id.
- A new parameter