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

This commit is contained in:
J. Nick Koston authored and GitHub committed 2020-05-23 18:05:41 +02:00
1 parent cda2da62cf
commit b0578018cb
6 files changed
+13 -11

No files matched your search

@@ -98,7 +98,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)
@@ -224,11 +224,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