Fix exception when trying to configure an ignored somfy mylink (#45198)
This commit is contained in:
parent
5677adc104
commit
b3764da912
2 changed files with 20 additions and 1 deletions
|
@ -118,7 +118,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
def _host_already_configured(self, host):
|
def _host_already_configured(self, host):
|
||||||
"""See if we already have an entry matching the host."""
|
"""See if we already have an entry matching the host."""
|
||||||
for entry in self._async_current_entries():
|
for entry in self._async_current_entries():
|
||||||
if entry.data[CONF_HOST] == host:
|
if entry.data.get(CONF_HOST) == host:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
|
@ -461,6 +461,25 @@ async def test_form_user_already_configured_from_dhcp(hass):
|
||||||
assert len(mock_setup_entry.mock_calls) == 0
|
assert len(mock_setup_entry.mock_calls) == 0
|
||||||
|
|
||||||
|
|
||||||
|
async def test_already_configured_with_ignored(hass):
|
||||||
|
"""Test ignored entries do not break checking for existing entries."""
|
||||||
|
await setup.async_setup_component(hass, "persistent_notification", {})
|
||||||
|
|
||||||
|
config_entry = MockConfigEntry(domain=DOMAIN, data={}, source="ignore")
|
||||||
|
config_entry.add_to_hass(hass)
|
||||||
|
|
||||||
|
result = await hass.config_entries.flow.async_init(
|
||||||
|
DOMAIN,
|
||||||
|
context={"source": config_entries.SOURCE_DHCP},
|
||||||
|
data={
|
||||||
|
IP_ADDRESS: "1.1.1.1",
|
||||||
|
MAC_ADDRESS: "AA:BB:CC:DD:EE:FF",
|
||||||
|
HOSTNAME: "somfy_eeff",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
assert result["type"] == "form"
|
||||||
|
|
||||||
|
|
||||||
async def test_dhcp_discovery(hass):
|
async def test_dhcp_discovery(hass):
|
||||||
"""Test we can process the discovery from dhcp."""
|
"""Test we can process the discovery from dhcp."""
|
||||||
await setup.async_setup_component(hass, "persistent_notification", {})
|
await setup.async_setup_component(hass, "persistent_notification", {})
|
||||||
|
|
Loading…
Add table
Reference in a new issue