Skip to content

Add OTA firmware update support for NRF52840 and ESP32 platforms#14

Draft
Copilot wants to merge 6 commits intootafrom
copilot/add-ota-dfu-support-nrf52840
Draft

Add OTA firmware update support for NRF52840 and ESP32 platforms#14
Copilot wants to merge 6 commits intootafrom
copilot/add-ota-dfu-support-nrf52840

Conversation

Copy link

Copilot AI commented Feb 12, 2026

Implements BLE OTA firmware updates triggered from Home Assistant, supporting both NRF52840 (Nordic DFU) and ESP32 (direct BLE OTA) platforms per OpenDisplay_Firmware#1.

NRF52840: Nordic DFU via bootloader

  • ble/nrf_dfu.py — Full Nordic Secure DFU protocol implementation (service 0xFE59): SELECT/CREATE/CRC/EXECUTE opcodes, 4096-byte data objects, init packet validation
  • Downloads NRF52840.zip (the only asset containing both the .dat init packet and .bin firmware required by the bootloader — .hex/.uf2 lack the init packet)
  • Sends cmd 0x0044 → device resets into Adafruit DFU bootloader → scans by service UUID → connects and flashes

ESP32: BLE OTA via application firmware

  • ble/esp32_ota.py — Three-command protocol mirroring the direct-write pattern:
    • 0x0046 OTA Start (4-byte LE size) → 0x0047 OTA Data (200-byte chunks, ACK per chunk) → 0x0048 OTA End → reboot
  • Downloads application-only .bin (excludes _full.bin merged images)

Platform-aware update entity

  • update.pyasync_install() reads system.ic_type from TLV config to dispatch:
    • ic_type=1 (NRF52840) → _install_nrf52840() → Nordic DFU
    • ic_type=2,3,4 (ESP32-S3/C3/C6) → _install_esp32() → BLE OTA
  • _get_firmware_download_url() resolves correct GitHub release asset per IC type
  • UpdateEntityFeature.INSTALL | PROGRESS with percentage callback

Other

  • protocol_open_display.pyCMD_OTA_START/CMD_OTA_DATA/CMD_OTA_END constants, enter_dfu_mode() method
  • ble/__init__.py — Exports perform_esp32_ota, perform_dfu_update, parse_dfu_package
  • strings.json — DFU and ESP32 OTA error strings, updated preview feature description
# IC type → asset mapping
_IC_TYPE_ASSET_PREFIXES = {
    IC_TYPE_NRF52840: "NRF52840",    # → NRF52840.zip (DFU package with init packet)
    IC_TYPE_ESP32_S3: "esp32-s3-",   # → esp32-s3-*.bin (app-only, not _full.bin)
    IC_TYPE_ESP32_C3: "esp32-c3-",
    IC_TYPE_ESP32_C6: "esp32-c6-",
}

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 12, 2026 07:39
Co-authored-by: Misiu <1741838+Misiu@users.noreply.github.com>
Co-authored-by: Misiu <1741838+Misiu@users.noreply.github.com>
Copilot AI changed the title [WIP] Add OTA DFU support for NRF52840 in Home Assistant Integration Add OTA DFU firmware update support for NRF52840 devices Feb 12, 2026
Copilot AI requested a review from Misiu February 12, 2026 07:43
Copilot AI and others added 2 commits February 12, 2026 07:58
Co-authored-by: Misiu <1741838+Misiu@users.noreply.github.com>
…tract constant

Co-authored-by: Misiu <1741838+Misiu@users.noreply.github.com>
Copilot AI changed the title Add OTA DFU firmware update support for NRF52840 devices Add ESP32 BLE OTA support alongside NRF52840 Nordic DFU Feb 12, 2026
Co-authored-by: Misiu <1741838+Misiu@users.noreply.github.com>
Copilot AI changed the title Add ESP32 BLE OTA support alongside NRF52840 Nordic DFU Add OTA firmware update support for NRF52840 and ESP32 platforms Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants