Statistics retention period

Hi there,

I am using HA for a couple of weeks now mainly to gather and display statistics data on my house consumption and Solar panels …
I run HA on a virtual machine on a Synology NAS.

I was wondering on what was the retention period of the statistics for HA ? Is it bas on disk space you have and can be months / years of data ?
I have seen we could use Influx DB and Grafana … is that an added value ?

Many Thanks !

1 Like

Long term statistics are never purged. I believe the 5 minute data is transformed to hourly data at some point. So there are only 24 data points x 3 (max, min, average) per sensor per day and they take up very little room in the database.

1 Like

ok … is there a difference between long term and “short term” statistics ?
How can I distinguish that ? (I have shelly sensors for house consumption, solar panels production, I want to keep for months and years … Is that considered as long term statistic ?

Are those stats backuped in case I need to reinstall my HA for example ?

Many Thanks !!

What are short term statistics?

States and events are purged after the interval in the recorder settings. 10 days by default.

Hello, I have no trace of any “recorder” in my configuration.yaml file actually.I have a practical example … I have Shelly clamps measuring my GRID, solar panels and some appliances in my house, I see the energy in the Energy tab :

started 22/06, … but I am wondering how much time the data will be there ?

Is it like after 6 months the data is deleted ? after 1 month ?
Will I be able to see in 2 years the data of 2 years back in the graphs ?

This is what I am looking for
:wink:

Many Thanks

Then you must have default_config in there, which includes the recorder.

As I said before LTS (which includes the energy data) is never deleted.

Only state history and events are deleted after they are older than the purge_keep_days setting, which is 10 days by default.

Indeed, I have “default config” in the configuration.yaml.
I understand this default config loads the default config, can I find somewhere the retention config from this default config in the page you provide ? There is this stored ?
Many Thanks !

P.S. in other terms, can I browse the “default config” parameters somewhere ?

I just told you. Repeatedly.

It is 10 days by default for states and events and forever for LTS (including Energy dashboard data).

Tom, understood what the retention period was, I believe you.
but as I am new in HA, my question was to know if there was some kind of configuration file I can go through (the default_config you were talking about), to see all what as in there.

If the is a config we can not “browse and modify” then fine with me

1 Like

No. The default config can not be “browsed”. There is no UI for it.

You can however add:

recorder:

To your configuration file and change any of the options.

yeah … in this case use for example InFluxDB I have seen, thanks a lot tom_I !
If there is a “forever” for the Energy tab data, then I am fine !

Many thanks !

Hi, I’m a bit new to HA and I read this topic and

Default Config - Home Assistant (home-assistant.io)

Understanding Home Energy Management - Home Assistant (home-assistant.io)

Recorder - Home Assistant (home-assistant.io)

And I’d like to be sure that Energy Data will be considered LTS only if all energy entity are registered in Energy Dashboard. Is is correct?

I’ve some energy sensors (from devices) but they are being deleted after 10 days. I’ve not added them to energy dashboard

image