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

tuya-cli not working with Teckin SP21 #64

Closed
FearNaBoinne opened this issue Feb 23, 2020 · 8 comments
Closed

tuya-cli not working with Teckin SP21 #64

FearNaBoinne opened this issue Feb 23, 2020 · 8 comments

Comments

@FearNaBoinne
Copy link

I finally managed to get my Teckin SP21's added (just kept trying, eventually they gave in!), but tuya-cli doesn't work for these.

Making a PCAP, I saw them report their protocol version as 3.3, but when I do a 'get all' I get a 'json obj data unvalid' message, and when trying to SET, it just doesn't do anything...

GET -ALL Debug output:

DEBUG=* tuya-cli get --ip *.*.*.* --id bfc*** --key 03*** --protocol-version 3.3 --all
  TuyAPI IP and ID are already both resolved. +0ms
  TuyAPI Connecting to *.*.*.*... +11ms
  TuyAPI Socket connected. +112ms
  TuyAPI GET Payload: +2ms
  TuyAPI { gwId: 'bfc***',
  TuyAPI   devId: 'bfc***' } +1ms
  TuyAPI Received data: 000055aa000000010000000a0000002c0000000158755a82b6eb11619e162139da95a818055c1bdc615e06518fe1d302d7f51fff30e61fb40000aa55 +32ms
  TuyAPI Parsed: +4ms
  TuyAPI { payload: 'json obj data unvalid',
  TuyAPI   leftover: false,
  TuyAPI   commandByte: 10,
  TuyAPI   sequenceN: 1 } +0ms
  TuyAPI GET Payload: +3ms
  TuyAPI { gwId: 'bfc***',
  TuyAPI   devId: 'bfc*** } +0ms
  TuyAPI Received data: 000055aa000000020000000a0000002c0000000158755a82b6eb11619e162139da95a818055c1bdc615e06518fe1d302d7f51fff0f2d61210000aa55 +11ms
  TuyAPI Parsed: +1ms
  TuyAPI { payload: 'json obj data unvalid',
  TuyAPI   leftover: false,
  TuyAPI   commandByte: 10,
  TuyAPI   sequenceN: 2 } +0ms
  TuyAPI Disconnect +1ms
json obj data unvalid
  TuyAPI Socket closed: *.*.*.* +4ms

SET Debug output:

DEBUG=* tuya-cli set --ip *.*.*.* --id bfc*** --key 03*** --protocol-version 3.3 --dps 1 --set 1
  TuyAPI IP and ID are already both resolved. +0ms
  TuyAPI Connecting to *.*.*.*... +11ms
  TuyAPI Socket connected. +45ms
  TuyAPI GET Payload: +2ms
  TuyAPI { gwId: 'bfc***',
  TuyAPI   devId: 'bfc***' } +0ms
  TuyAPI Received data: 000055aa000000010000000a0000002c0000000158755a82b6eb11619e162139da95a818055c1bdc615e06518fe1d302d7f51fff30e61fb40000aa55 +31ms
  TuyAPI Parsed: +4ms
  TuyAPI { payload: 'json obj data unvalid',
  TuyAPI   leftover: false,
  TuyAPI   commandByte: 10,
  TuyAPI   sequenceN: 1 } +0ms
  TuyAPI SET Payload: +3ms
  TuyAPI { devId: 'bfc***',
  TuyAPI   gwId: 'bfc***',
  TuyAPI   uid: '',
  TuyAPI   t: 1582473299,
  TuyAPI   dps: { '1': 1 } } +1ms
  TuyAPI Received data: 000055aa00000002000000070000000c0000000018cfc5da0000aa55 +74ms
  TuyAPI Parsed: +0ms
  TuyAPI { payload: false, leftover: false, commandByte: 7, sequenceN: 2 } +1ms
  TuyAPI Got SET ack. +0ms
  TuyAPI Pinging *.*.*.* +10s
  TuyAPI Received data: 000055aa00000000000000090000000c00000000b051ab030000aa55 +120ms
  TuyAPI Parsed: +1ms
  TuyAPI { payload: false, leftover: false, commandByte: 9, sequenceN: 0 } +0ms
  TuyAPI Pong from *.*.*.* +1ms
  TuyAPI Pinging *.*.*.* +10s
  TuyAPI Received data: 000055aa00000000000000090000000c00000000b051ab030000aa55 +41ms
  TuyAPI Parsed: +0ms
  TuyAPI { payload: false, leftover: false, commandByte: 9, sequenceN: 0 } +1ms
  TuyAPI Pong from *.*.*.* +0ms
  TuyAPI Pinging *.*.*.* +10s
  TuyAPI Received data: 000055aa00000000000000090000000c00000000b051ab030000aa55 +60ms
  TuyAPI Parsed: +1ms
  TuyAPI { payload: false, leftover: false, commandByte: 9, sequenceN: 0 } +0ms
  TuyAPI Pong from *.*.*.* +1ms
^C

Anything I can send to help debugging this?

@codetheweb
Copy link
Member

Hmm, the first thing that jumps out is that I've never seen an ID that starts like bfc.... Maybe Tuya's API reports the ID incorrectly or is stored in a field different from what @tuyapi/link looks at? Is the ID the same in the Tuya app?

@FearNaBoinne
Copy link
Author

I'll have to reset it and try from the app, I will let you know...

@FearNaBoinne
Copy link
Author

(BTW: All four devices I tested today have IDs like that!)

@FearNaBoinne
Copy link
Author

FearNaBoinne commented Feb 24, 2020

The TUYA-App on my iPhone shows exactly the same ID...

(There's actually one in there that ends with 'badafr0' 😆 )

@codetheweb
Copy link
Member

Does it seem possible that the device uses the "3.2" protocol? What do the UDP broadcast packets look like that are sent from the device?

@FearNaBoinne
Copy link
Author

I am not at home the rest of this week to test, but I am 99.9% positive I saw 3.3 in there... (The protocol version is one of the few clear-text items in there, after all!)

@FearNaBoinne
Copy link
Author

It is definitely protocol 3.3 being broadcast in the packets. Looking at them, the '3.3' in there is obvious!

If you want I can grab a few, but I'm not certain whether that would really help any...

@codetheweb
Copy link
Member

At this point I'm pretty sure your issue is the same one here: codetheweb/tuyapi#246. There seems to be a common theme of issues with Teckin devices, although at the end of the thread there's a Python port that claims to fix the issue - so you could try that. If it does work, I'll have to see what they did differently.

Closing this for now.

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