diff --git a/custom_components/localtuya/manifest.json b/custom_components/localtuya/manifest.json index dad10d44f..28e36fa03 100644 --- a/custom_components/localtuya/manifest.json +++ b/custom_components/localtuya/manifest.json @@ -10,5 +10,5 @@ "iot_class": "local_push", "issue_tracker": "https://github.com/rospogrigio/localtuya/issues", "requirements": [], - "version": "5.2.0" + "version": "5.2.1" } diff --git a/custom_components/localtuya/pytuya/__init__.py b/custom_components/localtuya/pytuya/__init__.py index e2abc58dc..bcc8bbed5 100644 --- a/custom_components/localtuya/pytuya/__init__.py +++ b/custom_components/localtuya/pytuya/__init__.py @@ -766,10 +766,9 @@ async def exchange(self, command, dps=None): enc_payload = self._encode_message(payload) self.transport.write(enc_payload) - try: - msg = await self.dispatcher.wait_for(seqno, payload.cmd) - except Exception as ex: - self.debug("Wait was aborted for seqno %d (%s)", seqno, ex) + msg = await self.dispatcher.wait_for(seqno, payload.cmd) + if msg is None: + self.debug("Wait was aborted for seqno %d", seqno) return None # TODO: Verify stuff, e.g. CRC sequence number? @@ -954,7 +953,7 @@ def _decode_payload(self, payload): json_payload = json.loads(payload) except Exception as ex: raise DecodeError( - "could not decrypt data: wrong local_key? (exception %s)", ex + "could not decrypt data: wrong local_key? (exception: %s)" % ex ) # json_payload = self.error_json(ERR_JSON, payload)