Notification when database gets corrupt

Hey guys,

Is there a way to get a notification when de database gets corrupted.
I had a power outtage a few days ago, and the server rebooted after the power got back, no big deal.
But I checked the energy consumption today and I saw that I lost 1,5 year of energy data consumption.
Im a sucker for that data so I my heart screamed like a little girl.

Luckily I make backups every night, but now I lost 5 days worth of data.

Is it possible to get a notification at least? Now HA just renames the db as CORRUPT and starts a new db…
Would really appreciate a notification or some sort.

Thanks!

1 Like

That would be a feature request (that I’d happily +1)

1 Like

Or an ability to set the DB to self prune.

My Database got to over 4GB when it got corrupted. And triggered a daily outage. I don’t need/use history so I deleted it and everything is fine now… But it Would be nice if would could set a max DB size and have the OS prune old entries.

It does self-prune, but by time rather than by size.
If you don’t care, just set “purge_keep_days” to 1. You’ll still have long-term statistics (aggregated data), which use basically no space.

My db just got corrupt 2 days ago again.
I switched to mariadb and will start clean.

I have no clue why my sqlite db gets corrupted the whole time.

Hope mariadb woning have these problems.

HA has stated that they prefer users to use the default sqlite over mariadb at the moment. Myself I had a corrupt message today as well. I managed to recover the corrupt db file and reuse it so I only lost todays information instead of all previous history.

I’ve created a feature request:

I converted back to sqlite since.
But I just had a recent db corrupt again, last week.
Made a new topic for that.

Because HA team preferred sqlite over mariadb I decided a few months ago to go back.