Skip to content

Commit

Permalink
Rename scanner variable try_v35 to a more descriptive try_v35_with_v34
Browse files Browse the repository at this point in the history
  • Loading branch information
uzlonewolf committed Jun 24, 2024
1 parent 0690e8c commit 7259b8d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tinytuya/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def __init__( self, ip, deviceinfo, options, debug ):
self.timeo = 0
self.resets = 0
self.step = FSCAN_NOT_STARTED
self.try_v35 = False
self.try_v35_with_v34 = False
self.cur_key = None
self.hard_time_limit = time.time() + 30
self.initial_connect_retries = options['retries']
Expand Down Expand Up @@ -276,7 +276,7 @@ def v34_negotiate_sess_key_start( self ):
print('v3.4/5 trying key', self.ip, self.device.real_local_key)
step1 = self.device._negotiate_session_key_generate_step_1()
self.sock.sendall( self.device._encode_message( step1 ) )
if self.try_v35 and self.device.version == 3.4:
if self.try_v35_with_v34 and self.device.version == 3.4:
self.device.version = 3.5
step1 = self.device._negotiate_session_key_generate_step_1()
self.sock.sendall( self.device._encode_message( step1 ) )
Expand All @@ -303,7 +303,7 @@ def __init__( self, ip, deviceinfo, options, debug ):
self.retries = 0
self.keygen = None
self.brute_force_data = []
self.try_v35 = True
self.try_v35_with_v34 = True
self.v34_connect_ok = False

self.connect()
Expand Down Expand Up @@ -529,14 +529,14 @@ def read_data( self ):
prefix_offset = data.find(tinytuya.PREFIX_BIN)
if prefix_offset >= 0:
data = data[prefix_offset:]
self.try_v35 = False
elif self.try_v35 and self.deviceinfo['version'] == 3.4:
self.try_v35_with_v34 = False
elif self.try_v35_with_v34 and self.deviceinfo['version'] == 3.4:
prefix_offset = data.find(tinytuya.PREFIX_6699_BIN)
if prefix_offset >= 0:
if self.debug:
print('ForceScannedDevice: device is v3.5!')
data = data[prefix_offset:]
self.try_v35 = False
self.try_v35_with_v34 = False
self.deviceinfo['version'] = 3.5
self.device.set_version(3.5)
self.ver_found = True
Expand Down

0 comments on commit 7259b8d

Please sign in to comment.