Skip to content

Commit

Permalink
Cleanup unnecessary reconfigure_confirm from config flows (home-assis…
Browse files Browse the repository at this point in the history
  • Loading branch information
epenet authored Oct 14, 2024
1 parent 8d2cf0c commit 25aea14
Show file tree
Hide file tree
Showing 52 changed files with 86 additions and 205 deletions.
8 changes: 1 addition & 7 deletions homeassistant/components/brother/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,6 @@ async def async_step_zeroconf_confirm(

async def async_step_reconfigure(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a reconfiguration flow initialized by the user."""
return await self.async_step_reconfigure_confirm()

async def async_step_reconfigure_confirm(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a reconfiguration flow initialized by the user."""
entry = self._get_reconfigure_entry()
Expand All @@ -170,7 +164,7 @@ async def async_step_reconfigure_confirm(
)

return self.async_show_form(
step_id="reconfigure_confirm",
step_id="reconfigure",
data_schema=self.add_suggested_values_to_schema(
data_schema=RECONFIGURE_SCHEMA,
suggested_values=entry.data | (user_input or {}),
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/brother/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"type": "[%key:component::brother::config::step::user::data::type%]"
}
},
"reconfigure_confirm": {
"reconfigure": {
"description": "Update configuration for {printer_name}.",
"data": {
"host": "[%key:common::config_flow::data::host%]"
Expand Down
8 changes: 1 addition & 7 deletions homeassistant/components/bryant_evolution/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,6 @@ async def async_step_user(

async def async_step_reconfigure(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle integration reconfiguration."""
return await self.async_step_reconfigure_confirm()

async def async_step_reconfigure_confirm(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle integration reconfiguration."""
errors: dict[str, str] = {}
Expand All @@ -82,7 +76,7 @@ async def async_step_reconfigure_confirm(
)
errors["base"] = "cannot_connect"
return self.async_show_form(
step_id="reconfigure_confirm",
step_id="reconfigure",
data_schema=STEP_USER_DATA_SCHEMA,
errors=errors,
)
2 changes: 1 addition & 1 deletion homeassistant/components/bryant_evolution/strings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"config": {
"step": {
"reconfigure_confirm": {
"reconfigure": {
"data": {
"filename": "[%key:component::bryant_evolution::config::step::user::data::filename%]"
}
Expand Down
8 changes: 1 addition & 7 deletions homeassistant/components/enphase_envoy/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,6 @@ async def async_step_user(

async def async_step_reconfigure(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Add reconfigure step to allow to manually reconfigure a config entry."""
return await self.async_step_reconfigure_confirm()

async def async_step_reconfigure_confirm(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Add reconfigure step to allow to manually reconfigure a config entry."""
reconfigure_entry = self._get_reconfigure_entry()
Expand Down Expand Up @@ -285,7 +279,7 @@ async def async_step_reconfigure_confirm(

suggested_values: Mapping[str, Any] = user_input or reconfigure_entry.data
return self.async_show_form(
step_id="reconfigure_confirm",
step_id="reconfigure",
data_schema=self.add_suggested_values_to_schema(
self._async_generate_schema(), suggested_values
),
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/enphase_envoy/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"host": "The hostname or IP address of your Enphase Envoy gateway."
}
},
"reconfigure_confirm": {
"reconfigure": {
"description": "[%key:component::enphase_envoy::config::step::user::description%]",
"data": {
"host": "[%key:common::config_flow::data::host%]",
Expand Down
10 changes: 2 additions & 8 deletions homeassistant/components/feedreader/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,20 +121,14 @@ async def async_step_import(self, import_data: dict[str, Any]) -> ConfigFlowResu

async def async_step_reconfigure(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a reconfiguration flow initialized by the user."""
return await self.async_step_reconfigure_confirm()

async def async_step_reconfigure_confirm(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a reconfiguration flow initialized by the user."""
reconfigure_entry = self._get_reconfigure_entry()
if not user_input:
return self.show_user_form(
user_input={**reconfigure_entry.data},
description_placeholders={"name": reconfigure_entry.title},
step_id="reconfigure_confirm",
step_id="reconfigure",
)

feed = await async_fetch_feed(self.hass, user_input[CONF_URL])
Expand All @@ -145,7 +139,7 @@ async def async_step_reconfigure_confirm(
return self.show_user_form(
user_input=user_input,
description_placeholders={"name": reconfigure_entry.title},
step_id="reconfigure_confirm",
step_id="reconfigure",
errors={"base": "url_error"},
)

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/feedreader/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"url": "[%key:common::config_flow::data::url%]"
}
},
"reconfigure_confirm": {
"reconfigure": {
"description": "Update your configuration information for {name}.",
"data": {
"url": "[%key:common::config_flow::data::url%]"
Expand Down
8 changes: 1 addition & 7 deletions homeassistant/components/google_travel_time/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,6 @@ async def async_step_user(self, user_input=None) -> ConfigFlowResult:

async def async_step_reconfigure(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle reconfiguration."""
return await self.async_step_reconfigure_confirm()

async def async_step_reconfigure_confirm(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle reconfiguration."""
errors: dict[str, str] | None = None
Expand All @@ -253,7 +247,7 @@ async def async_step_reconfigure_confirm(
)

return self.async_show_form(
step_id="reconfigure_confirm",
step_id="reconfigure",
data_schema=self.add_suggested_values_to_schema(
RECONFIGURE_SCHEMA, self._get_reconfigure_entry().data
),
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/google_travel_time/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"destination": "Destination"
}
},
"reconfigure_confirm": {
"reconfigure": {
"description": "[%key:component::google_travel_time::config::step::user::description%]",
"data": {
"api_key": "[%key:common::config_flow::data::api_key%]",
Expand Down
10 changes: 1 addition & 9 deletions homeassistant/components/holiday/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,6 @@ async def async_step_province(

async def async_step_reconfigure(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the re-configuration of a province."""
return await self.async_step_reconfigure_confirm()

async def async_step_reconfigure_confirm(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle the re-configuration of a province."""
reconfigure_entry = self._get_reconfigure_entry()
Expand Down Expand Up @@ -160,6 +154,4 @@ async def async_step_reconfigure_confirm(
}
)

return self.async_show_form(
step_id="reconfigure_confirm", data_schema=province_schema
)
return self.async_show_form(step_id="reconfigure", data_schema=province_schema)
2 changes: 1 addition & 1 deletion homeassistant/components/holiday/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"province": "Province"
}
},
"reconfigure_confirm": {
"reconfigure": {
"data": {
"province": "[%key:component::holiday::config::step::province::data::province%]"
}
Expand Down
8 changes: 1 addition & 7 deletions homeassistant/components/homeworks/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,12 +581,6 @@ async def _validate_edit_controller(

async def async_step_reconfigure(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a reconfigure flow."""
return await self.async_step_reconfigure_confirm()

async def async_step_reconfigure_confirm(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a reconfigure flow."""
errors = {}
Expand Down Expand Up @@ -628,7 +622,7 @@ async def async_step_reconfigure_confirm(
)

return self.async_show_form(
step_id="reconfigure_confirm",
step_id="reconfigure",
data_schema=self.add_suggested_values_to_schema(
DATA_SCHEMA_EDIT_CONTROLLER, suggested_values
),
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/homeworks/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"name": "[%key:component::homeworks::config::step::user::data_description::name%]"
}
},
"reconfigure_confirm": {
"reconfigure": {
"data": {
"host": "[%key:common::config_flow::data::host%]",
"port": "[%key:common::config_flow::data::port%]",
Expand All @@ -45,8 +45,8 @@
},
"data_description": {
"name": "A unique name identifying the Lutron Homeworks controller",
"password": "[%key:component::homeworks::config::step::reconfigure_confirm::data_description::password%]",
"username": "[%key:component::homeworks::config::step::reconfigure_confirm::data_description::username%]"
"password": "[%key:component::homeworks::config::step::reconfigure::data_description::password%]",
"username": "[%key:component::homeworks::config::step::reconfigure::data_description::username%]"
},
"description": "Add a Lutron Homeworks controller"
}
Expand Down
8 changes: 1 addition & 7 deletions homeassistant/components/lamarzocco/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,16 +284,10 @@ async def async_step_reconfigure(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Perform reconfiguration of the config entry."""
return await self.async_step_reconfigure_confirm()

async def async_step_reconfigure_confirm(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Confirm reconfiguration of the device."""
if not user_input:
reconfigure_entry = self._get_reconfigure_entry()
return self.async_show_form(
step_id="reconfigure_confirm",
step_id="reconfigure",
data_schema=vol.Schema(
{
vol.Required(
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/lamarzocco/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"password": "[%key:component::lamarzocco::config::step::user::data_description::password%]"
}
},
"reconfigure_confirm": {
"reconfigure": {
"data": {
"username": "[%key:common::config_flow::data::username%]",
"password": "[%key:common::config_flow::data::password%]"
Expand Down
8 changes: 1 addition & 7 deletions homeassistant/components/lcn/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,6 @@ async def async_step_user(

async def async_step_reconfigure(
self, user_input: dict[str, Any] | None = None
) -> config_entries.ConfigFlowResult:
"""Reconfigure LCN configuration."""
return await self.async_step_reconfigure_confirm()

async def async_step_reconfigure_confirm(
self, user_input: dict[str, Any] | None = None
) -> config_entries.ConfigFlowResult:
"""Reconfigure LCN configuration."""
reconfigure_entry = self._get_reconfigure_entry()
Expand All @@ -219,7 +213,7 @@ async def async_step_reconfigure_confirm(
await self.hass.config_entries.async_setup(reconfigure_entry.entry_id)

return self.async_show_form(
step_id="reconfigure_confirm",
step_id="reconfigure",
data_schema=self.add_suggested_values_to_schema(
CONFIG_SCHEMA, reconfigure_entry.data
),
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/lcn/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"acknowledge": "Retry sendig commands if no response is received (increases bus traffic)."
}
},
"reconfigure_confirm": {
"reconfigure": {
"title": "Reconfigure LCN host",
"description": "Reconfigure connection to LCN host.",
"data": {
Expand Down
8 changes: 1 addition & 7 deletions homeassistant/components/madvr/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,9 @@ async def async_step_user(

async def async_step_reconfigure(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle reconfiguration of the device."""
return await self.async_step_reconfigure_confirm()

async def async_step_reconfigure_confirm(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a reconfiguration flow initialized by the user."""
return await self._handle_config_step(user_input, step_id="reconfigure_confirm")
return await self._handle_config_step(user_input, step_id="reconfigure")

async def _handle_config_step(
self, user_input: dict[str, Any] | None = None, step_id: str = "user"
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/madvr/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"port": "The port your madVR Envy is listening on. In 99% of cases, leave this as the default."
}
},
"reconfigure_confirm": {
"reconfigure": {
"title": "Reconfigure madVR Envy",
"description": "Your device needs to be on in order to reconfigure the integation.",
"data": {
Expand Down
8 changes: 1 addition & 7 deletions homeassistant/components/mealie/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,6 @@ async def async_step_reconfigure(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle reconfiguration of the integration."""
return await self.async_step_reconfigure_confirm()

async def async_step_reconfigure_confirm(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle reconfiguration confirmation."""
errors: dict[str, str] = {}
if user_input:
self.host = user_input[CONF_HOST]
Expand All @@ -141,7 +135,7 @@ async def async_step_reconfigure_confirm(
},
)
return self.async_show_form(
step_id="reconfigure_confirm",
step_id="reconfigure",
data_schema=USER_SCHEMA,
errors=errors,
)
2 changes: 1 addition & 1 deletion homeassistant/components/mealie/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"api_token": "[%key:common::config_flow::data::api_token%]"
}
},
"reconfigure_confirm": {
"reconfigure": {
"description": "Please reconfigure with Mealie.",
"data": {
"host": "[%key:common::config_flow::data::url%]",
Expand Down
8 changes: 1 addition & 7 deletions homeassistant/components/melcloud/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,6 @@ async def async_reauthenticate_client(

async def async_step_reconfigure(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a reconfiguration flow initialized by the user."""
return await self.async_step_reconfigure_confirm()

async def async_step_reconfigure_confirm(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a reconfiguration flow initialized by the user."""
errors: dict[str, str] = {}
Expand Down Expand Up @@ -190,7 +184,7 @@ async def async_step_reconfigure_confirm(
)

return self.async_show_form(
step_id="reconfigure_confirm",
step_id="reconfigure",
data_schema=vol.Schema(
{
vol.Required(CONF_PASSWORD): str,
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/melcloud/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"password": "[%key:common::config_flow::data::password%]"
}
},
"reconfigure_confirm": {
"reconfigure": {
"title": "Reconfigure your MelCloud",
"description": "Reconfigure the entry to obtain a new token, for your account: `{username}`.",
"data": {
Expand Down
Loading

0 comments on commit 25aea14

Please sign in to comment.