diff --git a/homeassistant/components/hunterdouglas_powerview/config_flow.py b/homeassistant/components/hunterdouglas_powerview/config_flow.py index 52a70b85d2e..1e47b9ec3fe 100644 --- a/homeassistant/components/hunterdouglas_powerview/config_flow.py +++ b/homeassistant/components/hunterdouglas_powerview/config_flow.py @@ -126,7 +126,9 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): def _host_already_configured(self, host): """See if we already have a hub with the host address configured.""" existing_hosts = { - entry.data[CONF_HOST] for entry in self._async_current_entries() + entry.data[CONF_HOST] + for entry in self._async_current_entries() + if CONF_HOST in entry.data } return host in existing_hosts diff --git a/tests/components/hunterdouglas_powerview/test_config_flow.py b/tests/components/hunterdouglas_powerview/test_config_flow.py index e5b0d472304..383d0445a7d 100644 --- a/tests/components/hunterdouglas_powerview/test_config_flow.py +++ b/tests/components/hunterdouglas_powerview/test_config_flow.py @@ -6,7 +6,7 @@ from homeassistant import config_entries, setup from homeassistant.components.hunterdouglas_powerview.const import DOMAIN from tests.async_mock import AsyncMock, MagicMock, patch -from tests.common import load_fixture +from tests.common import MockConfigEntry, load_fixture def _get_mock_powerview_userdata(userdata=None, get_resources=None): @@ -102,6 +102,9 @@ async def test_form_homekit(hass): """Test we get the form with homekit source.""" await setup.async_setup_component(hass, "persistent_notification", {}) + ignored_config_entry = MockConfigEntry(domain=DOMAIN, data={}, source="ignore") + ignored_config_entry.add_to_hass(hass) + mock_powerview_userdata = _get_mock_powerview_userdata() with patch( "homeassistant.components.hunterdouglas_powerview.UserData",