SmartThings Community

[RELEASE] Sonoff, Sonoff TH, S20, Dual, 4CH, POW, & Touch Device Handler & SmartApp ($5 & $10 Smart Switches)

(Gareth) #1829

just followed this tutorical for a touch many thanks all sorted and now to fit to the wall
BTW do you have any advice for the led back light > can this be powered down at certain times for in bedrooms etc?
reduce power to it to dim it ?

Great work

(Pablo Vigo) #1830

Hi All,
After flashing a bunch of sonoff basic and a 4ch, I’m trying with no sucess flashing a dual switch r2. I’ve have few questions

1.¿Should I have to install switch child device handle for the dual switch? (I have 4ch switch’s installed allready)
2.After flashing, I can’t found on ST mobile app, with the discovery option, and if I’ve install it manually, it does not work properly.

I’m sorry if this issue was allready reported but i’ve read the all tred and could not found the answer.

Thank to all!

(Rob Wilson) #1831

Hi Eric

I have the Sonoff 4ch pro r2 which I have flashed with your 4ch firmware.
I have it working under smartthings now. Thanks very very much for that.

However the buttons do not work. I presume because of differences in the firmware configuration and the way they are accessed by the wireless and ESP chip for the r2.

Do you have any plans to update your firmware or open source it? Is it possible you could point me in a direction that could fix the buttons so I can use the wireless remote. Is it possible you could suggest some changes I could make to the tasmota firmware to get it working with your excellent Smartthings app and drivers?

Many thanks

Rob Wilson

(Rob Wilson) #1832

Hi again Eric.

I have a sonoff 4ch pro r2 as mentioned and it seems now I have messed up the wifi config / admin password or something. The board no longer appears on the network or creates its own wifi network.
I saw there is a reset option for your firmware by holding down a switch for 60 secs. As the switches on the 4ch pro r2 are not directly connected to the ESP this does not seem to work. Any suggestions about which pins I should pull down to earth for n seconds to trigger the reset? Which gpios are associated with the switch mention in your firmware reset guide?

Many thanks


(Rob Wilson) #1833


Hi All there was actually no problem with the buttons and the wireless control. The problem was simply that the board did not have enough power via the serial interface to actuate the relays. Duhh.

All working great now with smartthings and Alexa.


Many, many thanks Eric.


wireless problem and reset Solved:

I used the python tool to erase the flash and start again.

I’m on a mac so the com port is unix style -p /dev/cu.usbserial-00000000 -b 115200 erase_flash

would be -p COM3 -b 115200 erase_flash

on windows.

Works great and reflashed perfectly.


(Ben) #1834

I just got two of the sonoff Ifans02 and got them programmed and working. here the steps that worked for me
download SonoffIFan02.ino.generic.bin
add four pins to +3v3 rxd txd and gnd. Connect to the programmer. txd to rx, rxd to tx, 3v3 to 3.3, gnd to gnd.

the GND will need to be shorted to TP16-GPIO0. The way I did that was to split the wire that connected to the gnd pin on the sonoff to the programmer.

I setup nodeMCU like this. load the SonoffIFan02.ino.generic.bin into the first box on the config tab.

I touched the extra pin connected to ground to the GPIO0 spot, plugged in the programmer to the computer. removed the TP16 connector. Pressed flash on NodeMCU. Touched the GPIO0 spot again for a few seconds until nodeMCU starts showing progress on the flashing, then release the GPIO connection.

(initially on the first ifan i had soldered a connection to GPIO, but due to poor soldering skills I messed up the connection. Using a multimeter I located another spot to probe for the GPIO connection. here is a picture of the spot in case you mess up the first one like me. It is the side of the component that the arrow is pointing to.)

Add the device handler in the smartthings api. You can also use github integration to add it from erocm123 sonoff-ifan02-wifi-controller.groovy

Wire up the fan controller and give it power. It will boot up and broadcast the default sonoff network name. Connect to that wireless network. Enter the password configme then connect the device to wifi in the settings.

Perform a search in the sonoff connect app. add the new device. It will register as a normal sonoff outlet, not as a fan.

In the smartthings API, select the new sonoff device, and edit it. Next to type, change it to sonoff ifan02 wifi controller and save.


Nice work documenting your experience. There is an iFan02 thread that you might want to cross post this to.

(Ben) #1836

