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

@tomcoleman @moseslsy
Not sure if you solved your issue as your post was a couple of months ago but if not…
Did/do you still have access to the Tuya IoT Core API? When you sign up to the Tuya IoT website (for me at least) you only get a 14 day trial so you wouldn’t be able to get the DP data if that trial has expired. However you can request that Tuya extends your trial period. I requested and got a 6 month extension from Tuya. Just make sure you make it clear you are an individual setting up their HA smart home and you should get the extension and then you should be able to pull the DP IDs.

1 Like

i ditched it for something allot more simple which i got working in 30mins

If anyone is still struggling to get the DPS values for your Tuya devices, here is the link to the Tuya IOT page (Get Device Specification Attribute) which gives you all the DPS valus for a given device_id:

https://eu.iot.tuya.com/cloud/explorer?id=p1638267961021eedpq9&interfaceId=1455796956101095400

Thanks. I managed to stumble upon the correct link to obtain the list of DP IDs

1 Like

This doesn’t seem to work anymore. On both, the DP_ID is missing

It is still working for me today, Adam.

It is possible they made a change to their website, then reverted to previous website.

Check that you are accessing the correct Data Centre - I got a “device not exist” response before i remembered to change to central Europe (in my case, yours may be different).
Also that you are using the “Get Device Specification Attribute” menu entry with capital “D” and capital “S”.

1 Like

So some of the DPs I see on the tuya iot console aren’t available to be mapped in TuyaLocal. Does that mean the device itself is not (yet) supported.

In such a scenario, can I run TuyaLocal and Tuya’s native integration on the same HA instance?

Hello friends. Nice topic!
So, there is my story:
Bought a used IP camera and a really cheap (don’t blame me for that) tuya-based RF-433 alarm system.
Found out about HA and how awesome it is, so now I’m trying to integrate all these stuff in it.
Installed local-tuya via HACS.
Discovered how to query local-key via tuya iot cloud and started to setup things in local-tuya.
Several DPs were found and after testing I could setup all of them accordingly (arm mode, siren volume, SOS switch, and so on)
But something was missing and that was the most important thing: something that tells when the alarm fires! None of the entities were changing values on that case. So, after going back to tuya iot, like you guys did, I also found out how to query the DP list, the current values and the descriptions (some of them in Chinese but that’s fine). And there were 5 extra DP that were not listed by local-tuya: 110, 115,116,120,121.
121, that’s our guy. the “history”! Could check that this is the one that changes when alarm is fired!
So, I manually added this guy and the other missing ones in localtuya setup (it took a while for me to find out that if you manually add DPs after a first setup it won’t work! You have to erase your device, start the config from scratch and add your extra DPs from the very first time!)
Now that those guys are there, especially 121, and there is another challenge: They are strings! (maybe that’s why localtuya ignored them).
How do I interpret them? I Added them as numbers but that’s not what they are.
Moreover, even if I now how to interpret those strings and what they mean, how do I make it readable by local-tuya?

image

@AxeBro we may be facing similar scenarios (see my post above). Have you tried to manually add missing DP in the device config step?

they are base64 encoded strings that will decode to json if you’re lucky or to a hex string if you’re not

I’ve been having a similar, albeit slightly different, issue setting up sensors within HA and LocalTuya. The LocalTuya docs say they don’t support sensors atm (and I’ve noticed a sensors pyscript isn’t included in the integration folder), although some device sensors do show up automatically, if not always enabled, when you add a device that has other more easily readable DP’s.

If you are code proficient, you can always add an edited sensors pyscript file to the integration (you can find the template for this within the Tuya IoT SDK which you can download here…tuya-iot-py-sdk · PyPI (or you can download it with python command… pip3 install tuya-iot-py-sdk) (p.s. if you go down this route I’d definitely be interested in acquiring your work, if you’re happy to share it?)). If you’re not proficient enough at coding (I’m not proficient enough to start messing around with an otherwise working integration and potentially cause unintended conflicts etc), I believe (I’m having a slightly different DP sensor issue so haven’t tested this myself), you can use the ‘developers tools’ section to get HA to use the DP string data to fire an event, for example a notification or activating another device (such as setting an indoor camera to start recording or setting off an alarm). As I said, I haven’t needed to do this so I don’t have first-hand experience of using this successfully or otherwise, but I do believe that it’s possible if you’ve been able to add the DP to Home Assistant.

