Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot connect to Gateway #530

Open
m0nk3y33 opened this issue Aug 12, 2024 · 5 comments
Open

Cannot connect to Gateway #530

m0nk3y33 opened this issue Aug 12, 2024 · 5 comments

Comments

@m0nk3y33
Copy link

I'm sorry for wasting your time, but i have problem with basic connection to the "Smart" Gateway.

So the problem is, when i try to connect using tinytuya.Device() (with parameters) i always get this type of error.

DEBUG:ERROR Check device key or version - 914 - payload: null
DEBUG:status() received data={'Error': 'Check device key or version', 'Err': '914', 'Payload': None}

I've tried to Remove Device, and paired again several times, but on the mobile app this working perfectly.

Here is my code that i used.

d = tinytuya.Device("bff08a9acbf0efbf76a0rl", local_key='aaabbbcccdddfff', dev_type="device22",persist=True)
d.set_version(3.4)
d.set_socketTimeout(20)

Thanks for all the help!

@uzlonewolf
Copy link
Collaborator

Are you sure it's a device22? Those generally are v3.3 devices which kinda-sorta act like v3.1 devices. Also, did you re-run the wizard after re-pairing? Re-pairing generates a new local key.

@m0nk3y33
Copy link
Author

The problem is, when i switch to device22 it clearing error no. 903 (?) Even if the device is "default". And i also re-runned wizard, like 3-4 times. Changed that key, if its necessary i can try to find the name of the device.

@m0nk3y33 m0nk3y33 closed this as not planned Won't fix, can't repro, duplicate, stale Aug 12, 2024
@m0nk3y33 m0nk3y33 reopened this Aug 12, 2024
@uzlonewolf
Copy link
Collaborator

What does a scan show?

@m0nk3y33
Copy link
Author

Scanned withoud -d Parameter
Wired Smart Gateway

   Product ID = keyyj3fy8x98arty  [Valid Broadcast]:
   Address = 192.168.0.20
   Device ID = bff08a9acbf0efbf76a0rl (len:22)
   Local Key = aaabbbcccddd (replaced)
   Version = 3.4  Type = default,
   MAC = aa:bb:cc:dd (also replaced)
   
   Polling 192.168.0.20 Failed: No response
   Scan completed in 18.0253 seconds  

Scan Complete! Found 1 devices.
Broadcasted: 1
Versions: 3.4: 1

And there is a few lines at the end with -d parameter

DEBUG:final payload_dict for 'bff08a9acbf0efbf76a0rl' ('v3.4'/'default'): {1: {'command': {'gwId': '', 'devId': '', 'uid': '', 't': ''}}, 7: {'command': {'protocol': 5, 't': 'int', 'data': {}}, 'command_override': 13}, 8: {'command': {'gwId': '', 'devId': ''}}, 9: {'command': {'gwId': '', 'devId': ''}}, 10: {'command': {}, 'command_override': 16}, 13: {'command': {'protocol': 5, 't': 'int', 'data': {}}}, 16: {'command': {}}, 18: {'command': {'dpId': [18, 19, 20]}}, 64: {'command': {'reqType': '', 'data': {}}}}
DEBUG:building command 10 payload=b'{}'
DEBUG:final payload: b'{}'
DEBUG:payload encrypted=b'000055aa000000030000001000000034c2c75ca0014655dd85b33e82a8a5ed72d2276811139c316867dda911d753d5436b13f575c94ca5e16933a3683c9ec6d60000aa55'
DEBUG:Received valid UDP packet: {'from': 'app', 'ip': '192.168.0.24'}
DEBUG:PollDevice: raw unpacked message = TuyaMessage(seqno=26131, cmd=16, retcode=1, payload=b'%\x94F\x88c\xb8\xa8\xda\x08\x96I\x90\xad\x8d34|\xd1\xe6\x83.\x14\xff_\x84p\xed\xf1\x19L\xcd\xb7', crc=b'\x01\x86P\x9e\x0e4\xf1dx\xfc}\xb9ME\xf5\x1a^B#D\x82\xe1\xf4\xfb\xc94z`\x0e\x929\xb4', crc_good=True, prefix=21930, iv=None)
DEBUG:decode payload=b'%\x94F\x88c\xb8\xa8\xda\x08\x96I\x90\xad\x8d34|\xd1\xe6\x83.\x14\xff_\x84p\xed\xf1\x19L\xcd\xb7'
DEBUG:decrypting=b'%\x94F\x88c\xb8\xa8\xda\x08\x96I\x90\xad\x8d34|\xd1\xe6\x83.\x14\xff_\x84p\xed\xf1\x19L\xcd\xb7'
DEBUG:decrypted 3.x payload=b'json obj data unvalid'
DEBUG:payload type = <class 'bytes'>
DEBUG:'data unvalid' error detected: switching to dev_type 'device22'
DEBUG:PollDevice: Device22 detected and updated (default -> device22) - Update payload and try again
DEBUG:final payload_dict for 'bff08a9acbf0efbf76a0rl' ('v3.4'/'device22'): {1: {'command': {'gwId': '', 'devId': '', 'uid': '', 't': ''}}, 7: {'command': {'protocol': 5, 't': 'int', 'data': {}}, 'command_override': 13}, 8: {'command': {'gwId': '', 'devId': ''}}, 9: {'command': {'gwId': '', 'devId': ''}}, 10: {'command': {'devId': '', 'uid': '', 't': ''}, 'command_override': 13}, 13: {'command': {'protocol': 5, 't': 'int', 'data': {}}}, 16: {'command': {}}, 18: {'command': {'dpId': [18, 19, 20]}}, 64: {'command': {'reqType': '', 'data': {}}}}
DEBUG:building command 10 payload=b'{"devId":"bff08a9acbf0efbf76a0rl","uid":"bff08a9acbf0efbf76a0rl","t":"1723521812","dps":{"1":null}}'
DEBUG:final payload: b'3.4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00{"devId":"bff08a9acbf0efbf76a0rl","uid":"bff08a9acbf0efbf76a0rl","t":"1723521812","dps":{"1":null}}'
DEBUG:payload encrypted=b'000055aa000000040000000d000000a42ff370510fa92efae87272495601af52e3737eb6b0f2af0eadc3b9efa4bdddf6801d9a389176b9734a1a8973410e970553600d06f4ffc56767b04b0eb72f56b2ca1b80d209fa7e7822ba90e89c655e887c54a109a28749bdbd3bb391388c3cadd05d936b3d81d5d0074167ae95a3f76a9e5aa79de8fd2434a09b98d78a250dfad7d35c3a624c45487f089701ef9b2d095dcbdcb0bfca7483a4b93dc33a1c812f0000aa55'
DEBUG:Received valid UDP packet: {'ip': '192.168.0.20', 'gwId': 'bff08a9acbf0efbf76a0rl', 'active': 2, 'ablilty': 0, 'encrypt': True, 'productKey': 'keyyj3fy8x98arty', 'version': '3.4', 'lan_cap': 5520, 'lan_seq': 4, 'lan_ablilty': 1, 'token': True, 'wf_cfg': True, 'clientLink': 31}

(Also the data like Address, Device ID, etc. are this same as in the beginning)

@uzlonewolf
Copy link
Collaborator

Everything looks fine, d = tinytuya.Device("bff08a9acbf0efbf76a0rl", address='192.168.0.20', local_key='aaabbbcccdddfff', version=3.4, persist=True) should do it. It's normal for a gateway to not respond to status() requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants