As I had a bit of spare time I decided to clean up the entity names of my individual appliance power monitors (twelve in total). As a good Homeassistant citizen I created a backup (not in full as the database is 10 gigabyte in total) and started renaming my devices by removing some, changing others. To my great dismay I noticed after a reboot that all historical data was gone (including the data of DSMR meter which was untouched). I thought it was a mistake from my end, so I rolled back the backup (expecting a data loss of about an hour).
Unfortunately the data remained to be nowhere to be found. I believe the changes I made caused a flush of the Energy Dashboard database
So in short: be careful if you wish to safeguard your historical data in Energy Dashboard.
In that case all your data should be missing, not only the statistics.
Can you see historic data for your entities, going back longer, then your restore?
That used to happen a lot with backups (not sure if it still does).
However, in most cases this can be fixed by
To be complete, since then (a while back now) I just abandoned the sqlite recorder and installed the mariadb addon, and pointed the recorder config toward that database. No more corrupt DB’s and history is blaaaaazzziiiing fast now (Can get really slow if you have a lot of entities)!
You’re a life saver! Thanks to your tip I managed to recover my statistics. The “.dump” didn’t work however, so I used “.recover” which did the trick.
Only thing I need to do now is figure out how to move the sqlite db to mariadb while maintaining the energy history, but by judging from this forum I am not the only one struggling with that…
Personally, I moved my database to a NAS on a separate device. I store 30 days of data. Takes up 50ish gigs maybe 100. It’s still fast loading 3 hours with about 80 entities recorded (I filter out crap I don’t care about). Loading 2 weeks takes about a minute. The nice thing is, it’s all separate and it’s not stored in backups. It runs when HA is not running. It’s a set it and forget it. The drawbacks are: Sometimes I forget the password to the login management system for it because I don’t have to touch it for years… literally.