RRD4J Persistence - How to delete (or modify) historic data for an item in openHAB 4

There have been older posts which talk about using external to openHAB tools in order to be able to see and modify Item values stored in a RRD4J database. However with openHAB 4 we have the API Explorer available and there is a REST interface for Persistence. This is why I would like to stick to system provided tools.

On the Item Level you can find “Get”, “PUT” and “DELETE”.
I was able to manage to query a current items state and was also able to do this for a specific time e.g.:

(http://192.168.0.250:8080/rest/persistence/items/MY_Odometer?serviceId=rrd4j&starttime=2023-08-06T02%3A00%3A00.000&endtime=2023-08-06T03%3A01%3A00.000)

With that result I tried to use the Delete function but what I get back is this:

(http://192.168.0.250:8080/rest/persistence/items/MY_Odometer?serviceId=rrd4j&starttime=2023-08-06T02%3A00%3A00.000&endtime=2023-08-06T03%3A00%3A00.000)
{
  "error": {
    "message": "Persistence service not modifiable: rrd4j",
    "http-code": 400
  }
}

The reason I want or have to delete or modify the already stored values up to August 6th is that the values stored before where like in “meters” and now they are stored (as I want it and finally works well with 4.x) in “kilometers”.
Is there a way with openHAB standard abilities to delete the older values?
(I am currently running openHAB 4.0.2)
Thanks for any hint.

If the REST API won’t let you do it you’ll have to use an external too. HowTo Change values in an rrd4j database

1 Like

I wonder why there is such a restriction. OpenHAB itself must be able to change values or does it not? Does openhab only store data and never touches it again (except reading) in RRD datafiles?

Anyways thanks for the feedback, it confirmed what I was assuming, just wanted to make sure I am not missing a detail.

Correct. What would it need to save past values for?

Also, because of the way the rrd4j works, it’s not so simple as just changing one or two entries. Using a tool that understands how the underlying database works is a must. OH’s persistence capabilities are generic and doesn’t do anything to account how the different databases work.