Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 14 additions & 1 deletion homeassistant/components/zwave_js/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,23 @@ async def async_step_usb(self, discovery_info: UsbServiceInfo) -> ConfigFlowResu

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:
Expand Down
4 changes: 4 additions & 0 deletions homeassistant/components/zwave_js/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
10 changes: 10 additions & 0 deletions tests/components/zwave_js/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,11 @@ async def mock_restore_nvm(data: bytes, options: dict[str, bool] | None = None):

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"

Expand Down Expand Up @@ -1049,6 +1054,11 @@ async def mock_restore_nvm(data: bytes, options: dict[str, bool] | None = None):

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"

Expand Down
Loading