OH3 HTTP-Binding % in URL

Hi there,
I desperatly try to fix a HTTP-Binding in OH3.

The Protocol of my projector is quite unusal:

Switch on: http://IP/cgi-bin/pjctrl.cgi.elf?D=%05%02%01%00%00%00
Switch off: http://IP/cgi-bin/pjctrl.cgi.elf?D=%05%02%00%00%00%00

Status: http://IP/cgi-bin/pjctrl.cgi.elf?D=%06%00%BF%00%00%01%02
returns JSON, [6]=0 is off, [6]=4 is on

UID: http:url:http_projector
label: Beamer
thingTypeUID: http:url
  authMode: BASIC
  ignoreSSLErrors: false
  baseURL: http://IP
  delay: 0
  stateMethod: GET
  refresh: 30
  commandMethod: GET
  timeout: 3000
  bufferSize: 2048
location: Wohnzimmer
  - id: http_projector_switch
    channelTypeUID: http:switch
    label: Schalter (Beamer)
    description: ""
      onValue: "%05%02%01%00%00%00"
      offValue: "%05%02%00%00%00%00"
      stateExtension: /cgi-bin/pjctrl.cgi.elf?D=%06%00%BF%00%00%01%02
      commandExtension: /cgi-bin/pjctrl.cgi.elf?D=%2$s
      stateTransformation: JSONPATH:$.[6]∩MAP:projector.map

I tried to double % %%05%%02%%01%%00%%00%%00 but this is formated to %2505%2502...
I tried to set on value to 01 or 1 but with a % in the commandExtension %2$f won’t be replaced

Any other ideas to try?

Hi Maex,

I don’t think this is currently possible, I got stuck with an API which had the same requirement. I’ve implemented an escape hatch and logged a pull request, with the compiled code in a comment.

If you want to use the jar now you’ll need to double up your percent signs: http://IP/cgi-bin/pjctrl.cgi.elf?D=%%05%%02%%01%%00%%00%%00, and set escapedUrl: true as a parameter on the channel.



1 Like

Have you tried Base64 encoding the value?