Fix exception when trying to configure an ignored somfy mylink (#45198)
parent
5677adc104
commit
b3764da912
|
@ -118,7 +118,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
def _host_already_configured(self, host):
|
||||
"""See if we already have an entry matching the host."""
|
||||
for entry in self._async_current_entries():
|
||||
if entry.data[CONF_HOST] == host:
|
||||
if entry.data.get(CONF_HOST) == host:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
|
@ -461,6 +461,25 @@ async def test_form_user_already_configured_from_dhcp(hass):
|
|||
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):
|
||||
"""Test we can process the discovery from dhcp."""
|
||||
await setup.async_setup_component(hass, "persistent_notification", {})
|
||||
|
|
Loading…
Reference in New Issue