mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 08:47:10 +00:00
Abort before trying to connect in QNAP QSW DHCP discovery when already configured (#82362)
This commit is contained in:
parent
4a089b5c28
commit
00afcffbf9
@ -78,6 +78,13 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
_LOGGER.debug("DHCP discovery detected QSW: %s", self._discovered_mac)
|
_LOGGER.debug("DHCP discovery detected QSW: %s", self._discovered_mac)
|
||||||
|
|
||||||
|
await self.async_set_unique_id(format_mac(self._discovered_mac))
|
||||||
|
self._abort_if_unique_id_configured(
|
||||||
|
updates={
|
||||||
|
CONF_URL: self._discovered_url,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
options = ConnectionOptions(self._discovered_url, "", "")
|
options = ConnectionOptions(self._discovered_url, "", "")
|
||||||
qsw = QnapQswApi(aiohttp_client.async_get_clientsession(self.hass), options)
|
qsw = QnapQswApi(aiohttp_client.async_get_clientsession(self.hass), options)
|
||||||
|
|
||||||
@ -86,9 +93,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
except QswError as err:
|
except QswError as err:
|
||||||
raise AbortFlow("cannot_connect") from err
|
raise AbortFlow("cannot_connect") from err
|
||||||
|
|
||||||
await self.async_set_unique_id(format_mac(self._discovered_mac))
|
|
||||||
self._abort_if_unique_id_configured()
|
|
||||||
|
|
||||||
return await self.async_step_discovered_connection()
|
return await self.async_step_discovered_connection()
|
||||||
|
|
||||||
async def async_step_discovered_connection(
|
async def async_step_discovered_connection(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user