Skip to content

Commit

Permalink
Remember entered IP when error happend while setting up HomeWizard (h…
Browse files Browse the repository at this point in the history
  • Loading branch information
DCSBL authored Mar 22, 2024
1 parent a9e8572 commit 48553ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion homeassistant/components/homewizard/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,14 @@ async def async_step_user(
data=user_input,
)

user_input = user_input or {}
return self.async_show_form(
step_id="user",
data_schema=Schema(
{
Required(CONF_IP_ADDRESS): str,
Required(
CONF_IP_ADDRESS, default=user_input.get(CONF_IP_ADDRESS)
): str,
}
),
errors=errors,
Expand Down
1 change: 1 addition & 0 deletions tests/components/homewizard/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ async def test_error_flow(

assert result["type"] == FlowResultType.FORM
assert result["errors"] == {"base": reason}
assert result["data_schema"]({}) == {CONF_IP_ADDRESS: "127.0.0.1"}

# Recover from error
mock_homewizardenergy.device.side_effect = None
Expand Down

0 comments on commit 48553ec

Please sign in to comment.