[mh] Installing Tasmota firmware on Sonoff OTA devices

Jeff Siddall via misterhouse-users <[email protected]>
Newsgroups gmane.comp.misc.misterhouse.user
Message-ID <[email protected]>
Installing Tasmota on Sonoff 3.5.0+ (OTA) devices is slightly fiddly, 
but one nice thing about these "DIY" devices is that they requires no 
special apps to setup.  I installed mine using a browser on my phone and 
curl on my MH machine.  I also used apache to serve the firmware, but I 
think I could have just pointed them to the Tasmota OTA server if I wanted.

Here is the basic procedure:

Plug in/turn on the device.  When it boots, enter AP setup mode by 
holding the device button for 5+ seconds until the blue light begins to 
flash with a new pattern.  Release the button and begin holding the 
device button again for 5+ seconds until the blue light begins to flash 
approx. twice per second.  Then use a WiFi device, such as a smart 
phone, to connect to the Sonoff AP with SSID: ITEAD-xxxxxxx and 
password: 12345678

Use your WiFi device browser to visit: http://10.10.7.1/ and set the 
correct WiFi AP parameters.  The device will reboot and be reachable 
from the WiFi AP.  Use this command to confirm the device is in DIY mode:

curl -X POST |-H "Content-Type: application/json" |||-d 
'{||||||"deviceid":"", ||"data":{}}' 
http://<Sonoff_IP_address>:8081/zeroconf/info
||

If a response is received with no errors in the reply, then proceed to 
update the firmware with the setup-sonoff-mini.sh script posted below.  
Note that the device will require internet access to perform the unlock.

Below is a simple bash script to take care of most of the typing.  Be 
sure to replace http://<server_ip>/<firmware_path>/tasmota-lite.bin with 
the right URL for your firmware server.  Also update the sha256sum if 
you are not using release 9.1.0.

#!/bin/bash

# setup-sonoff.sh - Script to automate upgrading Sonoff DIY devices to 
Tasmota firmware
# Copyright (C) 2020 Jeff Siddall
# Last modified: 2020-12-14

# Exit if any of the spawned commands has failed (exits non-zero)
set -e

# Check for the right arguments
if [ $# -ne 1 ]; then
    echo "Usage: setup-sonoff-mini.sh <ip_address>"
    echo "   where <ip_address> is the IP address of the device to upgrade"
    exit 1
fi

# Print the current device info
echo "Current configuration:"
curl -X POST -H "Content-Type: application/json" -d '{"deviceid":"", 
"data":{}}' http://$1:8081/zeroconf/info
echo
echo "Enabling unlock (note: device requires internet access):"
curl -X POST -H "Content-Type: application/json" -d '{"deviceid":"", 
"data":{}}' http://$1:8081/zeroconf/ota_unlock
echo
echo "Starting firmware upgrade:"
curl -X POST -H "Content-Type: application/json" -d '{"deviceid":"", 
"data":{"downloadUrl":"http://<server_ip>/<firmware_path>/tasmota-lite.bin", 
"sha256sum":"b8a16f18a018bd6233170ce28a625508c38770d9d8ef195c7afa50f914c4ac9c"}}' 
http://$1:8081/zeroconf/ota_flash
echo
echo "The upgrade will take several minutes, after which time the device 
will reboot"

________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.