The Sonoff S26 WiFi smart plug is an upgraded version of the S20. More compact, it is especially certified CE and FCC which for me is essential for electrical safety. The S26 is easy enough to hack. In this tutorial we will install the firmware Tasmota.
Warnings. Unplug the Sonoff S26 smart plug before opening the case until the complete modification and reassembly of the case has been completed. The firmware you are going to install is delivered without any guarantee of operation by their developers. Certain features developed by the company Itead Sonoff or that require the use of the official application may no longer work (Amazon Alexa support, Google Assistant …). The original firmware is not available for download. If you want to reinstall the original firmware, you must make a backup of the original firmware before proceeding with its replacement.
Disassembling the Sonoff S26 and soldering the serial port
You just have to unscrew the 3 black screws at the back of the taken to gain access to the circuit.
The official documentation of Tasmato precisely describes or solder the 4 wires of the serial port necessary to flash the new firmware.
Once the new firmware is installed, you can desolder the 4 wires. Tasmota can be updated from the WEB interface (update OTA).
It is quite easy to come solder the 4 wires on the connector of the radio module located below the circuit board. The most difficult is to solder the TX cable to the radio module
I used 4 jumpers to make the connector. Here is the color and connector labeling
- Gray on the J2 (GND)
- Red on the J1 (3V3)
- Blue on the J10 (RX)
- Mauve on TX
Connecting the FTDIConnect the 4 solder jumpers on the S26 circuit board to the FTDI serial / USB converter. Remember to reverse the RX / TX pins for this to work.
To help you, here is the pin location of a conventional FTDI cable that I use for all my projects.
As well as the connection to the Sonoff S26
Download the firmware and install PlatformIO
It is possible to install Tasmota using the Arduino IDE but I advise you however to use the PlatformIO editor much more efficient for this type of hack. Follow this tutorial to install PlatformIO on Microsoft’s Visual Studio Code (VSC) Code Editor (Atom is not recommended at this time).
Then go to this Github page, download the project and unzip the ZIP.
Open the project folder directly under VSC and open the platform.io file
Uncomment the line that corresponds to the desired firmware
.env_default = sonoff
Connecting and turning on the Sonoff S26 in flash mode
Once the wiring is complete, hold down the switch on the top of the circuit. Connect the FTDI cable to the computer. Wait a few seconds and release the button. If no LED lights up, the ESP8266 of the S26 is in flash mode.
Modify the COM port in the platform.io
It remains for us to modify the COM port in the configuration file. The COM5 port is configured by default in the platform.io file and there is little change that your S26 is there. On macOS and Linux, run the command ls /dev/tty * to identify the COM port on which find the FTDI cable. It should be named like this for example
On Windows, run PowerShell and execute the command mode.
Modify the upload_port key (beyond line 150) in the platform.io file by the COM port that you just find. Save.
Modify the WiFi settings
I advises you to configure the WiFi directly in the configuration file my_user_config.h which is in the sonoff folder. You can pre-configure the connection settings to two WiFi networks (SSID1 and SSID2). I also advise you to set an IP address (WIFI_IP_ADDRESS) in order to know in advance the IP of the WEB interface on your local network. You will need it for example to make an update.
Upload Tasmota firmware
Once everything is ready, open the PlatformIO menu by clicking on the ant in the sidebar (1). Start by compiling the project (2). In the first build, PlatformIO retrieves all the libraries needed by the project.
If everything went well, you must obtain a success in front of the uncommented configuration.
If all is correct, you can now click upload (3) to upload the firmware.
By choosing the Sonoff generic environment, Tasmota does not know which module it is installed on. This is not a problem for the S26 which only has an output (relay). For other modules that have multiple outputs and sensors, it will have to be configured so that everything can work.
Open the configuration interface by entering the IP address previously indicated in any browser from your local network. Click Configuration and then Configure Module. In the list of choices, select Sonoff S2X (the configuration is the same for modules S20, S22 and S26). Save. The module restarts.
Control the Sonoff S26 in MQTT (Domoticz, Home Assistant, Homy …)
It remains only to connect the firmware to a home automation server or Homy in MQTT to control your equipment or create a scenario (presence simulator for example).
If you use Domoticz, you can directly connect the S26 without going through an intermediary MQTT broker.
Go to the Configure page and then Configure MQTT. Fill in the parameters of your MQTT broker and save. The module restarts to take into account the configuration.
If you use cloudMQTT to drive your accessories and home server, you must specify the standard port. The SSL port does not work (yet). To learn more about cloudMQTT, read this tutorial. Using cloudMQTT, you can even drive the S26 even outside your home from Homy.
- #Hack of Sonoff S26 WiFi smart plug, Tasmota firmware installation
- Hack Sonoff 4CH Pro with firmware MQTT Tasmota, inclusion in Domoticz