I’ve got both running on my HA, although the Tuya integration doesn’t seem to actually do anything, but my LocalTuya only works properly with Tuya installed too :man_shrugging:t3: no idea why, it’s been confusing me for a while lol

Hi, thanks for this. However, the DP’s for my lights at least, are slightly different. DP21 chooses which mode the light is in white/colour/scene etc. DP22, as you’ve said, is for brightness 1-1000. DP23 is the White colour temperature in 2700-8000k and DP24 is the colour shown when the light is in colour mode, displayed in Hex decimal code (you can Google to find the hex code to get the perfect colour settings or you can use the device colour wheel once you’ve added it to HA)

As others have said, LocalTuya doesn’t make things easy for you when you’re just starting out on your Home Assistant journey lol.

I’ve switch over from Local Tuya to Tuya Local, there are already so many device integrations, best of all if your device is not yet supported, just send a request to add. All devices use a YAML file which can be tinkered with if you really want, or send feedback with improvement suggestion.
Already, TUYA LOCAL supports devices that LOCAL TUYA can not support and will not be supporting.

Key point, need to delete local tuya device to config in TUYA LOCAL.

1 Like

Thanks adding it in didn’t seem to help… in the sense that I didn’t see it available as an option in the dropdown when selecting dp’s after adding manually.

Yes, the DP’s in the localtuya integration are a pain. I’ve stopped using it now too. I thought it would give me more control but it’s bizarrely more effort for less functionality. The Tuya integration is MUCH more user friendly, with none of device set up issues. Even sensors work perfectly in it.

Yes me too now. It’s so much easier and works with every device I’ve tried so far (80 odd).

You mentioned the TUYA integration, is that correct or did you mean TuyaLocal Integration, I actually have both running TUYA which is cloud based and TuyaLocal is obviously local with a lot more features working than TUYA. I had some device that just worked and a couple that needed to be added, so a simple issues request with as much info as possible, and in no time the new devices were added (needed some minor debugging) so once done the next user has it already added in the library of devices. Fantastic !!!

I meant the “Tuya” integration that you can add directly from the HA → settings → “add integration” → “Tuya” (or homeassistant.io/integrations/tuya)

…rather than the “local tuya” you can download through HACS

When I originally installed it (as you can see from my first message in this thread a few weeks ago), I stupidly misread the instructions and had my Smart Life app and Tuya-IoT accounts using the same email address (I thought it meant you had to set up a new account on the tuya-IoT website, which I did, but should have given the instructions a 2nd read and I would have realised (as I did last weekend) that you need to use 2 different email addresses, otherwise the Tuya integration will install but won’t have any devices or entities). As soon as I changed the user email in the Smart Life app every device and scene from Smart Life appeared within the Tuya integration. I wish I hadn’t gone down the road of LocalTuya because it was a right pain messing around with DP’s and I couldn’t add any sensors. However, every device, including temp and humidity sensor etc etc just appeared and worked perfectly once I went with “Tuya”.

Apologies for the rather long (and perhaps “basic”…as the kids would say lmao) answer. Thought laying it all out might help other ppl (rather than yourself) who find this thread later so they don’t repeat my mistakes lol.

So, which one are you using?

As I previously indicated, I’m using both TUYA (cloud based) and TuyaLocal (not LocalTuya) this gives local control.
To give you an example, I have a smart Siren;
With the TUYA integration gives the following (very limited capability);

image

However, with the TuyaLocal integration I get the following functions;

Which are all the function I can get on the Smart Life app.
So, I suggest try TuyaLocal.