Add manufacturer matching support to zeroconf (#48810)
We plan on matching with _airplay which means we need to able to limit to specific manufacturers to avoid generating flows for integrations with the wrong manufacturer
This commit is contained in:
parent
c2d98f1905
commit
493bd4cdca
2 changed files with 99 additions and 1 deletions
|
@ -279,6 +279,13 @@ async def _async_start_zeroconf_browser(
|
|||
else:
|
||||
uppercase_mac = None
|
||||
|
||||
if "manufacturer" in info["properties"]:
|
||||
lowercase_manufacturer: str | None = info["properties"][
|
||||
"manufacturer"
|
||||
].lower()
|
||||
else:
|
||||
lowercase_manufacturer = None
|
||||
|
||||
# Not all homekit types are currently used for discovery
|
||||
# so not all service type exist in zeroconf_types
|
||||
for entry in zeroconf_types.get(service_type, []):
|
||||
|
@ -295,6 +302,14 @@ async def _async_start_zeroconf_browser(
|
|||
and not fnmatch.fnmatch(lowercase_name, entry["name"])
|
||||
):
|
||||
continue
|
||||
if (
|
||||
lowercase_manufacturer is not None
|
||||
and "manufacturer" in entry
|
||||
and not fnmatch.fnmatch(
|
||||
lowercase_manufacturer, entry["manufacturer"]
|
||||
)
|
||||
):
|
||||
continue
|
||||
|
||||
hass.add_job(
|
||||
hass.config_entries.flow.async_init(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue