From 613bde4d6ab0bd127029edaae804ae1119b3cf3f Mon Sep 17 00:00:00 2001 From: rospogrigio Date: Tue, 24 Jan 2023 17:02:10 +0100 Subject: [PATCH] Improved logging --- custom_components/localtuya/pytuya/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/custom_components/localtuya/pytuya/__init__.py b/custom_components/localtuya/pytuya/__init__.py index ad546c4..d05a27f 100644 --- a/custom_components/localtuya/pytuya/__init__.py +++ b/custom_components/localtuya/pytuya/__init__.py @@ -444,11 +444,12 @@ class MessageDispatcher(ContextualLogger): if seqno in self.listeners: raise Exception(f"listener exists for {seqno}") - self.debug("Command %d waiting for sequence number %d", cmd, seqno) + self.debug("Command %d waiting for seq. number %d", cmd, seqno) self.listeners[seqno] = asyncio.Semaphore(0) try: await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout) except asyncio.TimeoutError: + self.warning("Command %d timed out waiting for sequence number %d", cmd, seqno) del self.listeners[seqno] raise @@ -511,7 +512,7 @@ class MessageDispatcher(ContextualLogger): if msg.cmd == CONTROL_NEW: self.debug("Got ACK message for command %d: will ignore it", msg.cmd) else: - self.error( + self.debug( "Got message type %d for unknown listener %d: %s", msg.cmd, msg.seqno,