How to keep daily sensor history forever (Domoticz Style)

Hello, I have been using Domoticz for a long time but have now started thinking about maybe switching to HA and have installed it on a spare raspberry pi to try it out. However I am so far really disappointed with how it handles sensor history. As I have understood it HA by default only keeps the history for 10 days and then it is gone.

In Domoticz it stores the detailed history (all sensor updates) for 24 hours. Then it deletes the detailed history and replaces it with daily history. For example showing what the avg/max/min temperature was for one day. I can’t see what the temperature was at 13:00 today two years ago but I can see that the average temperature that day was 6,3 °C and that is almost always enough. Due to it saving only the daily numbers this keeps the database quite small. I have multiple sensors and have been using it for 6+ years but my database is still <3 mb.

I know that you can install plugins like influxdb and send the data to grafana. But as someone how has never used grafana before I don’t think I will ever be able to create something as good as what comes with Domoticz. I would also want to mimic how Domoticz does it by saving only the daily values and not every single sensor value since that would result in a massive database.

Is there no good easy way to keep daily history forever? For me the main reason I use Domoticz/HA is to keep sensor data. If I want to automate something I mush prefer using node red. This is absolutely a deal breaker for me and if I can’t save it forever I absolutely will not switch.

Take a look at the history_stats integration.

Also, there’s a new Energy integration I haven’t played with yet which may meet your needs. I’m not even sure that’s the right link, but it’s talked about in the release notes for the August release.

For now I simply store my long-term data (from history_stats) to a flat file for later analysis.

I’ve also moved over from Domoticz, but a few years before you. I loved the graphs that Domoticz afforded us, and the database for all the data was tiny.

Home Assistant on the other hand could do the same thing, but even without doing it - the database is massive. Here is my current Home Assistant database:

| Table                 | Size (MB) |
| states                |   3859.30 |
| events                |   2902.33 |
| statistics_short_term |    125.05 |
| statistics            |     35.06 |
| statistics_runs       |      0.30 |
| recorder_runs         |      0.03 |
| statistics_meta       |      0.03 |
| schema_changes        |      0.02 |

Those table sizes would scare me!

There’s been a lot of discussion lately about improving the way HA’s Recorder works. Some ideas include splitting off long-term statistics into their own database, improving the way users can manage excluding records, and my own suggestion, allowing the retention period to be specified for individual entities.

I see some great ideas in these threads, and I’m optimistic that the best of them can be implemented to make HA even better. I’d encourage you to review those Feature Requests and vote on any you think would help. And add your own ideas and suggestions.

1 Like