From b517ce132f74ef3617ecd74570c89d487abcde88 Mon Sep 17 00:00:00 2001 From: Tom Matheussen <13683094+Tommatheussen@users.noreply.github.com> Date: Wed, 28 Jan 2026 19:40:02 +0100 Subject: [PATCH] Don't attempt to verify ignored Doorbird devices during discovery (#161776) --- .../components/doorbird/config_flow.py | 4 +++ tests/components/doorbird/test_config_flow.py | 31 +++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/homeassistant/components/doorbird/config_flow.py b/homeassistant/components/doorbird/config_flow.py index ac08ad0e1f62..7a9764876fed 100644 --- a/homeassistant/components/doorbird/config_flow.py +++ b/homeassistant/components/doorbird/config_flow.py @@ -12,6 +12,7 @@ from doorbirdpy import DoorBird import voluptuous as vol from homeassistant.config_entries import ( + SOURCE_IGNORE, ConfigEntry, ConfigFlow, ConfigFlowResult, @@ -218,6 +219,9 @@ class DoorBirdConfigFlow(ConfigFlow, domain=DOMAIN): ) if existing_entry: + if existing_entry.source == SOURCE_IGNORE: + return self.async_abort(reason="already_configured") + # Check if the host is actually changing if existing_entry.data.get(CONF_HOST) != host: await self._async_verify_existing_device_for_discovery( diff --git a/tests/components/doorbird/test_config_flow.py b/tests/components/doorbird/test_config_flow.py index 493762df5ef7..44dfea093122 100644 --- a/tests/components/doorbird/test_config_flow.py +++ b/tests/components/doorbird/test_config_flow.py @@ -145,6 +145,37 @@ async def test_form_zeroconf_ipv4_address( assert config_entry.data[CONF_HOST] == "4.4.4.4" +async def test_form_zeroconf_ignored_entry( + hass: HomeAssistant, doorbird_api: DoorBird +) -> None: + """Test we abort when the entry was ignored, without attempting to connect.""" + + config_entry = MockConfigEntry( + source=config_entries.SOURCE_IGNORE, + domain=DOMAIN, + unique_id="1CCAE3AAAAAA", + data={}, + options={}, + ) + config_entry.add_to_hass(hass) + + result = await hass.config_entries.flow.async_init( + DOMAIN, + context={"source": config_entries.SOURCE_ZEROCONF}, + data=ZeroconfServiceInfo( + ip_address=ip_address("4.4.4.4"), + ip_addresses=[ip_address("4.4.4.4")], + hostname="mock_hostname", + name="Doorstation - abc123._axis-video._tcp.local.", + port=None, + properties={"macaddress": "1CCAE3AAAAAA"}, + type="mock_type", + ), + ) + assert result["type"] is FlowResultType.ABORT + assert result["reason"] == "already_configured" + + async def test_form_zeroconf_ipv4_address_wrong_device( hass: HomeAssistant, doorbird_api: DoorBird ) -> None: