Which persistence servers support writing over rest?

Hi,

New to openhab here.

I have a series of home made sensors sensors that cache 1 hour of data, and then upload them to a base station.

I want the base station to send this data to my openhab server.

Since this is historic data I believe I want to put them directly into the persistence service, and not set the state for each item.

Doing something like an http PUT to http://server.local:8080/rest/persistence/items/plant1_temp?serviceId=mysql&time=2020-03-19&state=432

However when I do this I get Persistence service not modifiable.

I’ve tried with jdbc on sqllite and mysql.
The mysql services says on the wiki: MySQL - Persistence Services | openHAB

This persistence service supports writing information to MySQL relational database systems, as well as querying from them.

So in theory I thought the PUT request would work.

a. Is there something wrong with openhab config or persistence service?
or
b. Should I not be using the rest API to write historic data?
or
c. Is there a different persistence service I should be using, that supports PUT over the rest api?

Means what it says.
All the persistence services offered by openHAB are about recording instantaneous states of OH Items. No ad-hoc inserts, no arbitrary timestamps.

You can of course do any ad-hoc stuff you like outside of the openHAB framework.

In addition… you could use some persistence backends to add historic data, e.g. use a SQL statement to add those data directly into the correct table. Of course this is not intended, but if the data is setup correctly, openHAB will never notice that it didn’t write the data itself. :slight_smile:

Dear James,

I had a similar setup:

  • openHAB for home automation
  • a separate logger which sends all logged data once a day

Now I want to use this data in openHAB …

My first Idea was the persistence api, but I got the same error. It seems that Udo is right, there ist no persistence service that allows modification of item values in the past.

Here is my workarround:

  • Add the corresponding items to the persistence service with strategy = restoreOnStartup
  • Write the external data directly to the database (in my case a MariaDB)
    -> openHAB charts will use the data automaticly, but the states of the items will not update …
  • Use the rest API to update the state of the Item with the last value from my external data

It is not nice, a “restore” method for the Items woud be better. Now I have charts and a value in my item (of course only from the last day, but that does not matter for me).