Long term statistics for Energy kept outside recorder

I had to restore my HA a couple of times, and every time I have lost the long-term statistics for the energy dashboard due to corruption of the recorder. I have tried Mariadb without success, might even worsening the problem when restoring.

In the future I WOULD LOVE if the Energy statistics is kept outside recorder database, so it remains intact upon restoring HA.

Work is being done to make backups of the database more reliable.

That should not be the case. Especially if you stop the addon before creating the backup.

1 Like

Well, I use “Home Assistant Google Drive Backup” and I just did a dive into the settings; and there is a setting to stop add ons before backup. I’ll give that a try and stop Mariadb.

Do you know if anything more needs to be stopped before backing up?
Does stopping Mariadb during backup also stops recording of data?

Thanks!

I use Postgresql for my HA Recorder database, it is very solid. I wanted to keep very long term records for my HA devices, but did not want to slow down HA with a very large history. So a couple years ago, I added two database triggers to my HA database that copy each new event and state record that HA adds. It is worked solid for several years. I keep 60 days history in my HA Recorder and have never deleted any of the history in my archive database. While it is harder to access this long term history from within HA, it is easy outside with tools like Grafana and Juypter. You could do something similar to save just a subset of history, for example energy. Another options is one of the integrations such as InfluxDB. I tried InfluxDB for a while, but found keeping current on another database language was a lot of effort, I had already standard SQL needs so that fit me better. Good hunting!

1 Like

Thank you for your reply. I’m looking for an easy solution, and set my faith that the developers comes up with an solution to this annoying issue.
I might give Mariadb another try, and stop the process while backing up to see if that helps.