Using a Starline integration.
For a “mileage” sensor earlier I added these lines:
homeassistant:
customize:
sensor.auto_xxx_mileage:
state_class: measurement
since the sensor did not have LTS support natively.
How it was shown on a Statistics graph card:
where only “mean/max/min” options were available (as expected for “measurement”).
A recent PR added a state_class: total_increasing
natively.
Then I removed those customize
lines from a config.
The sensor has total_increasing
now:
After some period of time after HA reboot, on Statistics graph card only “state/sum/change” options became available (as expected for “total_increasing”). But no graph was displayed - probably because there were no “state/sum/change” data in DB yet, and old “mean/max/min” became “meaningless”.
Proposal:
If some sensor’s state_class was changed from “measurement” to “total/total_increasing”:
- Create a new issue in “Dev tools → Statistics”.
- Provide a possibility to convert old “mean” data into “state” data (“convert” = simply copy these data to a new column).
Although “sum” & “change” data will be still unavailable, this “conversion” will allow to keep old data as statistical.