Viewing Long Term Statistics Efficiently

I am trying to figure out how to approach this. I know I can use statistics cards to view LTS, which is great for a general overview, but unless it’s on a single pane dash then the real estate on the graph gets a bit tight to really do much if it’s more than a week or two worth of data.

When I decided to reduce my recorder history to shrink my database I decided at that time to also install influx for my LTS, so I should have it in two places - the database (MariaDB in my case for now) and influx. I believe Influx does more than LTS, but I’m really an Influx idiot right now.

Having the broad overview in a stat card has been useful for some things but I’m now wanting to dive a bit deeper and am not sure how to do that. Honestly Influx is super confusing to me and I’ve watched videos and read various write ups and have been doing SQL programming for decades but the user interface and how to actually get at the data is not intuitive so I’ve not really gotten deep into it yet.

That being said, I’m now wanting to look at very specific time frames in my LTS. In my case it’s all about energy usage during certain hours of the day - for instance, show me the last 60 days of a sensor for between 5pm and 11pm so I can calculate the average wattage used over that time frame.

What’s the best way to approach this, either with the native tools or influx? I would really love to be able to template this into a calculation if possible, but if I have to just pull the data and calculate outside of HA then I can work with that.

InfluxDB only stores state values, not LTS. Though it can store these for much longer than the purge keep days set for your recorder.

For LTS graphs of specific time periods try this: New interactive history explorer custom card

Thanks for clearing that up. For me it’s still kind of LTS since it stores states - but yes, now that you say that I remember that’s why I installed Influx is to keep STATES beyond the purge because my HA DB was above 9GB and blowing up on me.

Thanks for that link, that card looks like an impressive replacement for History as well as perhaps satisfying my need for LTS time based stats!

It definitely supports LTS: GitHub - alexarch21/history-explorer-card: A card for Home Assistant Lovelace for exploring the history of your entities interactively and in real time.

1 Like