Help linking a Tuya device to Vera via Node-Red


Anyone integrated Tuya devices using Node-Red with this node ?


I have created a virtual switch in Vera and using the MIOS node, I am able to turn on and off the Tuya device OK and that works currently.

However if possible, I would like to monitor the Tuya cloud service, so if someone uses the Smart Life app on their mobile device to operate the “light” (Galaxy Star Projector) then node-red will switch the Vera virtual switch to the correct ON of Off state etc.

However I can’t figure out how to do this part and if its possible ?

These screen shots are from the nodes webpage, their help isn’t very detailed and they have no code examples you can import.

@ElCid does this make any sense to you and do you use any Tuya devices with Vera that aren’t flashed with custom firmware?

There appears to be various different nodes available out there for Tuya / Smart Life.
I choose this one in particular, simply because when looking in Palette Manager it was the one that was most recently updated / actively being developed etc.


Also would like to be able to maybe choose primary colours via node-red.

I was able to get an output of this Galaxy Star Projectors schema.

data: object
dps: object
20: false
21: "colour"
22: 1000
24: "00f003e803e8"
25: "04464602007803e803e800000000464602007803e8000a00000000"
26: 0
deviceId: "xxxxxxxxxxxxxxxxxxxxxxxx"
deviceName: "Start Light"

I assume I need to use dps 21 for colour, but not sure how to send the colour codes ?

I used dps 20 for the switch in the example above, as I said I can turn on / off the Galaxy Star Project from Vera OK.

The other dps values I have no idea what they are for.

Just loaded node, will look at it tomorrow.
change colour, brightness, etc manually and see how those values change.

1 Like

Damn cloud.

What does this mean…

“Offline” looking in the Smart Life app right now.

I only have the one Tuya device and only one eWeLink device for good reason…

Can’t ping that devices static LAN IP address at the moment from my phone says request timed out.

I know the device is switched off as in the light it is currently off. But I’d expect it to still be in the WLAN.

This is the device in case anyone is wondering.

£21.83 30%OFF | WIFI Smart Star Projector Light LED Galaxy Projector Ocean Wave Night Light with Bluetooth Speaker Remote Voice Control Light US

Have you checked for tasmota support? Maybe you can convert it to full local control.

As far as i can tell you would have to set operation to “GET”
and poll for the dps you require.

As to being ofline, can you still turn on/off via node-red

How do I do that?

I doubt they support obscure devices like this Galaxy projector.

I dont think so no and I cant ping its LAN IP when it says its offline.

You have to turn the device off at the wall plug and back on again then its online again.

Looking in the Smart Life app it says the WiFi signal of the device is -58dbm

There is also a network test in the Smart Life app however that doesnt work. It says “Searched device is not nearby” whatever that means.

There is a decent WiFi signal in the room where the Tuya device is located, other WiFi devices don’t have any problems.

So I don’t know why the Tuya device keeps going offline.

Have you tried deleting device and re adding?

I take it this unable to connect started after you linked it in developer account at tuya.

Couldn’t say, I didn’t really use the device without it not being connected to the Tuya developer account.

Why is that a known issue?

I have not tried deleting the device and adding it again no not yet.

No just trying to understand what may be causing it.

I would add it again and check all is running as expected, before adding to tuya developer account.

OK trying to set this up now.



It just outputs what looks to be the same as the Schema output in the debug. It outputs all the information about the device not just the dps 20 value.


So I now need some way a function node ? To monitor that dps 20 field for true / false and then send a command to Vera to control the associated virtual switch etc.

This is its path["20"]


All is better than none.
You would have to poll the tuya device at interval to check device state,. Maybe every 15 seconds.

This node looks like it takes input from tuya, but is 2 years since any updates.

The node-red-contrib-tuya-smart-device node I am using currently seems unstable it often many times does not connect to the device on the Tuya cloud API and I see this:

msg : error
"Error: find() timed out. Is the device powered on and the ID or IP correct?"

I saw that other one you just linked too before, but its only for getting the status from Tuya device not actually controlling them ?

Thats what i mean you would use tuya–smart to get status and tuya-smart home to control them.

As to disconnect , maybe you have reached the limit of your router, and it can not handle any more wifi connections. Try turning off most of your other wifi devices and see if the connection stabilises to the tuya device.

Check for a device model and search “device x tasmota”

OK its finally connected currently but my flow isn’t working, the virtual switch in Vera is not being changed on or off.

I kinda copied what we did for the eWeLink Event Listener flow and how that controls a virtual switch in Vera.

Post the get status flow as i think the change and template are not right.

Here is the entire flow.

The top one detects when the virtual switch in Vera is turned on or off and then controls the device accordingly via the Tuya Cloud API. This works OK.

The bottom one is the GET status of the devices switch from the Tuya Cloud in an attempt to then set the Vera virtual switch to the correct state. This does not work.

