uOTA - OTA updater for MicroPython

Related tags

Hardwareuota
Overview

uOTA - OTA updater for MicroPython

Overview

Update your device firmware written in MicroPython over the air. Suitable for private and/or larger projects with many files.

Requires MicroPython 1.17 or newer.

How it's different from other OTA Updaters

Other OTA updaters, notably rdehuyss/micropython-ota-updater, smysnk/micropython-ota-updater and RangerDigital/senko, update code from a particular branch on GitHub. This OTA is different in the following aspects:

  • update from any HTTP(S) server with no hardcoded endpoints, allowing you to keep control of your hosting without dependencies
  • no need for GitHub account
  • no need to make your code public or pay for private repos
  • replaces files in-place without storing uncompressed new firmware in flash
  • replaces files in the root of the filesystem
  • downloads new firmware as a single compressed .tar.gz file which is more efficient for a larger number of files
  • compares SHA256 hash of the new firmware file but not of individual files (optional)
  • checks if there is sufficient available free space in the file system (optional)
  • compares firmware version: the content of version file from MicroPython device file system and the version published on your server stored in latest file, see details below

Usage

Drop the following files into the root of your project:

  1. uota.py
  2. uota.cfg
    • must be a valid Python dictionary with the following keys:
      • url
        • base HTTP or HTTPS URL where to look for new firmware
        • ends with a trailing slash
      • tmp_filename
        • the new firmware will be stored in a file of this name
        • this file is deleted automatically after
      • excluded_files
        • files or directories with matching names will be skipped and not overwritten with new versions. Keep local device configuration such as wifi credentials or certificates from being overwritten.
      • delete
        • items are file/directory names as strings, these will be deleted after new firmware is installed
        • this configuration option is loaded after the new firmware is installed to perform any cleanup that may be needed
  3. version
    • the current version of the firmware
    • version check can be disabled by passing version_check=False argument to uota.check_for_updates()

Publish new firmware on your HTTP(S) server as two files:

  • firmware file of any name
    • a TAR file compressed with gzip, the content will be downloaded and unpacked directly into the root of the filesystem of your MicroPython device
    • can be created with tar -czf firmware.tar.gz * shell command on any Linux/UNIX/MacOS system
  • latest
    • a text file with the following fields separated by a semicolon:
      • version
      • new firmware filename available on the server
      • required amount of additional free space in flash, measured in kB (optional)
      • SHA256 hash of the new firmware file (optional, but makes the previous item mandatory)
    • valid examples:
      • 2.0.1;firmware.tar.gz
      • 2.0.1;firmware.tar.gz;2
      • 2.0.1;firmware.tar.gz;0;8870f8b3bd8b54437f0a7f721cd3f3fe208e60638dcf36a9f4efe31dab58c548
    • invalid examples:
      • firmware.tar.gz
      • 2.0.1;firmware.tar.gz;8870f8b3bd8b54437f0a7f721cd3f3fe208e60638dcf36a9f4efe31dab58c548

And then use uota in your project as follows. You must connect to wifi yourself as uota expects a working wifi connection to function.

import uota
import machine
...
from connect_wifi import connect_wifi
connect_wifi()
...
if do_ota_update and uota.check_for_updates():
      uota.install_new_firmware()
      machine.reset()

SSL security considerations

MicroPython's built-in SSL package does not support checking server certificate or authenticating the client with the server using certificates. uOTA can perform certificate pinning by checking the hash of server-side private key, if ucertpin is installed.

Certificate pinning

Certificate pinning is disabled by default. To enable it make ucertpin available for import and pass pubkey_hash=b'---your-SHA256-hash-value---' argument to uota.check_for_updates:

>>> import uota
>>> uota.check_for_updates()     # no certificate pinning
new version 0.3 is available
True
>>> uota.check_for_updates(pubkey_hash=b'abc')    # certificate pinning with incorrect hash
Certificate pinning failed, the hash of server public key does not match. Aborting the update.
False
Owner
Martin Komon
Martin Komon
Inykcal is a software written in python for selected E-Paper displays.

Inykcal is a software written in python for selected E-Paper displays. It converts these displays into useful information dashboards. It's open-source, free for personal use, fully modular and user-f

Ace 727 Jan 02, 2023
Technical Answers to Real-World Problems. Evolution of Watering Manually to Watering Automatically.

Automatic Watering System using Soil Moisture Sensor and RTC Timer with Arduino Technical Answers to Real-World Problems Know the plant, Grow the plan

NelakurthiSudheer 3 Jan 03, 2022
♟️ QR Code display for P4wnP1 (SSH, VNC, any text / URL)

