No long term in history card?

I have several values i want to view over al longer time. If I use the history panel and choose the entity with a long time span (months in some cases) the view is supplemented from the long term statistic.
When I make a history graph card and set the “hours_to_show” to more than 250, the extra is simply cut off. This looks deliberate. If so, it ought to get mentioned in the documentation.

Add on question. Can I just add the two lines

recorder:
  purge_keep_days: 60

to my configuration.yaml and reboot without breaking anything?

Danke
Axel

Use the Statistics Graph card, it pulls from the long-term-statistics.

What is the state class of the sensors? Long term statistics are only stored for sensors with the state class measurement, total and total_increasing. For others the cut off will be at around 250 hours because 10 days is the default.

Thanks for trying to help, but as I clearly said I did use the history panel and it works. Where it doesn’t is in the history graph card inside another dashboard. Fair enough, but the documentation should say so.

Mine works fine. :grin:

This sensor has the state class measurement:

This has no state class:

The history dashboard is the same:

Wrong card, use

Incorrect, see karwosts’ post below.

History card is capable of showing combined history/long term statistics.

2 Likes

But neither the history card nor the statistics graph card will show them if there aren’t any! :joy:

I agree, the docs are unclear. History graph card doesn’t mention long term statistics at all. Statistics graph card says “statistics are gathered every 5 minutes and also hourly for sensors that support it” (not helpful). History dashboard mentions long term statistics sampling, but says nothing about which sensors will have long term statistics (there is a link to the Data Science Portal). You have to dig around in the Developer Docs to find anything useful.)

Thank you. One can pare down the statistics to show nothing but a line like history does. I wasn’t aware of that. Not sure yet yet, whether I like the rounding or not, but for longer times it makes no difference anyway.
It is the history card

that I expected to behave the same as the history panel. Mentioning the ten day limit may be helpful here.
Thank you

You missed a note from karwosts which might change your “solution”.

No not really. He made a claim that I find not to be the case. Unless you tell me what I’m missing or doing wrong, that doesn’t help.

Can you perhaps help with my add on question above?. Can I just add the two lines

recorder:
  purge_keep_days: 60

to my configuration.yaml and reboot without breaking anything?

Yes, you can. But your database will be huge.

The History Graph card definitely can show statistics. I just tested it:

Likely your sensor just needs a state class so that it generates long term statistics. Unless you are on a very old version of Home Assistant.

1 Like

Post a screenshot from dev tools - state for your sensor to see its content.

1 Like

Yeah just must be an old version? This feature was added to the history card much later than it was added to the history panel, so there’s a range of old versions where this might be true.

Define “old”. I am in Docker, where updating is a pain. But I have done it recently and am on version 2024.9.3, which I consider quite new.
I did try out HAOS on a test system but found a couple of quite serious drawbacks. (Can’t boot from harddisk on a Raspberry Pi3B and can’t use WLAN channel 13. Both work flawlessly using Raspian and Docker.)

Yes. That of course is the very page I got those entries from. What it does not say there is what happens if I add “recorder:” to a configuration.yaml that didn’t have one before. Do a lose all my old data? With entities this is just what happens in comparable cases.
That’s why I ask here before meddling with that setting.

Could you post a screenshot from Developer Tools | States as @Ildar_Gabdullin suggested? It should look something like…

Look, if the history panel and the statistics card both show the long term statistics, they are there and they get written. (They were not initially, but I added “state_call: measurement” quite some time ago and they are present from that moment on.)

That is seven major versions behind the current version. It will be eight versions behind in a few days. So no, that is not “quite new” and is the reason it is not working for you.

It was added in the 2025.2 release. Use statistics data in History graph card to fill gaps by MindFreeze · Pull Request #23612 · home-assistant/frontend · GitHub

Please update to the current version if you would like to use this feature.

2 Likes