mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Fix Synology DSM discovery can't be ignored (#35331)
This commit is contained in:
parent
9d5704307a
commit
0ed25e9f4e
@ -179,11 +179,15 @@ class SynologyDSMFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
discovery_info[ssdp.ATTR_UPNP_FRIENDLY_NAME].split("(", 1)[0].strip()
|
discovery_info[ssdp.ATTR_UPNP_FRIENDLY_NAME].split("(", 1)[0].strip()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
mac = discovery_info[ssdp.ATTR_UPNP_SERIAL].upper()
|
||||||
# Synology NAS can broadcast on multiple IP addresses, since they can be connected to multiple ethernets.
|
# Synology NAS can broadcast on multiple IP addresses, since they can be connected to multiple ethernets.
|
||||||
# The serial of the NAS is actually its MAC address.
|
# The serial of the NAS is actually its MAC address.
|
||||||
if self._mac_already_configured(discovery_info[ssdp.ATTR_UPNP_SERIAL].upper()):
|
if self._mac_already_configured(mac):
|
||||||
return self.async_abort(reason="already_configured")
|
return self.async_abort(reason="already_configured")
|
||||||
|
|
||||||
|
await self.async_set_unique_id(mac)
|
||||||
|
self._abort_if_unique_id_configured()
|
||||||
|
|
||||||
self.discovered_conf = {
|
self.discovered_conf = {
|
||||||
CONF_NAME: friendly_name,
|
CONF_NAME: friendly_name,
|
||||||
CONF_HOST: parsed_url.hostname,
|
CONF_HOST: parsed_url.hostname,
|
||||||
|
@ -385,6 +385,7 @@ async def test_form_ssdp(hass: HomeAssistantType, service: MagicMock):
|
|||||||
)
|
)
|
||||||
|
|
||||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||||
|
assert result["result"].unique_id == SERIAL
|
||||||
assert result["title"] == "192.168.1.5"
|
assert result["title"] == "192.168.1.5"
|
||||||
assert result["data"][CONF_HOST] == "192.168.1.5"
|
assert result["data"][CONF_HOST] == "192.168.1.5"
|
||||||
assert result["data"][CONF_PORT] == 5001
|
assert result["data"][CONF_PORT] == 5001
|
||||||
|
Loading…
x
Reference in New Issue
Block a user