Thanks @ezz9 I’ve been spending the past 2 days trying to find an easy way to get the “Tuya Localkey”, turns out there’s no easy way.
For the benefit of others, here’s a HOW TO: get the “Tuya Localkey” based on the steps i took and adapted from https://github.com/codetheweb/tuyapi/blob/d30ef9a1b2c51a016b3a2864cbe0b226071482c3/docs/SETUP.md
Three High Level Steps I did: (I’ve hashed the values in my keys so you can see the rough format and length to expect)
1. Get your device added to Tuya app and get Virtual ID from app
- Virtual ID from app: b######cb43a435330jyxu
2. Do the below steps on iot.tuya.com
- Create a new account on iot.tuya.com and make sure you are logged in. Go to Cloud -> Project in the left nav drawer and click “Create”. After you’ve created a new project, click into it. The access ID and access key are equivalent to the API key and API secret values need in step 6.
- Access ID/Client ID: 8######ca6xyfib0075x
- Access Secret/Client Secret: 6######702b84adc886d0e2b55a227b2
- Go to App -> App SDK -> Development in the nav drawer.
- Click “Create” and enter whatever you want for the package names (for the Android package name, you must enter a string beginning with com.).
- Go to Cloud -> Project and click the project you created earlier. Then click “Link Device”. Click the “Link devices by Apps” tab, and click “Add Apps”. Check the app you just created and click “Ok”.
- On the same page, click “API Group” on the left side. Change the status to Open for the following three API Groups by clicking “Apply” for each line, entering any reason, and clicking “OK”:
- “Authorization Management”,
- “Device Management”,
- “Device Control”,
- “User Management”,
- “Network Management”,
- “Data Service”
- “Device Statistics”.
3. Install and run uBuntu or any other Linux Distro
- Open a Terminal and run the below commands
- Sudo apt-get update
- Sudo apt install npm
- Sudo npm i @tuyapi/cli -g
- Sudo tuya-cli wizard
- Access ID/Client ID: 8######ca6xyfib0075x
- Access Secret/Client Secret: 6######702b84adc886d0e2b55a227b2
- Virtual ID from app: b######cb43a435330jyxu
-
Output:
[ { name: ‘Smart Garage Door Opener’,
id: ‘b######cb43a435330jyxu’,
key: ‘f######b4675c4e7’ } ]
With these steps you now have the Tuya local key: ‘f######b4675c4e7’ to run with the “localtuya” custom integration.
Tomorrow or tonight i’ll give it a go with “localtuya” and update if it all goes well.