Skip to content

Commit

Permalink
Fix missing title placeholders in powerwall reauth (home-assistant#13…
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Nov 11, 2024
1 parent 96c12fd commit e388e9f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion homeassistant/components/powerwall/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ async def async_step_reauth_confirm(
"""Handle reauth confirmation."""
errors: dict[str, str] | None = {}
description_placeholders: dict[str, str] = {}
reauth_entry = self._get_reauth_entry()
if user_input is not None:
reauth_entry = self._get_reauth_entry()
errors, _, description_placeholders = await self._async_try_connect(
{CONF_IP_ADDRESS: reauth_entry.data[CONF_IP_ADDRESS], **user_input}
)
Expand All @@ -261,6 +261,10 @@ async def async_step_reauth_confirm(
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}),
Expand Down
5 changes: 5 additions & 0 deletions tests/components/powerwall/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit e388e9f

Please sign in to comment.