Recorder purge not working?

Hello all.
my db keeps growing more than I will, so I decided to implement the recorder purge strategy as suggested in a lot of thread here.
I’ve added:

recorder:
purge_keep_days: 7
commit_interval: 300
auto_repack: true
auto_purge: true

to my configuration and restarted.
After 11 days I was expecting to get a smaller home-assistant_v2.db but it wasn’t true.
I’ve looked inside the database by using sqllite3 cli and noticed that the table “events” is really reduced to 7 days but the “states” table has ( at least ) two monts of data.
I’m really not interessed in getting all this data in this table as I’m also using influxdb and grafana for my historical data, but I would like to keep says 5 to 7 days at least.

Do you know how to achieve this ( without writing an automation, I mean :slight_smile: )?

My installation is:
home assistant on docker ( on raspberry ) 2022.10.5
sqlite3 version 3.31.1

Thanks in advance
Pierluigi

Have you restarted your server within that period that you set? HA will restart the count. Wait it out or run a manual purge. There are several posts about this with more info.

I think that restart day count reset was fixed a while ago.

No, I haven’t restarted in that period, and moreover I have also started the recorder.purge service manually from the webui ( Developer Tools → Services → Recorder: Purge ) configuring 5 days to keep and enabling Repack with no succes.
As told, in the “events” table rows get deleted, but not in the “states” tables.
In this last one rows remain for the last two months, and being that this table is the biggest one, there is no chances repack would save lot of spaces.

Thanks Tom – must’ve missed (or forgotten) that one. Note made.

Back again on this topic. I’ve waited some month and noticed that while other tables follow the purge directive the “states” table don’t.
WHat happens if I manually delete some records from “states”.
Would all other statistics, a part from history, be unaffected ?
For example, my energy tab would keeps his statistics or they derive from states table ?

Thanks in advance.

I relpy to myself as I just did a test.
I’ve deleted the content of “states” table and all the graphic of my sensor, in dashboard have gone flat, so deleting completely the states content is not an option.
Now I would like to understand why the purge is not operating following the rules in recorder section of configuration.yaml