This week I received a new device… Sonoff S20 Smart Switch.

After the basic test using the iOS App (EWeLink) knowed by me in other time, I started to find some information about the possibility of hack this device and connect it to my OpenHAB, and I found this interesting post in OpenHab Comuunity site:


First of all I disassemble the switch finding the connector on the board, and they were here indeed. Some minutes after, the S20 board had a four pin connector soldered!


So, it was time for search for a custom firmware, and Googling I found a project that absolutely amazed me:

An absolutely perfect and complete development that can do a lot of actions in our Sonoff switches by means of different short presses of the button! Really amazing!

There’s no time to loose… come on!

  • Preparation of Arduino IDE:
    • Download and unzip the NeoPixelBus library into directory portable\sketchbook\libraries and rename to NeoPixelBus.
    • Download and unzip the pubsubclient MQTT library into directory portable\sketchbook\libraries and rename to pubsubclient. Update default value in file pubsubclient\src\PubSubClient.h
      • Change MQTT_MAX_PACKET_SIZE from 128 to at least 400
  • Change default configuration in user_config.h (not necessary, but…)
  • Bring the Sonoff device in flash Mode:
    • Disconnect serial programmer and power)
    • Connect GPIO0 and GND (e.g. Press the button)
    • Connect serial programmer
    • Release GPIO0 (after one-two seconds)
  • Compile and Upload the firmware


In only 5 minutes my S20 device was hacked, modified and assemble… time to test it!

There are some options that you can do pressing the button, and all of them are described in the wiki’s page:, but the option that I really loved was the 3-short-presses…

It entered in “config mode”, and after search the IP Address that my router assigned to this device, I putted it on my Firefox and I freaked out!

This is the config webpage of my Sonoff S20:

You can modify ALL the configuration, connect to an OpenHAB, configure MQTT protocol, and many more options!

Definitively this Sonoff-Tasmota firmware was a great discovery!

Enjoy it!