Closed xyz-09 closed 1 month ago
Hi @xyz-09 -
python -m tinytuya scan -d
?ValueError: Incorrect AES key length (17 bytes) ValueError: Invalid key size (136 [bits]) for AES. (136 is 17 bytes * 8 bits)
It looks like your device key is wrong. How did you obtain it? python -m tinytuya wizard
? Looks like it could be a copy/paste error since it is 1 byte too long.
Yes its WS2815 but its led strip type :smile: my mistake
The controller: info from tuya developer panel:
Output from : https://github.com/jasonacox/tinytuya/discussions/260
Payload: b'{"ip":"xxx.xxx.x.xxx","gwId":"","uuid":"","active":2,"ablilty":0,"encrypt":true,"productKey":"","version":"3.5","token":true,"wf_cfg":true,"clientLink":3}'
I run simple script from example
import tinytuya
d = tinytuya.OutletDevice(
dev_id='DEVICE_ID_HERE',
address='IP_ADDRESS_HERE', # Or set to 'Auto' to auto-discover IP address
local_key='LOCAL_KEY_HERE',
version=3.3)
data = d.status()
print('set_status() result %r' % data)
d.turn_on()
d.turn_off()
I run
python -m tinytuya scan
and
python -m tinytuya wizard
But both unsuccessful.
ValueError: Incorrect AES key length (17 bytes) ValueError: Invalid key size (136 [bits]) for AES. (136 is 17 bytes * 8 bits)
It looks like your device key is wrong. How did you obtain it?
python -m tinytuya wizard
? Looks like it could be a copy/paste error since it is 1 byte too long.
There must have been something in it.
Today, I disconnected the controller from the app and from the power, then reconnected it to the app and to the power - thus obtaining a new key for the device. Additionally, I started a second controller Tuya, supporting protocol 3.3.
Once again, I ran python3 -m tinytuya wizard
Both devices were found without problem.
I copied the local_key
again - this time not from the terminal, but from the snapshot.json
file.
I managed to get the status of both devices, as well as turn them on and off - so it's a SUCCESS.
It's a pity I wasted the whole Saturday and Sunday trying to connect - without doing the basic test - turn it off and on, disconnect and reconnect the device again.
Your code is a great job :+1: You are amazing :+1: Thank you for taking the time to write and maintain your code. And Thank You for your help :1st_place_medal:
Thanks @xyz-09 ! I'll close this issue.
I have an issue, with debug mode i've got
It is WS2185 lightStrip with tuya :) controller
Protocol for conections is 3.5
I'v checked all crypto library: pyca/cryptography, PyCryptodomex, PyCrypto