diff --git a/homeassistant/components/zeroconf/__init__.py b/homeassistant/components/zeroconf/__init__.py index 6c7e0ff8103..b4d1359df9d 100644 --- a/homeassistant/components/zeroconf/__init__.py +++ b/homeassistant/components/zeroconf/__init__.py @@ -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 diff --git a/homeassistant/components/zeroconf/manifest.json b/homeassistant/components/zeroconf/manifest.json index a3d4d1d8399..9d4398f3b56 100644 --- a/homeassistant/components/zeroconf/manifest.json +++ b/homeassistant/components/zeroconf/manifest.json @@ -2,7 +2,7 @@ "domain": "zeroconf", "name": "Zero-configuration networking (zeroconf)", "documentation": "https://www.home-assistant.io/integrations/zeroconf", - "requirements": ["zeroconf==0.26.1"], + "requirements": ["zeroconf==0.26.2"], "dependencies": ["api"], "codeowners": ["@robbiet480", "@Kane610"], "quality_scale": "internal" diff --git a/homeassistant/package_constraints.txt b/homeassistant/package_constraints.txt index 0784fb39052..7a1543690e2 100644 --- a/homeassistant/package_constraints.txt +++ b/homeassistant/package_constraints.txt @@ -25,7 +25,7 @@ ruamel.yaml==0.15.100 sqlalchemy==1.3.17 voluptuous-serialize==2.3.0 voluptuous==0.11.7 -zeroconf==0.26.1 +zeroconf==0.26.2 pycryptodome>=3.6.6 diff --git a/requirements_all.txt b/requirements_all.txt index 4466a8a543d..d19f01f6c59 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2239,7 +2239,7 @@ youtube_dl==2020.05.08 zengge==0.2 # homeassistant.components.zeroconf -zeroconf==0.26.1 +zeroconf==0.26.2 # homeassistant.components.zha zha-quirks==0.0.39 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index d0f8ae47b04..8e79c1f30c2 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -906,7 +906,7 @@ xmltodict==0.12.0 ya_ma==0.3.8 # homeassistant.components.zeroconf -zeroconf==0.26.1 +zeroconf==0.26.2 # homeassistant.components.zha zha-quirks==0.0.39 diff --git a/tests/components/zeroconf/test_init.py b/tests/components/zeroconf/test_init.py index 89c9d0c2643..74069fa5faa 100644 --- a/tests/components/zeroconf/test_init.py +++ b/tests/components/zeroconf/test_init.py @@ -29,9 +29,10 @@ def mock_zeroconf(): yield mock_zc.return_value -def service_update_mock(zeroconf, service, handlers): +def service_update_mock(zeroconf, services, handlers): """Call service update handler.""" - handlers[0](zeroconf, service, f"name.{service}", ServiceStateChange.Added) + for service in services: + handlers[0](zeroconf, service, f"name.{service}", ServiceStateChange.Added) def get_service_info_mock(service_type, name): @@ -76,7 +77,7 @@ async def test_setup(hass, mock_zeroconf): mock_zeroconf.get_service_info.side_effect = get_service_info_mock assert await async_setup_component(hass, zeroconf.DOMAIN, {zeroconf.DOMAIN: {}}) - assert len(mock_service_browser.mock_calls) == len(zc_gen.ZEROCONF) + assert len(mock_service_browser.mock_calls) == 1 expected_flow_calls = 0 for matching_components in zc_gen.ZEROCONF.values(): expected_flow_calls += len(matching_components)