LocalTuya - Using Tuya IoT Platform to obtain not only Local Keys, but also DP (data point) IDs

@umu_ugg has created an excellent LocalTuya fork which allows full auto discovery and local control of sub-devices behind a gateway too!

I can’t get my light working despite acquiring all the data points. The values return with (value:-1), despite this not showing in the tuya developer portal against the data points.

{
  "result": {
    "properties": [
      {
        "code": "switch_led",
        "custom_name": "",
        "dp_id": 20,
        "time": 1705434823728,
        "value": true
      },
      {
        "code": "work_mode",
        "custom_name": "",
        "dp_id": 21,
        "time": 1705434785014,
        "value": "scene"
      },
      {
        "code": "bright_value",
        "custom_name": "",
        "dp_id": 22,
        "time": 1705431400653,
        "value": 701
      },
      {
        "code": "temp_value",
        "custom_name": "",
        "dp_id": 23,
        "time": 1705431402915,
        "value": 758
      },
      {
        "code": "colour_data",
        "custom_name": "",
        "dp_id": 24,
        "time": 1705431364516,
        "value": "00b403e803e8"
      },
      {
        "code": "scene_data",
        "custom_name": "",
        "dp_id": 25,
        "time": 1705412782630,
        "value": "000e0d0000000000000000c80000"
      },
      {
        "code": "countdown",
        "custom_name": "",
        "dp_id": 26,
        "time": 1705412782630,
        "value": 0
      },
      {
        "code": "music_data",
        "custom_name": "",
        "dp_id": 27,
        "time": 1705412780833,
        "value": ""
      },
      {
        "code": "control_data",
        "custom_name": "",
        "dp_id": 28,
        "time": 1705412780833,
        "value": ""
      },
      {
        "code": "power_memory",
        "custom_name": "",
        "dp_id": 33,
        "time": 1705412782734,
        "value": "AAEAAAPoA+gD6AAA"
      },
      {
        "code": "mic_music_data",
        "custom_name": "",
        "dp_id": 42,
        "time": 1705412782630,
        "value": "010000016432000003e8007803e800f003e8003c03e800b403e8012c03e8"
      }
    ]
  },
  "success": true,
  "t": 1705438188949,
  "tid": "c9de147cb4b011ee847d96852008b4f4"

I get permission issue although I am logged into Tuya IoT account. Is there a separate subscription for this logging service?

IMO, like others have said, use the “Tuya” app that comes with HASS if you do not mind using a chinese cloud based app. It works pretty seemlessly and for me was very reliable.
If that bothers you and if you want to try to use a local tuya integration, use “TUYALOCAL” not “localTuya” .
The “Tuya Local” solution has good support and supports many of the Tuya devices and is much much easier to implement. If you have trouvle implementing your device, open a ticket and they are very good at righting a new driver pretty quickly.
I would not use “Local Tuya” in short it is very dificult to set up each device.

Don, I know it’s been a while but did you figure out what to do about this?

After maybe a year, my Atomi-branded string lights developed this problem that is all over the internet wherein one bulb schizes out and everything after it blinks different colors at max brightness, usually at 3 AM so the neighbors are maximally annoyed. Don’t buy Atomi.
So, I looked all over the place and splurged for the Enbrighten Café premium string lights which do seem more heavy duty than the Atomi. Anyway, they’re the dj category and seem to be communicating all their data in a json-formatted line on dp 28 (which according to the charts here should be for debugging). tuyalocal will only turn them on and off and localtuya calls them unavailable.

  "result": {
    "category": "dj",
    "functions": [
      {
        "code": "switch_led",
        "dp_id": 20,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "countdown_1",
        "dp_id": 26,
        "type": "Integer",
        "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}"
      },
      {
        "code": "control_data",
        "dp_id": 28,
        "type": "Json",
        "values": "{\"change_mode\":{\"range\":[\"direct\",\"gradient\"]}, \"bright\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1}, \"temperature\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1}, \"h\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":360,\"step\":1},\"s\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1},\"v\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1}}"

EDIT: it looks like “dj” is just code for a light source, not like you’re being the DJ at the party…

Hi all,

I added a LSC smart pet feeder to the Tuya app and noticed that a lot of entities/functions are missing which are available in the smart life app. I got into the API explorer and found the DP’s:

{
  "result": {
    "category": "sp",
    "functions": [
      {
        "code": "basic_flip",
        "desc": "{}",
        "name": "反面翻转",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "motion_sensitivity",
        "desc": "{\"range\":[\"0\",\"1\",\"2\"]}",
        "name": "移动侦测灵敏度",
        "type": "Enum",
        "values": "{\"range\":[\"0\",\"1\",\"2\"]}"
      },
      {
        "code": "basic_nightvision",
        "desc": "{\"range\":[\"0\",\"1\",\"2\"]}",
        "name": "红外夜视",
        "type": "Enum",
        "values": "{\"range\":[\"0\",\"1\",\"2\"]}"
      },
      {
        "code": "sd_format",
        "desc": "{}",
        "name": "存储卡格式化",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "motion_switch",
        "desc": "{}",
        "name": "移动报警开关",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "record_switch",
        "desc": "{}",
        "name": "SD卡录像开关",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "record_mode",
        "desc": "{\"range\":[\"1\",\"2\"]}",
        "name": "录像模式",
        "type": "Enum",
        "values": "{\"range\":[\"1\",\"2\"]}"
      }
    ],
    "status": [
      {
        "code": "basic_flip",
        "name": "反面翻转",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "motion_sensitivity",
        "name": "移动侦测灵敏度",
        "type": "Enum",
        "values": "{\"range\":[\"0\",\"1\",\"2\"]}"
      },
      {
        "code": "basic_nightvision",
        "name": "红外夜视",
        "type": "Enum",
        "values": "{\"range\":[\"0\",\"1\",\"2\"]}"
      },
      {
        "code": "sd_storge",
        "name": "获取存储卡容量",
        "type": "String",
        "values": "{\"maxlen\":255}"
      },
      {
        "code": "sd_status",
        "name": "存储卡状态",
        "type": "Integer",
        "values": "{\"min\":1,\"max\":5,\"scale\":0,\"step\":1}"
      },
      {
        "code": "sd_format",
        "name": "存储卡格式化",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "movement_detect_pic",
        "name": "移动检测",
        "type": "Raw",
        "values": "{}"
      },
      {
        "code": "sd_format_state",
        "name": "格式化状态",
        "type": "Integer",
        "values": "{\"unit\":\"\",\"min\":-20000,\"max\":200000,\"scale\":0,\"step\":1}"
      },
      {
        "code": "motion_switch",
        "name": "移动报警开关",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "record_switch",
        "name": "SD卡录像开关",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "record_mode",
        "name": "录像模式",
        "type": "Enum",
        "values": "{\"range\":[\"1\",\"2\"]}"
      }
    ]
  },
  "success": true,
  "t": 1723719954134,
  "tid": "570f826e5af611ef883136d89ae34f8e"
}

But i don’t see any options in Tuya to add these. I added local tuya but that also doesn’t seem to work, although the option in there so add DP’s. Now here I read people mentioning tuyalocal, but i can only find the integration called localtuya… Does anyone have a link of tuyalocal? or does someone know if these additional DP’s can be added in the tuya integration? Which would have my prefference.

I also created a seperate thread for this which can be found here: Tuya - How to map data points? - Pet feeder

Maybe more people would benefit from this is we can document the eassiest way to add DP’s.

Thanks!