Remove custom flow deduplication logic from guardian (#127159)

This commit is contained in:
Erik Montnemery 2024-10-01 16:20:47 +02:00 committed by GitHub
parent 4a6e3e0f5a
commit 7129868a56
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -111,7 +111,7 @@ class GuardianConfigFlow(ConfigFlow, domain=DOMAIN):
await self._async_set_unique_id(
async_get_pin_from_uid(discovery_info.macaddress.replace(":", "").upper())
)
return await self._async_handle_discovery()
return await self.async_step_discovery_confirm()
async def async_step_zeroconf(
self, discovery_info: zeroconf.ZeroconfServiceInfo
@ -123,17 +123,6 @@ class GuardianConfigFlow(ConfigFlow, domain=DOMAIN):
}
pin = async_get_pin_from_discovery_hostname(discovery_info.hostname)
await self._async_set_unique_id(pin)
return await self._async_handle_discovery()
async def _async_handle_discovery(self) -> ConfigFlowResult:
"""Handle any discovery."""
self.context[CONF_IP_ADDRESS] = self.discovery_info[CONF_IP_ADDRESS]
if any(
self.context[CONF_IP_ADDRESS] == flow["context"][CONF_IP_ADDRESS]
for flow in self._async_in_progress()
):
return self.async_abort(reason="already_in_progress")
return await self.async_step_discovery_confirm()
async def async_step_discovery_confirm(