diff --git a/homeassistant/components/ssdp/__init__.py b/homeassistant/components/ssdp/__init__.py index b3d8a7f2898..e962c141bef 100644 --- a/homeassistant/components/ssdp/__init__.py +++ b/homeassistant/components/ssdp/__init__.py @@ -92,7 +92,10 @@ class Scanner: entries_to_process.append(entry) - if entry.location not in self._description_cache: + if ( + entry.location is not None + and entry.location not in self._description_cache + ): unseen_locations.add(entry.location) if not entries_to_process: diff --git a/tests/components/ssdp/test_init.py b/tests/components/ssdp/test_init.py index b6c8266b5da..008995cd78d 100644 --- a/tests/components/ssdp/test_init.py +++ b/tests/components/ssdp/test_init.py @@ -10,7 +10,7 @@ from homeassistant.components import ssdp from tests.common import mock_coro -async def test_scan_match_st(hass): +async def test_scan_match_st(hass, caplog): """Test matching based on ST.""" scanner = ssdp.Scanner(hass, {"mock-domain": [{"st": "mock-st"}]}) @@ -38,6 +38,7 @@ async def test_scan_match_st(hass): ssdp.ATTR_SSDP_SERVER: "mock-server", ssdp.ATTR_SSDP_EXT: "", } + assert "Failed to fetch ssdp data" not in caplog.text @pytest.mark.parametrize(