I have exactly the same question @patric.dahl
How does one clear this data when you can’t stop HA core (because it is hass os)?
Same issue here. I have hass OS and when editing core_restore_state and restartting, my changes are not taken into account
I came to this thread because I had a similar problem: experimental energy meters from when I was setting my Home Asssistant up for the first time which are no longer needed. Maybe it was written after this thread started, but unless I’m missing something the Statistics developer tool has a button for altering historical data and for removing statistics with no associated state: https://[home-assistant]/developer-tools/statistics
This doesn’t seem to help due to the way the energy data aggregates values from the sensors then stores them elsewhere. eg I have values from August where the cost was 100x too large. The developer tools / statistics show me recent data, but don’t allow me to fix the historic energy data. As it doesn’t think there’s anything wrong, I can’t see any options to change data there either.
Ideally I’d want to recalculate the aggregate cost value for the month based on a new cost per kWh from a certain date on.
The problem is, that the statistics table has a column “sum”, that contains the aggregated data at the time having created the row. So this includes the values having later deleted.
One has to modify all later rows, too.
Or there is a way to re-create the update/re-create the/all statistics … ?
Following, I made the mistake of testing various sensors and would love to reset all the data.
Hi Marco, can you explain what you mean by “the entity”, please. When I edit that file, it has many entities in it with lots of data for each. Which entity and what is it I should change to “0.0”?
Thanks very much,
-Bob
Uhh, long time, I think HA is repopulating the entity that you have mapped in Energy Config from that storage file, meaning you have to find that mapped entity in the file and reset it, but without HA running otherwise it will overwrite the file to save the current state. Afterwards you can cleanup the database. Then start HA again.
Hope that helps!
I spent almost two days solving this problem because I mixed W with kWh. Tried to tinker with the database but as you say, deleting all values from entity_id is not enough. It is saved also in statitistics. Then it looks like that some data are linked with the power sensor that is later used for energy sensor by the integration function and later into utility meter. The final solution for me was to simply restore the database from backup and HA as well. Yes I lost some data but at least I dont have corrupted data.
Anyone else here with a solution for this? I’ve deleted 3 days from the database with corrupted data, but the problem is it just aggregates the wrong values back again. So frustrating.
Even if I delete that entry, it will reappear.
Look here, worked for me.
How to completely wipe sensor history? - Development - Home Assistant Community (home-assistant.io)
Hi, i have the same issues after upgrading to the latest of 2022 and also the newest in 2023. I am able to play around in the DB an change some fields and the values do seem half ok then, but even when looking at the sensors, smart meter the problems keep getting back. I started using Home assistant next to homey for the energy monitoring, but this is just too troublesome. I do like the interface and dashboards, but I already do not trust the numbers anymore. As I am no developer or want to keep on spending time in the DB and frustration in this, why can this not be solved? I read threat threats going back to when the energy dashboards where released and everywhere you hav to dig into deep DB commands and changes. I want to simply with one click, reset all numbers from all energy sensors and start over. anyone knows where this is requested to the developers?
Hi,
I’ve been using the energy dashboard for about 6 months and have got some great data from my solar installation, my heat pump and the corresponding usage from the grid.
I’ve recently created some utility meters to track the costs from grid usage during the 3 different tariffs we have here in Spain.
It is working great but I want to stop the direct inclusion of my Shelly EM, but I’m greedy because I don’t want to lose my historical data (like everyone else). The solution of changing one of my new meters to the direct Shelly unique_id isn’t an option because the feeds from the Utility Meters don’t have unique_ID’s. I’m also using the Shelly as a source for the Utility Meters.
Anyone got any ideas?
Editing the database is no longer the way to do this.
Go to Developer Tools → Statistics and click on the ramp icon next to the entity.
This does not work for me. I have a huge spike at one day. But looking into the statistics at that day; I cannot find any entity, das hat abnormal values. I suppose, there is another logic, that I do not find.
In the statistic you see the data so are you sure about the right date and time?
Have you checked the day before the spike, some times it can come from the day before, verify every value.
@jeedee : Thanks for your questions. Yes, I have checked the 1st of July and the 30th of June 2023. I have looked at the statistics of all sensors of my PV system, especially the sensors for the battery, which seem to cause the spike:
It would be nice, if my battery had a capacity of 3.1 MWh .
Also following this since I have the same issue with costs… did a wrong calculation with my “total_electricity_price_including_vat” (a template sensor), and for like 2 hours it thinks I paid €80 per kWh hehe.
Not a super big deal, but would be nice to fix it.