mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Fix missing title placeholders in powerwall reauth (#130389)
This commit is contained in:
parent
96c12fdd10
commit
e388e9f396
@ -251,8 +251,8 @@ class PowerwallConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
"""Handle reauth confirmation."""
|
"""Handle reauth confirmation."""
|
||||||
errors: dict[str, str] | None = {}
|
errors: dict[str, str] | None = {}
|
||||||
description_placeholders: dict[str, str] = {}
|
description_placeholders: dict[str, str] = {}
|
||||||
|
reauth_entry = self._get_reauth_entry()
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
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: reauth_entry.data[CONF_IP_ADDRESS], **user_input}
|
{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
|
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(
|
return self.async_show_form(
|
||||||
step_id="reauth_confirm",
|
step_id="reauth_confirm",
|
||||||
data_schema=vol.Schema({vol.Optional(CONF_PASSWORD): str}),
|
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)
|
result = await entry.start_reauth_flow(hass)
|
||||||
assert result["type"] is FlowResultType.FORM
|
assert result["type"] is FlowResultType.FORM
|
||||||
assert result["errors"] == {}
|
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")
|
mock_powerwall = await _mock_powerwall_site_name(hass, "My site")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user