Switching SainSmart Relay via HTTP Binding not working

  • Hallo ich bin ein Anfänger und brauche Hilfe.
    Ich habe openhab2 auf eimen Rasperry instaillert und möchte ein Sainsamrt 8er Relais (wlan-modul) mit dem Http-Binding schalten. Ich habe das Binding installiert das ist mein item

“Switch Relais1 {http=”>[ON:POST:http://192.168.1.4:30000/01] >[OFF:POST:http://192.168.1.4:30000/00]"}"

Das sind die Befehle für das sainsmart, die ich im Inet gefunden habe.

“192.168.1.4/30000/00 ; Relais-01 off”
“” " /30000/01 ; Relais-01 on"

Und das ist der Eintrag im Log-file

Über die Imatic App lassen sich die Relais schalten.

Ich habe im Inet gesucht aber komme leider nicht weiter.

Danke im voraus für Eure Tipps.

As this is an international forum, could you ask your question in English please? Thank you.

Are you sure your using the right URL to switch the Relais on and off?
SocketTimeoutException occurs from the java framework when a request to a network socket (ip+port) is taking to long and timesout.
And since your making HTTP posts I would suggest you to make a simple rule.
if it’s a json HTTP API you can try this:

var url = "http://yourURL"
    var contenttype = "application/json"
    var POSTrequest = '{"your JSON post command'"}'

    var output = sendHttpPostRequest(url, contenttype, POSTrequest)   
logInfo("filename", output)

But as I said, check in your router which IP adress you need.

And please use english since this is not just a german forum :wink:

@Luebbo

Do you mean this manual?

Please first check, if the IP-Address of your relais is correct.

Second, it is not clear in above manual, if you need port 30000 or not.

Did you test it with a normal browser (e.g. Edge, Internet Explorer, Firefox, Chrome or Opera?)

What happens, if you copy the following to “address line” into your internet browser?

http://192.168.1.4/30000/01 or http://192.168.1.4/30000/00

http://192.168.1.4:30000/01 or http://192.168.1.4:30000/00

Which of above command(s) does switch your relais?

Third, check the syntax of your item.

Normally it should be:

 Switch Relais1 "Switch Relais1" { http=">[ON:POST:http://192.168.1.4:30000/01] >[OFF:POST:http://192.168.1.4:30000/00]" }

hello my english is bad but i try it. Thank you for your answer.

Yes it is the the sainsmart. I try the address line in my firefox browser but the relais dosn’t work.

The connect to the RJ45 is connect with a wifi fritz repeater, is this a problem.

Thanks a lot!

Don’t worry, a lot of not native English speakers here :grinning:

You could try to use a German language forum:


https://openhabforum.de/

Normally Fritz!Box has IP-Address 192.168.178.1 (if you didn’t change this manually). And all other network-devices will have 192.168.178.xxx.

Or do you have an other router and then a Fritz!Repeater connected?

Which IP-Address has your relais?

the relay has a fixed ip, I have set the ip on the router. The relays can also be switched with the app imatic

Ok. And IP-Address is 192.168.1.4 ?

Settings of My imatic App from sainsmart

Ok. When you open http://192.168.1.4:30000 with a browser on your smartphone, what do you get?

Error: network timeout.

And with http://192.168.1.4/30000/
Or
http://192.168.1.4:30000/30000/

hallo the same. network timeout

i made a pingtest ist works at 192.1.168.4

You mean 192.168.1 4 or 192.1.168.4 ?

oh sorry 192.168.1.4

In above manual I read the following:

“The Ethernet Controller board has integrated the web server, When you are on your office, you just need to open the page on your computer, pad or smartphone, and then control your devices…”

So http://192.168.1.4/30000 should work with a browser…

Maybe only http://192.168.1.4

Or you have to disconnect your imatic app, because it has exclusive access…

i don’t no, it’s crazy. imtic app works but explorer dident.

Thankt for your support

And what about??
.
http://192.168.1.4/30000/41 (=Enter)
or
http://192.168.1.4:30000/41

What is the IP address of your router (gateway)?
This seems to be an IP range related issue.