♟️ Display QR Codes on P4wnP1 (p4wnsolo-qr) 🟢 QR Code display for P4wnP1 w/OLED (SSH, VNC, P4wnP1 WebGUI, any text / URL / exfiltrated data) Note: Th

PawnSolo 4 Dec 19, 2022
Custom component for Home Assistant that integrates Candy/Haier Wi-Fi washing machines (also known as Simply-Fi).

Candy Home Assistant component Custom component for Home Assistant that integrates Candy/Haier Wi-Fi washing machines (also known as Simply-Fi). This

Olivér Falvai 61 Dec 29, 2022
Philippe 1 Jan 09, 2022
A Fast, Easy, and User Friendly way to control Robotics Actuators.

T-Motor Controller A Fast, Easy, and User Friendly way to control Robotics Actuators. View Demo · Report Bug · Request Feature Table of Contents About

26 Aug 23, 2022
AERO 421: Spacecraft Attitude, Dynamics, and Control Final Project.

AERO - 421 Final Project Redevelopment Spacecraft Attitude, Dynamics, and Control: Simulation to determine and control a satellite's attitude in LEO.

Gagandeep Thapar 3 Dec 16, 2022
Scripts for measuring and displaying thermal behavior on Voron 3D printers

Thermal Profiling Measuring gantry deflection and frame expansion This script runs a series of defined homing and probing routines designed to charact

Jon Sanders 30 Nov 27, 2022
Create a low powered, renewable generation forecast display with a Raspberry Pi Zero & Inky wHAT.

GB Renewable Forecast Display This Raspberry Pi powered eInk display aims to give you a quick way to time your home energy usage to help balance the g

Andy Brace 32 Jul 02, 2022
Software framework to enable agile robotic assembly applications.

ConnTact Software framework to enable agile robotic assembly applications. (Connect + Tactile) Overview Installation Development of framework was done

Southwest Research Institute Robotics 29 Dec 01, 2022
Monitor an EnvisaLink alarm module running Honeywell firmware, and set a Nest device to Home/Away depending on whether the alarm is Disarmed/Away.

Nestalarm Monitor an EnvisaLink alarm module running Honeywell firmware, and set a Nest device to Home/Away depending on whether the alarm is Disarmed

1 Dec 30, 2021
Real-time Coastal Monitoring at the University of Hawaii at Manoa

Coastal Monitoring at the University of Manoa Source code for Beaglebone/RPi-based data loggers, shore internet gateways, and web server. Software dev

Stanley Lio 7 Dec 07, 2021
🎃 Some spooky code samples to hack yourself a pumpkin 👻

🎃 Tech Or Treat 👻 It's spooky season for those who celebrate Halloween, and to get in the spirit (spirit - get it? 👻 ) we thought it would be fun t

Jim Bennett 5 Feb 07, 2022
Lenovo Legion 5 Pro 2021 Linux RGB Keyboard Light Controller

Lenovo Legion 5 Pro 2021 Linux RGB Keyboard Light Controller This util allows to drive RGB keyboard light on Lenovo Legion 5 Pro 2021 Laptop Requireme

36 Dec 16, 2022
Transform a Raspberry Pi into a network diagnostic machine.

EtherView Last updated jan 30, 2022. Welcome to the EtherView project! This is a project to transform a RaspberryPi into a portable network diagnostic

1 Jan 30, 2022
Aqara Camera G3 integration for Home Assistant

Aqara Camera G3 integration for Home Assistant ATTENTION: The component only works after enabled telnet. Only supportd stream. Not support still image

14 Dec 18, 2022
DIY split-flap display

The goal is to make a low-cost display that's easy to fabricate at home in small/single quantities (e.g. custom materials can be ordered from Ponoko or similar, and other hardware is generally availa

Scott Bezek 2.5k Jan 05, 2023
🐱 Petkit feeder components for HomeAssistant

Petkit for HomeAssistant Installing Download and copy custom_components/xiaomi_miot folder to custom_components folder in your HomeAssistant config fo

62 Dec 29, 2022
Estimation of whether or not the persons given information will have diabetes.

Diabetes Business Problem : It is desired to develop a machine learning model that can predict whether people have diabetes when their characteristics

Barış TOKATLIOĞLU 0 Jan 20, 2022
Home Assistant custom integration to fetch data from Powerpal

Powerpal custom component for Home Assistant Component to integrate with powerpal. This repository and integration is not affiliated with Powerpal. Th

Lawrence 32 Jan 07, 2023