Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
6170156
Add repair to migrate away from multiprotocol/Multi-PAN
agners Apr 17, 2026
19aecf2
Detect multi-PAN via addon state, not just firmware field
agners Apr 17, 2026
523f5da
Rename repairs.py to repair_helpers.py to avoid platform discovery
agners Apr 17, 2026
dc4f4ad
Replace flasher addon with direct firmware flashing
agners Apr 17, 2026
26df3f1
Add repairs dependency to homeassistant_hardware manifest
agners Apr 17, 2026
9d96626
Update tests for direct firmware flashing flow
agners Apr 17, 2026
110ba33
Merge branch 'dev' into create-repair-to-remove-multiprotocol
agners Apr 28, 2026
2f1730e
Fix repair flow to render uninstall form on first invocation
agners Apr 28, 2026
352e898
Update Multi-PAN repair flow translations to match new flow
agners Apr 28, 2026
0a14e93
Fix `fw_install_failed` abort placeholders for Multi-PAN flow
agners Apr 28, 2026
b2ca7f4
Handle Supervisor errors when checking Multi-PAN add-on usage
agners Apr 28, 2026
e709189
Add Multi-PAN progress translations to options flow
agners Apr 28, 2026
9eddc58
Apply suggestions from code review
agners Apr 28, 2026
98be235
Lock the device while flashing Zigbee firmware in Multi-PAN repair flow
agners Apr 28, 2026
ab52d02
Initialize Multi-PAN repair flows via the explicit options-flow base
agners Apr 28, 2026
e1b2de2
Mock the firmware flashing context in Multi-PAN options-flow tests
agners Apr 29, 2026
fd04989
Catch specific firmware-flash errors in Multi-PAN repair flow
agners Apr 29, 2026
90e8ed0
Use direct key access for the Multi-PAN repair issue data payload
agners Apr 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Home Assistant Hardware",
"after_dependencies": ["hassio"],
"codeowners": ["@home-assistant/core"],
"dependencies": ["usb"],
"dependencies": ["repairs", "usb"],
"documentation": "https://www.home-assistant.io/integrations/homeassistant_hardware",
"integration_type": "system",
"requirements": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
"""Repairs for the Home Assistant Hardware integration."""

from __future__ import annotations

from homeassistant.components.repairs import RepairsFlow
from homeassistant.config_entries import ConfigEntry, ConfigFlowResult
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import issue_registry as ir

ISSUE_MULTI_PAN_MIGRATION = "multi_pan_migration"


@callback
def _multi_pan_issue_id(config_entry: ConfigEntry) -> str:
"""Return the issue id for the multi-PAN migration issue of an entry."""
return f"{ISSUE_MULTI_PAN_MIGRATION}_{config_entry.entry_id}"


@callback
def async_create_multi_pan_migration_issue(
hass: HomeAssistant,
domain: str,
config_entry: ConfigEntry,
) -> None:
"""Create a repair issue to guide migration away from Multi-PAN."""
ir.async_create_issue(
hass,
domain=domain,
issue_id=_multi_pan_issue_id(config_entry),
is_fixable=True,
is_persistent=False,
severity=ir.IssueSeverity.WARNING,
translation_key=ISSUE_MULTI_PAN_MIGRATION,
translation_placeholders={"hardware_name": config_entry.title},
data={"entry_id": config_entry.entry_id},
)


@callback
def async_delete_multi_pan_migration_issue(
hass: HomeAssistant,
domain: str,
config_entry: ConfigEntry,
) -> None:
"""Delete the multi-PAN migration repair issue for this entry."""
ir.async_delete_issue(hass, domain, _multi_pan_issue_id(config_entry))


class MultiPanMigrationRepairFlow(RepairsFlow):
"""Reuse the multi-PAN options flow uninstall steps as a repair flow.

Subclass this together with the hardware-specific
``MultiPanOptionsFlowHandler`` in each hardware integration's repairs
module.

The repair flow runs in the repairs flow manager where ``self.handler``
is the integration domain rather than the hardware config entry id, so
the ``config_entry`` accessor of ``OptionsFlow`` must be overridden.
"""

_repair_config_entry: ConfigEntry

@property
def config_entry(self) -> ConfigEntry:
"""Return the hardware config entry to migrate."""
return self._repair_config_entry

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]
Comment on lines +68 to +74
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.
Loading