File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ):
You can’t perform that action at this time.
0 commit comments