[{"id":"95265c17.19791","type":"tab","label":"Tuya Smart Life","disabled":false,"info":""},{"id":"93abe3e2.4b81e","type":"mios-in","z":"95265c17.19791","name":"Star-Light - Vera Switch","server":"e0da9958.969478","item":"Kids Bedroom:Star-Light:Status","exact":false,"x":140,"y":80,"wires":[["b40531fc.dce14","8c7babe2.7cccb8"]]},{"id":"b40531fc.dce14","type":"switch","z":"95265c17.19791","name":"Turn On","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":340,"y":80,"wires":[["f418337b.e2915"]]},{"id":"f418337b.e2915","type":"change","z":"95265c17.19791","name":"msg.payload.true","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":80,"wires":[["a9b73949.bb9918"]]},{"id":"8c7babe2.7cccb8","type":"switch","z":"95265c17.19791","name":"Turn Off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":340,"y":120,"wires":[["4286369c.c19b38"]]},{"id":"4286369c.c19b38","type":"change","z":"95265c17.19791","name":"msg.payload.false","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":120,"wires":[["a9b73949.bb9918"]]},{"id":"4984016a.173d5","type":"tuya-smart-device","z":"95265c17.19791","deviceName":"Start Light","deviceId":"bfbfaa09add7bf7f6aegz2","deviceKey":"4583174a2360f033","x":890,"y":100,"wires":[["83c79d6b.1ab5a"]]},{"id":"a9b73949.bb9918","type":"function","z":"95265c17.19791","name":"dps 20 - Switch","func":"msg.payload ={\n dps : 20,\n set : msg.payload\n}\n\n/*\n\n */\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":720,"y":100,"wires":[["4984016a.173d5"]]},{"id":"a00cc913.c579a8","type":"comment","z":"95265c17.19791","name":"Vera Virtual Switch Monitor","info":"","x":150,"y":40,"wires":[]},{"id":"20aa281c.7d53f8","type":"inject","z":"95265c17.19791","name":"Get Switch Status","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"30","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"operation\":\"GET\",\"dps\":\"20\"}","payloadType":"json","x":150,"y":220,"wires":[["4d809ee0.58a36"]]},{"id":"99d5ae8b.df064","type":"debug","z":"95265c17.19791","name":"Debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":510,"y":180,"wires":[]},{"id":"83c79d6b.1ab5a","type":"debug","z":"95265c17.19791","name":"Debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1030,"y":100,"wires":[]},{"id":"34560901.a1f7c6","type":"comment","z":"95265c17.19791","name":"Star Light Switch Status","info":"","x":150,"y":180,"wires":[]},{"id":"2ac8d498.c928dc","type":"switch","z":"95265c17.19791","name":"dps 20 - True","property":"[\"20\"]","propertyType":"msg","rules":[{"t":"eq","v":"true","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":540,"y":220,"wires":[["b7af2d63.04925"]]},{"id":"b7af2d63.04925","type":"template","z":"95265c17.19791","name":"msg.payload.1","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"1","output":"str","x":720,"y":220,"wires":[["d449860a.e48b28"]]},{"id":"d449860a.e48b28","type":"mios-out","z":"95265c17.19791","name":"Vera Virtual Switch","server":"52df5198.cf2a1","item":"Kids Bedroom:Star-Light:Target","x":910,"y":220,"wires":[]},{"id":"81a602d7.dfa9d","type":"switch","z":"95265c17.19791","name":"dps 20 - False","property":"[\"20\"]","propertyType":"msg","rules":[{"t":"eq","v":"true","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":540,"y":260,"wires":[["245943bd.6ab9cc"]]},{"id":"245943bd.6ab9cc","type":"template","z":"95265c17.19791","name":"msg.payload.0","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"0","output":"str","x":720,"y":260,"wires":[["4f287088.6a0ae"]]},{"id":"4f287088.6a0ae","type":"mios-out","z":"95265c17.19791","name":"Vera Virtual Switch","server":"52df5198.cf2a1","item":"Kids Bedroom:Star-Light:Target","x":910,"y":260,"wires":[]},{"id":"4d809ee0.58a36","type":"tuya-smart-device","z":"95265c17.19791","deviceName":"Start Light","deviceId":"bfbfaa09add7bf7f6aegz2","deviceKey":"4583174a2360f033","x":350,"y":220,"wires":[["2ac8d498.c928dc","81a602d7.dfa9d","99d5ae8b.df064"]]},{"id":"e0da9958.969478","type":"mios-server","z":"","name":"Vera-Plus","host":"","port":"3480"},{"id":"52df5198.cf2a1","type":"mios-server","z":"","name":"Vera-Plus","host":"","port":"3480"}]


The template node works on my eWeLink flow OK and that does change the virtual switch on or off in Vera using the MIOS out node etc.

I think the problem is elsewhere likely with the “Switch” node, probably obtaining the boolean True / False of the devices switch from the Tuya Cloud API, this then has to be converted in to a 1 or a 0 for the virtual switch in Vera.