mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 07:37:34 +00:00
Add Z-Wave USB migration confirm step (#149243)
This commit is contained in:
parent
3947569132
commit
828a47db06
@ -494,10 +494,23 @@ class ZWaveJSConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
self._usb_discovery = True
|
self._usb_discovery = True
|
||||||
if current_config_entries:
|
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()
|
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(
|
async def async_step_manual(
|
||||||
self, user_input: dict[str, Any] | None = None
|
self, user_input: dict[str, Any] | None = None
|
||||||
) -> ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
|
@ -108,6 +108,10 @@
|
|||||||
"start_addon": {
|
"start_addon": {
|
||||||
"title": "Configuring add-on"
|
"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": {
|
"zeroconf_confirm": {
|
||||||
"description": "Do you want to add the Z-Wave Server with home ID {home_id} found at {url} to Home Assistant?",
|
"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"
|
"title": "Discovered Z-Wave Server"
|
||||||
|
@ -932,6 +932,11 @@ async def test_usb_discovery_migration(
|
|||||||
|
|
||||||
assert mock_usb_serial_by_id.call_count == 2
|
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["type"] is FlowResultType.SHOW_PROGRESS
|
||||||
assert result["step_id"] == "backup_nvm"
|
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 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["type"] is FlowResultType.SHOW_PROGRESS
|
||||||
assert result["step_id"] == "backup_nvm"
|
assert result["step_id"] == "backup_nvm"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user