Skip to content

Add repair to migrate away from multiprotocol/Multi-PAN#168431

Open
agners wants to merge 18 commits intodevfrom
create-repair-to-remove-multiprotocol
Open

Add repair to migrate away from multiprotocol/Multi-PAN#168431
agners wants to merge 18 commits intodevfrom
create-repair-to-remove-multiprotocol

Conversation

@agners
Copy link
Copy Markdown
Member

@agners agners commented Apr 17, 2026

Proposed change

The Silicon Labs Multiprotocol app (add-on) has been deprecated since July 2025 (home-assistant/addons#3833) but still has ~4400 active installations. We would like to remove the app from the repository, but simply removing it would trigger a repair that just removes the app — potentially breaking the user's currently running Zigbee/Thread setup without guidance.

This PR adds a fixable repair issue for users still running the Multiprotocol app on Home Assistant Yellow and SkyConnect. The repair hooks into the existing migration flow so users can gracefully migrate back to single-protocol (Zigbee) firmware before the app is removed.

Detection works via two signals:

  • The config entry's firmware field being cpc
  • The multiprotocol app actually running and using the device (via multi_pan_addon_using_device)

Both are checked because the firmware field can be stale/incorrect — it is only guessed once during config entry migration and is never re-evaluated. A system with the multiprotocol app running could have firmware: spinel if OTBR was installed at migration time. This was the case in my test setup, and I guess it's likely that users manually installed apps as well. This secondary check shouldn't harm anyways.

The PR also replaces the use of the Silicon Labs Flasher app during migration with direct flashing via universal-silabs-flasher (the built-in flasher already used by the Yellow/SkyConnect firmware options flow). The old approach has issues on recent Home Assistant OS installations (Yellow not correctly detected) and stale app configuration (e.g. a previously set firmware_url option causing the wrong firmware to be flashed).

The architecture (multiple inheritance mixin reusing the existing options flow steps in a repair flow context) is admittedly not the cleanest, but given that all of the multiprotocol code is deprecated and will eventually be removed, the goal here is just to get a guided migration path in front of users before we pull the app. Not worth a larger refactor for code that's on its way out.

Screenshots Yellow

image image

Screenshots ZBT-1/SkyConnect

image Screenshot From 2026-04-28 15-05-13

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue: Deprecate multiprotocol addons#3833
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

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

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

agners and others added 4 commits April 17, 2026 11:49
Create a fixable repair issue when Yellow or SkyConnect is running
multiprotocol (CPC) firmware. The repair flow reuses the existing
options flow uninstall steps to revert the radio to Zigbee-only
firmware and migrate ZHA automatically.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The firmware field in the config entry can be wrong (e.g. guessed as
"spinel" instead of "cpc") since it is only set once during migration.
Check the actual multiprotocol addon state via multi_pan_addon_using_device
in addition to the firmware field to reliably detect multi-PAN usage.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The repairs platform discovery finds any module named repairs.py and
tries to register it. Since homeassistant_hardware/repairs.py only
contains shared helpers and the mixin (no async_create_fix_flow), the
discovery fails with "Invalid repairs platform". Rename to
repair_helpers.py so it is not discovered as a platform.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use universal-silabs-flasher directly instead of the flasher addon to
flash Zigbee firmware during multi-PAN migration. This eliminates the
dependency on the flasher addon and avoids issues with stale addon
config (e.g. firmware_url being set from a previous use).

The new flow: ZHA backup via multiprotocol socket, uninstall
multiprotocol addon, download Zigbee firmware from Nabu Casa releases,
flash directly via universal-silabs-flasher, restore ZHA backup.

Also moves WaitingAddonManager from silabs_multiprotocol_addon to util
to break a circular import and allow top-level imports of
async_flash_silabs_firmware and ApplicationType.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 17, 2026 14:01
@agners agners requested a review from a team as a code owner April 17, 2026 14:01
@home-assistant
Copy link
Copy Markdown
Contributor

Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration (homeassistant_yellow) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of homeassistant_yellow can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant mark-draft Mark the pull request as draft.
  • @home-assistant ready-for-review Remove the draft status from the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign homeassistant_yellow Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant update-branch Update the pull request branch with the base branch.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the pull request.

@home-assistant
Copy link
Copy Markdown
Contributor

Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration (homeassistant_sky_connect) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of homeassistant_sky_connect can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant mark-draft Mark the pull request as draft.
  • @home-assistant ready-for-review Remove the draft status from the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign homeassistant_sky_connect Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant update-branch Update the pull request branch with the base branch.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the pull request.

@home-assistant
Copy link
Copy Markdown
Contributor

Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration (homeassistant_hardware) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of homeassistant_hardware can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant mark-draft Mark the pull request as draft.
  • @home-assistant ready-for-review Remove the draft status from the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign homeassistant_hardware Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant update-branch Update the pull request branch with the base branch.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the pull request.

Copy link
Copy Markdown
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

The repair_helpers module imports RepairsFlow from the repairs
integration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Hedda
Copy link
Copy Markdown
Contributor

Hedda commented Apr 17, 2026

This PR adds a fixable repair issue for users still running the Multiprotocol app on Home Assistant Yellow and SkyConnect. The repair hooks into the existing migration flow so users can gracefully migrate back to single-protocol (Zigbee) firmware before the app is removed.

FYI, while not a likely some users are probably using the Multiprotocol app for Zigbee2MQTT instead of ZHA, so maybe add a note that this could in some circumstances potentially also break the user's Zigbee2MQTT setup if using this Multiprotocol app for it (as thus repair will not reconfigure Zigbee2MQTT configuration), and could also add that Zigbee2MQTT do not officially support Multiprotocol firmware https://www.zigbee2mqtt.io/guide/adapters/emberznet.html#emberznet-adapters-silicon-labs

Update all tests that referenced the old flasher addon steps to match
the new direct flashing flow (uninstall multiprotocol addon → flash
zigbee firmware → flashing complete).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
# Lazy import to avoid circular dependency
from .silabs_multiprotocol_addon import ( # noqa: PLC0415
get_multiprotocol_addon_manager,
)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Using async_flash_silabs_firmware from util created a circular dependency. I've moved WaitingAddonManager to util which resolved part of it, but that one remains.

But since it is multi-protocol related, which anyways will go at one point, seems acceptable to me. Getting rid of it would need further refactoring.

Copilot AI review requested due to automatic review settings April 28, 2026 12:45
Copy link
Copy Markdown
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

Copilot reviewed 19 out of 19 changed files in this pull request and generated 6 comments.

Comment thread homeassistant/components/homeassistant_hardware/silabs_multiprotocol_addon.py Outdated
Comment thread homeassistant/components/homeassistant_yellow/__init__.py
Comment thread homeassistant/components/homeassistant_sky_connect/__init__.py Outdated
Comment thread homeassistant/components/homeassistant_yellow/strings.json Outdated
Comment thread homeassistant/components/homeassistant_sky_connect/strings.json Outdated
The repair flow init data is the issue context, not user form input. Passing
it to async_step_uninstall_addon caused a KeyError: 'disable_multi_pan'.
Drop the user_input forwarding so the uninstall confirmation form is rendered
on first invocation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@agners
Copy link
Copy Markdown
Member Author

agners commented Apr 28, 2026

@puddly @TheJulianJES I've tested this with SkyConnect/ZBT-1, but with it ZHA had a hard time to even connect to the Silicon Labs Multiprotocol app (zigbeed) 🙈 I wonder if anyone is using this on a recent Core version even.

Anyhow, this PR zigpy/bellows#714 made ZHA reload work 100% reliable 🎉 . And also this migration flow.

agners and others added 3 commits April 28, 2026 17:25
The Multi-PAN repair issue flow now flashes Zigbee firmware directly
instead of starting the flasher add-on. Replace the dead
`progress.start_flasher_addon` key with `progress.install_zigbee_firmware`
(using `{hardware_name}`), and add the `abort.fw_install_failed` alias
since the flow can now abort with that reason.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The shared `firmware_picker` `fw_install_failed` translation expects
`{firmware_name}`, not `{hardware_name}`, so the placeholder was never
substituted. Pass `firmware_name="Zigbee"` to align with how the
firmware_picker flow invokes the same translation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`multi_pan_addon_using_device()` calls `async_get_addon_info()`, which
can raise `AddonError` (a `HomeAssistantError`). Both Yellow and
SkyConnect now invoke this unconditionally during `async_setup_entry`,
so a transient Supervisor failure would crash setup with an uncaught
exception. Wrap the calls and raise `ConfigEntryNotReady` instead, so
setup retries cleanly — matching the existing pattern for
`check_multi_pan_addon`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 28, 2026 15:27
The options flow base class emits `install_zigbee_firmware` and
`uninstall_multiprotocol_addon` as progress actions, but neither
Yellow nor SkyConnect defined matching `options.progress.*` keys, so a
direct options-flow run would render the dialog with unlocalized text.
Add canonical translations under `silabs_multiprotocol_hardware.options
.progress` and reference them from both `options.progress` and
`fix_flow.progress` in Yellow and SkyConnect (replacing the inline
literals previously committed for the fix flow).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
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

Copilot reviewed 19 out of 19 changed files in this pull request and generated 6 comments.

Comment thread homeassistant/components/homeassistant_sky_connect/strings.json Outdated
Comment thread homeassistant/components/homeassistant_yellow/__init__.py
Comment thread homeassistant/components/homeassistant_sky_connect/__init__.py
Comment thread homeassistant/components/homeassistant_sky_connect/repairs.py Outdated
Comment thread homeassistant/components/homeassistant_hardware/silabs_multiprotocol_addon.py Outdated
Comment thread homeassistant/components/homeassistant_yellow/strings.json Outdated
agners and others added 2 commits April 28, 2026 17:38
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
`async_flash_silabs_firmware` is documented as needing to run within a
firmware update context. Both `firmware_config_flow` and the hardware
update entity wrap their flash calls with
`async_firmware_flashing_context`, which signals to other integrations
(notably ZHA) that the hardware is in use and pauses any owners that
would otherwise reclaim the serial device mid-flash. The Multi-PAN
repair flow flashed the radio without that context, so a ZHA reload
after the multiprotocol add-on stopped could race the flash.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
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

Copilot reviewed 20 out of 20 changed files in this pull request and generated 4 comments.

Comment thread homeassistant/components/homeassistant_yellow/repairs.py Outdated
Comment thread homeassistant/components/homeassistant_sky_connect/repairs.py Outdated
Comment thread homeassistant/components/homeassistant_hardware/silabs_multiprotocol_addon.py Outdated
Comment thread homeassistant/components/homeassistant_sky_connect/strings.json
`super().__init__(...)` works here because Python's MRO walks past the
intervening `RepairsFlow` mixin (which has no `__init__`) and lands on
the options-flow base, but it's not obvious from reading the code —
Copilot already misread it as a TypeError. Calling the named
options-flow class directly makes intent explicit: the diamond's
options-flow side is the one that actually consumes `config_entry`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

There's a related test failure.

Comment thread homeassistant/components/homeassistant_hardware/silabs_multiprotocol_addon.py Outdated
Comment thread homeassistant/components/homeassistant_sky_connect/repairs.py Outdated
@home-assistant
Copy link
Copy Markdown
Contributor

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant home-assistant Bot marked this pull request as draft April 29, 2026 11:43
agners and others added 3 commits April 29, 2026 14:54
The Multi-PAN uninstall flow now wraps the Zigbee firmware flash in
`async_firmware_flashing_context`, which calls into
`homeassistant_hardware`'s firmware-update registry. The options-flow
tests don't load that integration, so the context manager raised
`KeyError('homeassistant_hardware')` and the flow ended in
`firmware_flash_failed` instead of completing. Patch the context to
no-op alongside the existing `async_flash_silabs_firmware` mock.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Previously the flow caught a bare `Exception` and logged a stack trace,
which mixes intentional flow-abort signals with unexpected programmer
errors and is noisier than other steps in this flow.

Wrap the network-side fetch (`async_update_data`, `async_fetch_firmware`,
firmware lookup) in a focused handler that converts realistic failures
(`StopIteration`, `TimeoutError`, `ClientError`, `ManifestMissing`,
`ValueError`) into `HomeAssistantError`, mirroring `firmware_config_flow`.
`async_flash_silabs_firmware` already raises `HomeAssistantError`, so
the outer handler can now catch only that and log a single line. Update
the affected tests to use the matching exception types.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`async_create_multi_pan_migration_issue` always populates the issue
data with `entry_id`, so reading it back with `dict.get` masks contract
violations rather than surfacing them. Switch to `data["entry_id"]` in
both Yellow and SkyConnect's `async_create_fix_flow`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 29, 2026 13:24
Copy link
Copy Markdown
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

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

Comment on lines +68 to +74
async def _async_step_start_migration(self) -> ConfigFlowResult:
"""Jump straight into the uninstall step of the migration flow.

The repair flow's init data is the issue context, not user form input,
so pass None to render the uninstall confirmation form.
"""
return await self.async_step_uninstall_addon() # type: ignore[attr-defined, no-any-return]
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

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

Ensure the repair flow cannot finish successfully unless the migration actually runs (otherwise the issue will be auto-deleted). Because RepairsFlowManager deletes the issue on any non-ABORT result, reusing the options-flow uninstall_addon step as-is allows the user to submit with disable_multi_pan=False and end the flow without fixing anything; consider overriding that step in the repair flow to abort/keep the issue open (or force a positive confirmation default).

Copilot uses AI. Check for mistakes.
Comment thread homeassistant/components/homeassistant_yellow/__init__.py
Comment thread homeassistant/components/homeassistant_sky_connect/__init__.py
@agners agners marked this pull request as ready for review April 29, 2026 14:33
@home-assistant home-assistant Bot requested a review from MartinHjelmare April 29, 2026 14:34
@MartinHjelmare
Copy link
Copy Markdown
Member

MartinHjelmare commented Apr 30, 2026

Nikita said he had some comments for this PR in progress, right? Or did I mishear that?

Edit: I mean, I think we should wait for those if that is the case.

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