Http Binding OH2 HTTP Request


(Michael) #1

Hello Everybody,
i would like to toggle my Beckhoff SPS by sending a http post to

http://192.168.0.10/TcAdsWebService/ein.html

i tried a item like this:

Switch networkLamp {http=">[ON:POST:http://192.168.0.10/TcAdsWebService/ein.html]" >[OFF:POST:http://192.168.0.10/TcAdsWebService/aus.html "}

it doesn’t work. log error message:

2017-05-02 18:11:25.256 [WARN ] [org.openhab.io.net.http.HttpUtil ] - Method failed: HTTP/1.1 404 Not Found

i also tried to use the rules like i found on my researches

rule “Network Lamp ON”
when
Item MyItem1 received update ON
then
sendHttpGetRequest(“http://135.1.200.115/TcAdsWebService/ein.html”)
end

rule “Network Lamp OFF”
when
Item MyItem1 received update OFF
then
sendHttpGetRequest(“http://135.1.200.115/TcAdsWebService/aus.html”)
end

but this also don’t work without any errors.

I use OH2 on Windows 7. Thanks for all supporters


(John Schmitz) #2

Try using GET in your item:`

Switch networkLamp {http=">[ON:GET:http://192.168.0.10/TcAdsWebService/ein.html]" …

Double check your URL - the fact that it says 404 Not Found seems to indicate it tried to connect to a bad address?