Edit (or delete) history/statistics from a sensor/entity

There have been several times when I have been experimenting with a sensor or circuit and caused some sort of unusual reading. This messes with graphs on the dashboard so would be good to have a way to edit or delete values - without deleting all history.

There are two places this needs to be addressed.

  1. Long term statistics can currently only be adjusted for entities with a total or total_increasing state class, not measurement.

  2. State history. Though this does disappear after your recorder purge keep days setting (10 days by default).

Yeah, would also love to see this.

Maybe a new service call that takes in data ala ā€œfrom: 2024-12-01 10:00AMā€ and ā€œto: 2024-11-20 03:00PMā€ or something. And clears that data out or can replace it with a specific value.

Every time I replace freezer temperature sensor battery, I have peak in graph that also changes min/max values. The same when I need to (re)calibrate power measuring plugs/sockets.

Sometimes I just remove sensor and re-add it back later hoping that the sensor name will be the same. But it is easy to forget that.

1 Like

As a not so SQL-gifted person this would help me greatly, right now I always dread having to do this manually in the database (and I forget how every time).

I consider the Need of Managing Recordings/Historical Data is a Task almost every User will face sooner or later. By now it guess every user at some Point abadons Statics, sometimes containing Values of many Years.

Just an, as i think, really common Usecase:
Got a Replacement for a Temperature Sensor. Hooked it up, and let it run some Days parallel to the old one. Then put the new one beneath some others, and found out the Room where i want to replace the sensor is shifted 0.6Ā° in average.
What i now need to do:

  • Export all Statistics for the old one
  • Shift the Values by 0.6Ā°
  • Identify and Delete wrong Data for both Devices, where i had them in the Hand for changing batteries, carry aroundā€¦
  • Import the cleaned old Data into the new cleaned up Devicesā€™ LTS

As far as i am aware of, you can only edit specific Datapoints one by one. There is a function to completely delete Stats for an Entity, if it is no longer beeing recorded. Thats it.
What i regulary (1-2x per Year) would need:

  • Delete Statistics/Recorder Data for a given Time Interval (ā€˜delete everything between 02-12 12:00 and Nowā€™)
  • Import Statistics/Recorder from another entity/from a csv, with the Option to overwrite everything / Import up to the Point where data starts / overwrite existing data at Destination, keep existing data when not present in Source
  • Export all Statistics/Recorder to a csv (this is already available i think)

There are more Tasks, like modify Data externally, but with an Option to export/import everything, that can all be done. Maybe the Options from Pt. 2 can be narrowed down as well.

Most probably a full Restart will be required after such operations. Further, before actually writing Data i guess Recorder needs to be stopped. This could be minimized by only previewing the data operations in edit mode, but queeing the actual commands. then, when hitting run, HA stops Recorder, performs the operations, and automatically restarts - either recorder, or Homassistant in Total.

1 Like

I think this is a fundamental must-have !!
Data is the new oil.

Dear @Alsoff, my WTH WTH can't we comprehensive manage Historical/Recorder Data got merged with yours, as its longer up and has more Votes already - great!

However, my WTH goes beyond the Demand to ā€œedit or delete values - without deleting all historyā€.

Is your WTH only about recent readings, or Historical Data as well?
If it is meant to adress both Recorder and LTS, would you mind extendning your Headline? I would be disappointed, if at some Point that would be ā€œsolvedā€, but only adresses recent Readings.
Same, if there would come a Feature to edit one specific Datapoint each with ā€œDoneā€ - i think bulk replace / erase / complete is more handy than edit selective some.