From eac92896172e6877e88f8bf69186a144e80cb032 Mon Sep 17 00:00:00 2001 From: Josh Wickham Date: Sun, 22 Mar 2026 08:56:17 -0700 Subject: [PATCH] 71: Prevent unneeded auto-discovery of devices when already set up Since this integration is a cloud-based integration, any new entities added to the cloud integration will be included automatically. The detection of devices using DHCP is meant to be a trigger for the initial setup of cloud integrations. Because new devices will already be detected through the existing integration, it is unnecessary to prompt to set up the integration when DHCP detects a new device. Thus, we can safely ignore newly detected DHCP devices if the integration is already configured, which will prevent the useless "device detected" cards from appearing on the integration screen --- custom_components/vesync/config_flow.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/custom_components/vesync/config_flow.py b/custom_components/vesync/config_flow.py index 4fdd683..ef9a3fb 100644 --- a/custom_components/vesync/config_flow.py +++ b/custom_components/vesync/config_flow.py @@ -143,8 +143,12 @@ async def async_step_user( async def async_step_dhcp(self, discovery_info: dhcp.DhcpServiceInfo) -> FlowResult: """Handle DHCP discovery.""" - hostname = discovery_info.hostname + # VeSync is a cloud account integration — if it's already configured, + # DHCP discovery of any Levoit device is a no-op. + if self._async_current_entries(): + return self.async_abort(reason="already_configured") + hostname = discovery_info.hostname _LOGGER.debug("DHCP discovery detected device %s", hostname) self.context["title_placeholders"] = {"gateway_id": hostname} return await self.async_step_user()