Install Tasmota on a Sonoff Mini

The Sonoff Mini firmware can be performed over the air (OTA).

Tasmota project offer a well detailed guide on how to flash the device
https://github.com/arendst/Tasmota/wiki/Sonoff-DIY#flash-procedure

First open the case and install the jumper in the package to enable the DIY mode.

Create the wifi hotspost

Create an hotpost with SSID sonoffDiy and WPA2 password 20170618sn.

On ubuntu you can add a new wifi connection and select hotspot instead of client

ubuntu wifi hotspot

Connect back the power to the device (taking care of not being electrocuted) and await for it to be connected. Use arp to see connected devices.

Setup a local web server

It will serve the firmware. An example made with docker follows

Create a Caddyfile with content

1
2
3
0.0.0.0:80
browse /
root /data

in the same directory put the tasmota-wifiman.bin

wget http://thehackbox.org/tasmota/tasmota-wifiman.bin

then launch the web server

1
2
3
4
5
6
7
docker run -d \
--rm --name caddy_sonoff \
-v $(pwd)/Caddyfile:/etc/Caddyfile \
-e ACME_AGREE=false \
-p 80:80 \
-v $(pwd):/data \
abiosoft/caddy

Get the web server ip

1
WEBSERVER_IP=...

Manual Flash instructions (Linux)

I used the manual flash procedure.

Note Set the GLOBAL_VARS to copy paste the command

Retrieve the device ID and IP (in bold)

avahi-browse -t _ewelink._tcp --resolve

1
2
3
4
+ wlp2s0 IPv4 eWeLink_1010a02ed5                            _ewelink._tcp        local
...
address = [10.42.0.160]
...
1
2
DEVICE_ID=...
DEVICE_IP=...

Get the shasum of the firmware

shasum -a 256 tasmota-wifiman.bin

1
SHASUM=...

Retrieve device info

curl http://$DEVICE_IP:8081/zeroconf/info -XPOST --data '{"deviceid":"$DEVICE_ID","data":{} }'

Enable OTA updates

curl http://$DEVICE_IP:8081/zeroconf/ota_unlock -XPOST --data '{"deviceid":"$DEVICE_ID","data":{} }'

Flash the firmware

curl http://$DEVICE_IP:8081/zeroconf/ota_flash -XPOST --data '{"deviceid":"$DEVICE_ID,"data":{"downloadUrl": "http://$WEBSERVER_IP/tasmota-wifiman.bin", "sha256sum": "$SHASUM"} }'

The process takes 30 seconds

Setup the device

Connect to a wifi network named tasmota-* and browse http://192.168.4.1. Setup your AP and enjoy!

Configure the template for Sonoff MINI

config

image source