Hello,
sorry, I searched and tried a lot and I don’t find a way to transfer my http commands I have to send to open/close and so on to external systems.
I have now OH3.0.2 installed with the http binding.
With OH2.x the command was the following:
I created under OH2 an Item
Switch xx “xx” { http=">[*:POST:http://192.xxx.xxx.xxx/relay_control?1=on]" }
I tried a lot and it don’t worked…
Could everyone help me and give me the infromation what must be configured with the OH3 http binding?
id: ON
channelTypeUID: http:switch
label: ON
description: “”
configuration:
onValue: on
mode: WRITEONLY
offValue: off
commandExtension: relay_control?1=on
thanks. Why do you have two channels? And which of the channels did you link to the item? Another thing: I guess the baseUrl contains the ip-address, correct? It looks empty in your posted condifuration.
Hi Jan,
I deleted only the ip adress here.
I have 2 bindings only made for testing, because I was not sure, witch works…
I added here it complete again
id: ON
channelTypeUID: http:switch
label: ON
description: “”
configuration:
onValue: on
mode: WRITEONLY
offValue: off
commandExtension: relay_control?1=on
In general that looks very good. Maybe you should set the binding to TRACE logging (Logging | openHAB and see what exactly is send and what the response is. Coud it be that the content (which is the command) of the POST request is the problem?
Thanks a lot Jan. Sorry for late reponse, coudn’t test it.
In the log I get the following:
[WARN ] [p.internal.http.HttpResponseListener] - Requesting ‘http://192.168.xx.xxx/relay_control?1=on’ (method=‘POST’, content=‘org.eclipse.jetty.client.util.StringContentProvider@35174cc8’) failed: 400 Bad request
It could be that the server does not allow content to be sent. By default the command is set as content. Can you try if you get the same error if you send something in the content in OH2?
Hi Jan,
with the HTTP Binding I don’t get it to work…
I now have done this with the “sendHttpPostRequest” out of a rule and it works.
Don’t know why, but for this issue solved. I I had time, I will try to get it done with http binding, I think for other things it would be nice…
Thanks and best regards
Stefan