Welcome to our Knowledge Base

Flash Sonoff Mini with Tasmota OTA

You are here:
< Back

Preinstall Setup

  1. Verify and/or update eWelink firmware version
  2. If quick pairing doesn’t work, use alternative pairing method
  3. Prerequisite Tools Installation
  4. Enter DIY Mode
  5. Enter Unlock OTA mode

Prerequisite Steps

  • Install Rester extension in Chrome or Firefox or any other preferred tool to perform REST API operations.
  • Setup Local Firmware File Server

1. Enter DIY mode

Guide originally from @Brunas

  1. Power on;
  2. Long press the button for 5 seconds for entering Compatible Pairing Mode (AP) User tips: If the device has been paired with eWeLink APP, reset the device is necessary by long press the pairing button for 5 seconds, then press another 5 seconds for entering Compatible Pairing Mode (AP)
  3. The LED indicator will blink continuously;
  4. 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
  5. Open the browser and access http://10.10.7.1/
  6. Next, Fill in WiFi SSID and password that the device would have connected with
  7. Succeed, Now the device is in DIY mode.

Note: Follow instructions how to enter DIY mode from Sonoff.

It may be necessary to 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.

2. Unlock OTA Mode

  1. Find IP address of your Sonoff Mini device. MAC Vendor most likely is Espressif, name “ESP_XXXXXX”, and the device has 8081 port open.
  2. Install Rester extension in Chrome or Firefox or any other preferred tool to perform REST API operations.
  3. To test your device DIY mode create new request in Rester:Method: POST
  4. URL: http://<IP of your device>:8081/zeroconf/info
  5. Body: {"data": {}}
  6. You might need to add Header Content-Type with value application/json
  7. Press SEND
  8. If all is OK, status code 200 should be returned with bunch of data:
{
    "seq": 4,
    "error": 0,
    "data": {
        "switch": "off",
        "startup": "off",
        "pulse": "off",
        "pulseWidth": 500,
        "ssid": "Parsons_IoT",
        "otaUnlock": false,
        "fwVersion": "3.6.0",
        "deviceid": "1000a4e9d5",
        "bssid": "e0:63:da:3d:22:31",
        "signalStrength": -53
    }
}

Enter unlock OTA Mode:

  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
  7. Optionally for curiosity you could retry info query to check if otaUnlock value now is true

Setup Local Firmware File Server

  • Install file browser

Note: Not sure if pointing the firmware URL directly to Github raw binary (and therefore skipping this step) would work.

I used Docker-based Nginx server to quickly serve the file the right way (look at the end of the article for details on why I chose Nginx server).

docker run -p 8002:80 \
    -v ~/Downloads/sonoff-mini-flash/:/opt/www/files/ \
    config backup/Device Firmware/Tasmota/Tasmota bins
  • download latest tasmota firmware at http://ota.tasmota.com/tasmota/
  • Get sha256sum value https://emn178.github.io/online-tools/sha256_checksum.html
  • check http://localhost:8000 if the firmware file is available.

Flash Initial Firmware

Send POST request to http://{{sonoffURL}}/zeroconf/ota_flash with payload

{
  "deviceid": "",
  "data": {
    "downloadUrl": "http://FILE_SERVER_IP/files/tasmota-lite.bin",
    "sha256sum": "FIRMWARE_SHA256_HASH"
  }
}

EXAMPLE
{
    "deviceid": "",
    "data": {
        "downloadUrl": "http://192.168.1.10:8002/files/tasmota-lite.bin",
        "sha256sum": "fdc4dfdd8fd870cb25df32c89264aec119767cab47aeb2fff45616fd5e7ff6ad"
    }
}

where:

  • FILE_SERVER_IP is IP address of your computer (i.e. the server where you have tasmota-lite.bin served from)
  • FIRMWARE_SHA256_HASH is SHA-256 hash of the tasmota-lite.bin file

When you execute this API call, you should get success response immediately.

You can now observe log from Docker Nginx server and see how Sonoff Mini is fetching firmware chunks.

Post Installation Setup

Configuration Details

Once the desired firmware is on the device, continue the regular Tasmota setup process.

  • Connect to the sonoff itead network
  • Enter WIFI SSID and Password
  • Connect to sonoff IP and configure with Tasmota WEB UI

Sonoff Mini Relay

Sonoff Mini
GPIO #Component
GPIO00Button1
GPIO01None
GPIO02None
GPIO03None
GPIO04Switch1
GPIO05None
GPIO09None
GPIO10None
GPIO12Relay1
GPIO13Led1i
GPIO14None
GPIO15None
GPIO16User
FLAGNone
{"NAME":"Sonoff Mini","GPIO":[17,0,0,0,9,0,0,0,21,56,0,0,255],"FLAG":0,"BASE":1}

References

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Table of Contents