Skip to content

fix: support OTA updates for devices with multiple image types#31529

Open
AlexisPolegato wants to merge 5 commits intoKoenkk:devfrom
AlexisPolegato:master
Open

fix: support OTA updates for devices with multiple image types#31529
AlexisPolegato wants to merge 5 commits intoKoenkk:devfrom
AlexisPolegato:master

Conversation

@AlexisPolegato
Copy link
Copy Markdown

Problem

Some Zigbee devices embed multiple MCUs, each with its own firmware and imageType. Z2M is unable to handle them
correctly because #inProgress and #lastChecked were keyed by ieeeAddr alone — the second imageType was either blocked
or silently ignored for 24h after the first update.

Open issues : #29293 #30022

Solution

  • Composite key ${ieeeAddr}_${imageType} for #inProgress and #lastChecked, so each imageType is tracked independently.
  • Reset #lastChecked after a successful update, so sibling MCUs are rechecked on their next queryNextImageRequest
    without waiting 24h.
  • Conditional re-interview — only triggered if no other update is in progress for the same device.
  • Pending request cache — if a manual update targets the wrong MCU first (toVersion === undefined), Z2M retries using
    a cached queryNextImageRequest recorded during the last auto-check.

Use composite key ieeeAddr+imageType for #inProgress and #lastChecked
to allow concurrent OTA updates for devices with multiple MCUs.
Also reset #lastChecked after a successful update so sibling MCUs
are rechecked on their next queryNextImageRequest.
@Nerivec
Copy link
Copy Markdown
Collaborator

Nerivec commented Mar 27, 2026

Quick first glance:

  • shouldn't use mixed keys in same map, it's confusing, prone to errors, and is defeated in logic anyway in both "has request" and "pending request" cases. The "has request" should use a separate Set (O(1) * 2), and "pending request" would appear to be far more efficient using just address instead of requiring startsWith
  • shouldn't spread maps/sets, defeats the perf gains

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