mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 22:27:07 +00:00
Use new reauth helpers in powerwall (#128717)
This commit is contained in:
parent
c214adcdf0
commit
908f649ea7
@ -99,7 +99,6 @@ class PowerwallConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
"""Initialize the powerwall flow."""
|
"""Initialize the powerwall flow."""
|
||||||
self.ip_address: str | None = None
|
self.ip_address: str | None = None
|
||||||
self.title: str | None = None
|
self.title: str | None = None
|
||||||
self.reauth_entry: ConfigEntry | None = None
|
|
||||||
|
|
||||||
async def _async_powerwall_is_offline(self, entry: ConfigEntry) -> bool:
|
async def _async_powerwall_is_offline(self, entry: ConfigEntry) -> bool:
|
||||||
"""Check if the power wall is offline.
|
"""Check if the power wall is offline.
|
||||||
@ -250,17 +249,16 @@ class PowerwallConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
self, user_input: dict[str, Any] | None = None
|
self, user_input: dict[str, Any] | None = None
|
||||||
) -> ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle reauth confirmation."""
|
"""Handle reauth confirmation."""
|
||||||
assert self.reauth_entry is not None
|
|
||||||
errors: dict[str, str] | None = {}
|
errors: dict[str, str] | None = {}
|
||||||
description_placeholders: dict[str, str] = {}
|
description_placeholders: dict[str, str] = {}
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
entry_data = self.reauth_entry.data
|
reauth_entry = self._get_reauth_entry()
|
||||||
errors, _, description_placeholders = await self._async_try_connect(
|
errors, _, description_placeholders = await self._async_try_connect(
|
||||||
{CONF_IP_ADDRESS: entry_data[CONF_IP_ADDRESS], **user_input}
|
{CONF_IP_ADDRESS: reauth_entry.data[CONF_IP_ADDRESS], **user_input}
|
||||||
)
|
)
|
||||||
if not errors:
|
if not errors:
|
||||||
return self.async_update_reload_and_abort(
|
return self.async_update_reload_and_abort(
|
||||||
self.reauth_entry, data={**entry_data, **user_input}
|
reauth_entry, data_updates=user_input
|
||||||
)
|
)
|
||||||
|
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
@ -274,9 +272,6 @@ class PowerwallConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
self, entry_data: Mapping[str, Any]
|
self, entry_data: Mapping[str, Any]
|
||||||
) -> ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle configuration by re-auth."""
|
"""Handle configuration by re-auth."""
|
||||||
self.reauth_entry = self.hass.config_entries.async_get_entry(
|
|
||||||
self.context["entry_id"]
|
|
||||||
)
|
|
||||||
return await self.async_step_reauth_confirm()
|
return await self.async_step_reauth_confirm()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user