History Editor - edit, fix, and bulk-correct state history and statistics

I just published a new integration that implements a history editor that is able to edit state history, short-term and long-term statistics.

With this, you’ll be able to correct those pesky wrong readings from that sensor that keep spoiling your graphs, repair your energy dashboard stats and bulk-correct wrong spikes.

Deleting values from short-term or long-term statistics doesn’t actually deletes the stats rows, but “neutralizes” them, copying the value from the previously existing statistics.

But… Here be dragons! You’ll be able to modify the database directly, so you can easily break things if you start doing things carelessly.

You can install it from HACS following the instructions at https://github.com/davefx/dfx-ha-history-editor

Note that I have implemented this with the help of GitHub Copilot and Claude AIs (as I, software engineer, have done with much of the code that I’ve been implementing in the last weeks). But these are not the happy results of a single binge-coding session. I’ve invested some time into the integration: the project includes unitary and integration tests to ensure nothing breaks. Also, after feedback, I’ve added a few safeguards to avoid potentially doing things wrong.

Claude AI assisted? You didn’t mention that in your (now edited) post.

You are directly editing the database with your code. Are there any rollback features, transaction logging, or backup/restore facilities should there be any errors encountered?

Should the database structure change in the future, are there any provisions for your code to cope with that? Version checking, etc?

Here be dragons. Immensely powerful, but the ability to make a mess is just so easy. I know it will be used widely, the developers of HomeAssistant avoiding adding this functionality for good reasons and the temptation to ‘fix’ things up by tweaking data points is so overwhelming, especially by new users.

Folks: be careful. You’ve been given the equivalent of a machine gun to swat a fly. Use it sparingly. Use it wisely.

Thanks for your feedback.

I just made changes to address your concerns.

Thanks.
Use with care!