mirror of
https://github.com/home-assistant/core.git
synced 2026-08-28 02:24:46 -05:00
Rename "advanced" setup/migration strategy ids to "manual" in ZHA
This commit is contained in:
@@ -70,13 +70,13 @@ DECONZ_DOMAIN = "deconz"
|
||||
# For the fast path, we automatically migrate everything
|
||||
# and restore the most recent backup
|
||||
MIGRATION_STRATEGY_RECOMMENDED = "migration_strategy_recommended"
|
||||
MIGRATION_STRATEGY_ADVANCED = "migration_strategy_advanced"
|
||||
MIGRATION_STRATEGY_MANUAL = "migration_strategy_manual"
|
||||
|
||||
# Similarly, setup follows the same approach: we create a new network
|
||||
SETUP_STRATEGY_RECOMMENDED = "setup_strategy_recommended"
|
||||
SETUP_STRATEGY_ADVANCED = "setup_strategy_advanced"
|
||||
SETUP_STRATEGY_MANUAL = "setup_strategy_manual"
|
||||
|
||||
# For the advanced paths, we allow users to pick how to form a network: form a brand new
|
||||
# For the manual paths, we allow users to pick how to form a network: form a brand new
|
||||
# network, use the settings currently on the stick, restore from a database backup, or
|
||||
# restore from a JSON backup
|
||||
FORMATION_STRATEGY = "formation_strategy"
|
||||
@@ -340,8 +340,8 @@ class BaseZhaFlow(ConfigEntryBaseFlow):
|
||||
# Fast path: automatically form a new network
|
||||
return await self.async_step_setup_strategy_recommended()
|
||||
if self._flow_strategy == ZigbeeFlowStrategy.ADVANCED:
|
||||
# Advanced path: let the user choose
|
||||
return await self.async_step_setup_strategy_advanced()
|
||||
# Manual path: let the user choose
|
||||
return await self.async_step_setup_strategy_manual()
|
||||
|
||||
# Allow onboarding for new users to just create a new network automatically
|
||||
if (
|
||||
@@ -355,7 +355,7 @@ class BaseZhaFlow(ConfigEntryBaseFlow):
|
||||
step_id="choose_setup_strategy",
|
||||
menu_options=[
|
||||
SETUP_STRATEGY_RECOMMENDED,
|
||||
SETUP_STRATEGY_ADVANCED,
|
||||
SETUP_STRATEGY_MANUAL,
|
||||
],
|
||||
)
|
||||
|
||||
@@ -365,10 +365,10 @@ class BaseZhaFlow(ConfigEntryBaseFlow):
|
||||
"""Recommended setup strategy: form a brand-new network."""
|
||||
return await self.async_step_form_new_network()
|
||||
|
||||
async def async_step_setup_strategy_advanced(
|
||||
async def async_step_setup_strategy_manual(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
"""Advanced setup strategy: let the user choose."""
|
||||
"""Manual setup strategy: let the user choose."""
|
||||
return await self.async_step_choose_formation_strategy()
|
||||
|
||||
async def async_step_choose_migration_strategy(
|
||||
@@ -379,13 +379,13 @@ class BaseZhaFlow(ConfigEntryBaseFlow):
|
||||
# Fast path: automatically migrate everything
|
||||
return await self.async_step_migration_strategy_recommended()
|
||||
if self._flow_strategy == ZigbeeFlowStrategy.ADVANCED:
|
||||
# Advanced path: let the user choose
|
||||
return await self.async_step_migration_strategy_advanced()
|
||||
# Manual path: let the user choose
|
||||
return await self.async_step_migration_strategy_manual()
|
||||
return self.async_show_menu(
|
||||
step_id="choose_migration_strategy",
|
||||
menu_options=[
|
||||
MIGRATION_STRATEGY_RECOMMENDED,
|
||||
MIGRATION_STRATEGY_ADVANCED,
|
||||
MIGRATION_STRATEGY_MANUAL,
|
||||
],
|
||||
)
|
||||
|
||||
@@ -512,10 +512,10 @@ class BaseZhaFlow(ConfigEntryBaseFlow):
|
||||
description_placeholders={"device_path": self._radio_mgr.device_path},
|
||||
)
|
||||
|
||||
async def async_step_migration_strategy_advanced(
|
||||
async def async_step_migration_strategy_manual(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
"""Advanced migration strategy: let the user choose."""
|
||||
"""Manual migration strategy: let the user choose."""
|
||||
return await self.async_step_choose_formation_strategy()
|
||||
|
||||
async def async_step_choose_formation_strategy(
|
||||
|
||||
@@ -51,11 +51,11 @@
|
||||
"choose_migration_strategy": {
|
||||
"description": "Choose how you want to migrate your Zigbee network backup from your old adapter to a new one.",
|
||||
"menu_option_descriptions": {
|
||||
"migration_strategy_advanced": "This will let you restore a specific network backup or upload your own.",
|
||||
"migration_strategy_manual": "This will let you restore a specific network backup or upload your own.",
|
||||
"migration_strategy_recommended": "This is the quickest option to migrate to a new adapter."
|
||||
},
|
||||
"menu_options": {
|
||||
"migration_strategy_advanced": "Migrate manually",
|
||||
"migration_strategy_manual": "Migrate manually",
|
||||
"migration_strategy_recommended": "Migrate automatically (recommended)"
|
||||
},
|
||||
"title": "Migrate to a new adapter"
|
||||
@@ -70,11 +70,11 @@
|
||||
"choose_setup_strategy": {
|
||||
"description": "Choose how you want to set up Zigbee. Automatic setup is recommended unless you are restoring your network from a backup or setting up an adapter with nonstandard settings.",
|
||||
"menu_option_descriptions": {
|
||||
"setup_strategy_advanced": "This will let you restore from a backup.",
|
||||
"setup_strategy_manual": "This will let you restore from a backup.",
|
||||
"setup_strategy_recommended": "This is the quickest option to create a new network and get started."
|
||||
},
|
||||
"menu_options": {
|
||||
"setup_strategy_advanced": "Set up manually",
|
||||
"setup_strategy_manual": "Set up manually",
|
||||
"setup_strategy_recommended": "Set up automatically (recommended)"
|
||||
},
|
||||
"title": "Set up Zigbee"
|
||||
@@ -2260,11 +2260,11 @@
|
||||
"choose_migration_strategy": {
|
||||
"description": "[%key:component::zha::config::step::choose_migration_strategy::description%]",
|
||||
"menu_option_descriptions": {
|
||||
"migration_strategy_advanced": "[%key:component::zha::config::step::choose_migration_strategy::menu_option_descriptions::migration_strategy_advanced%]",
|
||||
"migration_strategy_manual": "[%key:component::zha::config::step::choose_migration_strategy::menu_option_descriptions::migration_strategy_manual%]",
|
||||
"migration_strategy_recommended": "[%key:component::zha::config::step::choose_migration_strategy::menu_option_descriptions::migration_strategy_recommended%]"
|
||||
},
|
||||
"menu_options": {
|
||||
"migration_strategy_advanced": "[%key:component::zha::config::step::choose_migration_strategy::menu_options::migration_strategy_advanced%]",
|
||||
"migration_strategy_manual": "[%key:component::zha::config::step::choose_migration_strategy::menu_options::migration_strategy_manual%]",
|
||||
"migration_strategy_recommended": "[%key:component::zha::config::step::choose_migration_strategy::menu_options::migration_strategy_recommended%]"
|
||||
},
|
||||
"title": "[%key:component::zha::config::step::choose_migration_strategy::title%]"
|
||||
|
||||
@@ -772,7 +772,7 @@ async def test_multiple_zha_entries_aborts(hass: HomeAssistant, mock_app) -> Non
|
||||
|
||||
result_recommended = await hass.config_entries.flow.async_configure(
|
||||
result_confirm["flow_id"],
|
||||
user_input={"next_step_id": config_flow.MIGRATION_STRATEGY_ADVANCED},
|
||||
user_input={"next_step_id": config_flow.MIGRATION_STRATEGY_MANUAL},
|
||||
)
|
||||
|
||||
result_reuse = await hass.config_entries.flow.async_configure(
|
||||
@@ -1669,7 +1669,7 @@ def advanced_pick_radio(hass: HomeAssistant) -> Generator[RadioPicker]:
|
||||
|
||||
advanced_strategy_result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
user_input={"next_step_id": config_flow.SETUP_STRATEGY_ADVANCED},
|
||||
user_input={"next_step_id": config_flow.SETUP_STRATEGY_MANUAL},
|
||||
)
|
||||
|
||||
assert advanced_strategy_result["type"] is FlowResultType.MENU
|
||||
@@ -2372,7 +2372,7 @@ async def test_options_flow_defaults(
|
||||
|
||||
result6 = await hass.config_entries.options.async_configure(
|
||||
result5["flow_id"],
|
||||
user_input={"next_step_id": config_flow.MIGRATION_STRATEGY_ADVANCED},
|
||||
user_input={"next_step_id": config_flow.MIGRATION_STRATEGY_MANUAL},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@@ -3018,7 +3018,7 @@ async def test_migrate_setup_options_with_ignored_discovery(
|
||||
assert confirm_result["step_id"] == "choose_setup_strategy"
|
||||
assert confirm_result["menu_options"] == [
|
||||
"setup_strategy_recommended",
|
||||
"setup_strategy_advanced",
|
||||
"setup_strategy_manual",
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user