Add Z-Wave USB migration confirm step (#149243)

This commit is contained in:
Martin Hjelmare 2025-07-22 16:09:11 +02:00 committed by GitHub
parent 3947569132
commit 828a47db06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 28 additions and 1 deletions

View File

@ -494,10 +494,23 @@ class ZWaveJSConfigFlow(ConfigFlow, domain=DOMAIN):
self._usb_discovery = True
if current_config_entries:
return await self.async_step_intent_migrate()
return await self.async_step_confirm_usb_migration()
return await self.async_step_installation_type()
async def async_step_confirm_usb_migration(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Confirm USB migration."""
if user_input is not None:
return await self.async_step_intent_migrate()
return self.async_show_form(
step_id="confirm_usb_migration",
description_placeholders={
"usb_title": self.context["title_placeholders"][CONF_NAME],
},
)
async def async_step_manual(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:

View File

@ -108,6 +108,10 @@
"start_addon": {
"title": "Configuring add-on"
},
"confirm_usb_migration": {
"description": "You are about to migrate your Z-Wave network from the old adapter to the new adapter {usb_title}. This will take a backup of the network from the old adapter and restore the network to the new adapter.\n\nPress Submit to continue with the migration.",
"title": "Migrate to a new adapter"
},
"zeroconf_confirm": {
"description": "Do you want to add the Z-Wave Server with home ID {home_id} found at {url} to Home Assistant?",
"title": "Discovered Z-Wave Server"

View File

@ -932,6 +932,11 @@ async def test_usb_discovery_migration(
assert mock_usb_serial_by_id.call_count == 2
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "confirm_usb_migration"
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
assert result["type"] is FlowResultType.SHOW_PROGRESS
assert result["step_id"] == "backup_nvm"
@ -1049,6 +1054,11 @@ async def test_usb_discovery_migration_restore_driver_ready_timeout(
assert mock_usb_serial_by_id.call_count == 2
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "confirm_usb_migration"
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
assert result["type"] is FlowResultType.SHOW_PROGRESS
assert result["step_id"] == "backup_nvm"