Sometimes we want to store long histories of our sensors (e.g. Network, Energy, Weather, etc) and the default sqlite is not the best place, nor a SQL database (MySQL, Postgres) due to performance issues and sheer amount of space it occupies. If you are like me, you have setup InfluxDB which is a specialised DB for time series, yet it is a new daemon you must install (probably through the Add-on) and lots of complexity just to answer trivial curiosity questions such as how hot was the summer last year. IMHO there should be a better way to solve these trivial questions.
To solve this issue, I’ve implemented the “RRD Recorder” which stores information into RRD database files, that have the particularity of having a fixed size and storing information using aggregation functions very efficiently. Using an RRD database one might store every event occurring in the last day, but only the hourly average of the sensor for the last week, and a daily average for the last year.
The current implementation can be installed through HACS (you must add a custom repository for now) and creates and updates the RRD files (recorder functionality) and renders fully configurable graphs (through a virtual camera) using rrdtool graph functionality (check documentation).
I am trying to install into HA, which runs in Docker containter (it is running in Alpine Linux). But packages librrd-dev and libpython3-dev are not available in Alpine. Therefore during app start there is a error message:
Error: Unable to compile the binary module. Do you have the rrdtool header and libraries installed?
I tried to install DEB packages manually by DPKG, but there are too much dependencies.
Just to give some additional information to interested users:
If you are using either Home Assistant OS or Home Assistant Container, you already have a librrd wheel available. You can easily add the supporting dependencies using an automation:
Admittedly rrdtool doesn’t get many updates. But it’s hardly obsolete. And it produces way better graphs than almost anything else, and is easily customisable.
And it’s not a confusing mess of contradictions, unlike a lot of software.