Sonoff relay config

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
nygma
Normal user
Posts: 25
Joined: 26 Nov 2016, 11:16

Sonoff relay config

#1 Post by nygma » 26 Nov 2016, 11:19

Hi Guys,

I have flashed the R120 ESP Easy to my Sonoff switch. I want to use it with MQTT and the HTTP commands. The device connects to me network and MQTT as well.

But I cannot get the relay working. Can somebody send me screenshots of how to configure the device? I have seen somebody doing it as Input Switch, other as Output, and I am confused. I know it is GPIO12.
Can you also tell me what is the exact topic and message I should send over MQTT to activate it?
I also tried the following:
http://192.168.1.116/control?cmd=giop,12,1 but I am getting "Unknown or restricted command!" message back.

Regards,
Csongor

nygma
Normal user
Posts: 25
Joined: 26 Nov 2016, 11:16

Re: Sonoff relay config

#2 Post by nygma » 26 Nov 2016, 11:20

Sorry, I just realized I miss typed GPIO in the URL. That is working correctly, I can turn the relay on and off using HTTP.

nygma
Normal user
Posts: 25
Joined: 26 Nov 2016, 11:16

Re: Sonoff relay config

#3 Post by nygma » 26 Nov 2016, 11:28

A bit more info: the MQTT setup is definitely working. I created 2 System Info devices and they are sending the uptime and wifi strength info to MQTT without any issues.

So my only remaining info is how to turn the relay on and off over MQTT.

nygma
Normal user
Posts: 25
Joined: 26 Nov 2016, 11:16

Re: Sonoff relay config

#4 Post by nygma » 26 Nov 2016, 14:43

Hi All,

It seems just be talking to myself the issue resolved itself. I found another reference saying that the MQTT topic is:
/<device name>/gpio/12 and the payload is 1 or 0 to turn it on and off. So I presume this is a general way to write the gpio pins regardless of the device configuration on the ESP.

Cheers,

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 23 guests