# Tuya Device not connect

**URL:** https://discourse.nodered.org/t/tuya-device-not-connect/55049
**Category:** General
**Created:** [11 December 2021 16:03 UTC](https://discourse.nodered.org/t/tuya-device-not-connect/55049 "2021-12-11T16:03:54Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![pinie\_pinie](https://avatars.discourse-cdn.com/v4/letter/p/ccd318/32.png) [@pinie\_pinie](https://discourse.nodered.org/u/pinie_pinie)
#### Post date: [11 December 2021 16:03 UTC](https://discourse.nodered.org/t/tuya-device-not-connect/55049/1 "2021-12-11T16:03:54Z")

</div>

Hi there,

I want to evaluate and control a Duya thermostat via Node Red.  
It works via the APP. I have created a project on the Tuya platform and can find the thermostat and control it (e.g. temperature).  
I installed a Tuya Node in Node Red. Unfortunately I can't get a connection to the thermostat. I do not understand which ID or IP address I have to enter. Do services or similar have to be activated on the Tuya platform. I've already read. Unfortunately the descriptions are apparently out of date or I don't understand them. For example, you have to enter the internal IP address or the address of the Tuya platform.  
Can someone help how to configure the node?

Many Thanks

Thoralf

---

<div class="post-metadata">

### Author: ![Buckskin](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Buckskin](https://discourse.nodered.org/u/Buckskin)
#### Post date: [11 December 2021 21:55 UTC](https://discourse.nodered.org/t/tuya-device-not-connect/55049/2 "2021-12-11T21:55:35Z")

</div>

Not sure which Tuya node you are using as there is more than 1. I use `node-red-contrib-tuya-smart-device` which works well

The instructions for setting it up are here [node-red-contrib-tuya-smart-device (node) - Node-RED (nodered.org)](https://flows.nodered.org/node/node-red-contrib-tuya-smart-device)

but as described in these instructions you need to create a new account on [iot.tuya.com](https://iot.tuya.com/) and then follow the setup as shown here  
[tuyapi/SETUP.md at master · codetheweb/tuyapi · GitHub](https://github.com/codetheweb/tuyapi/blob/master/docs/SETUP.md)

This allows you to get the device id and the key which are required to access your device. The only tricky bit is creating a developer account on [iot.tuya.com](http://iot.tuya.com) but if you follow the instructions you should be OK

---

<div class="post-metadata">

### Author: ![pinie\_pinie](https://avatars.discourse-cdn.com/v4/letter/p/ccd318/32.png) [@pinie\_pinie](https://discourse.nodered.org/u/pinie_pinie)
#### Post date: [12 December 2021 12:48 UTC](https://discourse.nodered.org/t/tuya-device-not-connect/55049/3 "2021-12-12T12:48:16Z")

</div>

Hi there,

thank you so much for your information. It works for me now. From my point of view, the decisive hint was the installation of "npm i @ tuyapi / cli -g" on my Raspberry (via command line). Then I started the tuya-cli wizard and at the end received the "ID" and the "Key". For me it was a bit confusing what kind of data I should enter. The names weren't unique. In the end, however, the wizard recognized the device. Then I knew that the entries were correct. I wrote this data into the node mentioned and the node went "online".  
If I now change the temperature on the device or the APP, I get values displayed in Node Red. Even small controls are transferred to the device via Node Red. There are already some templates.  
So thank you very much. I had already given up hope.

Thoralf 😆 😆

---

<div class="post-metadata">

### Author: ![Buckskin](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Buckskin](https://discourse.nodered.org/u/Buckskin)
#### Post date: [12 December 2021 15:15 UTC](https://discourse.nodered.org/t/tuya-device-not-connect/55049/4 "2021-12-12T15:15:07Z")

</div>

No problem, glad you got it all sorted out.

---

<div class="post-metadata">

### Author: ![tonylane26](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tonylane26/32/9272_2.png) [@tonylane26](https://discourse.nodered.org/u/tonylane26)
#### Post date: [26 January 2022 14:33 UTC](https://discourse.nodered.org/t/tuya-device-not-connect/55049/5 "2022-01-26T14:33:16Z")

</div>

Since you both seem to have gotten this working recently,..  
I tried using the instructions to set up a developer account and register my Tuya devices using the Smartlife App. All went well except that when it came to adding my Devices, the only option was to download and use the "IoT Device Management App", which downloads as a .APK file. Others seemed to indicate that as soon as I linked my Smartlike Account to the Project, my devices would just appear, but they didn't. Unfortunately when I run the App installed from the .APK it crashes on my Galaxy S21, in fact it seems to crash the S21 itself!  
Since I have a project (Access Client) code and an Access Secret code, I tried using these plus a VirtualID from the Smartlife App in the wizard, but I got the "Device(s) failed to be registered! Error". Any clues would be much appreciated.  
Thanks.

---

<div class="post-metadata">

### Author: ![Buckskin](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Buckskin](https://discourse.nodered.org/u/Buckskin)
#### Post date: [27 January 2022 00:28 UTC](https://discourse.nodered.org/t/tuya-device-not-connect/55049/6 "2022-01-27T00:28:40Z")

</div>

Smartlife & Smartlink are 2 completely different things. Have you followed the steps in [tuyapi/SETUP.md at master · codetheweb/tuyapi · GitHub](https://github.com/codetheweb/tuyapi/blob/master/docs/SETUP.md)

You have to link your devices to the Smartlife app then create the account with Smartlink, I didn't have to download anything. Check that you followed the steps as described.

---

<div class="post-metadata">

### Author: ![tonylane26](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tonylane26/32/9272_2.png) [@tonylane26](https://discourse.nodered.org/u/tonylane26)
#### Post date: [24 March 2022 15:06 UTC](https://discourse.nodered.org/t/tuya-device-not-connect/55049/7 "2022-03-24T15:06:31Z")

</div>

Thanks for replying. I believe I followed the instructions as per the link. I did it a few times, starting from scratch each time. I will wait a month or two and try again. Hopefully they will move beyond installing an APK which crashes my phone.

---

<div class="post-metadata">

### Author: ![Buckskin](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Buckskin](https://discourse.nodered.org/u/Buckskin)
#### Post date: [24 March 2022 19:40 UTC](https://discourse.nodered.org/t/tuya-device-not-connect/55049/8 "2022-03-24T19:40:02Z")

</div>

Why are you installing an APK on your phone. Smartlife is installed on the phone, everything else is installed on the Pi (or other) that Node-red is running on

---

<div class="post-metadata">

### Author: ![TexasMom](https://avatars.discourse-cdn.com/v4/letter/t/9fc29f/32.png) [@TexasMom](https://discourse.nodered.org/u/TexasMom)
#### Post date: [25 March 2022 17:26 UTC](https://discourse.nodered.org/t/tuya-device-not-connect/55049/9 "2022-03-25T17:26:34Z")

</div>

I have a Raspberry Pi 4B, 8GB RAM. I recently set up Docker using IOTstack with the following containers: NodeRed, Mosquitto, InfluxDB, Grafana, and Portainer.

I followed the instructions (actually from a different website) to add the node-red-contrib-tuya-smart-device node to NodeRed through Manage Palette. All of my devices were transferred in from the Smart Life app. I do have a different issue, but let me see if I can help you get your devices added first.

@tonylane26 , on [iot.tuya.com](http://iot.tuya.com), please go to Cloud, My Services, Subscribed Services. Which services are listed there?

I have 5 subscribed services: IoT Core, Authorization, Smart Home Scene Linkage, Data Dashboard Service, and Device Status Notification. That last one, I believe was because I followed instructions from a different website. Not sure if you are missing that service, if it will help. But at least a place to start.

---

<div class="post-metadata">

### Author: ![TexasMom](https://avatars.discourse-cdn.com/v4/letter/t/9fc29f/32.png) [@TexasMom](https://discourse.nodered.org/u/TexasMom)
#### Post date: [25 March 2022 19:22 UTC](https://discourse.nodered.org/t/tuya-device-not-connect/55049/10 "2022-03-25T19:22:47Z")

</div>

[https://www.home-assistant.io/integrations/tuya](https://www.home-assistant.io/integrations/tuya)

These are the instructions that I used when set up my Tuya account and linked devices from Smart Life app. Just stop when it gets into the Home Assist specific stuff. I abandoned Home Assistant and am using the `node-red-contrib-tuya-smart-device`node directly in NodeRed now.

---

<div class="post-metadata">

### Author: ![tonylane26](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tonylane26/32/9272_2.png) [@tonylane26](https://discourse.nodered.org/u/tonylane26)
#### Post date: [26 March 2022 14:57 UTC](https://discourse.nodered.org/t/tuya-device-not-connect/55049/11 "2022-03-26T14:57:43Z")

</div>

Thanks for your input. I think authorizing the extra service "Device Status Notification" has helped, and the screenshots from the Home Assistant instructions confirmed the method I was using. I now get the same obstacle as before, but with some notifications.  
After I scan the QR code and hit confirm on the Smartlife App on my phone, I get this pop-up on my browser:

 ![Screenshot 2022-03-26 10.45.12 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/2/f2fe44523df21e8d3139d46fb01879f9ad9751b0.png)  
regardless of which options I choose, when I hit OK I get these two error messages at the top of the browser screen:  
 ![Screenshot 2022-03-26 10.44.03 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/4/34d0d23f461b03f97cbc09dfbf91d6cbceb70481.png)

I've tried this using the Smartlife App and the Tuya App (different accounts), and get the same result.

Any ideas are welcome. I feel I'm getting close! Thanks.

---

<div class="post-metadata">

### Author: ![pinie\_pinie](https://avatars.discourse-cdn.com/v4/letter/p/ccd318/32.png) [@pinie\_pinie](https://discourse.nodered.org/u/pinie_pinie)
#### Post date: [11 April 2022 12:57 UTC](https://discourse.nodered.org/t/tuya-device-not-connect/55049/12 "2022-04-11T12:57:03Z")

</div>

Hello,  
sorry i was offline for a while. I would like to revisit my problem.  
My thermostat works because the device is constantly online, i.e. it is present in the network with an IP address. The node also requires an IP address in the input field. In contrast, the smoke detector is not always online. I assigned it a fixed IP address in my router. But that's no use because he's not always there. The node tries to address the IP address. The result is: "not connect". When I unplug my thermostat, I got the same error message (IP address then also not available).  
My conclusion for the smoke detector is that I have to fetch the data directly from the Tuya cloud. You would theoretically have to use a different node. Does anyone have experience or can confirm my theory?  
For evidence, I would be very grateful!!!

Thoralf

---

<div class="post-metadata">

### Author: ![manjha](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/manjha/32/29301_2.png) [@manjha](https://discourse.nodered.org/u/manjha)
#### Post date: [23 May 2022 09:59 UTC](https://discourse.nodered.org/t/tuya-device-not-connect/55049/13 "2022-05-23T09:59:30Z")

</div>

In order to get a Smartplug working in my Domoticz/Nodered setup, I installed node-red-contrib-tuya-smart.  
Using tuya-cli, I created a list of all my devices (9 lamps, 1 panel heater, 3 smartplugs).  
I then created nodes for the 3 plugs, and inserted the local IP, device ID, and device key.  
This does not work.... when I deploy, it changes status to "connecting", but after a few seconds goes to "disconnected".  
I checked IP, ID and key. Also made sure the plugs are online.  
What can be wrong?

---

<div class="post-metadata">

### Author: ![msillano](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/msillano/32/17424_2.png) [@msillano](https://discourse.nodered.org/u/msillano)
#### Post date: [23 May 2022 16:02 UTC](https://discourse.nodered.org/t/tuya-device-not-connect/55049/14 "2022-05-23T16:02:54Z")

</div>

You rigth: some devices cannot be seen by [tuyapi](https://github.com/codetheweb/tuyapi#-notes).

I developped a IOT project to overcoming this limit (see [tuyaDAEMON](https://github.com/msillano/tuyaDAEMON)) and an example is exacly a [smoke.detector](https://github.com/msillano/tuyaDAEMON/wiki/mirror-device-'Smoke_Detector':-case-study) node-red integration.

It is possible to integrate in tuyaDAEMON **any** tuya device and **any** custom device (MQTT, 433 Mhz, USB-serial etc..).

I believe that you could find interesting ideas in the documentation.

In the hope that this will help you, cordially

m..s.

---

<div class="post-metadata">

### Author: ![Buckskin](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Buckskin](https://discourse.nodered.org/u/Buckskin)
#### Post date: [23 May 2022 23:08 UTC](https://discourse.nodered.org/t/tuya-device-not-connect/55049/15 "2022-05-23T23:08:28Z")

</div>

You only require either the Device IP or Device Virtual ID (Don't use both). I use the Device Virtual ID and the Device Key. Ensure you only have ONE node connected to each device (on any flow)

Apologies, I got the node wrong as I use `node-red-contrib-tuya-smart-device` although the use of the `tuyapi` is the same

---

<div class="post-metadata">

### Author: ![manjha](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/manjha/32/29301_2.png) [@manjha](https://discourse.nodered.org/u/manjha)
#### Post date: [24 May 2022 09:18 UTC](https://discourse.nodered.org/t/tuya-device-not-connect/55049/16 "2022-05-24T09:18:26Z")

</div>

Right. WHen I try to omit either the local IP or the device ID, the "smart" node throws an error.

Meanwhile, I got the tuyapi to work, more or less. It gives me an object with several values that I can trace back to match the Tuya app, but there are a lot of other values that I don't recognize.  
Is there a list or explanaition somewhere? I tried to find it on the Tuya developers site, but no luck...

In the configuration of the node I used all: local IP, ID and key.

---

<div class="post-metadata">

### Author: ![Buckskin](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Buckskin](https://discourse.nodered.org/u/Buckskin)
#### Post date: [24 May 2022 19:29 UTC](https://discourse.nodered.org/t/tuya-device-not-connect/55049/17 "2022-05-24T19:29:41Z")

</div>

Try the` node-red-contrib-tuya-smart-device` the `node-red-contrib-tuya-smart` has not been updated for a while. I couldn't get it to work either

---

<div class="post-metadata">

### Author: ![manjha](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/manjha/32/29301_2.png) [@manjha](https://discourse.nodered.org/u/manjha)
#### Post date: [26 May 2022 08:07 UTC](https://discourse.nodered.org/t/tuya-device-not-connect/55049/18 "2022-05-26T08:07:22Z")

</div>

Thanks, but that did not make it easier. I think I will try to get node-red-contrib-tuya-local to work. For now, I am getting a reliable response. I can switch the device on/off, and I get readings for status, current, power, voltage, IP, name. Plus a number of other values that I cannot place...

The values come out of the raw.dps object, and are labeled by numbers. I found the values mentioned above by comparing the values in the Tuya app on my Android phone with the output from a debug node, but there are still several that I don't recognize in the debug output. Also there are some values that I see in the Tuya app, but not in the debug output.  
Is there a list somewhere to decypher the dps.raw object?

edit: I found a list on [developer.tuya.com](http://developer.tuya.com), but there are values missing. For instance, the kWh Today value that I can see in the Tuya app is not there.  
[list](https://developer.tuya.com/en/docs/iot/1s?id=K9tp11c62qjq8)

---

<div class="post-metadata">

### Author: ![Buckskin](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Buckskin](https://discourse.nodered.org/u/Buckskin)
#### Post date: [26 May 2022 20:18 UTC](https://discourse.nodered.org/t/tuya-device-not-connect/55049/19 "2022-05-26T20:18:30Z")

</div>

This is my device output

```auto
{"1":true,"9":0,"18":0,"19":0,"20":2423,"21":1,"22":726,"23":30333,"24":20639,"25":1010}

```

and this is what they mean

```auto
DPS	Identifier Description Output Step	Scale	Range Unit	Data Type
1 switch_1 On or Off - true or false Command, Report
9 countdown_1 Countdown - 0 1 0 0-86400 s Command, Report
18 cur_current (current)	Current - 0 1 1 0-30000 mA Report
19 cur_power (power) Power - 0 1 1 0-50000 W Report
20	cur_voltage (voltage)	Voltage - 2321 1 1 0-5000 V Report

Factory Set and of no interest. All Report only
21	test_bit Test flag - 1 1 0 0-5 Report (For factory use)
22	voltage_coe Voltage coefficient - 726 1 0 0-1000000 Report (Set by factory for voltage measurement)
23	electric_coe Current coefficient - 30333 1 0 0-1000000 Report (Set by factory for current measurement)
24	power_coe Power coefficient - 20639 1 0 0-1000000 Report (Set by factory for power measurement)
25	electricity_coe Statistics coefficient - 1010 1 0 0-1000000 Report (Set by factory for voltage statistic measurement)

```

Note that the output of a device are selected by the manufacturer so may or may not include values on the developer web site. I am guessing that if your device is outputting 21 - 25 that these are NOT included in the app

---

<div class="post-metadata">

### Author: ![manjha](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/manjha/32/29301_2.png) [@manjha](https://discourse.nodered.org/u/manjha)
#### Post date: [27 May 2022 08:52 UTC](https://discourse.nodered.org/t/tuya-device-not-connect/55049/20 "2022-05-27T08:52:51Z")

</div>

This is the list I am getting in the raw.dps object:

> 1: true  
> 9: 0  
> 17: 112  
> 18: 0  
> 19: 0  
> 20: 2393  
> 21: 1  
> 22: 556  
> 23: 28222  
> 24: 15267  
> 25: 2730  
> 26: 0  
> 38: "memory"  
> 39: false  
> 40: "relay"  
> 41: false  
> 42: ""  
> 43: ""  
> 44: ""

I understand that the device manufacturer decides which fields to return. What puzzles me is the fact that I can see some fields in the Tuya app, which donot show up in the raw.dps object!

[Next page](https://discourse.nodered.org/t/tuya-device-not-connect/55049.md?page=2)
