Request Energy States from the past in the Backup.
tom_l
April 27, 2022, 2:26am
2
They are stored in your recorder. Which is backed up if you do a full backup.
I have successfully installed a backup but no energy states from the past will showing up. Maybe a Bug?
tom_l
April 27, 2022, 10:11pm
4
Did you lose all your history data, not just energy data?
hellcry
(Ciprian)
April 28, 2022, 4:56am
5
for me also does not backup db (docker container here) db is backup as a file but is 0 bytes
Yes. all my history states are lost…
tom_l
April 29, 2022, 7:35am
7
The the issue isn’t that energy stats aren’t in your backup. It’s that either the recorder database was not in your backup or the database became corrupt when backing up. That last one is a common problem. If you search the forum you will find topics on repairing the database with SQL commands, like this:
I restored a snapshot when switching hardware / sd card (HASS OS on Pi 2 B 32 bit to HASS OS on Pi 3 B+ 64 bit).
Result:
The home-assistant_v2.db from a restored snapshot is malformed or corrupted. This leads so error messages and not functional Home Assistant (history graphs not generated/shown, sensor state changes aren´t stored etc.).
I tested it several times, in every test case the SQLite database got corrupted. Either during backup (creating the snapshot) or restore process.
sqlalchem…
or this:
For all ya googlers (or ducckduckgoers). I fixed mine!
shut down HA
via shell cd into config folder and execute:
sqlite3 ./home-assistant_v2.db “.dump” | sqlite3 ./home-assistant_v2.db.fix
mv ./home-assistant_v2.db ./home-assistant_v2.db.broken
mv ./home-assistant_v2.db.fix ./home-assistant_v2.db
Start ha and check logs and history via ui if fixed
Delete home-assistant_v2.db.broken