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

Steveuk23 / kaiser_will - there is something going on. I have at least 10 of these devices purchased a few months ago - all worked IMMEDIATELY after flashing them. I recently purchased 4, flashed them and NONE of the 4 new ones boot up after flashing. I too tried all the methods listed (holding down, resetting etc). I can re-flash as holding down the button and restarting puts me in flash mode, but no matter how many times I reflash, I get the same results.

Something is not working, and since I KNOW this process worked previously, I am inclined to believe that something has changed with the devices.

Thanks for all your input! I wish I knew more about troubleshooting this type of stuff. All I can really do is look for other peoples recommendations, and try them out.

Bobby_Boucher, that gives me some hope that someone with more skill than me will figure this out! I was about ready to trash them.

Hope so, or looking forward to it as I’ve got a few places I could use the triple and double gangs.

That’s not good :frowning:
Did you buy them from the same place ?
If so is there any marking on the board maybe a different version

I have purchased all of mine from ITEAD directly. I’m going to compare the devices tonight.

I got mine from banggood. Someone mentioned on the ESPEasy forum that the flash memory is different, and the flash mode has to be DOUT. it’s label on mine is PN25F08B. I tried to use this command, but mine is still not booting after programming.

esptool.exe -vv -cd nodemcu -cb 115200 -cp COM3 -ca 0x00000 -bm dout -cf Sonoff.ino.generic.bin

I got it working. I don’t know exactly why or how, but I read through a lot of the ESPEasy forums and pieced together information.
Flash it using NodeMCU flasher here: https://github.com/nodemcu/nodemcu-flasher
In Config set the first box to the path of the sonoff firmware:

Then under advanced set Baudrate to 115200, Flash Size to 1MByte, Flash speed to 40MHZ and SPI Mode to DOUT.
Then press flash under operation. Wait until its complete. Then disconnect the programmer, disconnect TX/RX, plug the programmer back in with only VCC and Ground, wait for it to boot, reset the wifi by holding the button for 10+ seconds, then connect to the wifi and configure it as usual.


Bravo, Bravo. Just flashed one using your process and its booting like normal. Thank you for figuring this out, made my life a LOT easier.

Awesome! I’m glad that worked for yours. My “educated” guess now is that it will work with any that have the flash memory module labeled PN25F08B

Hmm… how do we know you aren’t just creating your own personal botnet then? Surely you understand the importance of peer review in software security. There are many other firmwares to choose from that are open source. You started with one yourself. What’s your goal here? You do spend a lot of time troubleshooting people’s basic usage problems. You seem so helpful. Why not with the source of the firmware? I don’t understand your decision. You’ve said you are done with development for these in your blog documentation. Let somebody else take it up. You even said you would release the source for the first Sonoff device in this thread but I can’t find the post anymore.

I guess I’ll be moving onto some other firmware and I would recommend that the people on this thread that have installed this firmware do the same. There is no guarantee that these things won’t at some point turn against you or somebody else. Dramatic, right? But totally possible. NTP server to fake a real-time clock to call home at some later point… get a target connection and then loop requests at it. Bam. We just aided and abetted.

This seemed like such a good starting point too.


Have to say I agree with codahq here…does seem a bit odd…I have my own firmware for esp8266 would have liked to have added the smartthings stuff to it…unless the author plans to try and monetise the firmware in the future I can’t imagine any benign reason for not sharing.


after trying and testing some Sonoff Devices I have some issues:
Sonoff 10A, flash ok, WLAN config o.k., access via Webbrowser possible, Intergration in ST success, works fine
Sonoff POW, flash ok, WLAN config o.k., access via Webbrowser possible, Intergration in ST success (need some tries, I dont know why), works fine
Sonoff TH16, flash ok, WLAN config o.k., access via Webbrowser possible, Intergration in ST NOT success, I got an error: Ther is a tempöate error
After some tries, sonoff(Connect) says: successfully intergrated, but under things thers is no TH16. At the device himself the HA Controller IP is
And now, roundabout 30min later, the TH16 is integrated!!! I do nothing. And the HA Controller IP is now correct.???

Al last
Sonoff Touch, flash ok, WLAN config doesnt work. I see for a moment the SSID, but then never. I try to flah again. No SSID from the Touch.

Any ideas what happend here?

from Germany

Hi all, and thanks to Erocm1231 and all for the fantastic work.
I have all my house lights automated for pennies thanks to this switches…
I live in Spain, and here all houses have roller shutters, I am trying to include them in the smartthings hub, but none of the standard solutions (FIBARO Roller Shutter 2) convinces me.
I was thinking how easy it would be to use a Sonoff Dual to control it.
It would only be, setting up an auto-off time for each switch (just for security, as the motors have endpoints) and a rule that will only allow one relay to be closed, let me explain:
You push down, and while the shutter is going down, you push up. Then the down relay will open and the up will close…
It might be just a matter of having a “roller shutter mode” tick box in the config menu…
What do you thing of this Erocm1231? Do you think it is easy to implement?
I would open a world of possibilities…
Sorry all to hijack the post…

Hi Eric
I bought a th16 ,try to flash with espeasy and it did not want to flash ,i got this error: stat SonoffTH.ino.generic failed, so i have flash it with nodemcu, i can now acces to a web browser and control it. When i try to add it to smartthing ,sonoff connect see it ,i hit next and got a blank page,hit done and got an error(error-bad state.Unable to complete page configuration)
Do you know what im doing wrong?
I Have try to reflash and samething


@Sylvain Thats the same state by me with the TH16.
I hope this is the solution: I upload the deviceHandler for the TH16 again. After the first upload and missed integration the devicehandler fot the TH16 was not in the list, don’t know why. After upload again the integration works.(dont forget to publish to yourself)

Hope this helps.

Botnet? Very comical, but think what you want. I have my reasons for maintaining the source, but why do I need to explain myself to you? This started out as a project for myself. I was impressed with the outcome so I decided to share it with others so they could benefit from it. I have given a lot to this community and I find it frustrating that some won’t be satisfied unless I give everything.


Thanks Mike
That was my problem ,i forgot that i have modified the dh for my th10 ,so i put back the original dh :grin:

I think the point others are trying to make is that given that so much of the ST ecosystem is open-source, and that so much of the community-developed stuff for ESP based devices is open-source, it sticks out like a sore thumb that you’re not releasing the source.

This is the first ESP8266 project I’ve seen (for Sonoff devices or otherwise) that didn’t have open source firmware. Some people will (right or wrong) assume bad faith from your choice. A little paranoia isn’t out of line given the state of IoT security. It’s certainly your prerogative to keep the source to yourself

I mean, it wouldn’t be rocket science to update your device handler to the command URL structure of the Sonoff-Tasmota firmware (which conveniently adds the ability to control the Sonoff devices with the MQTT protocol) if someone wanted to use your SmartApp/device handlers to provide the “glue” with SmartThings. /on becomes /cm?cmnd=Power%20Off, etc. The device discovery piece might be non-trivial, but that’s about the only special sauce I’m seeing at a glance.

I’m well aware of the atmosphere of the SmartThings community as far as code goes. I have dozens of device handlers and SmartApps that are available and have been here for a very long time. I suppose others in my shoes who may have commercial aspirations just keep their projects to themselves so that they don’t gain exposure in the community. Maybe that is where I went wrong. Not that I ever intend on making money on the Sonoff devices, I provide the community with a free and easy solution to integrate a cheap product into their smart home and do so gladly (minus those that are ungrateful or question my motives without any evidence). There is just a lot of overlap between these projects and others that myself and others may bring to the public in a commercial manner.