diff --git a/homeassistant/components/frontier_silicon/config_flow.py b/homeassistant/components/frontier_silicon/config_flow.py index 8a3c5fe086f884..06af041d8f214c 100644 --- a/homeassistant/components/frontier_silicon/config_flow.py +++ b/homeassistant/components/frontier_silicon/config_flow.py @@ -101,8 +101,9 @@ async def async_step_ssdp( if device_hostname == hostname_from_url(entry.data[CONF_WEBFSAPI_URL]): return self.async_abort(reason="already_configured") - speaker_name = discovery_info.ssdp_headers.get(SSDP_ATTR_SPEAKER_NAME) - self.context["title_placeholders"] = {"name": speaker_name} + if speaker_name := discovery_info.ssdp_headers.get(SSDP_ATTR_SPEAKER_NAME): + # If we have a name, use it as flow title + self.context["title_placeholders"] = {"name": speaker_name} try: self._webfsapi_url = await AFSAPI.get_webfsapi_endpoint(device_url) diff --git a/tests/components/frontier_silicon/test_config_flow.py b/tests/components/frontier_silicon/test_config_flow.py index a6c1ba1e74ff8f..c92cf897fe618c 100644 --- a/tests/components/frontier_silicon/test_config_flow.py +++ b/tests/components/frontier_silicon/test_config_flow.py @@ -26,6 +26,7 @@ ssdp_udn="uuid:3dcc7100-f76c-11dd-87af-00226124ca30", ssdp_st="mock_st", ssdp_location="http://1.1.1.1/device", + ssdp_headers={"SPEAKER-NAME": "Speaker Name"}, upnp={"SPEAKER-NAME": "Speaker Name"}, ) @@ -34,6 +35,7 @@ ssdp_udn="uuid:3dcc7100-f76c-11dd-87af-00226124ca30", ssdp_st="mock_st", ssdp_location=None, + ssdp_headers={"SPEAKER-NAME": "Speaker Name"}, upnp={"SPEAKER-NAME": "Speaker Name"}, ) @@ -268,6 +270,11 @@ async def test_ssdp( assert result["type"] is FlowResultType.FORM assert result["step_id"] == "confirm" + flows = hass.config_entries.flow.async_progress() + assert len(flows) == 1 + flow = flows[0] + assert flow["context"]["title_placeholders"] == {"name": "Speaker Name"} + result2 = await hass.config_entries.flow.async_configure( result["flow_id"], {},