Http binding for Homepilot... wrong

Hi Openhab Community,

i might have not configured my openhab for a while and might have to forgot something basic.

I have had a couple of homepilot rolershutters inegrated with a HTTP binding. Now i upgraded the firmware of the HP - and the interface changed. Grrr.

A bit of “F12” in google chrome and some trying and i know i can control a sutter with a

curl -X PUT -d '{"name":"GOTO_POS_CMD","value":"35"}' http://homepilot/devices/10001

So:

  • hostame resolves (i run it on my OH machine)
  • no auth needed
  • no fancy header or tokeneither

Now i want to setup a mathcig http binding correctly. No, i do not want se excec, since i will poll the status of all rollershutters every minute, and therefore like to have the caching…

My best guess:

Rollershutter RollladenWZSL "Süd Links" (GRollAll,GRollWZ,GRollWZSL) {http=">[*:PUT:http://homepilot/devices/10001:{\"name\":\"GOTO_POS_CMD\",\"value\":%2$s}]"}

(That is the stripped down version, w/o the reading, sitemap etc worked with the old url)

If i tail -f the openhab log i see no errors or save of the item or setting the slider in the basic ui. But nothing happened either…

Did i do some obvious fault? What would should i do?

Thanks
Michael

In the HTTP binding, the colon character : is used as a parameter separator.
So you have to hide any colons included in your plain text by URL encoding as %3A.
There’s a problem with that though … % is itself an escape character. So you have to escape the %3A and use %%3A

There might be another way to escape with \ but I don’t know it.

I think you might need to URL encode your curly braces too.

1 Like

Thats a great tipp! Thanks! I gave it a quick try with

{http=">[*:PUT:http://homepilot/devices/10001:%%7B%%22name%%22%%3A%%22GOTO_POS_CMD%%22,%%22value%%22%%3A%2$s%%7D]"}

But it did not help yet. I’ll try to set logging to verbose or something tonight; did not think about that yesterday…

1 Like

The data you are trying to POST is JSON, by the way.
You might look to see how others send JSON by HTTP

1 Like

Well, i need to PUT, not POST :-). Thanks for pointing this out; so yes, i could definitely do it with a rule…

well, setting the log for the http binding on trace, reveals the not so helpful 2 entries:

> 2019-09-11 20:41:46.861 [DEBUG] [ab.binding.http.internal.HttpBinding] - Executing url 'http://homepilot/devices/10001' via method PUT
> 2019-09-11 20:41:46.864 [TRACE] [ab.binding.http.internal.HttpBinding] - Couldn't find matching binding provider [itemName=RollladenWZSL, command=CHANGED]

The first one is calming, since i would expect that; the second one might be not relevant (says google) but no info of the provided payload.

any idea on the binding is greatly appriciated; otherwise i have t write that rules :-/

looking for the debug message in the source code, i found https://github.com/openhab/openhab1-addons/blob/c14c872c25f68d28de7024f0414445a6c57ee6df/bundles/binding/org.openhab.binding.http/src/main/java/org/openhab/binding/http/internal/HttpBinding.java#L282

The binding does not support the posting of body content for PUT.

WTF?

Well, I’ll try to file a bug/feature request.

Edit: did already exist… https://github.com/openhab/openhab1-addons/issues/5845?_pjax=%23js-repo-pjax-container

1 Like