Skip to content

Commit ea2385d

Browse files
committed
Prevent loop message on dulicated listeners rospogrigio#192
1 parent f365684 commit ea2385d

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

custom_components/localtuya/core/pytuya/__init__.py

+2-13
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
from cryptography.hazmat.backends import default_backend
5454
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
5555

56-
version_tuple = (2024, 3, 0)
56+
version_tuple = (2024, 4, 0)
5757
version = version_string = __version__ = "%d.%d.%d" % version_tuple
5858
__author__ = "rospogrigio, xZetsubou"
5959

@@ -596,12 +596,7 @@ def abort(self):
596596

597597
async def wait_for(self, seqno, cmd, timeout=5):
598598
"""Wait for response to a sequence number to be received and return it."""
599-
# This is for >= 3.4 devices [workaround].
600-
# if cmd == CONTROL_NEW and self.version >= 3.4:
601-
# seqno += 2
602599
if seqno in self.listeners:
603-
self.error(f"listener exists for {seqno}")
604-
return
605600
raise Exception(f"listener exists for {seqno}")
606601

607602
self.debug("Command %d waiting for seq. number %d", cmd, seqno)
@@ -983,11 +978,7 @@ async def exchange(self, command, dps=None, nodeID=None):
983978
self.debug("3.4 or 3.5 device: negotiating a new session key")
984979
await self._negotiate_session_key()
985980

986-
self.debug(
987-
"Sending command %s (device type: %s)",
988-
command,
989-
self.dev_type,
990-
)
981+
self.debug("Sending command %s (device type: %s)", command, self.dev_type)
991982
payload = self._generate_payload(command, dps, nodeId=nodeID)
992983
real_cmd = payload.cmd
993984
dev_type = self.dev_type
@@ -1100,8 +1091,6 @@ async def detect_available_dps(self, cid=None):
11001091
# in the ranges [1-25] and [100-110] need to split the bruteforcing in
11011092
# different steps due to request payload limitation (max. length = 255)
11021093

1103-
if not cid:
1104-
self.dps_cache = {}
11051094
ranges = [(2, 11), (11, 21), (21, 31), (100, 111)]
11061095

11071096
for dps_range in ranges:

0 commit comments

Comments
 (0)