Http binding url escaping rules

I’m trying to use http binding to execute an InfluxDB query using it’s http api.
The query url is:

http://openhabianpi.local:8086/query?db=openhab_db&q=SELECT mean("value") AS "mean_value" FROM "openhab_db"."origin"."IOT_Aerotermia" where time > now() -1m

And I had some problems escaping it. First I tried with using standard url encoding, but I got some strange java.util.UnknownFormatConversionException: Conversion = ‘F’ errors.
After some research I found in another thread that I’ve to escape the %

Are the escaping rules for http binding documented somewhere?

Quick question. Why are you not using the averageSincepersistence method ?
See the persistence docs in the main openHAB docs. At the bottom.

My use case is not about persisted item values by Openhab.
It’s about retrieved data previously stored in InfluxDB by a third party module.
That comes from a suggestion in that thread.

Did you get this working? (Still in the community??) I’m trying to do the same thing

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: