ITEAD Sonoff switches and sockets - cheap ESP8266 Wifi+MQTT hardware

Tags: #<Tag:0x00007fd30d748348> #<Tag:0x00007fd30d748208> #<Tag:0x00007fd30d7480c8>

(Vincent Regaud) #568

Download the bin file and flash that. No compile needed

(Rob) #569

Hi Vincent!
But how can I then submit the SSID and pwd, so the sonoff devices can hook on to the router?
thanks rob

(Vincent Regaud) #570

The sonoff will create its own wifi network. You can connect to it and go to and then enter the required information for your own network.

(Rob) #571

Which flash Tool would you use. Just tried ESP easy flasher without sucess

(Rob) #572

And used the latest sonoff.bin

(Vincent Regaud) #573


(Johann Obermeier) #574

First i dont use Arduino IDE i cant help here. But at first look i see a MANDANTORY error, never flash a sonoff device with mode DIO it will NOT work. Only mode DOUT is possible as mentioned in Readme
Take a look here

(Michael Ingraham) #575

@vzorglub Vincent,

FYI - will probably post to a new track… but I’m in the process of re-thinking. I’m retaining the original fan speed switches but am adding switches for each channel and running the β€œupdate” (feedback) rule base on the state and transition of those. This way my rule can update the Selection but also set up β€œinterlocking” logic. The Hunter fan doesn’t allow me to use the 4CH in interlocking mode… but I can inter-lock the setting with openHAB by the appropriate checks on the β€œallowed” speed inputs vs. what is physically possible on the 4CH buttons or via the RF remote (or the TASMOTA web interface). For now I’m not implementing rules w/in TASMOTA.

I’ll post my final solution later. Just be aware that your insights were very helpful and made me come to the realization that I needed to enhance your feedback rule to add better state logic for the switch.

Thanks and Cheers!


(Rob) #576

Hi Vincent,
You were perfectly right. I burned sucessfully all my Sonoff Devices with the current .bin file and managed them into AP mode to customize them according my testing WLAN aera here at the hotel. I also flashed 2 NodeMCUΒ΄s with Easy ESP, hooked them up into the WLAN and wired 2 pcs MH Z-19b onto their pins in order to measure CO2. IΒ΄m not quite sure what they are measuring but you can follow my next steps in the β€œmush machine” postings :wink: thanks for your help so far!

(CM6.5 H102) #577

A few weeks back I wired a 3.3v relay (Icstation 1CH 3V 3.3V Relay Power Switch Module with Optocoupler) to sonoff basic GPIO 14 and played with the configuration a bit. If I turned on either relay, both came on. I was able to turn each relay off separately and thats were I stopped. Does anyone know if GPIO 14 can be controlled completely separate from the main relay? BTW, firmware is tasmota, tried with both 6.1.0 & 5.12.0 versions.


(Vincent Regaud) #578

I think you can. You’ll have better luck on the tasmota forum though

(Vincent Regaud) #579


I had a deep look into the tasmota wiki and I didn’t find an option to set GPIOs on command.
However I may have missed something

(Johann Obermeier) #580

Yes. it is possible. It should work out of the box. You have defined GPIO14 as Relay2?
So you just send Power2 On to control relay on GPIO14. If you disconnect the relay you
have an controlled GPIO Pin ON/OFF.
Many things are possible… What is your desired use case?

(Johann Obermeier) #581

You can connect one MHZ-19b on a ESP with TASMOTA too. You have the benefit just playing around with one β€œPlatform” -> the device and mqtt β€œhandling” is always the same

(Vincent Regaud) #582

I was looking for that in the tasmota wiki and I probably missed it.
How do you do that?

(Johann Obermeier) #583

It is a litte bit hided in sensors (GPIO, GPIOS)

You can add a sensor using the following (MQTT) commands:

modules - show supported modules
module 4 - select desired module functionality for a Sonoff TH (Wait for the restart)
gpios - show supported sensor types. (DHT21 = AM2301, AM2302 = AM2321 = DHT22)
gpio - show current defined sensors on supported GPIO pins
gpio14 2 - select sensor AM2301 (Wait for the restart)
For some sensors to show up a power cycle of Sonoff is needed to reset the devices just configured.

But in the WebConsole it is easily found in Module Configuration just select and save!

(Vincent Regaud) #584

Yes I saw that but I did not see a relay module

(Johann Obermeier) #585

10:25:00 CMD: gpios
10:25:00 MQT: stat/sonoff-17DBAE/RESULT = {β€œGPIOs1”:[β€œ0 (None)”,β€œ1 (DHT11)”,β€œ2 (AM2301)”,β€œ3 (SI7021)”,β€œ4 (DS18x20)”,β€œ5 (I2C SCL)”,β€œ6 (I2C SDA)”,β€œ7 (WS2812)”,β€œ8 (IRsend)”,β€œ9 (Switch1)”,β€œ10 (Switch2)”,β€œ11 (Switch3)”,β€œ12 (Switch4)”,β€œ13 (Button1)”,β€œ14 (Button2)”,β€œ15 (Button3)”,β€œ16 (Button4)”,β€œ17 (Relay1)”,β€œ18 (Relay2)”,β€œ19 (Relay3)”,β€œ20 (Relay4)”]}
10:25:00 MQT: stat/sonoff-17DBAE/RESULT = {β€œGPIOs2”:[β€œ21 (Relay5)”,β€œ22 (Relay6)”,β€œ23 (Relay7)”,β€œ24 (Relay8)”,β€œ25 (Relay1i)”,β€œ26 (Relay2i)”,β€œ27 (Relay3i)”,β€œ28 (Relay4i)”,β€œ29 (Relay5i)”,β€œ30 (Relay6i)”,β€œ31 (Relay7i)”,β€œ32 (Relay8i)”,β€œ33 (PWM1)”,β€œ34 (PWM2)”,β€œ35 (PWM3)”,β€œ36 (PWM4)”,β€œ37 (PWM5)”,β€œ38 (Counter1)”,β€œ39 (Counter2)”,β€œ40 (Counter3)”,β€œ41 (Counter4)”]}
10:25:00 MQT: stat/sonoff-17DBAE/RESULT = {β€œGPIOs3”:[β€œ42 (PWM1i)”,β€œ43 (PWM2i)”,β€œ44 (PWM3i)”,β€œ45 (PWM4i)”,β€œ46 (PWM5i)”,β€œ47 (IRrecv)”,β€œ48 (Led1)”,β€œ49 (Led2)”,β€œ50 (Led3)”,β€œ51 (Led4)”,β€œ52 (Led1i)”,β€œ53 (Led2i)”,β€œ54 (Led3i)”,β€œ55 (Led4i)”,β€œ56 (MHZ Tx)”,β€œ57 (MHZ Rx)”,β€œ58 (PZEM Tx)”,β€œ59 (PZEM Rx)”,β€œ60 (SAir Tx)”,β€œ61 (SAir Rx)”,β€œ62 (SPI CS)”,β€œ63 (SPI DC)”]}
10:25:00 MQT: stat/sonoff-17DBAE/RESULT = {β€œGPIOs4”:[β€œ64 (BkLight)”,β€œ65 (PMS5003)”,β€œ66 (SDS0X1)”,β€œ67 (SerBr Tx)”,β€œ68 (SerBr Rx)”]}

(Vincent Regaud) #586

Cool thanks

(CM6.5 H102) #587

I did try GPIO14 as Relay2. That’s how I was able to turn the relays OFF individually but the issue was both turning ON when either was selected. I tried from the web UI and via mqtt but same result. Most of my sonoff’s have a sensor connected and work great so I thought maybe this would work with a relay. It’s nothing I must have, just testing it out. When I get some extra time I’ll give it another go. At the moment, I’m downgrading all sonoff’s to v5.12, the latest v6.1.0 with mqtt is giving issues.