mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Set unique id while SSDP discovery of Synology DSM (#56914)
This commit is contained in:
parent
7d6b4a985d
commit
2d174d0cbb
@ -239,8 +239,12 @@ class SynologyDSMFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
# 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.
|
||||||
|
|
||||||
|
await self.async_set_unique_id(discovered_mac)
|
||||||
existing_entry = self._async_get_existing_entry(discovered_mac)
|
existing_entry = self._async_get_existing_entry(discovered_mac)
|
||||||
|
|
||||||
|
if not existing_entry:
|
||||||
|
self._abort_if_unique_id_configured()
|
||||||
|
|
||||||
if existing_entry and existing_entry.data[CONF_HOST] != parsed_url.hostname:
|
if existing_entry and existing_entry.data[CONF_HOST] != parsed_url.hostname:
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"Update host from '%s' to '%s' for NAS '%s' via SSDP discovery",
|
"Update host from '%s' to '%s' for NAS '%s' via SSDP discovery",
|
||||||
@ -253,6 +257,7 @@ class SynologyDSMFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
data={**existing_entry.data, CONF_HOST: parsed_url.hostname},
|
data={**existing_entry.data, CONF_HOST: parsed_url.hostname},
|
||||||
)
|
)
|
||||||
return self.async_abort(reason="reconfigure_successful")
|
return self.async_abort(reason="reconfigure_successful")
|
||||||
|
|
||||||
if existing_entry:
|
if existing_entry:
|
||||||
return self.async_abort(reason="already_configured")
|
return self.async_abort(reason="already_configured")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user