Announcement

Collapse
No announcement yet.

Node-Red and Tuya

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Node-Red and Tuya

    I have been playing around and managed some local control of Tuya devices.
    So far I can turn on and off!

    I am using node-red-contrib-tuya-local

    With msg.payload = {"set": true, "dps" : 1} I can turn devices on.

    I am trying to find the commands to change colour or scene in a Tuya bulb but so far with no success!

    Has anybody had success with commands other than on and off?

    #2
    I haven't looked at it yet, but I saw there's a Tuya Local integration for Home Assistant that might shed some light on other commands.

    https://github.com/rospogrigio/localtuya

    If you need help reading the Python code just let me know.
    "if I have seen further [than others], it is by standing on the shoulders of giants." --Sir Isaac Newton (1675)

    Comment


      #3
      Apparently you would need to determine the DPS setting to change to set the colour. Try adding an Inject node as set below. In the contrib's Issues it is suggested this may work. The biggest difference is that they appear to use JSON to set the values while the node as shown below is adding them as individual items. Done mostly so you can see what is being set and maybe change an individual item easier. THis should set DPS 20 to True and 24 to '00da03e803e8'

      Inject Node to Import:
      Code:
      [{"id":"5953c975c9b8758c","type":"inject","z":"a7065ccc9d946145","name":"","props":[{"p":"payload.multiple","v":"true","vt":"bool"},{"p":"payload.data.20","v":"true","vt":"bool"},{"p":"payload.data.24","v":"00da03e803e8","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"str","x":260,"y":400,"wires":[["bd5db63f819b2893"]]}]
      Click image for larger version

Name:	HS1.png
Views:	953
Size:	19.4 KB
ID:	1490236
      Karl S
      HS4Pro on Windows 10
      1070 Devices
      56 Z-Wave Nodes
      104 Events
      HSTouch Clients: 3 Android, 1 iOS
      Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

      Comment


        #4
        Additionally, this MAY work to set the light to 50% brightness and full red colour:

        Inject Node to Import:
        Code:
        [{"id":"833cfabbfb1ea0bc","type":"inject","z":"a7065ccc9d946145","name":"50% Brightness, Full Red ?","props":[{"p":"payload.multiple","v":"true","vt":"bool"},{"p":"payload.data.20","v":"true","vt":"bool"},{"p":"payload.data.21","v":"colour","vt":"str"},{"p":"payload.data.22","v":"500","vt":"num"},{"p":"payload.data.23","v":"0","vt":"num"},{"p":"payload.data.24","v":"00da03e803e8","vt":"str"},{"p":"payload.data.25","v":"000e0d0000000000000000c80000","vt":"str"},{"p":"payload.data.26","v":"0","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":322,"y":469,"wires":[["bd5db63f819b2893"]]}]


        Image:
        Click image for larger version  Name:	HS1.png Views:	0 Size:	37.2 KB ID:	1490244

        I found these from someone setting an Arlec RGB + CCT bulb (Tuya Smart Life compatible) via a different contrib. There are many more settings there for different colors and brightness levels.
        Karl S
        HS4Pro on Windows 10
        1070 Devices
        56 Z-Wave Nodes
        104 Events
        HSTouch Clients: 3 Android, 1 iOS
        Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

        Comment


          #5
          Originally posted by ksum View Post
          Apparently you would need to determine the DPS setting to change to set the colour. Try adding an Inject node as set below. In the contrib's Issues it is suggested this may work. The biggest difference is that they appear to use JSON to set the values while the node as shown below is adding them as individual items. Done mostly so you can see what is being set and maybe change an individual item easier. THis should set DPS 20 to True and 24 to '00da03e803e8'

          Inject Node to Import:
          Code:
          [{"id":"5953c975c9b8758c","type":"inject","z":"a7065ccc9d946145","name":"","props":[{"p":"payload.multiple","v":"true","vt":"bool"},{"p":"payload.data.20","v":"true","vt":"bool"},{"p":"payload.data.24","v":"00da03e803e8","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"str","x":260,"y":400,"wires":[["bd5db63f819b2893"]]}]
          Click image for larger version

Name:	HS1.png
Views:	953
Size:	19.4 KB
ID:	1490236
          That one didn't work :-(

          Comment


            #6
            Originally posted by ksum View Post
            Additionally, this MAY work to set the light to 50% brightness and full red colour:

            Inject Node to Import:
            Code:
            [{"id":"833cfabbfb1ea0bc","type":"inject","z":"a7065ccc9d946145","name":"50% Brightness, Full Red ?","props":[{"p":"payload.multiple","v":"true","vt":"bool"},{"p":"payload.data.20","v":"true","vt":"bool"},{"p":"payload.data.21","v":"colour","vt":"str"},{"p":"payload.data.22","v":"500","vt":"num"},{"p":"payload.data.23","v":"0","vt":"num"},{"p":"payload.data.24","v":"00da03e803e8","vt":"str"},{"p":"payload.data.25","v":"000e0d0000000000000000c80000","vt":"str"},{"p":"payload.data.26","v":"0","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":322,"y":469,"wires":[["bd5db63f819b2893"]]}]


            Image:
            Click image for larger version Name:	HS1.png Views:	0 Size:	37.2 KB ID:	1490244

            I found these from someone setting an Arlec RGB + CCT bulb (Tuya Smart Life compatible) via a different contrib. There are many more settings there for different colors and brightness levels.
            This one didn't work either. I have chores to do now but will play some more when I have time. Thanks for helping.

            Comment

            Working...
            X