Skip to content

[nrf52,ota] allow to update OTA via cmd#12344

Open
tomaszduda23 wants to merge 29 commits intoesphome:devfrom
tomaszduda23:ota_cmd
Open

[nrf52,ota] allow to update OTA via cmd#12344
tomaszduda23 wants to merge 29 commits intoesphome:devfrom
tomaszduda23:ota_cmd

Conversation

@tomaszduda23
Copy link
Contributor

@tomaszduda23 tomaszduda23 commented Dec 7, 2025

What does this implement/fix?

It can be used in following way.

esphome upload h.yaml
esphome upload h.yaml --device /dev/ttyACM0
esphome upload h.yaml --device 00:11:22:33:44:55
esphome upload h.yaml --device BLE

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Developer breaking change (an API change that could break external components)
  • Code quality improvements to existing code or addition of tests
  • Other

Related issue or feature (if applicable):

  • fixes

Pull request in esphome-docs with documentation (if applicable):

Test Environment

  • ESP32
  • ESP32 IDF
  • ESP8266
  • RP2040
  • BK72xx
  • RTL87xx
  • nRF52840

Example entry for config.yaml:

# Example config.yaml

Checklist:

  • The code change is tested and works locally.
  • Tests have been added to verify that the new code works (under tests/ folder).

If user exposed functionality or configuration variables are added/changed:

@github-actions
Copy link
Contributor

github-actions bot commented Dec 7, 2025

To use the changes from this PR as an external component, add the following to your ESPHome configuration YAML file:

external_components:
  - source: github://pr#12344
    components: [nrf52]
    refresh: 1h

(Added by the PR bot)

@codecov-commenter
Copy link

codecov-commenter commented Dec 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.26%. Comparing base (1912dcf) to head (4da600c).
⚠️ Report is 8 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #12344      +/-   ##
==========================================
- Coverage   74.28%   74.26%   -0.03%     
==========================================
  Files          55       55              
  Lines       11597    11597              
  Branches     1583     1583              
==========================================
- Hits         8615     8612       -3     
- Misses       2578     2580       +2     
- Partials      404      405       +1     

☔ 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.

@tomaszduda23 tomaszduda23 marked this pull request as draft January 11, 2026 20:30
@tomaszduda23 tomaszduda23 marked this pull request as ready for review January 22, 2026 15:05
@github-actions
Copy link
Contributor

github-actions bot commented Jan 22, 2026

Memory Impact Analysis

Components: nrf52
Platform: nrf52-adafruit

Metric Target Branch This PR Change
RAM 18,281 bytes 18,281 bytes ➡️ +0 bytes (0.00%)
Flash 78,592 bytes 78,592 bytes ➡️ +0 bytes (0.00%)

Note: This analysis measures static RAM and Flash usage only (compile-time allocation).
Dynamic memory (heap) cannot be measured automatically.
⚠️ You must test this PR on a real device to measure free heap and ensure no runtime memory issues.

This analysis runs automatically when components change. Memory usage is measured from a representative test configuration.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for uploading nRF52 (Zephyr/MCUBoot) firmware updates via esphome upload ... --device ... using mcumgr/SMP over BLE (by name or MAC) or serial, integrating it into the existing nRF52 upload flow.

Changes:

  • Add an nRF52 OTA uploader (smpclient-based) supporting BLE scan-by-name and direct BLE MAC / serial device targeting.
  • Route nRF52 uploads to the new mcumgr path when BOOTLOADER_MCUBOOT is used, and allow explicit --device BLE / --device <MAC> selection.
  • Update Python dependencies to include smpclient and adjust the pinned bleak version.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 8 comments.

File Description
requirements.txt Adds smpclient and changes the pinned bleak version.
esphome/components/nrf52/ota.py New mcumgr/SMP upload implementation (BLE + serial).
esphome/components/nrf52/init.py Hooks the new uploader into the nRF52 upload_program path and tweaks BLE logger scan usage.

@tomaszduda23
Copy link
Contributor Author

tomaszduda23 commented Feb 8, 2026

retested
also with https://github.com/boogie/mcumgr-web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants