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

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.

How did you managed to get the local_key?

1 Like

Firstly, have you setup an account at the tuya-iot-developer-portal?
you can sign-up for free here @ https://auth.tuya.com/
then follow the instructions from here,
Tuya - Home Assistant

Do this first, once in, under the right menu the local key plus lots of other goodies are also available.

Hi. Thanks for answering.
Yes, I have the tuya-iot account and my devices are working well in HA but I have three thermostat and they show the temperature divided by 5.

What menu are you referring to? I can’t find it.


Thanks again!

So have you already linked your devices by your app account?
if not, follow the instruction that I indicated Tuya - Home Assistant
If you have, then in the left section hover over cloud and select Development,

  1. open/select the project you created on the right hand side,
  2. then select the device tab,
  3. copy the device id that you want to find local key,
  4. Again hover over cloud label on the left and select API Explorer,
  5. select on the left menu “Device Management” on left, then select the sub menu “Query Device Details”,
  6. Paste the device id in the box provided and click :Submit Request" button,
    And there you go, a whole lot of info, including the “local key”.
  7. Repeat 3 to 6 for the other devices
    I hope this helps.

Thanks so much for your detailed explanation!
This is what I got:


I guess I need a cloud development plan, right?

Yes. However, you can ask for them to extend your trial. Just say you’re only running your own smart home devices via home assistant and they will extend it for you.

1 Like

I found TuyaLocal annoying as it didn’t let me add sensors etc and was constantly having issues of automations not running because a device had gone offline for no reason. When I set up Tuya on its own and disabled TuyaLocal, every device and scene I had in Smart Life (plus anything I added later) appeared straight away, with all the correct sensor details and haven’t had a single issue since switching. Yes there’s the local vs non-local argument but for the sake of everything working all the time without set up issues I’m happy for it to not run locally, especially as I was using Google Home and Smart Life before HA so it doesn’t feel like I’m losing anything by not going local. Also running both means having duplicate devices and entities all over the place, so that’s a hassle lol.

1 Like

My experience with Tuya local seems to be the opposite to yours, I haven’t had any drop-out issues.
True that having both Tuya and Tuya Local can potentially double the entities, but this is temporary in my case, I intend to remove Tuya from HA and run only Tuya Local, since I’m happy with its performance now.
As I previously illustrated the control I have with Tuya is very limited for some devices when compared to Tuya Local, especially if the Tuya Local file (YAML) is fully working. I’ve had to provide feedback to the owner of Tuya Local for some minor fixes/improvements. Then others can benefit from the fixes/improvements.
I too use Google Home (Display) and HA together, and this works well, so I can give verbal commands to do things.

2 Likes

Zagal, did you ever create a project? These three components are needed.
step 6 In Configuration Wizard, make sure you add Industry Basic Service, Smart Home Basic Service and Device Status Notification APIs.
If you have, then it probably is due to expired, just reactivate/extend in the same menu to reauthorize.

1 Like

Yes, I had them but, for example, Smart Home Basic Service was expired but in service (?). Anyway, I asked for an extension of 6 months and will try again to get the local key.

About if its better LocalTuya or Tuya integration, I’m don’t know yet. I prefer things running locally, but Tuya integration is working well so far, with the only exception that the temperatures in thermostats are given divided by 5 so it is a lilttle bit annoying. I will give a better oppinion if I can make LocalTuya work.

Thanks again.

1 Like

Unfortunately until they give you the extension, I believe that finding the local key is impossible. As far as I know it’s only available automatically (if your Tuya IoT account is working) when you add devices to TuyaLocal, or through the device manager page on the Tuya IoT website.

That’s weird about the temps being divided . All my temp and humidity sensors popped up straight away and with all the readings correct. I obviously don’t know what thermostat you’re using, but with the settings shown in HA for my sensors’ entities, I’m guessing the issue isn’t there. My sensors also don’t show a relevant option in the Tuya/Smart Life app (unless your model adds extra options in Tuya) that would be transferred to HA and cause the divided reading. I know you can change those settings if you do a deep dive on the Tuya IoT website (and you can change the read out when installing via TuyaLocal) but you would know you’ve done that. I guess the only advice I can give is the standard IT response, try deleting the device from the Tuya/SL app, reset the device, and then see what happens when you add it back again. Hopefully when it’s added back to HA it will have the correct read out. Out of curiosity, does it show the correct temp in Tuya/SL??

