Itead have expanded their Sonoff range a lot since I wrote about the original Sonoff module over a year ago. That module has been in use since then and has been rock solid although I did switch from the ESPEasy firmware to Theo Arends’ Sonoff specific firmware, now called TASMOTA which has seen a lot of development.

Back in December I also got a couple of these (then newly launched) Sonoff S20 plug in sockets which are basically just a Sonoff refactored to fit inside a nice plug in housing and are of course using the ESP8266, the price is good at £9.90/$12.86 plus a bit of shipping.

Max current rating is 10A and max power 2000W. Unlike other Sonoff devices these are not CE marked.

As is usual for Itead there is an unpopulated header for the power and serial connections and the onboard button is connected to GPIO0 which makes replacing the firmware trivial.

Opening the case is easy, just one screw on the back and then the case unclips. The pads for the programming header are conveniently labelled so just solder a header on, connect up to your 3.3v USB Serial adapter and flash the firmware. I use PlatformIO and TASMOTA works brilliantly with this thanks to a preconfigured platformio.ini file, just clone the repository from Github and then I preset my Wi-Fi credentials in user_config.h and flash away. Don’t forget to press and hold the onboard button while powering on to get into programming mode. After flashing, restart it and just connect to its web interface and set the correct module type, MQTT settings and so on.

As always – make sure the mains is NOT connected when flashing the initial firmware in this way, upgrades can be done over the air so this step should only ever need to be done once.

Header fitted for programming

There you go, you now have a Wi-Fi mains socket that can be controlled via MQTT or even HTTP GET if you must. 🙂

Assuming you have set the topic for it in the web interface to “sonoff” then you can turn it on my sending an MQTT message with a payload of “on” or “1” to the topic “cmnd/sonoff/power” and turn it off with a payload of “off” or “0”. Likewise, a payload of “toggle” will, unsurprisingly toggle the output. The device will publish the status to stat/sonoff/POWER. See the Wiki here for more MQTT features.

These units seem pretty well made and designed to me although I did run into a snag with one of them where one of the mains input wires had a bad dry joint to the PCB and was making intermittent contact, annoying but easily fixed with a quick application of the soldering iron.