Flashing firmware on a Sonoff Mini wifi relay: a Google search reveals many results, but there is much conflicting or confusing information. Here is a description on how I managed to flash my Sonoff Mini relays with ESPHome firmware (works for Tasmota as well).

Entering DIY mode

No need to open the physical device, putting in jumper bridges or worse: soldering. Everything happens software-wise.

  1. Connect the Sonoff Mini to the mains. Attention: only do this if you’re familiar with electrical works.
  2. Power up the Sonoff Mini
  3. Long press the button for 5 seconds for entering Compatible Pairing Mode (AP) User tips: If the device has been previously 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)
  4. The blue LED indicator will blink continuously;
  5. 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
  6. Open the browser and access http://10.10.7.1/
  7. Next, Fill in WiFi SSID and password that the Sonoff Mini device should connect with.
  8. Succeed, Now the device is in DIY mode. The device restarts and connects to your WiFi network.

Finding out the device’s IP address

Now, the Sonoff Mini is connected to your Wifi network. We need to find out the device’s IP address in order to continue.

Ways of finding out the IP address:

  • I like the “Net Analyzer Pro” app on my iPhone to scan networks, ping devices, etc.
  • Access your router’s admin web interface. Many routers show a list of all connected devices with their IP address.

MAC Vendor most likely is Espressif and the device has 8081 port open.

  1. Install Rester extension in Chrome or Firefox or any other preferred tool to perform REST API operations.
  2. 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
    6. 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
    }
}
7. If that doesn't return *200*, try going back to 5s+5s reset above.
  1. Install Rester extension in Chrome or Firefox or any other preferred tool to perform REST API operations.
  2. 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
    6. 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
    }
}
7. If that doesn't return *200*, try going back to 5s+5s reset above.
  1. If all above works, let’s unlock OTA:
    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 curiousity you could retry info query to check if otaUnlock value now is true
  2. Sonoff’s flashing tool should see your device now!
  3. Download Tasmota-lite.bin from https://github.com/arendst/Tasmota/releases and flash it according to instructions everywhere on the Internet. Just the WiFi AP name is TASMOTA_XXXX and not sonoff_XXX.