On the local/not local bit, I do agree that it would be nice to have everything working locally (when you’re on your home network), however, imo TuyaLocal needs a lot of work before it’s ready for use. Again imo, there are too many issues adding devices, keeping them online, and types of devices that don’t work with it. Plus, whenever you go out any commands you send will be non-local anyway so I’ve opted for the simplicity (those DP settings and local key etc etc are a right pain, even if you’re on the DP readout page on the Tuya IoT site lol) and reliability of Tuya instead. But I’m a lazy bastard :joy::rofl::joy:

1 Like

Yes, I use Google displays and mini’s dotted around the house and Nabu Casa for voice commands too. Works well…although I can’t wait for Google to add Bard/conversational AI to the Google Assistant so it’s easier to talk more naturally to it. Apparently it’s in the works :partying_face::partying_face::partying_face:

epajfl00,
I am have trouble with “localtuya”(LT) so I am trying to switch over the “tuyalocal”(TL) based on all the feedback. I have all the DP’s, locals, ip’s, device id’s, secrets, uuid, etc recorded…but I am missing something along the way. I can’t seem to get TL to setup a device? I have deleted device it from LT integration thinking it can only be seen in one integration at a time, I can still see the same device in in the SmartLife app and the tuya IoT platform. Any suggestions? Can I set up TL through nabucasa or do I need to be on my .local network to set up? I have tried both, neither seem to work. I keep getting the message “unable to connect to your device with those details” message. Entering the info in the TL integration is straight forward once you have all the info but I am going wrong somewhere!?!
Can you provide any insight to my dilema?
Thanks!

I too have received the same message, usually means the device file does not exist, or your inputs are not correct.
To setup a device you only need to complete the input popup screen.

  1. Device Id, that you found in TUYA IOT site
  2. The local IP address of the device, so far I have not found that auto works, so input the known address.
  3. Local Key, that you found in TUYA IOT site
  4. Protocol Version, if 3.3 does not work try 3.1, 3.2, 3.4, 3.5, auto has not worked for me.

image

I don’t believe it has anything to do with nabucasa, since I don’t use it.
Just curious what device are you adding? brand/model
Do you know if it is already supported? ie. a YAML file exists for it
Is it listed in DEVICES.md file (supported devices) at the github site?
If not listed, it may still be still supported since it may be similar to another device that is supported, or just request device be added.

2 Likes

Well, with the Smart Home Basic Service extension I finally got the local_key! I wil try to make TuyaLocal work later.
Actually I only want it to see the correct values of the temperatures in the dashboard, I don’t care so much if automations are programmed with temperatures multiplied by 5.

I did already, but this doesn’t work.I have read here that this is a problem of some manufacturers and Tuya doesn’t want to make a fix for them, because is something this manufacturers had done wrong.

In Tuya app temperatures are shown correctly.

Me either! I will only use this devices to see the right number in the dashboards, like I said.

I hope that finally I can make it work, I will come again and say how it goes.

Thanks again.

Hi again.
I tried to configure the devices but no joy!
After filling all the data here:


All I get is this:
imagen
Tried many times but nothing happens.
The ip to fill in configuration is the one on the local network, is not?
Anyway I tried with the ip that appears in the data obtained from Tuya IoT and nothing happens either.
What I’m doing wrong?
Thanks.

EDIT:
I have a secondary router configured as repeater. After turn it off, the devices had been added succesfully!!
I don’t know if this was the problem, I decided to turn it off because I can get the ip of some two of the devices because they were connected to this secondary router.
Now the temperatures are shown correctly in the dashboards:
imagen
I’ll keep the automations working with the Tuya integration and lets see how it goes.
Thanks to everyone that helped!!

1 Like