localtuya icon indicating copy to clipboard operation
localtuya copied to clipboard

Support for RGB IC light strip and not discovered DPS from the test.py script

Open tommicarraro opened this issue 1 year ago • 9 comments

The problem

  • The light's behavior is not supported by localtuya. The leds of the strip can individually be controlled from the tuya app, but they require a Dreamlight scene mode, and the actual scene defined are not working.
  • Some DPS are not discovered by the debugging script, but in the Tuya iot Platform - Device Debugging Console are present and they are perfectly working.

Device Informations

Product Name: WIFI幻彩灯带 Product Category: dd

From the product category, it seems that the instruction set is the following: https://developer.tuya.com/en/docs/iot/strip-lights?id=Kaof81gv0qj9i

DP dump and missing DPS

dev_type type_0a:
    DPS [20] VALUE [True] -> ON/OFF 
    DPS [21] VALUE [scene] -> Mode 
    DPS [22] VALUE [380] -> Brightness 
    DPS [23] VALUE [105] -> Color Temp 
    DPS [24] VALUE [003c03e8000c] -> Color 
    DPS [25] VALUE [000e0d0000000000000000c80000] -> Scene
    DPS [26] VALUE [0] -> Timer 
    DPS [53] VALUE [3] -> Strip light pixel number set

Missing DPS that the test.py script is not able to discover but are present on the tuya iot "Device Debugging" console. To get them, I've followed the tutorial that Zigbee2MQTT.io provides at: https://www.zigbee2mqtt.io/advanced/support-new-devices/03_find_tuya_data_points.html#_8-find-your-data-point

and the data found are confirmed by official API through Postman https://developer.tuya.com/en/docs/iot/set-up-postman-environment?id=Ka7o385w1svns

    DPS [27] -> Music
    DPS [28] -> Adjust
    DPS [31] -> Fall Asleep
    DPS [32] -> Wake up
    DPS [33] -> Power memory
    DPS [34] -> Do not disturb mode
    DPS [51] -> Dreamlight scene mode
    DPS [52] -> Dreamlight built-in music sync

What is working, and what not with localtuya:

Mode Code on Tuya DP Type Values Supported?
ON/OFF switch_led 20 Boolean "{true,false}" Yes
Mode work_mode 21 Enum {"range": ["white","colour","scene","music"]} Yes (is setted)
Brightness bright_value 22 Integer {"min": 10,"max": 1000,"scale": 0,"step": 1} Yes
Color Temp temp_value 23 Integer {"min": 0,"max": 1000,"scale": 0,"step": 1} Yes
Color colour_data 24 String {"maxlen": 255} Yes
Scene scene_data 25 String {"maxlen": 255} No (see below "Dreamlight scene mode")
Timer countdown 26 Integer {"unit": "s","min": 0,"max": 86400,"scale": 0,"step": 1} No
Music music_data 27 String {"maxlen": 255} No (see below "Dreamlight built-in music sync")
Adjust control_data 28 String {"maxlen": 255} No
Fall Asleep sleep_mode 31 Raw {"maxlen": "255"} No
Wake up wakeup_mode 32 Raw {"maxlen": "255"} No
Power memory power_memory 33 Raw {"maxlen": "255"} No
Do not disturb mode do_not_disturb 34 Boolean "{true,false}" No
Dreamlight scene mode dreamlight_scene_mode 51 Raw {"maxlen": "255"} No: all the light effects from the remote and from the tuya app are codified here
Dreamlight built-in music sync dreamlightmic_music_data 52 Raw {"maxlen": "255"} No: all the music effects from the remote and from the tuya app are codified here
Strip light pixel number set lightpixel_number_set 53 Integer {"min": 1,"max": 1000,"scale": 1,"step": 1} No

Some Device Commands

Dreamlight scene mode

Mode on the app Code
Quiet - Film AQAAAAAAAABkAAAA
Quiet - Dating AQEAAAAAAABkACFk
Quiet - Sunset AQIAAACgAABkAB5QADxQABJV
Quiet - Christmas Eve AQMAAACAAABkAPBkAD1kAABkAK5kARNkAHhk
Active - Romantic AQQBKCgAAABkACMXAJJXAHgy
Active - Colorful AQUDZGQAAABkAABkAHhkAPBkAD1kAK5kARNk
Active - Dynamic AQYEZGQAAABkAABkADxkAHhkALRkAPBkASxk
Active - Dream AQcBPDwAAABkAQRQARhGARNk
Marquee - Rainbow AQgLMjKAAABkAABkAB5kADxkAHhkALRkAPBkASxk
Marquee - Flowing Water AQkKMjKgAABkAABkADxkAHhkALRkAPBkASxk

