From 624d866239a8e70fd621a08859cc26ea23263268 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 25 Nov 2021 18:41:49 +0100 Subject: [PATCH] SSDP attributes can be present but empty (#60340) Co-authored-by: epenet --- homeassistant/components/hue/config_flow.py | 2 +- homeassistant/components/upnp/config_flow.py | 6 +++--- homeassistant/components/wilight/config_flow.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/hue/config_flow.py b/homeassistant/components/hue/config_flow.py index fd743213d7f..b1bed30478c 100644 --- a/homeassistant/components/hue/config_flow.py +++ b/homeassistant/components/hue/config_flow.py @@ -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") diff --git a/homeassistant/components/upnp/config_flow.py b/homeassistant/components/upnp/config_flow.py index 80c126edbec..58dee0c7021 100644 --- a/homeassistant/components/upnp/config_flow.py +++ b/homeassistant/components/upnp/config_flow.py @@ -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) ) diff --git a/homeassistant/components/wilight/config_flow.py b/homeassistant/components/wilight/config_flow.py index 4bfc331a543..a5e14ebfc6b 100644 --- a/homeassistant/components/wilight/config_flow.py +++ b/homeassistant/components/wilight/config_flow.py @@ -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