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 18:41:49 +01:00 committed by GitHub
parent 67684d68ff
commit 624d866239
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -207,7 +207,7 @@ class HueFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
return self.async_abort(reason="not_hue_bridge") return self.async_abort(reason="not_hue_bridge")
if ( 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 or ssdp.ATTR_UPNP_SERIAL not in discovery_info
): ):
return self.async_abort(reason="not_hue_bridge") return self.async_abort(reason="not_hue_bridge")

View File

@ -41,9 +41,9 @@ def _is_complete_discovery(discovery_info: Mapping[str, Any]) -> bool:
"""Test if discovery is complete and usable.""" """Test if discovery is complete and usable."""
return ( return (
ssdp.ATTR_UPNP_UDN in discovery_info ssdp.ATTR_UPNP_UDN in discovery_info
and ssdp.ATTR_SSDP_ST in discovery_info and discovery_info.get(ssdp.ATTR_SSDP_ST)
and ssdp.ATTR_SSDP_LOCATION in discovery_info and discovery_info.get(ssdp.ATTR_SSDP_LOCATION)
and ssdp.ATTR_SSDP_USN in discovery_info and discovery_info.get(ssdp.ATTR_SSDP_USN)
) )

View File

@ -53,7 +53,7 @@ class WiLightFlowHandler(ConfigFlow, domain=DOMAIN):
"""Handle a discovered WiLight.""" """Handle a discovered WiLight."""
# Filter out basic information # Filter out basic information
if ( 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_MANUFACTURER not in discovery_info
or ssdp.ATTR_UPNP_SERIAL not in discovery_info or ssdp.ATTR_UPNP_SERIAL not in discovery_info
or ssdp.ATTR_UPNP_MODEL_NAME not in discovery_info or ssdp.ATTR_UPNP_MODEL_NAME not in discovery_info