Dreamlight built-in music sync

Mode on the app Code
Rhythm AQEAAzIyAAAAZAAAZAB4ZADwZAA8ZAC0ZAEsZAAAAA==
Roll AQEBAjIyAQAAZAAAZAB4ZADwZAA8ZAC0ZAEsZAAAAA==
Energy AQECADIyAQAAZAAAZAB4ZADwZAA8ZAC0ZAEsZA==
Spectrum AQEDEDIyAQAAZAAAZAB4ZADwZAA8ZAC0ZAEsZAAAAA==

tommicarraro avatar Apr 17 '23 16:04 tommicarraro

I am slowly unfolding the actual encoding of the Dreamlight scene mode format:

def encode_simple_custom_base64(value):
    characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
    value = max(1, min(value, 64))
    encoded_char = characters[value - 1]
    return encoded_char


def encode_custom_base64(value):
    value = max(1, min(value, 100))
    quotient, remainder = divmod(value , 64)
    encoded_char = encode_simple_custom_base64(quotient) + encode_simple_custom_base64(remainder)
    return encoded_char

def main(name):
    header = "AckAZGT" - related to static dreamlight mode
    header += "A"  # color transition 
    header += "AA" # probably another setting
    header += encode_custom_base64(50) #brighness
    R = 60 #saturation
    G = 12 #color wheel value
    B = 64 #not very clear
    for i in range(15):
        header += 'A'
        header += encode_simple_custom_base64(G)
        header += encode_simple_custom_base64(R)
        header += encode_simple_custom_base64(B)
    print(insert_text_in_main_body(header))

I would really enjoy some propper support eventually, especially for the static mode so I can write home assistent scripts that trigger basic animations.

TheWiseWolfy avatar Dec 14 '23 21:12 TheWiseWolfy

I'm not quite sure but I think I've got at least a similar or maybe the same problem. If that's not on topic let me know.

It's a tuya controllable RGBIC strip, which doesn't seem to work correctly for me. I'm attaching some screenshots from my app and available configuration here, maybe that helps! Would love to see this integrated in local tuya correctly.

From what your "modes" (seems to be called "dynamic_mod" in the API) are saying these seem to be different ones to mine tho, being:

  • Breath
  • Flash
  • Jump
  • Gradient
  • Symphony
  • Trail
  • Popular
  • Stacking
  • Adjoint

Also I can choose from the following "scenes" in the app:

  • Reading
  • Get Up
  • Good Night
  • Starr(..something not readable)
  • Party
  • Film

Besides that I have the option for "dimmer" (just a color selection), "music" and "timer".

If there's anything else I could read from the Tuya IoT explorer that helps, let me know.

rialDave avatar Jan 15 '24 23:01 rialDave

Hi everyone. I'm also interested in taking full control of this led light strip. Please DM when you've had any success in setting indivudal segments through python/homeassistant control. Thanks!

heijligers avatar Jan 26 '24 23:01 heijligers

Hi, Im having the same issue (I think): LocalTuya: Detected most of my devices but one RGB Strip is not discovered. I tried to add it manually but I got this message: Connection to device succeeded but no datapoints found, please try again. Create a new issue and include debug logs if problem persists.

rriverob avatar Feb 05 '24 15:02 rriverob

I went on a little wild goose chase in trying to reverse engineer the individual segment control... No luck so far, but maybe it inspires one of you to the correct path.: https://chat.openai.com/share/69b96cbf-b258-4786-ab53-56b8b650ef59

CleanShot 2024-02-06 at 00 35 48@2x

heijligers avatar Feb 05 '24 23:02 heijligers

Also watching this in hopes for a solution. If only it was possible to flash WLED on the majority of these controllers!

ArcaneTemplar13 avatar Jul 03 '24 08:07 ArcaneTemplar13

following as same issue

thestumonkey avatar Aug 25 '24 10:08 thestumonkey

Looks like tuya has documented the protocol for this! https://developer.tuya.com/en/docs/iot/sdk?id=Kbhjudllricrx Odd issue is that DP 58 (number of LEDs) is not exposed, but I suppose this is perhaps set via the hardware and isn't something we'd need to play with.

thestumonkey avatar Aug 25 '24 11:08 thestumonkey

Also looks like there's some code on how to make scenes, but it's beyond my coding ability: https://github.com/tuya/tuya-panel-demo/tree/main/examples/lampLightString

thestumonkey avatar Aug 26 '24 09:08 thestumonkey