Skip to content

Commit

Permalink
Bug fix hexdigest[8:][:16] for 3.1 Devics
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonacox committed Dec 20, 2020
1 parent 1f4644c commit 917093b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tinytuya/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
Crypto = AES = None
import pyaes # https://github.com/ricmoo/pyaes

version_tuple = (1, 1, 1)
version_tuple = (1, 1, 2)
version = __version__ = '%d.%d.%d' % version_tuple
__author__ = 'jasonacox'

Expand Down Expand Up @@ -435,8 +435,9 @@ def generate_payload(self, command, data=None):
m = md5()
m.update(preMd5String)
hexdigest = m.hexdigest()
# some tuya libraries strip 8: to :24
json_payload = PROTOCOL_VERSION_BYTES_31 + \
hexdigest[8:][:24].encode('latin1') + json_payload
hexdigest[8:][:16].encode('latin1') + json_payload
self.cipher = None # expect to connect and then disconnect to set new

postfix_payload = hex2bin(
Expand Down

0 comments on commit 917093b

Please sign in to comment.