From af8f5949392fb67c1f88998a1d8e424ab61c1d81 Mon Sep 17 00:00:00 2001 From: Jc2k Date: Mon, 26 Jul 2021 14:32:16 +0100 Subject: [PATCH] Address late review of homekit_controller (#53492) Co-authored-by: Martin Hjelmare --- .../homekit_controller/config_flow.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/homekit_controller/config_flow.py b/homeassistant/components/homekit_controller/config_flow.py index a19c1d0c107..cc4addfae4f 100644 --- a/homeassistant/components/homekit_controller/config_flow.py +++ b/homeassistant/components/homekit_controller/config_flow.py @@ -279,13 +279,6 @@ class HomekitControllerFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): ) try: await pairing.list_accessories_and_characteristics() - _LOGGER.debug( - "%s (%s - %s) claims to be unpaired but isn't. It's implementation of HomeKit is defective or a zeroconf relay is broadcasting stale data", - name, - model, - hkid, - ) - return self.async_abort(reason="already_paired") except AuthenticationError: _LOGGER.debug( "%s (%s - %s) is unpaired. Removing invalid pairing for this device", @@ -294,6 +287,16 @@ class HomekitControllerFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): hkid, ) await self.hass.config_entries.async_remove(existing.entry_id) + else: + _LOGGER.debug( + "%s (%s - %s) claims to be unpaired but isn't. " + "It's implementation of HomeKit is defective " + "or a zeroconf relay is broadcasting stale data", + name, + model, + hkid, + ) + return self.async_abort(reason="already_paired") # Set unique-id and error out if it's already configured self._abort_if_unique_id_configured(updates=updated_ip_port)