From d8e25e6efbc5a7b2727c665cc325c5bfa360042b Mon Sep 17 00:00:00 2001 From: xZetsubou Date: Mon, 16 Oct 2023 08:31:49 +0300 Subject: [PATCH] Don't send warning disconnect dc is intended --- custom_components/localtuya/common.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/custom_components/localtuya/common.py b/custom_components/localtuya/common.py index da515dcd5..d3c642e8a 100644 --- a/custom_components/localtuya/common.py +++ b/custom_components/localtuya/common.py @@ -298,6 +298,8 @@ async def _make_connection(self): self.warning(f"Initial state update failed {e}, trying key update") await self.update_local_key() await self.abort_connect() + finally: + pass if self._interface is not None: # Attempt to restore status for all entities that need to first set @@ -473,10 +475,9 @@ def disconnected(self): self._connect_task = None # If it's disconnect by unexpected error. if self._is_closing is not True: + self.warning("Disconnected - waiting for discovery broadcast") self._is_closing = True self._hass.create_task(self.async_connect()) - else: - self.warning("Disconnected - waiting for discovery broadcast") class LocalTuyaEntity(RestoreEntity, pytuya.ContextualLogger):