mirror of
https://github.com/home-assistant/core.git
synced 2025-07-12 15:57:06 +00:00
parent
014743a27c
commit
0ab30ece68
@ -135,6 +135,9 @@ class NetgearFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
|
||||
_LOGGER.debug("Netgear ssdp discovery info: %s", discovery_info)
|
||||
|
||||
if ssdp.ATTR_UPNP_SERIAL not in discovery_info.upnp:
|
||||
return self.async_abort(reason="no_serial")
|
||||
|
||||
await self.async_set_unique_id(discovery_info.upnp[ssdp.ATTR_UPNP_SERIAL])
|
||||
self._abort_if_unique_id_configured(updates=updated_data)
|
||||
|
||||
|
@ -14,7 +14,9 @@
|
||||
"config": "Connection or login error: please check your configuration"
|
||||
},
|
||||
"abort": {
|
||||
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]"
|
||||
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]",
|
||||
"not_ipv4_address": "No IPv4 address in ssdp discovery information",
|
||||
"no_serial": "No serial number in ssdp discovery information"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
|
@ -236,6 +236,25 @@ async def test_ssdp_already_configured(hass: HomeAssistant) -> None:
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
async def test_ssdp_no_serial(hass: HomeAssistant) -> None:
|
||||
"""Test ssdp abort when the ssdp info does not include a serial number."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": SOURCE_SSDP},
|
||||
data=ssdp.SsdpServiceInfo(
|
||||
ssdp_usn="mock_usn",
|
||||
ssdp_st="mock_st",
|
||||
ssdp_location=SSDP_URL,
|
||||
upnp={
|
||||
ssdp.ATTR_UPNP_MODEL_NUMBER: "RBR20",
|
||||
ssdp.ATTR_UPNP_PRESENTATION_URL: URL,
|
||||
},
|
||||
),
|
||||
)
|
||||
assert result["type"] == data_entry_flow.FlowResultType.ABORT
|
||||
assert result["reason"] == "no_serial"
|
||||
|
||||
|
||||
async def test_ssdp_ipv6(hass: HomeAssistant) -> None:
|
||||
"""Test ssdp abort when using a ipv6 address."""
|
||||
MockConfigEntry(
|
||||
|
Loading…
x
Reference in New Issue
Block a user