From 6ce45e39d1621dc3e5848709173c2e69654e9dfc Mon Sep 17 00:00:00 2001 From: Jc2k Date: Mon, 7 Dec 2020 12:51:35 +0000 Subject: [PATCH] Hide HomeKit devices from discovery that are known to be problematic (#44014) --- .../components/homekit_controller/config_flow.py | 12 ++++++++++++ .../homekit_controller/test_config_flow.py | 15 +++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/homeassistant/components/homekit_controller/config_flow.py b/homeassistant/components/homekit_controller/config_flow.py index 9881ef15dcb..71c8005cbc5 100644 --- a/homeassistant/components/homekit_controller/config_flow.py +++ b/homeassistant/components/homekit_controller/config_flow.py @@ -21,6 +21,14 @@ HOMEKIT_BRIDGE_DOMAIN = "homekit" HOMEKIT_BRIDGE_SERIAL_NUMBER = "homekit.bridge" HOMEKIT_BRIDGE_MODEL = "Home Assistant HomeKit Bridge" +HOMEKIT_IGNORE = [ + # eufy Indoor Cam 2K Pan & Tilt + # https://github.com/home-assistant/core/issues/42307 + "T8410", + # Hive Hub - vendor does not give user a pairing code + "HHKBridge1,1", +] + PAIRING_FILE = "pairing.json" MDNS_SUFFIX = "._hap._tcp.local." @@ -255,6 +263,10 @@ class HomekitControllerFlowHandler(config_entries.ConfigFlow): # Devices in HOMEKIT_IGNORE have native local integrations - users # should be encouraged to use native integration and not confused # by alternative HK API. + if model in HOMEKIT_IGNORE: + return self.async_abort(reason="ignored_model") + + # If this is a HomeKit bridge exported by *this* HA instance ignore it. if await self._hkid_is_homekit_bridge(hkid): return self.async_abort(reason="ignored_model") diff --git a/tests/components/homekit_controller/test_config_flow.py b/tests/components/homekit_controller/test_config_flow.py index a8eb869abf4..72a8133159d 100644 --- a/tests/components/homekit_controller/test_config_flow.py +++ b/tests/components/homekit_controller/test_config_flow.py @@ -257,6 +257,21 @@ async def test_discovery_ignored_model(hass, controller): """Already paired.""" device = setup_mock_accessory(controller) discovery_info = get_device_discovery_info(device) + discovery_info["properties"]["id"] = "AA:BB:CC:DD:EE:FF" + discovery_info["properties"]["md"] = "HHKBridge1,1" + + # Device is discovered + result = await hass.config_entries.flow.async_init( + "homekit_controller", context={"source": "zeroconf"}, data=discovery_info + ) + assert result["type"] == "abort" + assert result["reason"] == "ignored_model" + + +async def test_discovery_ignored_hk_bridge(hass, controller): + """Already paired.""" + device = setup_mock_accessory(controller) + discovery_info = get_device_discovery_info(device) config_entry = MockConfigEntry(domain=config_flow.HOMEKIT_BRIDGE_DOMAIN, data={}) formatted_mac = device_registry.format_mac("AA:BB:CC:DD:EE:FF")