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

Empty key from scan #553

Open
thewh1teagle opened this issue Nov 2, 2024 · 3 comments
Open

Empty key from scan #553

thewh1teagle opened this issue Nov 2, 2024 · 3 comments
Labels
tuya_device Support for specific Tuya Devices

Comments

@thewh1teagle
Copy link

When I scan the devices I get empty keys so can't control them.
I have heater, switch, and lamp.

"python .\test.py       
DEBUG:TinyTuya [1.15.1]

DEBUG:Python 3.12.5 on win32
DEBUG:Using pyca/cryptography 43.0.3 for crypto, GCM is supported

TinyTuya (Tuya device scanner) [1.15.1]

Scanning on UDP ports 6666 and 6667 and 7000 for devices for 18 seconds...

DEBUG:Listening for Tuya devices on UDP ports 6666, 6667 and 7000
DEBUG:Sending discovery broadcast from 'your_ip_address' to '255.255.255.255' on port 7000
DEBUG:Received valid UDP packet: {'from': 'app', 'ip': 'your_ip_address'}
New Broadcast from App at your_ip_address - {'from': 'app', 'ip': 'your_ip_address'}
DEBUG:Received valid UDP packet: {'from': 'app', 'ip': 'your_ip_address'}
DEBUG:Received valid UDP packet: {'ip': 'device_ip_1', 'gwId': 'device_gwId_1', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'productKey_1', 'version': '3.1'}
DEBUG:final payload_dict for 'device_gwId_1' ('v3.1'/'default'): { ... }
DEBUG:building command 10 payload=b'{"gwId":"device_gwId_1","devId":"device_gwId_1","uid":"device_gwId_1","t":"timestamp"}'
DEBUG:payload encrypted=b'...'
DEBUG:PollDevice: raw unpacked message = ...
DEBUG:decode payload=b'...'
DEBUG:decoded results='...'
Unknown v3.1 Device   Product ID = productKey_1  [Valid Broadcast]:
    Address = device_ip_1   Device ID = device_gwId_1   Version = 3.1  Type = default
    Status: {...}
DEBUG:Received valid UDP packet: {'ip': 'device_ip_2', 'gwId': 'device_gwId_2', 'active': 2, 'encrypt': True, 'productKey': 'productKey_2', 'version': '3.3'}
Unknown v3.3 Device   Product ID = productKey_2  [Valid Broadcast]:
    Address = device_ip_2   Device ID = device_gwId_2   Version = 3.3  Type = default

Scan completed in 18.0915 seconds

Scan Complete!  Found 2 devices.
Broadcasted: 2
Versions: 3.1: 1, 3.3: 1
Unknown Devices: 2

>> Saving device snapshot data to snapshot.json

DEBUG:Scan complete with 2 devices found"

removed sensitive data

@jasonacox jasonacox added the tuya_device Support for specific Tuya Devices label Nov 2, 2024
@jasonacox
Copy link
Owner

Hi @thewh1teagle - you will need to get the local keys before scan will be able to read the devices. Follow the instructions here: https://github.com/jasonacox/tinytuya?tab=readme-ov-file#setup-wizard---getting-local-keys

python3 -m tinytuya wizard

@thewh1teagle
Copy link
Author

@jasonacox

I thought that it can automatically login and fetch them.
Is there unofficial api/library that I can also login with username and password for fetching the keys automatically?
Thanks

@uzlonewolf
Copy link
Collaborator

https://github.com/blakadder/tuya-uncover will spit out a TinyTuya-compatible JSON file with -w devices.json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tuya_device Support for specific Tuya Devices
Projects
None yet
Development

No branches or pull requests

3 participants