Fix missing title placeholders in powerwall reauth (#130389)
parent
929164251a
commit
79329e16cf
|
@ -251,8 +251,8 @@ class PowerwallConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||
"""Handle reauth confirmation."""
|
||||
errors: dict[str, str] | None = {}
|
||||
description_placeholders: dict[str, str] = {}
|
||||
if user_input is not None:
|
||||
reauth_entry = self._get_reauth_entry()
|
||||
if user_input is not None:
|
||||
errors, _, description_placeholders = await self._async_try_connect(
|
||||
{CONF_IP_ADDRESS: reauth_entry.data[CONF_IP_ADDRESS], **user_input}
|
||||
)
|
||||
|
@ -261,6 +261,10 @@ class PowerwallConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||
reauth_entry, data_updates=user_input
|
||||
)
|
||||
|
||||
self.context["title_placeholders"] = {
|
||||
"name": reauth_entry.title,
|
||||
"ip_address": reauth_entry.data[CONF_IP_ADDRESS],
|
||||
}
|
||||
return self.async_show_form(
|
||||
step_id="reauth_confirm",
|
||||
data_schema=vol.Schema({vol.Optional(CONF_PASSWORD): str}),
|
||||
|
|
|
@ -339,6 +339,11 @@ async def test_form_reauth(hass: HomeAssistant) -> None:
|
|||
result = await entry.start_reauth_flow(hass)
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["errors"] == {}
|
||||
flow = hass.config_entries.flow.async_get(result["flow_id"])
|
||||
assert flow["context"]["title_placeholders"] == {
|
||||
"ip_address": VALID_CONFIG[CONF_IP_ADDRESS],
|
||||
"name": entry.title,
|
||||
}
|
||||
|
||||
mock_powerwall = await _mock_powerwall_site_name(hass, "My site")
|
||||
|
||||
|
|
Loading…
Reference in New Issue