hgross / node-red-contrib-tuya-smart

NodeRED nodes to get data from tuya smart devices (like smart plugs, bulbs, ...).
MIT License
43 stars 14 forks source link

Input format is limiting when controlling LED strips #6

Closed mturbutt closed 5 years ago

mturbutt commented 5 years ago

This is a very useful node, thanks!

I've been testing with Wifi Led Strips from Zemismart and am able to successfully set individual parameters to change state, colour mode, brightness, white-temp, led-colour, etc.

{
   "payload": {
      "data": {
      "devId": "xxxxxxxxxxxxxxxxxxxx",
      "dps": {
         "1": false,  //device state
         "2": "white",  //colour or white mode
         "3": 255,  //white mode brightness
         "4": 255,  //white mode temp
         "5": "ff003a00000000",  //colour (format = "rrggbb00hhssvv")
         "6": "00ff0000000000",
         "7": "ffff500100ff00",
         "8": "ffff8003ff000000ff000000ff000000000000000000",
         "9": "ffff5001ff0000",
         "10": "ffff0505ff000000ff00ffff00ff00ff0000ff000000"
       }
     },
     "deviceIp": "xxx.xxx.xxx.xxx",
     "deviceId": "xxxxxxxxxxxxxxxxxxxx",
     "deviceName": "led_name"
   },
   "_msgid": "f8de40b7.e39ed"
}

The issue is that I have to set each dps parameter individually with a request because the input node only allows:

{
    "set": "00ff0000000000",
    "dpsIndex": 5
}

Could the input node be allowed to change multiple dps values in a single request, ideally replicating the output format?

Many thanks.

lkwr commented 5 years ago

Hello mturbutt,

I had made a merge request with this feature (#7)! Now you are able to put an array to the payload and send all parameters in one message.

Example:

[{"set":true, "dpsIndex": 1},{"set":"colour", "dpsIndex": 1},{"set":"00ff0000000000", "dpsIndex": 5}]

Hope I could help you. 😃

Greetings Luke

mturbutt commented 5 years ago

Luke that is sensational! Thanks so much for the fast turnaround. I'll test this tomorrow.

hgross commented 5 years ago

Nice, thank you @lkwlkr ! Published as part of 1.2.0.

mturbutt commented 5 years ago

Works like a charm. Thanks @lkwlkr and thanks also to @hgross for merging in.