Custom recorder history for entities

Hello everyone!

I think I just realized HA is missing one thing, that for me (and I am guessing other people like me) is crucial: a custom way to setup how long recorder keeps data for an entity.

For example: I have entities that I need to keep in history for 5 years (or even more), some for 1 year… I have some I only need for a month, and then some I would like to be kept for maximum 24h.

I know you can now set your “purge_keep_days” and then use include and exclude options, but it doesn’t help too much. You can only set maximum recorder days to keep (in my case 5 years for the longes), and then all other will follow that rule. Which is crazy as some entities really spam with a lot of data that I don’t need - but I also don’t want to set them in exclude, as I need them on daily/hourly bases.

Maybe I am wrong and what I want can be already done with some tricks, purge scripts and some advanced tinkering, but I would love to see this feature included by default, and HA allowing us to set for each entity/device/domain for how long to be kept in history. It would be nice to be as simple as the sample I have made:

Please search before posting. Closing as a duplicate. You can vote and comment here: Recorder Retention Period By Entity

1 Like

Also there is no need to do this (and it will cause performance issues) if you ensure the entity has a state_class. Then long term statistics are kept forever.