1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Fix ZBT-2 Thread to Zigbee migration discovery failing (#155735)

This commit is contained in:
TheJulianJES
2025-11-03 21:02:13 +01:00
committed by GitHub
parent ce38a93177
commit 98f6001c9c
2 changed files with 50 additions and 1 deletions

View File

@@ -75,6 +75,7 @@ class ZBT2FirmwareMixin(ConfigEntryBaseFlow, FirmwareInstallFlowProtocol):
context: ConfigFlowContext
BOOTLOADER_RESET_METHODS = [ResetTarget.RTS_DTR]
ZIGBEE_BAUDRATE = 460800
async def async_step_install_zigbee_firmware(
self, user_input: dict[str, Any] | None = None
@@ -112,7 +113,6 @@ class HomeAssistantConnectZBT2ConfigFlow(
VERSION = 1
MINOR_VERSION = 1
ZIGBEE_BAUDRATE = 460800
def __init__(self, *args: Any, **kwargs: Any) -> None:
"""Initialize the config flow."""

View File

@@ -128,6 +128,26 @@ async def test_config_flow_zigbee(
assert zha_flow["context"]["source"] == "hardware"
assert zha_flow["step_id"] == "confirm"
progress_zha_flows = hass.config_entries.flow._async_progress_by_handler(
handler="zha",
match_context=None,
)
assert len(progress_zha_flows) == 1
# Ensure correct baudrate
progress_zha_flow = progress_zha_flows[0]
assert progress_zha_flow.init_data == {
"flow_strategy": "recommended",
"name": model,
"port": {
"path": usb_data.device,
"baudrate": 460800,
"flow_control": "hardware",
},
"radio_type": fw_type.value,
}
@pytest.mark.usefixtures("addon_installed", "supervisor")
async def test_config_flow_thread(
@@ -335,6 +355,35 @@ async def test_options_flow(
assert flash_mock.call_count == 1
assert flash_mock.mock_calls[0].kwargs["bootloader_reset_methods"] == ["rts_dtr"]
flows = hass.config_entries.flow.async_progress()
# Ensure a ZHA discovery flow has been created
assert len(flows) == 1
zha_flow = flows[0]
assert zha_flow["handler"] == "zha"
assert zha_flow["context"]["source"] == "hardware"
assert zha_flow["step_id"] == "confirm"
progress_zha_flows = hass.config_entries.flow._async_progress_by_handler(
handler="zha",
match_context=None,
)
assert len(progress_zha_flows) == 1
# Ensure correct baudrate
progress_zha_flow = progress_zha_flows[0]
assert progress_zha_flow.init_data == {
"flow_strategy": "recommended",
"name": model,
"port": {
"path": usb_data.device,
"baudrate": 460800,
"flow_control": "hardware",
},
"radio_type": "ezsp",
}
async def test_duplicate_discovery(hass: HomeAssistant) -> None:
"""Test config flow unique_id deduplication."""