Skip to content

How to detect Tuya Device by using port 6668? #405

Answered by uzlonewolf
Ahmad-Agbaria asked this question in Q&A
Discussion options

You must be logged in to vote

Getting a response is going to depend on the device version. v3.4/v3.5 devices will not respond at all unless you successfully complete a 3-way handshake with the correct key first, v3.1 is going to use a different payload format, and v3.3 should respond like the device above.

That response is to a DP_QUERY with the wrong key. Something like this should get you there:

import tinytuya
import socket

dummy_payload = bytes(bytearray.fromhex('deadbeef112233445566778899aabbccddeeffb00bface112233feedbabe74f0'))
msg = tinytuya.TuyaMessage(0, tinytuya.DP_QUERY, 0, dummy_payload, 0, True, tinytuya.PREFIX_55AA_VALUE, False)
msg = tinytuya.pack_message(msg,hmac_key=None)

print( 'sending:', msg )
sock 

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@uzlonewolf
Comment options

@uzlonewolf
Comment options

@Ahmad-Agbaria
Comment options

Answer selected by uzlonewolf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants