Newbie: Only 10 days of history

I am using HA for about 2 months and have several sensors created.
Also some automatically created devices like a Sunnyboy solar.
None of these show history for more than 10 days.
I have googled for days now and can’t find the reason.
Configuration,yaml has:

# Loads default set of integrations. Do not remove.
default_config:

Can somebody please explain to a newbie how to solve this?
Thanks.

10 days is the default limit for recorder. You can change it on configuration.yaml

1 Like

Just keep a close eye on the Recorder database file (home-assistant_v2.db) size. It can grow exponentially if you don’t carefully exclude any entities you don’t need to keep. Lots of good information here, now that you know what words to search for. A good starting point is:

If you need long-term (archival) data, you may want to keep it external to HA. There are a number of ways to do that. Look around and ask specific questions here if you’re stuck.

1 Like

Welcome to Home Assistant…

I have my recorder set to 31 days to cover the last month of history. Keep in mind that the concept of history is a little skewed in HA. History, like you’re thinking of it in the recorder settings, is generally for the history you might use/view in the dashboards. Think of it as “how long would I like to see this information in a graph on the dashboard” type thing. It’s more involved, but that’s the general idea.

So when setting a recorder setting, you have to balance how long you’d like to visualize that information in the day to day dashboard. Does it really matter if you have the history for every time a light came on in the living room for the last year? It might sound cool to know, but the reality is you will likely never look to see if your lights were on last December… So why store it? Your database will get pretty large if you keep everything for terribly long…

The important aspect to this is that once you start graphing a months worth of data on a dashboard, it can start taking a long time to load, as the cards have to compile the graph every time you load the page. Generally, in my dashboards, the graphs are for the last 24 hours, and last week. With limited exceptions, I don’t show a whole month very often. All this will depend on your specific need, of course… But long history makes for a lot of unnecessary bloat.

The “skewed” part I’m referring to is that HA also keeps STATISTICS. These things are stored forever, and complex math only keeps relevant values over time so that they don’t take a lot of space for long time periods. Much of what you think you’d need “long term” will already keep that information. The devs are smart enough to know that your thermostat temperature history can be helpful over many years, so much of that stuff is already broken down and compiled for long term analysis.

If you click on “Developer Tools” and “Statistics”, you will see the things already keeping long term records. Of the things listed there, you would use the STATISTICS card to graph those things.

If your solar is already recording statistics, you can access the history with the statistics card instead of a history graph.

1 Like

5-minute statistics is stored within same limited period (10 days by default).

1 Like

I didn’t know that there are statistics for 5 minutes.

I am aware that there are two types of history;

  • exact state for each measurement, kept according to recorder settings (10 days by default)
  • hourly long term statistics, kept forever

Info: Home Assistant Statistics | Home Assistant