tinytuya: Tuya Protocol 3.5 - Globe lightbulb - Unexpected payload in scan & can't control

Hi, I have an RGB lightbulb that I’m trying to control, and although the wizard managed to pull the device information and local key from the cloud, I can’t control the device. The scan finds it, but gets an “unexpected payload”:

python -m tinytuya scan -nocolor

TinyTuya (Tuya device scanner) [1.9.1]

[Loaded devices.json - 1 devices]

Scanning on UDP ports 6666 and 6667 for devices (16 retries)...

*  Unexpected payload=%r
 b'\x13@\x8d(H\x7f`\xe3\xb9Muf<\x97Ej\xaf)@\xd4\xe0\xdf\x19\xfa\x04,\xa6Bm\xceK\x0f;fuE j\x01\x129S\n\xb6\xb0"\xeb\xc7\xf9mn\xa0\x15\xd2T\xa8f\x93\x85\x94\xa5pEi\xd0\xeeY\x1100\'\xfao\x946\x07\xeb\x99\xe8\x17]\x1e\xdc\x87\xa20\xf4\t\x8d\xd4\xc5$\xd9\r\x94\xea6\xcc\x0c\x8c\xfb\x9b\xce /A\xa0\xfb\xb9gn\xcb\x04\x0e\xd4Hb\xb6t\xb1\xbe\xbeO\x18w\xdb\xbf\xad\xf0\xe90>r\xa4\xa1\x1a\xdf\xd1O$f\x10\xa6\xf9gt\x07\x01\x82\xa9\xd4\x87\x8f\xbb\xc6u\xeb\'\xbe\xbbv6\xe0\xc6\xae\xf6\xa4\\\xe9}\x1e\xa359B\x15\xb3W\xeb\x14\x11=q;\x96\xac\xcc8\xd3ZF\x19m\xb7\xf6"\x17\x9bA\xfe=\x97\xdbL\n\xcdt\x1d\xe3\x95T>I\x94\xfa\xa7p\xb1\x87x\x97\xb7\xbb\x81\xfe\xd9gH\xf2\x0e\x86B\xd1'
Unknown v Device   Product ID =   [Unknown payload]:
    Address = 192.168.2.46,  Device ID = , Local Key = ,  Version = , MAC =
    No Stats for 192.168.2.46: DEVICE KEY required to poll for status
*  Unexpected payload=%r
 b'\x13@\x8d(H\x7f`\xe3\xb9Muf<\x97Ej\xaf)@\xd4\xe0\xdf\x19\xfa\x04,\xa6Bm\xceK\x0f;fuE j\x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x0e)\x02\xc1\xa2?5\xf1\xf02\x17N\xf6\xa1\xf3\x87\x81t\x0e\xa3(\x9d\xbf\x17\xa8jrE\x06\x1d\x92\xf0\xa8n\xd6\xa5\xf2\x82P\xa6;'
*  Unexpected payload=%r
 b'\xbb\xcfh+@\x0b\xe6t\x0c\x83H\'\xb1-\xdc\xb9D\xc2\xc7\x08\x8a\x13\xaf]\x8b4\xda\x17\x847\xdfn\xb7\x81v\xcf\xf2\';\x10\x1f\x1bA;(#\xca3r\x83U\xdeh\xa6\xfe>\xd2"YH\xaf\xf0\'\x9aV}\x08uIs\xdf\xd0\x12\x826\xae\x1e%){+{ijJk\x18\x9e\xfb\xdetp\xe3V2\xa1\x1f\x02\xef@\xee\x05\xc2\xddy\xb4\x88oF\x97\xc2\x04\x1aW<rJ $\x89.y\x0b\x89\x86\x81\xd6\x08i\xc0\x0b\xf7\xa3~\xd1\x98%\x11\xb9\xe7\xc0\xb7\x9c+\x16\xc0\xf7\xb9\xe1\xc3\xb0\x89d\xd2\xb2\x0b\x19\xa5\xd6s\x01\x0e,/v~=iVe\tv\xa4 A0\xf5\x02\xf1\xae$\x18\xfc\x91\xaf\xc9?\xf74\x19z\xe9\x0e)\x02\xc1\xa2?5\xf1\xf02\x17N\xf6\xa1\xf3\x87\x81t\x0e\xa3(\x9d\xbf\x17\xa8jrE\x06\x1d\x92\xf0\xa8n\xd6\xa5\xf2\x82P\xa6;'
