Python HTTP OTA Server - RTurala/Sonoff-Tasmota GitHub Wiki

Introduction

Sonoff-Tasmota firmware can be ugraded using 'Firmware Upgrade' option on main menu and selecting an OTA URL to fetch (and flash) a new firmware on the device.

To use this nice feature users need to deploy an HTTP server with Apache, Nginx or other software solutions switching to superuser privileges and installing additional packages (and libraries) on his own Linux/Windows box.

Python makes available Flask (micro)framework (http://flask.pocoo.org) that can be used at different levels of complexity due to its modular architecture. A simple HTTP server (hello-world) can be developed only by six lines of Python code (http://flask.pocoo.org/docs/1.0/quickstart/#a-minimal-application).

A Flask application to offer Sonoff-Tasmota firmware images for OTA upgrades is available in 'tools' directory (https://github.com/arendst/Sonoff-Tasmota/blob/development/tools/fw-server.py).

Requirements

  • Python3 (follow instruction related to your operating system)
  • netifaces and Flask libraries - can be installed by 'pip' package manager:
pip install netifaces flask

Instructions:

Copy Sonoff-Tasmota firmware binary files in 'tools/fw' directory. A set of prebuilt files can be downloaded by Sonoff-Tasmota release page:

Configure your Sonoff-Tasmota device with your fw-server URL:

Firmware Upgrade -> Upgrade by web server:
     http://<ip_address>:5000/sonoff-minimal.bin

or use the following commands:

otaurl http://<ip_address>:5000/sonoff-minimal.bin
upgrade 1

Usage:

To start Python HTTP server:

python fw-server.py -d <net_iface>   (default: eth0)
  or
python fw-server.py -i <ip_address>

Example:

python fw-server.py -d wlan0
  or
python fw-server.py -i 192.168.1.1

Note

On Windows operating system it is advisable to use '-i' option because Windows uses UUID name for network interfaces that are not so easy to type...

⚠️ **GitHub.com Fallback** ⚠️