The Ifan02 has a remote with a button that triggers a relay to control the lights on the fan. I tried setting up some rules to run in webcore when that is triggered. The problem is that smartthings doesn’t reliably update the status of the lights when it is changed with the remote. On the device’s internal web server on the status page (http://[ipaddress]/status) it does instantly update when the relay changes.
Is this a limitation of smartthings or is it possible that the firmware or handlers can be changed to make this reliably update in smartthings?

(Eric M) #1837

It should update. Hit the “configure” button for the device in SmartThings a couple times. This should fill in the SmartThings ip address & port number in the config page for the device (http://ipaddress/advanced).

You will probably want to make sure your Smartthings hub has a static IP or DHCP reservation from your router.

(Uk Ak47) #1838

Hi all,

I’m quite new to this and have attempted to search through this post (and others) to figure it out, but I’ve come up blank.
I’ve managed to flash one of the new “Sonoff RF R2 Power V1.0” boards, and get it all setup and working in smarthings. I’ve also set the external switch type to rocker. However with this board having no accessible GPIO14, I’m wondering what ports I can use that a rocker switch will work with! Are there alternatives that work with this firmware?
If so, I’ve seen some posts elsewhere suggesting using IO02 or IO03? Will either work? If not there a method with this firmware/a version of it to replace GP1O14 with GPIO03 so I can connect my rocker to this?

Thanks in advance!

(Uk Ak47) #1839

I think it’s a fairly simple mod actually? I assume all I need to do is compile and flash a version of erocm123/SmartThingsPublic/master/devicetypes/erocm123/sonoff-wifi-switch.src/Sonoff.ino with a 14 changed to a 3 in line 209 and maybe 246/247, however I don’t know what I need to compile this!

(Eric M) #1840

There are actually several lines you would need to change. You would need to change the GPIO pin like you mentioned, but you would also need to enable the extra pin capability in the POW firmware by changing several of the lines that say something like:

#if defined SONOFF || defined SONOFF_TH || defined SHELLY


#if defined SONOFF || defined SONOFF_TH || defined SHELLY || defined SONOFF_POW

If you use the regular Sonoff board or the Sonoff TH then GPIO14 is already setup to be used with an external switch.

(Uk Ak47) #1841

Hi Eric,
Thanks for your help. I think the main problem I’m having is a lack of a GPIO14 on the new generation of sonof basic of boards (unless I’m mistaken) so I’m forced to use GPIO3. (it looks like the pics on this post

I’ve tried to compile the code from github changing the 14’s to 3 but I think I’m doing something more fundamental wrong as the sonoff won’t even start up with these flashed on (I’ve never compiled in Arduino so I’m not sure if I setup the board right in that menu. I’m also not sure if I have to then compile and flash through NODEMCU or IDE or what…

Thanks for any further help!

(Antonello Migliorelli) #1842

Hi i flash my shelly 1 with the firmware in your page compiled for Shelly (i think)
Here is the link to the bin:
After wifi connected i set Module to Shelly 1 and Template to Shelly 1 and then i install smartthings DH and SmartAPP.
I use SmartApp to manualy add the device but on smartthing app (or smartthing classic app) the shelly don’t do nothing and always say ON state.
In web page of my shelly the toggle works good!
Where is the error???
Thanks so much!

(Eric M) #1843

I just added Shelly support for the discovery procedure in Sonoff (Connect). Try removing it, update the app, and do a discovery again.

(Steven Cull) #1844

Question about the 4ch pro r2. After flashing, can it still work with 433mhz signals? If so, could it work with 433mhz Reed sensors, or does it only work with the key fob?

(Jeppepupu) #1845

I have been struggling with ecrom123 firmware installation to Shelly1 v3. Capable to update Tasmota to Shelly and ecrom123 to Sonoff devices. Tried to compile ecrom123 firmware from source code and using existing bin with ESPeasy and ESP8266Flasher softwares.

After ecrom installation WLAN hotspot is not visible.

Are there any hints what could be wrong?

(Eric M) #1846

I believe it works. The RF remote uses its own MCU that controls the esp8266.

@Jeppepupu make sure you are flashing in dout mode. I use esptool to flash which works very well. --port COM8 write_flash -fs 1MB -fm dout 0x0 Sonoff.ino.generic.bin

You can also backup the original Shelly firmware with: --port COM8 flash_id
to get the flash size

and then --port COM8 read_flash 0x00000 0x100000 Shelly_1M.bin
for 1M --port COM8 read_flash 0x00000 0x200000 Shelly_2M.bin



I am using a sonoff Th16 to monitor my pool temperature after my fibaro door and window sensor quit working. I liked that the fibaro sensor when in my favorites on the smartthings app would show the temp right on the main page. The sonoff device handler shows the on/off option instead of the temp. Does anybody know how I would go into the code to change the postion of the temp show it would show first instead of the on/off option? I’m using the recommended device handler for the sonoff. Any help would be greatly appreciated.

1 Like
(Eric M) #1848

You just change the main tile to temperature. So:

details([“switch”, “temperature”, “humidity”,
“ip”, “uptime”])


details([“switch”, “temperature”, “humidity”,
“ip”, “uptime”])

Might have to force close and restart the app.

1 Like