*  Unexpected payload=%r
 b'RU8\xd9\t&\xec\xee]\xces6*:0\x02\xab\xe3\xfe\xa1\xf5\xf7a7\xde\xdc\xac\xb87\xa0\xc3\xe4\xc2\xfc\xff\xab.u\xeb\x93\x8bx\xc4>\xee\xafX%p\xb8\xa2\xd6L\x058M\xea\xb25\xdbs\x82\x0c\xad\xab\xfc\xa1`\xb3N7\xabM\xf4\xe9\x89D%So\xc0\x1fpG\xfc\xd5\xef\x1f\xabd\xda\xa0h\xbf\xf0cE\xdc)G\x87o\xe4\xc6=te\x1d\x0e:9\xf0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oj$K\x88-\x89\xde\x1c>\xf1\x080\x82\x8d\x15\xad\xdad"\x8ds\xdd\x18\xa5\xb5rku\x07\xcf\xc6\xb5\xc0\x0e\xffp\xfa\xe0B\x00s\x13\xbc\xe3\xe61(\xe6\xa3\x84a{?\x1b\'\xc6\xa9\x8a\xce~\xbd\xc0\xd4\r\\\xcb];\t\x80$\xcf\xd6\xa3\xb0\xa3\x8eO\xf1I\x9c\xb6\x0b\xc3Q\xbc\xdekR\x18\x00'
*  Unexpected payload=%r
 b'Df\xa6L\xa4\xfc\xa4\x18\xb5\xceJ\x8dN`.j\x8c\xaf\x90)4\xfa\r\xach%p\x7f\x1e9h\xc2\xd62kP\xb9\xa7\xc1\x01\x83\xde\n\xdf\xca\xd0|\x19\xcfZ~\xc4\xb3\xd9x-M\xa2qk\xa5\x9evz3\xa5\xa2/%\x06\xf4\x8c\xe4\x86a\x9f\xc0^.Y\xabf\xd2\xc0\xce\xadF&T\x1c\x01.\x831\x11\xf07\xcb\x95M\x83cX\xba4%L^\xb1\x96\x13\x0c"\xb1;\xcc/\x93R\xbeX3t8\x16\xc6v*\x1a\xfe9\xfe0<=\xfc\x80\x12\x9e%B\xae\x1a\xcci\xfb\xf57\xe3\x04\xa3\x1b\xe9\xbc@aB\xfd{d\xf5[l{h\xe3\xd5n|j\x8c\x82*\xfe\xa2O.\xf3w(\x86%wg\x9b\x83c*\xe4J\x8as\xd8}\xa48\xc4\xb4Id\xad\x9a\xf7\x08P\x07!\xbc\x8c\xd2\xf6\xcd\xb8\xd3j\xe3?\xa7O\xe2\x86%\xac\xfc;|\xa7\xa3)\x83n\xf1\xcb'

Scan Complete!  Found 1 devices.

>> Saving device snapshot data to snapshot.json

When trying to send commands, I get {'Error': 'Timeout Waiting for Device', 'Err': '902', 'Payload': 'Check device key or version'}. I tried all protocol versions and the “device22” device type, to no avail. Enabling debug mode only reveals a “timeout in _send_receive()” and no reply from the bulb. Control using tinytuya.Cloud works perfectly. I can ping the bulb’s IP with no problem.

I checked the datapoint codes on the website and they seem to match the “version 3.3 - light type (RGB)” table in the README. However, trying to set these values through code doesn’t work.

Any ideas? Thanks!

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 69 (14 by maintainers)

Commits related to this issue

Most upvoted comments

FYI, got positive results:

connected!
data: b'\x00\x00f\x99\x00\x00\x00\x00\\\xd3\x00\x00\x00\x04\x00\x00\x00P\x0c\x1c\xef\xea\xccm\xe9\x16e\xd0z\\X\xc6\xf6\xfc\xe4;R\xf4\xdf\x0fI\x88\x8e\xd64\xa7\x11b\xa2\x1b"\xaeBL\xd3[n\x17n\x96/\xceX\xa1\x1d\xbe%\x11\x1fu\xf7\xecB,ytr*\xf55y\xf9R\x82/\xc8\xd57\x89!h\x95\xb7\x86\x9c\x80\xf2b\x00\x00\x99f' in 0.05198383331298828
connected!
data: b'\x00\x00f\x99\x00\x00\x00\x00\xa9B\x00\x00\x00\x04\x00\x00\x00P\x80\x1fJ\xc1~\xce\xf7\xb8\x14a\xa6\x95Wi\xc9\xc1\\\x9f/"\x16\xfd\x12-\xde\x85v\xfd\x8b\x96\xb1\xc7\x97\x84\xc8\xff<\xff\x7f\xacv6&\x8bM\xb4\xf9\x0f\xfd\xb9\'\xa7\xdf/5\xcc\x88Q\xcf\x91\xa6\xbc\xa1\x1f\x94\xbe\xe3\xee6! \\\'\xe3\xa7\x8f\xd0\x86$Z\x00\x00\x99f' in 0.11254739761352539

