You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed this when I was capturing volumetric data in cubic feet where the long term statistic is normalized to cubic meters.
The sensor is configured as {state_class: total_increasing, device_class: gas, unit_of_measurement: ft^3} and the values in the states table are stored as their original cubic feet numbers. The statistics table values are stored converted to cubic meters, but the summed value show some sort of exponential growth.
Comparing to statistics of sensors that do look normal, the last columns is supposed to add just the small differences between measurements. The following logged entries are relevant to these bad data jumps.
2021-09-02 21:12:00 INFO (Recorder) [homeassistant.components.sensor.recorder] Detected new cycle for sensor.gas_meter, value dropped from 5226.8934465076 to 184585.99993983016
2021-09-02 22:12:10 INFO (Recorder) [homeassistant.components.sensor.recorder] Detected new cycle for sensor.gas_meter, value dropped from 5227.1199812804 to 184593.99993982754
In these messages, the first value is the m^3 value, while the second value is (a close approximation of) the original ft^3 data.
This is caused by the fact that the relevant code in components/sensor/recorder.py is using statistics.get_last_statistics which returns values converted for display (in my case ft^3) which are then compared against the normalized values from fstates which are m^3.
I noticed this when I was capturing volumetric data in cubic feet where the long term statistic is normalized to cubic meters.
The sensor is configured as
{state_class: total_increasing, device_class: gas, unit_of_measurement: ft^3}
and the values in the states table are stored as their original cubic feet numbers. The statistics table values are stored converted to cubic meters, but the summed value show some sort of exponential growth.Comparing to statistics of sensors that do look normal, the last columns is supposed to add just the small differences between measurements. The following logged entries are relevant to these bad data jumps.
In these messages, the first value is the m^3 value, while the second value is (a close approximation of) the original ft^3 data.
This is caused by the fact that the relevant code in
components/sensor/recorder.py
is usingstatistics.get_last_statistics
which returns values converted for display (in my case ft^3) which are then compared against the normalized values fromfstates
which are m^3.core/homeassistant/components/sensor/recorder.py
Line 341 in 8af0cb9
core/homeassistant/components/sensor/recorder.py
Line 387 in 8af0cb9
core/homeassistant/components/recorder/statistics.py
Line 375 in 8af0cb9
The text was updated successfully, but these errors were encountered: