So I was thinking of manually entering this missing data.
ChatGpt absolutely advised me against doing so, but I don’t believe in AI, so I’m asking you if I can do it without any repercussions.
Set the value for the December 8 record
UPDATE statistics
SET state = 7.1, sum = sum + 7.1
WHERE metadata_id = 15 AND start_ts = strftime('%s','2025-12-08 12:00:00');
Move forward all records after December 8th to today
UPDATE statistics
SET sum = sum + 7.1
WHERE metadata_id = 15 AND start_ts > strftime('%s','2025-12-08 12:00:00');
If i wanted to that, i would take a datebase backup, shutdown Home Assistant to prevent concurrent access and then try it.
Restart HA and verify.
If anything goes wrong you could restore the backup.
(I did not check if your update statements are correct!)
I’ve done that a bunch of times. Just shut down core and make a backup. I feel it’s pretty safe if you are comfortable with sql – and at keeping good backups… And doin’t mind having core off for awhile.
I changed a sensor’s unit of measurement and then the new values in the new unit got written, so when I changed it back I had to go in and update all those rows in state and history tables.