Use a single service browser for zeroconf discovery (#35997)

This commit is contained in:
J. Nick Koston authored and Paulus Schoutsen committed 2020-05-28 15:51:13 -07:00
1 parent 2df1c90e6a
commit 4df8e51edd
6 files changed
+13 -11

No files matched your search

@@ -97,7 +97,7 @@ class HaServiceBrowser(ServiceBrowser):
# To avoid overwhemling the system we pre-filter here and only process
# DNSPointers for the configured record name (type)
#
if record.name != self.type or not isinstance(record, DNSPointer):
if record.name not in self.types or not isinstance(record, DNSPointer):
return
super().update_record(zc, now, record)
@@ -216,11 +216,12 @@ def setup(hass, config):
)
)
for service in ZEROCONF:
HaServiceBrowser(zeroconf, service, handlers=[service_update])
types = list(ZEROCONF)
if HOMEKIT_TYPE not in ZEROCONF:
HaServiceBrowser(zeroconf, HOMEKIT_TYPE, handlers=[service_update])
types.append(HOMEKIT_TYPE)
HaServiceBrowser(zeroconf, types, handlers=[service_update])
return True