From f9419c9f72c92257622156b2c1a360e9b74eb5da Mon Sep 17 00:00:00 2001 From: Steven B <51370195+sdb9696@users.noreply.github.com> Date: Mon, 6 Jan 2025 12:52:55 +0000 Subject: [PATCH] Log the first timeout and retryable error --- kasa/protocols/iotprotocol.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/kasa/protocols/iotprotocol.py b/kasa/protocols/iotprotocol.py index b58e57ae..1af4ae59 100755 --- a/kasa/protocols/iotprotocol.py +++ b/kasa/protocols/iotprotocol.py @@ -98,12 +98,26 @@ class IotProtocol(BaseProtocol): ) raise auex except _RetryableError as ex: + if retry == 0: + _LOGGER.debug( + "Device %s got a retryable error, will retry %s times: %s", + self._host, + retry_count, + ex, + ) await self._transport.reset() if retry >= retry_count: _LOGGER.debug("Giving up on %s after %s retries", self._host, retry) raise ex continue except TimeoutError as ex: + if retry == 0: + _LOGGER.debug( + "Device %s got a timeout error, will retry %s times: %s", + self._host, + retry_count, + ex, + ) await self._transport.reset() if retry >= retry_count: _LOGGER.debug("Giving up on %s after %s retries", self._host, retry)