-
Notifications
You must be signed in to change notification settings - Fork 186
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
Smart Keypad - ValueError: invalid padding length byte #438
Comments
That means it can't decrypt the response because the local key is wrong. I'd run the wizard again to make sure you have the latest key. |
@uzlonewolf thanks, that fixed it, however I obtained the key several times before through the Tuya IoT API, and that one seems to be in a different format? This one from tinytuya seems like HEX format, but the one from the API definitely isn't in HEX.
|
I'm not sure what you mean about the key being encoded. Older keys were hexadecimal strings - they're not encoded, the key just consists of 0-9 and a-f characters. Newer ones use random symbols in addition to the full a-z/A-Z/0-9 character set. I have no idea what IoT API you used so I'm not sure what data it's returning; with the inclusion of symbols it wouldn't surprise me if they're returning it as base64 or something. Edit to add: the final key should be exactly 16 characters/bytes long. As for using it in tinytuya, you should be able to do it but you're going to need to figure out what data it's expecting for the different DPs. Usually the easiest way to do this is to use the app to perform an action and then look at the device logs in the IoT website to see what it sent. Sometimes you can also open a persistent connection with tinytuya and just watch for async updates sent by the device. |
@uzlonewolf thanks. The device doesn't return any DPs though:
Any idea why that would be? |
Not all devices have persistent status, some only emit events asynchronously. I'd run a monitoring loop (i.e. https://github.com/jasonacox/tinytuya/blob/master/examples/monitor.py ) while entering something on the keypad to see if it sends an event. I just realized Amazon has these keypads, so I should have one to play around with later today. |
That's awesome! I got sick and my keypads are outdoors so I didn't manage to try monitoring yet. I hope it will be possible to access the device :) Adding temporary passwords programatically would be so useful. |
After poking at it a bit, it looks like you can add/change/delete codes locally but not view/list them. You may be able to pull a list from the cloud, I still need to check that. The DP description at https://developer.tuya.com/en/docs/iot/datapoint-reference?id=Kadhd28uy4rvp seems to be pretty accurate. |
@uzlonewolf That's awesome, it's enough for my needs (don't need a list). Would you mind sharing your example code if you still have it? Will save me some time as I'm new to tinytuya. |
@uzlonewolf do you happen to still have that code? |
I do apologize for the delay, I've been really busy lately. Unfortunately I have only had a chance to look at how they communicate and haven't had a chance to write any code yet. I'll try to get something put together shortly. |
Hey @uzlonewolf did you happen to have some time to look at this? Thanks! |
Unfortunately I was not able to get it done before leaving town late last month, but I get back later this week so hopefully I'll have something for you by the weekend. |
@uzlonewolf no worries, thanks for your time and effort! |
@uzlonewolf did you manage to check it out? |
I am interested in trying to add support for a Smart Keypad/Card+PIN device (product id s7qamihym60z5jro). I am aware it's not supported at this time. Would like to get some help with getting basic status / protocol / message encryption working and then I might be able to implement the functionality myself. When trying to do
status()
, I get the following error:ValueError: invalid padding length byte
. How could I successfully decode the message?Here is the debug output:
I'm happy to run any further commands and share more debug output.
The text was updated successfully, but these errors were encountered: