History for meter is missing

Entity ID is still the same, history is still in database, but in the fronted, it starts only about 10 days back

Have you changed your recorder database purge_keep_days?

It is 10 days by default.

No, where can I do that?

BTW my goal is not to remove items from database, but to have longer history.


Beware that increasing it (particularly beyond a month) can cause performance issues.

I’m even more confused “now, purge_keep_days” and data that are kept in sqlite database are different thing? Also energy dashboard has data months back - so it does have different different datasource than sqlite database?

If the recorder runs on home-assistant_v2.db — statistics it is not deleting the data, but from the entity history it seem it does delete data as it shows only 10 days back.

State history is kept for the purge keep days setting.

Long term statistics (including energy dashboard stats) are kept forever (but only at hourly resolution).

They are all kept in the same database.

Is it possible to set same purge logic as in energy dashboard, or similar for specified entities or entities by type? Ie. keep all temperature and humidity forever, but only value that was current each hour?

Yes, the sensor has to have state_class: measurement , and a valid device_class.

I tried a have a go at it finally today, but no luck, what am I doing wrong?

Your sensor needs to…

And you need to view the history in a statistics card. The History panel uses state data.