Record different entities a certain time

Hi all,

I’ve a question regarding the the ‘recorder’ integration in the config.yaml file. So my database is getting quite big (5GB) so I started to implement some rules on which entities are important te recorder and which ones are useless to record.

Now my situation: I’ve a smart energy meter (for gas and power) which I’m reading into my Home Assistant. Ofcourse this is important information for me as I can recall my usage and can compare to like last month or year. So it is important to save these entities for maybe 5 years or so?

Most other entities like states of lights etc I would like to keep for a few days, but most definitely not for years.

How can I make a difference in retention days between entities?

Many thanks!

I know the word GrafanaInfluxDB, maybe that would suit you?

I’m already using Grafana, but that is not a database…

InfluxDB is though. And it is better suited to time range data over especially long periods.

Record in home assistant for 7 days, record in InfluxDB forever.

You should definitely still exclude things like sensor.time that update every minute but store no useful historical information.

Thanks for the reply!

Currently I’m running HA on a Rpi 4. I have now influx running on the same Pi as HA. I’m reading that the amount of writing for a SD card is bad so I want to store the database externally on my Synology NAS. My NAS can running MariaDB but not Influx as I can not run Docker as it is an older model.

Is there a way in the config.yaml file to give certain entities different retentions?

Nope. It’s a global setting.

And yeah Influx on an SD card would not be wise.

That is unfortunate, how are other people doing this, running HA on a rpi if I can’t have the database on there?

Might it be possible to connect an external harddrive a put the database on there?