feat: Add ESP32 WiFi Unified OTA update support by skgsergio · Pull Request #898 · meshtastic/python
Conversation
Added ESP32 WiFi Unified OTA update support.
Did not include BLE support as I didn't manage to connect to a device via BLE. I have a draft (AI-generated, because I know little about BLE and its libraries) for BLE, but I'm not going to commit something I can't review and test properly.
Related to #895
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Implements ESP32 WiFi Unified OTA support in the Python CLI and library so ESP32 nodes can be updated over WiFi/TCP without the Android app.
Changes:
- Added
ESP32WiFiOTAhelper inmeshtastic/ota.pyto compute firmware hashes and drive the Unified OTA TCP protocol. - Extended
Nodewith astartOTA()admin helper to request OTA mode using the newOTAEventfields. - Wired a new
--ota-updateCLI option inmeshtastic.__main__that triggers WiFi OTA for ESP32 nodes (firmware ≥ 2.7.18) over a TCP connection.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| meshtastic/ota.py | Introduces the ESP32WiFiOTA class that connects to the node’s OTA TCP server, sends size/hash metadata, and streams firmware with basic progress reporting and status handling. |
| meshtastic/node.py | Adds startOTA() on Node to populate AdminMessage.OTAEvent (reboot_ota_mode, ota_hash) and updates the rebootOTA docstring to clarify firmware version applicability. |
| meshtastic/main.py | Imports meshtastic.ota/admin_pb2, adds the --ota-update admin CLI flag, and invokes startOTA() plus the ESP32WiFiOTA flow when running over a TCP interface. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report
❌ Patch coverage is 98.21429% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.83%. Comparing base (cdf893e) to head (5721859).
⚠️ Report is 34 commits behind head on master.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| meshtastic/__main__.py | 91.66% | 2 Missing ⚠️ |
Additional details and impacted files
@@ Coverage Diff @@ ## master #898 +/- ## ========================================== + Coverage 59.82% 60.83% +1.00% ========================================== Files 24 25 +1 Lines 4329 4440 +111 ========================================== + Hits 2590 2701 +111 Misses 1739 1739
| Flag | Coverage Δ | |
|---|---|---|
| unittests | 60.83% <98.21%> (+1.00%) |
⬆️ |
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.
🚀 New features to boost your workflow:
- ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
I think this seems good and I'll get it merged. Noting here but doesn't need to be your work if you don't want to, but we might add an optional argument to --reboot-ota that lets users manually reboot into an appropriate mode, to enable the BLE side of things without needing to actually implement the BLE uploading etc. But I haven't dug that hard into how it all works, either, so I'm not sure the best UI there.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters