Correct reconfigure flows to get data from config entry (#127393)

Fetch entry data in async_step_reconfigure
This commit is contained in:
epenet 2024-10-03 09:46:41 +02:00 committed by GitHub
parent 13e4cd4a49
commit c658dc0ffc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 7 deletions

View File

@ -149,10 +149,11 @@ class AxisFlowHandler(ConfigFlow, domain=AXIS_DOMAIN):
return self.async_create_entry(title=title, data=self.config)
async def async_step_reconfigure(
self, entry_data: Mapping[str, Any]
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Trigger a reconfiguration flow."""
return await self._redo_configuration(entry_data, keep_password=True)
entry = self._get_reconfigure_entry()
return await self._redo_configuration(entry.data, keep_password=True)
async def async_step_reauth(
self, entry_data: Mapping[str, Any]

View File

@ -141,12 +141,12 @@ class HERETravelTimeConfigFlow(ConfigFlow, domain=DOMAIN):
)
async def async_step_reconfigure(
self, entry_data: Mapping[str, Any]
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle reconfiguration."""
self._entry = self._get_reconfigure_entry()
return self.async_show_form(
step_id="user", data_schema=get_user_step_schema(entry_data)
step_id="user", data_schema=get_user_step_schema(self._entry.data.copy())
)
async def async_step_origin_menu(self, _: None = None) -> ConfigFlowResult:

View File

@ -399,12 +399,12 @@ class ShellyConfigFlow(ConfigFlow, domain=DOMAIN):
)
async def async_step_reconfigure(
self, entry_data: Mapping[str, Any]
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Handle a reconfiguration flow initialized by the user."""
self.host = entry_data[CONF_HOST]
self.port = entry_data.get(CONF_PORT, DEFAULT_HTTP_PORT)
self.entry = self._get_reconfigure_entry()
self.host = self.entry.data[CONF_HOST]
self.port = self.entry.data.get(CONF_PORT, DEFAULT_HTTP_PORT)
return await self.async_step_reconfigure_confirm()