I did it, and it works. But it’s very unmaintenable:
Take a look for example at an Item that does a query to get the mean energy consumption of an Aerothermia device:
Number AerotermiaPower “Aerotermia [%d W]” <“energy”> { http=“<[http://localhost:8086/query?db=openhab_db&q=SELECT%%20mean(%“value%”)%%20AS%%20%“mean_value%”%%20FROM%%20%“openhab_db%”.%“origin%”.%“IOT_Aerotermia%”%%20where%%20time%%20%>%%20now()%%20-1m:10000:JSONPATH($.results[0].series[0].values[0].[1])]”}
Also in the near future, I want to use InfluxDB 2 with flux queries, and it will be even more difficult.
Just last week I proposed to develop a new addon to be able to create Items from arbitrary InfluxDB queries, and it’s in study:
It’s a developer topic, but you can follow if have interest: