Hide HomeKit devices from discovery that are known to be problematic (#44014)
This commit is contained in:
parent
727b1d37b6
commit
6ce45e39d1
2 changed files with 27 additions and 0 deletions
|
@ -21,6 +21,14 @@ HOMEKIT_BRIDGE_DOMAIN = "homekit"
|
||||||
HOMEKIT_BRIDGE_SERIAL_NUMBER = "homekit.bridge"
|
HOMEKIT_BRIDGE_SERIAL_NUMBER = "homekit.bridge"
|
||||||
HOMEKIT_BRIDGE_MODEL = "Home Assistant 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"
|
PAIRING_FILE = "pairing.json"
|
||||||
|
|
||||||
MDNS_SUFFIX = "._hap._tcp.local."
|
MDNS_SUFFIX = "._hap._tcp.local."
|
||||||
|
@ -255,6 +263,10 @@ class HomekitControllerFlowHandler(config_entries.ConfigFlow):
|
||||||
# Devices in HOMEKIT_IGNORE have native local integrations - users
|
# Devices in HOMEKIT_IGNORE have native local integrations - users
|
||||||
# should be encouraged to use native integration and not confused
|
# should be encouraged to use native integration and not confused
|
||||||
# by alternative HK API.
|
# 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):
|
if await self._hkid_is_homekit_bridge(hkid):
|
||||||
return self.async_abort(reason="ignored_model")
|
return self.async_abort(reason="ignored_model")
|
||||||
|
|
||||||
|
|
|
@ -257,6 +257,21 @@ async def test_discovery_ignored_model(hass, controller):
|
||||||
"""Already paired."""
|
"""Already paired."""
|
||||||
device = setup_mock_accessory(controller)
|
device = setup_mock_accessory(controller)
|
||||||
discovery_info = get_device_discovery_info(device)
|
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={})
|
config_entry = MockConfigEntry(domain=config_flow.HOMEKIT_BRIDGE_DOMAIN, data={})
|
||||||
formatted_mac = device_registry.format_mac("AA:BB:CC:DD:EE:FF")
|
formatted_mac = device_registry.format_mac("AA:BB:CC:DD:EE:FF")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue