API PUT to rrd4j fails with error 400

I have create an empty rrd4j instance.
When I retrieve data via the API, this works fine.

When I try to add data to a new schema it fails with:

curl -X PUT --header “Content-Type: application/json” --header “Accept: application/json” “http://192.168.1.104:8080/rest/persistence/items/Test?time=2019-06-30&state=1
{“error”:{“message”:“Persistence service not modifiable: rrd4j”,“http-code”:400}

Is it a bug or is there something wrong with the command?

Thanks
Michael

Does this have anything to do with openHAB? You’d normally use OH persistence layer, not access a db directly.

I do use the openHAB REST API. Does it belong to OH directly or not?

I had completely missed the REST call buried in the curl, duh.

Anyways, I do not think you can write arbitrary data to the rrd4j type, because of the compression.

OK, understood.
I want to display my total monthly energy consumption.

Currently I am saving the energy counter number each minute resulting in a continuously increasing graph.
My idea was via cron to fill on the first of each month the recent counter value to a new rrd4j schema and in addition put in the diff value.
Is there ( I am sure there is) a smarter way to achieve this?

Thanks a lot
Michael

At the end of the month set the Item back to zero. That will save a zero to database and it will start increasing for the next month. Use a cron builder to get the cron job right.

Rrd4j requires entries every minute, that said your setup with the " new rrd4j schema" that is filled only once a month will not work.