Httpbinding special characters


I’m new to openHAB. I would like to make the following http request using the httpbinding but it does not appear to work:[“ESP0007”]&endkey=[“ESP0007”,{}]

I suspect it is due to the square brackets and curly braces. Is there a way to escape these special characters?

Thanks for your help in advance!

Yes. Here is a link to the full map. You will want:

  • [ = %5B
  • ] = %5D
  • { = %7B
  • } = %7D

Try this:

Thanks for the help! Not only did I need to escape the braces, I also then had to escape the percentage symbol because the httpbinding is expecting a parameter. Here is the final working escaped url for anyone that runs into this:[%"ESP0007%"%]&endkey=%[%"ESP0007%",%{%}%]

Does this also apply to REGEX?

I would like to extract “plugged” from curl:
The result of curl looks like this:

Battery level 47% (plugged)

I tried:
val String plugged = transform(“REGEX”, “.% %%28(…).”, json) - ascii replacement for (
val String plugged = transform(“REGEX”, “.% ((…).”, json) - escaping (
val String plugged = transform(“REGEX”, “.%%25%%20%%28(…).”, json)

none of these work.

So how to look for “% (” and extract the next 7 characters?

Got it:
I needed to double escape the “(”
val String plugged = transform("REGEX", ".*% \\((.......).*", json)