The problem
I'm playing with the (not yet documented) long-term history/statistics_during_period websocket API and there is something in the result quite confusing.
As an example, here is a response
{
"id": 1,
"type": "result",
"success": true,
"result": {
"sensor.exterieur_temperature": [{
"statistic_id": "sensor.exterieur_temperature",
"start": "2021-09-10T08:00:00+00:00",
"mean": 21.926369901972222,
"min": 21.3,
"max": 22.3,
"last_reset": null,
"state": null,
"sum": null
}
]
}
}
Request (with end_time in the future)
{
"id": 1,
"type": "history/statistics_during_period",
"start_time": "2021-09-10T07:00:00.001Z",
"end_time": "2021-09-11T09:02:37.932Z",
"statistic_ids": ["sensor.exterieur_temperature"]
}
By comparison with influxdb, I can see that the aggregations are for temperatures between 8:00 UTC and 9:00 UTC.
However, in the statistics graph, the point is displayed at 8:00 UTC (which is the only available date), so it actually displays an average of the future as far as the graph is concerned, which doesn't make a lot of sense.
Furthermore, just with the API we don't know on what range is the temperature averaged.
Wouldn't it make sens to add an end to the API, then for the frontend graph to use that date instead?
What is version of Home Assistant Core has the issue?
2021.9.5
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Container
Integration causing the issue
No response
Link to integration documentation on our website
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response
The problem
I'm playing with the (not yet documented) long-term
history/statistics_during_periodwebsocket API and there is something in the result quite confusing.As an example, here is a response
{ "id": 1, "type": "result", "success": true, "result": { "sensor.exterieur_temperature": [{ "statistic_id": "sensor.exterieur_temperature", "start": "2021-09-10T08:00:00+00:00", "mean": 21.926369901972222, "min": 21.3, "max": 22.3, "last_reset": null, "state": null, "sum": null } ] } }Request (with end_time in the future)
{ "id": 1, "type": "history/statistics_during_period", "start_time": "2021-09-10T07:00:00.001Z", "end_time": "2021-09-11T09:02:37.932Z", "statistic_ids": ["sensor.exterieur_temperature"] }By comparison with influxdb, I can see that the aggregations are for temperatures between 8:00 UTC and 9:00 UTC.
However, in the statistics graph, the point is displayed at 8:00 UTC (which is the only available date), so it actually displays an average of the future as far as the graph is concerned, which doesn't make a lot of sense.
Furthermore, just with the API we don't know on what range is the temperature averaged.
Wouldn't it make sens to add an
endto the API, then for the frontend graph to use that date instead?What is version of Home Assistant Core has the issue?
2021.9.5
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Container
Integration causing the issue
No response
Link to integration documentation on our website
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response