Extending the REST API possible?

Hi everyone, I need to fetch some values from the persistence extension via REST API. This is not currently configured in the pre-defined REST API. Is there a way or a work around how I can fetch these data through an API call? eg. .averageSince(ZonedDateTime)

No, the REST API is what it is. But you could create a rule to calculate the averageSince over some set period of timer periodically and post that to an Item which you can read from the REST API.

Or you can get all the values from the REST API and calculate the average yourself.

Or you can query the database directly if it supports that.

Welcome to the openHAB community!

influxdb can be used as a persistence service in openHAB and does support your use case (InfluxQL functions | InfluxDB OSS 1.8 Documentation) and comes with an API (InfluxDB API reference | InfluxDB OSS 1.8 Documentation).

Hello Jessica,
If you are able to write Java code then you can add additional REST endpoint throught third party extension. There is nothing which will block you from doing so.
There is bunch of annotations you need to place on your REST endpoint class, however its all you need to wire it in.

Are you familiar with developer docs of openHAB?

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.