Make harmony handle IP address changes (#33173)
If the IP address of the harmony hub changed it would not be rediscovered. We now connect to get the unique id and then update config entries with the correct ip if it is already setup.
This commit is contained in:
1 parent
087b672449
commit
0b2a8bf79a
4 files changed
+70
-41
No files matched your search
@@ -91,19 +91,28 @@ async def test_form_ssdp(hass):
|
||||
"""Test we get the form with ssdp source."""
|
||||
await setup.async_setup_component(hass, "persistent_notification", {})
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data={
|
||||
"friendlyName": "Harmony Hub",
|
||||
"ssdp_location": "http://192.168.209.238:8088/description",
|
||||
},
|
||||
)
|
||||
harmonyapi = _get_mock_harmonyapi(connect=True)
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.harmony.config_flow.HarmonyAPI",
|
||||
return_value=harmonyapi,
|
||||
):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_SSDP},
|
||||
data={
|
||||
"friendlyName": "Harmony Hub",
|
||||
"ssdp_location": "http://192.168.1.12:8088/description",
|
||||
},
|
||||
)
|
||||
assert result["type"] == "form"
|
||||
assert result["step_id"] == "link"
|
||||
assert result["errors"] == {}
|
||||
assert result["description_placeholders"] == {
|
||||
"host": "Harmony Hub",
|
||||
"name": "192.168.1.12",
|
||||
}
|
||||
|
||||
harmonyapi = _get_mock_harmonyapi(connect=True)
|
||||
with patch(
|
||||
"homeassistant.components.harmony.config_flow.HarmonyAPI",
|
||||
return_value=harmonyapi,
|
||||
@@ -117,7 +126,7 @@ async def test_form_ssdp(hass):
|
||||
assert result2["type"] == "create_entry"
|
||||
assert result2["title"] == "Harmony Hub"
|
||||
assert result2["data"] == {
|
||||
"host": "192.168.209.238",
|
||||
"host": "192.168.1.12",
|
||||
"name": "Harmony Hub",
|
||||
}
|
||||
await hass.async_block_till_done()
|
||||
|
||||
Reference in new issue
Block a user