Get Local Keys for Your Devices - iRayanKhan/homebridge-tuya GitHub Wiki

To get the local keys for your devices, you'll need an account on Tuya's IoT site. Don't be overwhelmed, there's a lot on that site but it's pretty easy to get what you need out of it. The free trial will give you enough access to the Tuya API to get the information you need, on up to 50 devices.

1 - Tuya Smart App

As a prerequisite, add all of your devices to the Tuya Smart app (iOS / Android)

2 - Sign up for an IoT account

Go to https://iot.tuya.com and click Sign Up

signup

  • Fill in your information
  • Make up a company name if you need to

signup-info

  • Check Agree to Terms
  • Click Agree
  • You'll be emailed a code, enter it

3 - Sign in at iot.tuya.com

4 - Create a cloud project

  • Click through the intro
  • On the sidebar click cloud, then projects
  • Click Free Trial under TRIAL EDITION

freetrial

  • Click Buy now in the new tab

buynow

  • Close the Tuya Value Added Service tab/popup
  • In the Tuya IoT Platform tab, click Subscribed to be taken back to Cloud -> Projects
  • Click create

create

  • Make sure you pick smart home PAAS and the correct region, this affects whether you will be able to access your devices in the following steps. Click create

createproject

  • Click Authorize for the recommended APIs

authorize

5 - Link devices registered in Tuya app to the IoT site

  • From your project, click the link devices tab, then Link devices by App Account, then Add App Account

addappaccount

  • In the Tuya Smart app, click me at the bottom, then the scan button, then scan your QR code

scan2

  • Confirm the sign in

6 - Get the keys for your devices

  • Go to the device list tab
  • Copy the device ID for your device

devices

  • In the sidebar, hover over "Cloud" and click on "API Explorer"

apiexplorer

  • In the sidebar, search for "get device information" endpoint and click on the highlighted option. (It should be under "General Devices management" section. Note: there is also another endpoint called "Get the device information" which will not work.)

  • In the "device_id" text field, paste in the device ID you copied and click "Submit Request"

  • In the "Response" section, there should be a property called local_key which is your local key.

localkey

7 - Video Tutorial