1
mirror of https://github.com/home-assistant/core synced 2024-08-31 05:57:13 +02:00

Ensure homekit yaml config works when there is an ignored config entry (#48175)

This commit is contained in:
J. Nick Koston 2021-03-21 21:17:04 -10:00 committed by GitHub
parent a2c4b438ea
commit 6b93c4073d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -223,7 +223,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
"""Return a set of bridge names."""
return {
entry.data[CONF_NAME]
for entry in self._async_current_entries()
for entry in self._async_current_entries(include_ignore=False)
if CONF_NAME in entry.data
}
@ -251,7 +251,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
port = user_input[CONF_PORT]
return not any(
entry.data[CONF_NAME] == name or entry.data[CONF_PORT] == port
for entry in self._async_current_entries()
for entry in self._async_current_entries(include_ignore=False)
)
@staticmethod

View File

@ -5,7 +5,7 @@ import pytest
from homeassistant import config_entries, data_entry_flow, setup
from homeassistant.components.homekit.const import DOMAIN, SHORT_BRIDGE_NAME
from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.config_entries import SOURCE_IGNORE, SOURCE_IMPORT
from homeassistant.const import CONF_NAME, CONF_PORT
from tests.common import MockConfigEntry
@ -229,6 +229,8 @@ async def test_import(hass):
"""Test we can import instance."""
await setup.async_setup_component(hass, "persistent_notification", {})
ignored_entry = MockConfigEntry(domain=DOMAIN, data={}, source=SOURCE_IGNORE)
ignored_entry.add_to_hass(hass)
entry = MockConfigEntry(
domain=DOMAIN, data={CONF_NAME: "mock_name", CONF_PORT: 12345}
)