diff --git a/homeassistant/components/hue/config_flow.py b/homeassistant/components/hue/config_flow.py index ebd71ba7c1c..375042c8835 100644 --- a/homeassistant/components/hue/config_flow.py +++ b/homeassistant/components/hue/config_flow.py @@ -16,6 +16,7 @@ from .const import DOMAIN, LOGGER from .errors import AuthenticationRequired, CannotConnect HUE_MANUFACTURERURL = "http://www.philips.com" +HUE_IGNORED_BRIDGE_NAMES = ["HASS Bridge", "Espalexa"] @callback @@ -133,14 +134,16 @@ class HueFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): This flow is triggered by the SSDP component. It will check if the host is already configured and delegate to the import step if not. """ - from homeassistant.components.ssdp import ATTR_MANUFACTURERURL + from homeassistant.components.ssdp import ATTR_MANUFACTURERURL, ATTR_NAME if discovery_info[ATTR_MANUFACTURERURL] != HUE_MANUFACTURERURL: return self.async_abort(reason="not_hue_bridge") - # Filter out emulated Hue - if "HASS Bridge" in discovery_info.get("name", ""): - return self.async_abort(reason="already_configured") + if any( + name in discovery_info.get(ATTR_NAME, "") + for name in HUE_IGNORED_BRIDGE_NAMES + ): + return self.async_abort(reason="not_hue_bridge") host = self.context["host"] = discovery_info.get("host") diff --git a/tests/components/hue/test_config_flow.py b/tests/components/hue/test_config_flow.py index 54082464a7c..a6d221ef323 100644 --- a/tests/components/hue/test_config_flow.py +++ b/tests/components/hue/test_config_flow.py @@ -230,6 +230,26 @@ async def test_bridge_ssdp_emulated_hue(hass): ) assert result["type"] == "abort" + assert result["reason"] == "not_hue_bridge" + + +async def test_bridge_ssdp_espalexa(hass): + """Test if discovery info is from an Espalexa based device.""" + flow = config_flow.HueFlowHandler() + flow.hass = hass + flow.context = {} + + result = await flow.async_step_ssdp( + { + "name": "Espalexa (0.0.0.0)", + "host": "0.0.0.0", + "serial": "1234", + "manufacturerURL": config_flow.HUE_MANUFACTURERURL, + } + ) + + assert result["type"] == "abort" + assert result["reason"] == "not_hue_bridge" async def test_bridge_ssdp_already_configured(hass):