Long term statistics now allows showing statistics in a different unit than it's stored in. For example, it's possible to show statistics stored as
The changes are implemented in a series of PRs:
The background is that we allow overriding the unit of several sensor device classes, and this override should also be reflected when viewing long term statistics.
This affects authors of code calling the following WS APIs:
recorder/adjust_sum_statistics- A new mandatory parameter
adjustment_unit_of_measurementhas been added, which defines the unit used by the
recorder/statistics_during_period- In case of statistics generated from sensor entities, the unit of returned statistics will be converted to the sensor's
unit_of_measurement. This behavior can be controlled by passing the optional