Thank you for your help @uzlonewolf !

Got this today. You are right, finally have my first legit v3.5 device. 😂

SmartBulb Product ID = key8u54q9dtru5jw [Valid Broadcast]: Address = 10.0.1.94 Device ID = ************************** (len:22) Local Key = ************ Version = 3.5 Type = default, MAC = 18🇩🇪50:e7:12:64 Status: {‘20’: False, ‘21’: ‘white’, ‘22’: 596, ‘23’: 0, ‘24’: ‘00d603e803e8’, ‘25’: ‘000e0d0000000000000000c80000’, ‘26’: 0, ‘34’: False}

If anyone wants v3.5 devices, the bulbs I got from https://www.ebay.com/itm/395006526624 came with v3.5 (firmware is reporting V1.5.21).

Thank you … yeeaaayyy … more work 😃 … They should concentrate on Matter (like me) and not to invent new tuya protocols 😉

That’s great news! Thanks for helping test. The changes from @uzlonewolf have been merged into the main repo.

A huge thanks to @uzlonewolf ! 🙇 You are brilliant!

Please report any other issues. I’ll continue my standard battery of test (even though I don’t have a 3.5 device) and if all goes well, will be releasing tinytuya v1.10.0 to PyPI later tonight.

Well that PR does give correct output on python -m tinytuya scan and snapshot. Control also seems to work (using BulbDevice.set_colourtemp and BulbDevice.set_brightness

I’m also working on the snapshot issue, hopefully I’ll have a PR for that one soon

While the ZB gateway I have does not respond to v3.5 requests, it can sent them to v3.5 devices to support scene linkage. So, I wrote a script that pretends to be a v3.5 device to capture some traffic. Turns out my final session key generation is wrong; I’m trying to figure it out now.

That actually works! I think. At least there’s some data, not sure if it’s meaningful

connected!
data: b"\x00\x00f\x99\x00\x00\x00\x00\xe9~\x00\x00\x00\x04\x00\x00\x00Pk\xac\x89\xac#1T\x90\xbfy\xdb\xd6q^\x1e\xc5\xe7\x852k\x04\x11\x9fv\n\xdc\x97:d&|'q\x10\x9c\x1e\x08\xfa\xd00\x8b\xd8\x83Y\xe0k\xcfg\xe0\xe8\xc6\r\x06\x87\xf6nr\x10X\t\xb87\xb8\x08V\xf3\xd4\xad\x97\x14\xe6!\xaa\xfb\x0e)\x1e(\xa1.\x00\x00\x99f" in 0.020395755767822266
connected!
data: b'\x00\x00f\x99\x00\x00\x00\x00M\x10\x00\x00\x00\x04\x00\x00\x00PM-\x0b\xa5<\xe7p\xe0\xcc\x81\xa6d\xcf\xc5\xd5\xf2\xb1\x14\x91)\x8b\x93\xdf\xe2\x8a\x04p\xb4/p\nAJ\x96e\xff\xd0k\x0e\xf6Q\x9c\x0e3\x96}\xaa\x97\xd2{\xff\xd7\x93?\xca\xfb\x9f\xd6Qqh\x8b/\x80\xdbLvi\xf1@"Uj\xfeS\xd5\xfa\x16]\xf1\x00\x00\x99f' in 0.03944563865661621

Sure

Edit: if anyone’s just looking for an overview of the v3.5 protocol, check out https://github.com/jasonacox/tinytuya/discussions/260#discussion-4762410


That’s really odd. Can you post the output from:

import socket

clients = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
clients.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
clients.bind(("", 6667))
clients.settimeout(7)

for i in range( 8 ):
    data, addr = clients.recvfrom(4048)
    print( addr, '=', data )