SSDP attributes can be present but empty (#60340)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet
2021-11-25 11:41:49 -06:00
committed by GitHub
co-authored by epenet
parent 67684d68ff
commit 624d866239
3 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -207,7 +207,7 @@ class HueFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
return self.async_abort(reason="not_hue_bridge")
if (
ssdp.ATTR_SSDP_LOCATION not in discovery_info
not discovery_info.get(ssdp.ATTR_SSDP_LOCATION)
or ssdp.ATTR_UPNP_SERIAL not in discovery_info
):
return self.async_abort(reason="not_hue_bridge")
+3 -3
View File
@@ -41,9 +41,9 @@ def _is_complete_discovery(discovery_info: Mapping[str, Any]) -> bool:
"""Test if discovery is complete and usable."""
return (
ssdp.ATTR_UPNP_UDN in discovery_info
and ssdp.ATTR_SSDP_ST in discovery_info
and ssdp.ATTR_SSDP_LOCATION in discovery_info
and ssdp.ATTR_SSDP_USN in discovery_info
and discovery_info.get(ssdp.ATTR_SSDP_ST)
and discovery_info.get(ssdp.ATTR_SSDP_LOCATION)
and discovery_info.get(ssdp.ATTR_SSDP_USN)
)
@@ -53,7 +53,7 @@ class WiLightFlowHandler(ConfigFlow, domain=DOMAIN):
"""Handle a discovered WiLight."""
# Filter out basic information
if (
ssdp.ATTR_SSDP_LOCATION not in discovery_info
not discovery_info.get(ssdp.ATTR_SSDP_LOCATION)
or ssdp.ATTR_UPNP_MANUFACTURER not in discovery_info
or ssdp.ATTR_UPNP_SERIAL not in discovery_info
or ssdp.ATTR_UPNP_MODEL_NAME not in discovery_info