Using advanced features of InfluxDB

I really like the graphing feature in the OH3 UI. It’s easy to use and it’s well integrated into the UI. If possible I would like to stick with it instead of switching to e.g. grafana.
Is there any way to use some of the features influxDB provides? E.g. moving window average or calculations like the difference between two items’ values. I don’t see such options when defining a graph or on the item itself.
If something like this does not exists, would it be possible to define the query for influxDB in the item metadata and use it in the influxDB persistence module to fetch the data?

Everything built into openHAB is going to have to support the lowest common denominator between all supported databases. If InfluxDB provides a feature or capability that rrd4j or MongoDB or MariaSQL doesn’t, then openHAB isn’t going to support it either.

The UI and persistence actions all use a common API to fetch data regardless of which database is configured to be used.

1 Like

OK, I understand that it makes sense to only provide one common API to fetch the data. Would it be possible to integrate this into the influxdb module itself? I imagine the following process: The graph asks for persisted data of one item through the API not knowing which service is used. The request is redirected to the influxdb service. The service in turn would check if there are metadata on the item containing additional information specifically for this item. Using the additional information from the metadata, the query would be performed on the influxdb instance.
Do you think an approach like this could make sense? I know that is not possible at the moment but would require a modification of the influxdb module.

Maybe, but I doubt that add-ons even have access (or are allowed access) to the Item metadata.

One of the ways that a system like openHAB is even possible is by providing uniform APIs for various layers to communicate with each other and defining and encapsulating capabilities in a constrained manner.

You can always open an issue and see if the maintainers like the idea. Historically they have not.

Sure, but I think adding functionality based on metadata would still conform to this. When I switch to a different persistence I would lose functionality which relies on influx but it would still work.
That’s somehow similar to integrations like google or alexa which only work through metadata. There is not even a generalized way to integrate items.

I think I will check if it’s possible to do (including accessing the metadata). As I said in the beginning, I really want to stick to the OH graphs for their seemless integration.