Skip to content

Commit

Permalink
Merge pull request #1424 from rospogrigio/fix_socket.send_exceptions
Browse files Browse the repository at this point in the history
Fix for socket.send() exceptions in the logs
  • Loading branch information
rospogrigio committed Jun 7, 2023
2 parents 53e1ad8 + ba5670f commit f06e484
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion custom_components/localtuya/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
9 changes: 4 additions & 5 deletions custom_components/localtuya/pytuya/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit f06e484

Please sign in to comment.