Skip to content

Commit f06e484

Browse files
authored
Merge pull request #1424 from rospogrigio/fix_socket.send_exceptions
Fix for socket.send() exceptions in the logs
2 parents 53e1ad8 + ba5670f commit f06e484

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

custom_components/localtuya/manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
"iot_class": "local_push",
1111
"issue_tracker": "https://github.com/rospogrigio/localtuya/issues",
1212
"requirements": [],
13-
"version": "5.2.0"
13+
"version": "5.2.1"
1414
}

custom_components/localtuya/pytuya/__init__.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -766,10 +766,9 @@ async def exchange(self, command, dps=None):
766766

767767
enc_payload = self._encode_message(payload)
768768
self.transport.write(enc_payload)
769-
try:
770-
msg = await self.dispatcher.wait_for(seqno, payload.cmd)
771-
except Exception as ex:
772-
self.debug("Wait was aborted for seqno %d (%s)", seqno, ex)
769+
msg = await self.dispatcher.wait_for(seqno, payload.cmd)
770+
if msg is None:
771+
self.debug("Wait was aborted for seqno %d", seqno)
773772
return None
774773

775774
# TODO: Verify stuff, e.g. CRC sequence number?
@@ -954,7 +953,7 @@ def _decode_payload(self, payload):
954953
json_payload = json.loads(payload)
955954
except Exception as ex:
956955
raise DecodeError(
957-
"could not decrypt data: wrong local_key? (exception %s)", ex
956+
"could not decrypt data: wrong local_key? (exception: %s)" % ex
958957
)
959958
# json_payload = self.error_json(ERR_JSON, payload)
960959

0 commit comments

Comments
 (0)