Replies: 6 comments 5 replies
-
|
It's very much non-trivial. Depending on the protocol version that particular device uses you will need a combination of md5, CRC32, HMAC-SHA256, AES-ECB and AES-GCM functions to properly encrypt the payload to control the device. Some devices also require a 3-way session key negotiation as well. You're looking at a couple thousand lines of code at a minimum. |
Beta Was this translation helpful? Give feedback.
-
|
Qsys lua has access to all of that. I’m already using hmac 256 and sha256 to encrypt the api calls. I think when using the tinytua server app I saw 3.3 but it is something I can verify. It’s a couple years older kinda custom device for a large foam party system that hasn’t been updated in awhile. If that is something I could find out would it be possible getting help understanding which byte arrays to construct and process to send this one command?
…________________________________
From: uzlonewolf ***@***.***>
Sent: Thursday, April 23, 2026 9:17:14 PM
To: jasonacox/tinytuya ***@***.***>
Cc: Torinth ***@***.***>; Author ***@***.***>
Subject: Re: [jasonacox/tinytuya] Tinytua in lua (Discussion #702)
It's going to depend on the device version. If it's v3.1 or v3.3 then you can pre-compute everything and just send the command. v3.4 and v3.5 use per-session keys and will require full crypt libraries.
—
Reply to this email directly, view it on GitHub<#702?email_source=notifications&email_token=AB5II2T2STL5HC7DXLK33Z34XLFCVA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCNRWHE2DOMZVUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVRTG633UMVZF6Y3MNFRWW#discussioncomment-16694735>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AB5II2UAMKX3OCOBA24TM5D4XLFCVAVCNFSM6AAAAACYESHCY6VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTMNRZGQ3TGNI>.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS<https://github.com/notifications/mobile/ios/AB5II2RMRC4VTX2A743XJFT4XLFCVA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCNRWHE2DOMZVUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVJTG633UMVZF62LPOM> and Android<https://github.com/notifications/mobile/android/AB5II2S3AKB6RGBDV2WKLBD4XLFCVA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCNRWHE2DOMZVUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVZTG633UMVZF6YLOMRZG62LE>. Download it today!
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
Awesome thank you very much! I can definitely run that and see what to send. I really appreciate the help!
…________________________________
From: uzlonewolf ***@***.***>
Sent: Thursday, April 23, 2026 9:34:31 PM
To: jasonacox/tinytuya ***@***.***>
Cc: Torinth ***@***.***>; Author ***@***.***>
Subject: Re: [jasonacox/tinytuya] Tinytua in lua (Discussion #702)
Edit to add: command line will look something like python3 -m tinytuya -d on --id 'eb...5'
—
Reply to this email directly, view it on GitHub<#702?email_source=notifications&email_token=AB5II2S2M7PBQFG36W6FFI34XLHDLA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCNRWHE2DQNRYUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVRTG633UMVZF6Y3MNFRWW#discussioncomment-16694868>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AB5II2RTBMNEKLGQZVP36DD4XLHDLAVCNFSM6AAAAACYESHCY6VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTMNRZGQ4DMOA>.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS<https://github.com/notifications/mobile/ios/AB5II2UBM6KTMFXOLRPBM2D4XLHDLA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCNRWHE2DQNRYUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVJTG633UMVZF62LPOM> and Android<https://github.com/notifications/mobile/android/AB5II2XWSIE7AIX6CFWU4VD4XLHDLA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCNRWHE2DQNRYUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVZTG633UMVZF6YLOMRZG62LE>. Download it today!
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
Do the local keys expire and have to be re freshed?
…________________________________
From: Jason Rainwater ***@***.***>
Sent: Thursday, April 23, 2026 9:35:50 PM
To: jasonacox/tinytuya ***@***.***>; jasonacox/tinytuya ***@***.***>
Cc: Author ***@***.***>
Subject: Re: [jasonacox/tinytuya] Tinytua in lua (Discussion #702)
Awesome thank you very much! I can definitely run that and see what to send. I really appreciate the help!
________________________________
From: uzlonewolf ***@***.***>
Sent: Thursday, April 23, 2026 9:34:31 PM
To: jasonacox/tinytuya ***@***.***>
Cc: Torinth ***@***.***>; Author ***@***.***>
Subject: Re: [jasonacox/tinytuya] Tinytua in lua (Discussion #702)
Edit to add: command line will look something like python3 -m tinytuya -d on --id 'eb...5'
—
Reply to this email directly, view it on GitHub<#702?email_source=notifications&email_token=AB5II2S2M7PBQFG36W6FFI34XLHDLA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCNRWHE2DQNRYUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVRTG633UMVZF6Y3MNFRWW#discussioncomment-16694868>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AB5II2RTBMNEKLGQZVP36DD4XLHDLAVCNFSM6AAAAACYESHCY6VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTMNRZGQ4DMOA>.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS<https://github.com/notifications/mobile/ios/AB5II2UBM6KTMFXOLRPBM2D4XLHDLA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCNRWHE2DQNRYUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVJTG633UMVZF62LPOM> and Android<https://github.com/notifications/mobile/android/AB5II2XWSIE7AIX6CFWU4VD4XLHDLA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCNRWHE2DQNRYUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVZTG633UMVZF6YLOMRZG62LE>. Download it today!
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
Awesome thanks!
…________________________________
From: uzlonewolf ***@***.***>
Sent: Friday, April 24, 2026 8:13:57 AM
To: jasonacox/tinytuya ***@***.***>
Cc: Torinth ***@***.***>; Author ***@***.***>
Subject: Re: [jasonacox/tinytuya] Tinytua in lua (Discussion #702)
No, they'll only change if you re-pair the device using the app.
—
Reply to this email directly, view it on GitHub<#702 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AB5II2TAMP5RNCX2EU2ZYPL4XNSBHAVCNFSM6AAAAACYESHCY6VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTMNZQGE4TMNY>.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS<https://github.com/notifications/mobile/ios/AB5II2VWQZ6I2IJHLH7I5Z34XNSBHA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCNRXGAYTSNRXUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVJTG633UMVZF62LPOM> and Android<https://github.com/notifications/mobile/android/AB5II2VRCTBDGE2BJEUTTHL4XNSBHA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCNRXGAYTSNRXUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVZTG633UMVZF6YLOMRZG62LE>. Download it today!
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
Well that solution worked perfectly! I was able to use the debug payload to create what I needed in qsys to turn the device on. Thanks a bunch for the help!
…________________________________
From: Jason Rainwater ***@***.***>
Sent: Friday, April 24, 2026 8:19:01 AM
To: jasonacox/tinytuya ***@***.***>; jasonacox/tinytuya ***@***.***>
Cc: Author ***@***.***>
Subject: Re: [jasonacox/tinytuya] Tinytua in lua (Discussion #702)
Awesome thanks!
________________________________
From: uzlonewolf ***@***.***>
Sent: Friday, April 24, 2026 8:13:57 AM
To: jasonacox/tinytuya ***@***.***>
Cc: Torinth ***@***.***>; Author ***@***.***>
Subject: Re: [jasonacox/tinytuya] Tinytua in lua (Discussion #702)
No, they'll only change if you re-pair the device using the app.
—
Reply to this email directly, view it on GitHub<#702 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AB5II2TAMP5RNCX2EU2ZYPL4XNSBHAVCNFSM6AAAAACYESHCY6VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTMNZQGE4TMNY>.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS<https://github.com/notifications/mobile/ios/AB5II2VWQZ6I2IJHLH7I5Z34XNSBHA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCNRXGAYTSNRXUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVJTG633UMVZF62LPOM> and Android<https://github.com/notifications/mobile/android/AB5II2VRCTBDGE2BJEUTTHL4XNSBHA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCNRXGAYTSNRXUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVZTG633UMVZF6YLOMRZG62LE>. Download it today!
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there! I work a lot with qsys for centralized integration and control of many devices and one thing they do not have a plugin for is controlling Tuya devices locally. The problem is their language of choice is lua. I figured out how to write a lua script to use their cloud integration for a single customer to control one device through the cloud and realized that only works for a 1 month trial.
I have the lua code to do the authentication and getting data about the device including local keys and I have the ability to use tcp sockets but I am having trouble deciphering what I need to just make a single request to set switch_1 to true.
Would it be possible to get help with writing this in lua or possibly a way to port the python library to lua?
Qsys is a world class integration system so I do think it would be a good thing to have Tuya control in it.
Beta Was this translation helpful? Give feedback.
All reactions