Tuyapi (node-red-contrib-tuya-smart-device) - how to GET a value

I use node-red and tuyapi to control my floor heater sensors. I use the node "tuya smart device".

Set orders work perfect like this one to set a new temperatur (it is json):
"dps": 2,
"set": {{payload}}

But how can i just read a value like dps:3 for the room temperatur? I must somehow use the get() operation but i tried nearly every way and nothign works. Can someone please help here?

I hope you understand my problem. If you need further info please tell me. Sorry I am pretty new to all this stuff :slight_smile:

This is the Info site for this: https://flows.nodered.org/node/node-red-contrib-tuya-smart-device

The SET ist the Standard so the code above works. But I can have the GET code to work :frowning:

Hi, I dont use that but looking at the src code, i can see you need to set msg.payload.operation to "GET"

so I imagine you send something like...

msg.payload = {
  "dps": 2,
  "operation": "GET"
return msg;

... to the node.

WoW thanks a lot!

I tried soemthing like this before but with a template and JSON which didnt work. Not i a funktion node with JS theis works :slight_smile:

Thanks a lot again!

1 Like

I'm facing the same problem, trying to read state of Tuya Smart plug using "tuya-smart-device".
I can set the state of the smart plug with:

msg.payload ={
dps : 1,
set : msg.payload
return msg;

I try and read the state of the plug with:

msg.payload = {
dps: 1,
operation: "GET"
return msg;

I also tried the same format as the answer that worked for the original question with different dps index numbers. Nothing has worked so far, any help would be greatly appreciated.

Just a suggestion but Steve-Mcl example had the object parts as strings i.e.

"dps" :


"operation" :

Try that

I have tried it in the exact way suggested. Unfortunately it didn't work and I receive the debug error: "json obj data unvalid"