How 0adill3/mqtt_ota works
MQTT_OTA enables an ESP32 to receive and validate firmware updates over an existing MQTT connection. The workflow runs from a Python publisher’s firmware preparation and staged MQTT messages, through device-side begin/chunk/end handling, to flash validation, version persistence, and restart. The README documents the example’s loop and callback delegation; the sampled example source was not available, so those links reflect documented usage only.
Main entry points: MQTT_OTA_firmware_publisher.py Python publisher · MQTT_OTA.cpp OTA coordinator · Basic_MQTT_OTA.ino Device application
Components 18
Firmware Publisher
- Python publisher
tools/MQTT_OTA_firmware_publisher.py - MD5 preparation
tools/MQTT_OTA_firmware_publisher.py - Begin metadata
tools/MQTT_OTA_firmware_publisher.py - Chunk transfer
tools/MQTT_OTA_firmware_publisher.py - End signal
tools/MQTT_OTA_firmware_publisher.py
ESP32 OTA
- Device application
examples/Basic_MQTT_OTA/Basic_MQTT_OTA.ino - OTA coordinator
src/MQTT_OTA.cpp - Auto-subscribe
src/MQTT_OTA.cpp - Metadata checks
src/MQTT_OTA.cpp - Firmware write
src/MQTT_OTA.cpp - MD5 finalize
src/MQTT_OTA.cpp
Runtime Integrations
- PubSubClient
- ESP32 Update
- Version preferences
- ESP32 restart
Other components
- Firmware operator
- Firmware binary
- MQTT broker
Connections 25
- Firmware operator → Python publisher: starts upload
- Firmware binary → Python publisher: reads file
- Python publisher → MD5 preparation: calculates hash
- Python publisher → Begin metadata: builds metadata
- Python publisher → Chunk transfer: reads chunks
- Python publisher → End signal: signals completion
- Begin metadata → MQTT broker: publishes begin
- Chunk transfer → MQTT broker: publishes chunks
- End signal → MQTT broker: publishes end
- MQTT broker → PubSubClient: delivers messages
- PubSubClient → Device application: invokes callback
- Device application → OTA coordinator: delegates callback
- Device application → Auto-subscribe: calls handle
- Auto-subscribe → PubSubClient: subscribes
- OTA coordinator → Metadata checks: processes begin
- Metadata checks → ESP32 Update: sets MD5 and begins
- OTA coordinator → Firmware write: processes chunks
- Firmware write → ESP32 Update: writes payload
- OTA coordinator → MD5 finalize: processes end
- MD5 finalize → ESP32 Update: validates update
- MD5 finalize → Version preferences: stores version
- MD5 finalize → ESP32 restart: restarts on success
- OTA coordinator → PubSubClient: publishes status
- PubSubClient → MQTT broker: sends status
- MQTT broker → Python publisher: delivers status