Discovering LocalTuya keys and DP's

As others have commented before, if you’re trying to setup LocalTuya as I’ve just been doing, you can discover the device id’s and local keys through the tuya iot platform website. Once you’ve got your device ids from the Devices tab in your project, you can use the API Explorer to find your keys. If you go to the Device Management section, it’s now called Query Device Details, using a device ID. This will show you your local key. However, it’s actually more useful that that. If you go to the Device Control section and Query Properties of a device, it returns JSON which actually lists out all of the DPs, and tells you which is which.

"result": {
    "properties": [
      {
        "code": "switch_1",
        "custom_name": "",
        "dp_id": 1,
        "time": 1688541767048,
        "value": false
      },
      {
        "code": "countdown_1",
        "custom_name": "",
        "dp_id": 9,
        "time": 1688541767048,
        "value": 0
      },
      {
        "code": "relay_status",
        "custom_name": "",
        "dp_id": 38,
        "time": 1688541767077,
        "value": "memory"
      }

If you then go to Device Control (Standard Instruction Set) section, it’ll even tell you the correct values for a select list for example if you do a “Get Specifications and Properties”

      {
        "code": "relay_status",
        "desc": "{\"range\":[\"power_off\",\"power_on\",\"last\"]}",
        "name": "上电状态",
        "type": "Enum",
        "values": "{\"range\":[\"power_off\",\"power_on\",\"last\"]}"
      },

So, no guesswork required setting up the DPs in LocalTuya :slight_smile:

Hope that’s helpful.

3 Likes

GREAT info

You saved my life

THANK YOU!

If someone is experiencing with cloud trial expiration issue, I have found an article which explains how to get the DPs ID using free Tuya Smart Home Basic Service. Title of article is Getting Tuya Device ID, Local Key and DP ID using Tuya Smart Home Basic Service.