Skip to content

Commit 032ba19

Browse files
Merge pull request #1 from dolkensp/codex/fix-connection-issue-with-intesishome
Fix IntesisHome reconnect deadlock when callbacks issue commands
2 parents 1d8550b + f919274 commit 032ba19

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

pyintesishome/intesishome.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ def __init__(
4242
async def _parse_response(self, decoded_data):
4343
_LOGGER.debug("%s API Received: %s", self._device_type, decoded_data)
4444
resp = json.loads(decoded_data)
45+
# Ensure any pending command awaiters are released before invoking callbacks
46+
if not self._received_response.is_set():
47+
_LOGGER.debug("Setting _received_response event")
48+
self._received_response.set()
49+
4550
# Parse response
4651
if resp["command"] == "connect_rsp":
4752
# New connection success
@@ -67,10 +72,6 @@ async def _parse_response(self, decoded_data):
6772
self._update_rssi(resp["data"]["deviceId"], resp["data"]["value"])
6873
else:
6974
_LOGGER.debug("Unexpected command received: %s", resp["command"])
70-
# Ensure the _received_response event is set
71-
if not self._received_response.is_set():
72-
_LOGGER.debug("Setting _received_response event")
73-
self._received_response.set()
7475
return
7576

7677
async def _send_keepalive(self):

0 commit comments

Comments
 (0)