-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
parse data error #23
Comments
Have you tried using TuyAPI from a script directly? Your device may use the v3.3 protocol. |
I will try it soon. It’s from a brand recently sold in The Netherlands named “LSC”, which just uses the Tuya protocol and also works with the TuyaSmart app (apps also almost looks identical). Tomorrow I will try this out and see how the API works. |
Whatever I try, also to update the source of Tuya-Cli to debug stuff, I cannot get wrap around it. This is my latest response, after I reconnected to light to TuyaSmart app, and extracted the new
I fails with decrypting, but I don't know if it's because the data is bad, or the encryption or so. So i'm quite stuck on this. |
Ok, did you try using TuyAPI directly from a script and specifying the v3.3 version as I suggested? |
@codetheweb This is the response of a custom script against TuyAPI:
Using this almost unchanged sample code:
Command:
// EDIT 1/2 // In file data = this.cipher.decrypt(data); Followed by another TuyAPI Received data: 000055aa000000010000000a0000002c00000001e43a9f9fb09424634104f66db124feee8e3bf2aeee7be51f9590b6b57c1fe62e4f61356e0000aa55 +13ms
========== BEFORE this.cipher.decrypt ==========
<Buffer e4 3a 9f 9f b0 94 24 63 41 04 f6 6d b1 24 fe ee 8e 3b f2 ae ee 7b e5 1f 95 90 b6 b5 7c 1f e6 2e>
========== AFTER this.cipher.decrypt ==========
json obj data unvalid No idea how to move further, also no idea if the // EDIT 2/2 // Tested more in
const decipher = crypto.createDecipheriv('aes-128-ecb', this.key, '');
result = decipher.update(data, format, 'utf8');
result += decipher.final('utf8'); It's the literal content of const decipher = crypto.createDecipheriv('aes-128-ecb', this.key, '');
result = decipher.update(data, format, 'utf8');
console.log( 'RESULT 1' );
console.log( result );
result += decipher.final('utf8');
console.log( 'RESULT 2' );
console.log( result ); Results in: RESULT 1
json obj data un
RESULT 2
json obj data unvalid At this point it goes to
|
Closing this as issue was opened on TuyAPI. |
When running:
I get this response:
It keeps throwing
parse data error
.The text was updated successfully, but these errors were encountered: