mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 23:27:37 +00:00
Add retry restore step to ZWave-JS migration (#143934)
* Add retry restore step to ZWave-JS migration * improve test
This commit is contained in:
parent
4ac29c6aef
commit
a7af0eaccd
@ -1133,7 +1133,15 @@ class ZWaveJSConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
self, user_input: dict[str, Any] | None = None
|
self, user_input: dict[str, Any] | None = None
|
||||||
) -> ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Restore failed."""
|
"""Restore failed."""
|
||||||
return self.async_abort(reason="restore_failed")
|
if user_input is not None:
|
||||||
|
return await self.async_step_restore_nvm()
|
||||||
|
|
||||||
|
return self.async_show_form(
|
||||||
|
step_id="restore_failed",
|
||||||
|
description_placeholders={
|
||||||
|
"file_path": str(self.backup_filepath),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
async def async_step_migration_done(
|
async def async_step_migration_done(
|
||||||
self, user_input: dict[str, Any] | None = None
|
self, user_input: dict[str, Any] | None = None
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
"not_zwave_js_addon": "Discovered add-on is not the official Z-Wave add-on.",
|
"not_zwave_js_addon": "Discovered add-on is not the official Z-Wave add-on.",
|
||||||
"reconfigure_successful": "[%key:common::config_flow::abort::reconfigure_successful%]",
|
"reconfigure_successful": "[%key:common::config_flow::abort::reconfigure_successful%]",
|
||||||
"reset_failed": "Failed to reset controller.",
|
"reset_failed": "Failed to reset controller.",
|
||||||
"restore_failed": "Failed to restore network.",
|
|
||||||
"usb_ports_failed": "Failed to get USB devices."
|
"usb_ports_failed": "Failed to get USB devices."
|
||||||
},
|
},
|
||||||
"error": {
|
"error": {
|
||||||
@ -118,6 +117,11 @@
|
|||||||
"title": "Unplug your old controller",
|
"title": "Unplug your old controller",
|
||||||
"description": "Backup saved to \"{file_path}\"\n\nYour old controller has been reset. If the hardware is no longer needed, you can now unplug it.\n\nPlease make sure your new controller is plugged in before continuing."
|
"description": "Backup saved to \"{file_path}\"\n\nYour old controller has been reset. If the hardware is no longer needed, you can now unplug it.\n\nPlease make sure your new controller is plugged in before continuing."
|
||||||
},
|
},
|
||||||
|
"restore_failed": {
|
||||||
|
"title": "Restoring unsuccessful",
|
||||||
|
"description": "Your Z-Wave network could not be restored to the new controller. This means that your Z-Wave devices are not connected to Home Assistant.\n\nThe backup is saved to ”{file_path}”",
|
||||||
|
"submit": "Try again"
|
||||||
|
},
|
||||||
"choose_serial_port": {
|
"choose_serial_port": {
|
||||||
"data": {
|
"data": {
|
||||||
"usb_path": "[%key:common::config_flow::data::usb_path%]"
|
"usb_path": "[%key:common::config_flow::data::usb_path%]"
|
||||||
|
@ -3914,8 +3914,27 @@ async def test_reconfigure_migrate_restore_failure(
|
|||||||
|
|
||||||
result = await hass.config_entries.flow.async_configure(result["flow_id"])
|
result = await hass.config_entries.flow.async_configure(result["flow_id"])
|
||||||
|
|
||||||
assert result["type"] == FlowResultType.ABORT
|
assert result["type"] == FlowResultType.FORM
|
||||||
assert result["reason"] == "restore_failed"
|
assert result["step_id"] == "restore_failed"
|
||||||
|
assert result["description_placeholders"]["file_path"]
|
||||||
|
|
||||||
|
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||||
|
|
||||||
|
assert result["type"] == FlowResultType.SHOW_PROGRESS
|
||||||
|
assert result["step_id"] == "restore_nvm"
|
||||||
|
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
|
assert client.driver.controller.async_restore_nvm.call_count == 2
|
||||||
|
|
||||||
|
result = await hass.config_entries.flow.async_configure(result["flow_id"])
|
||||||
|
|
||||||
|
assert result["type"] == FlowResultType.FORM
|
||||||
|
assert result["step_id"] == "restore_failed"
|
||||||
|
|
||||||
|
hass.config_entries.flow.async_abort(result["flow_id"])
|
||||||
|
|
||||||
|
assert len(hass.config_entries.flow.async_progress()) == 0
|
||||||
|
|
||||||
|
|
||||||
async def test_get_driver_failure(hass: HomeAssistant, integration, client) -> None:
|
async def test_get_driver_failure(hass: HomeAssistant, integration, client) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user