Skip to content

Sonoff DIY

Some new Sonoff devices support the new Itead DIY architecture which allows OTA firmware upload. With Sonoff DIY, a user has more control over the hardware features of the device and also allows for upgrading the firmware without additional hardware. The following procedure upgrades Sonoff eWelink firmware to Tasmota.

There are many reports this procedure has changed with newer versions of Sonoff DIY

Tasmota does not provide any kind of support for flashing using this method. Please contact Sonoff Support for help.

IMPORTANT: There are some reports suggesting that the Windows version of Sonoff DIY Tool contains a trojan. It is not clear if it actually contains the malicious code or these are just false positives due to the way Python code was converted to native executables. Nevertheless, proceed with care.

Compatible devices~

Currently the following devices officially support Sonoff DIY: - Sonoff Basic R3 - Sonoff RF R3 - Sonoff Mini

As Sonoff DIY is enabled by connecting GPIO16 to GND it may well be possible that other Sonoff devices running eWelink will support it.

Note

The OTA process Sonoff provides through the Sonoff DIY procedure does not create a backup of the Itead firmware on the device. If you use this OTA method to flash Tasmota on the Sonoff device, you will not be able to revert to the original factory firmware. ⚠

Flash procedure~

Guide originally from @Brunas

  1. Pair the device with the eWeLink app and update firmware. The wifi network you connect to during this step will need to be reachable in order to enter DIY mode.
  2. Follow instructions how to enter DIY mode from Sonoff. This is the excerpt from it:

    1. Long press the button for 5 seconds to enter pairing mode, then press another 5 seconds to ender Compatible Pairing Mode (AP). The LED indicator should blink continuously.
    2. From mobile phone or PC WiFi setting, an Access Point of the device named ITEAD-XXXXXXXX will be found, connect it with default password 12345678
    3. Open the browser and access http://10.10.7.1/
    4. Next, Fill in WiFi SSID and password. Once successfully connected, the device is in DIY mode.

Note: I needed to manually change IP address to 10.10.7.2, 255.0.0.0 with gateway 10.10.7.1 in adapter TCP/IPv4 settings to access that IP address.

  1. Use Fing or any similar local network scanning app on your smartphone or PC to find IP address of your Sonoff Mini device. MAC Vendor most likely is Espressif and the device has 8081 port open.
  2. Check that diy mode is working properly.

With curl:

curl -XPOST --header "Content-Type: application/json" --data-raw '{"deviceid": "", "data": {}}' http://$SONOFF_IP:8081/zeroconf/info
Or with the Rester browser extension: Install **Rester** extension in Chrome or Firefox or any other preferred tool to perform REST API operations. To test your device DIY mode create new request in **Rester**: 1. Method: **POST** 2. URL: http://<*IP of your device*>:8081/zeroconf/info 3. Body: `{"data": {}}` 4. You might need to add Header **Content-Type** with value **application/json** 5. Press **SEND**

If all is OK, status code 200 should be returned with bunch of data:

{
    "seq": 1,
    "error": 0,
    "data": {
        "switch": "off",
        "startup": "off",
        "pulse": "off",
        "pulseWidth": 2000,
        "ssid": "YourWiFi",
        "otaUnlock": false,
        "fwVersion": "3.6.0",
        "deviceid": "YourDeviceId",
        "bssid": "YourBSSId",
        "signalStrength": -52
    }
}
If that doesn't return 200, try going back to 5s+5s reset above. 4. If all above works, let's unlock OTA:

With curl:

curl -XPOST --header "Content-Type: application/json" --data-raw '{"deviceid": "", "data": {}}' http://$SONOFF_IP:8081/zeroconf/ota_unlock
Or with the Rester browser extension: 1. Method: **POST** 2. URL: http://<*IP of your device*>:8081/zeroconf/ota_unlock 3. Body: `{"data": {}}` 4. You might need to add Header **Content-Type** with value **application/json** 5. Press **SEND** 6. You should get status code *200*

Optionally for curiousity you could retry info query to check if otaUnlock value now is true 5. Download the appropriate binary from http://ota.tasmota.com/tasmota/release and flash it. NOTE: The maximum firmware size is 508kb, which precludes the standard release binary.

There are a number of reported issues with the stock firmware's OTA behavior, so it may be easier to use an existing server that works around these issues. For example:

curl -XPOST --data "{\"deviceid\":\"\",\"data\":{\"downloadUrl\": \"http://sonoff-ota.aelius.com/tasmota-latest-lite.bin\", \"sha256sum\": \"$HASH\"} }" http://$SONOFF_IP:8081/zeroconf/ota_flash

You're now ready to configure tasmota.

Video tutorials~

More info:~

Back to top