logo elektroda
logo elektroda
X
logo elektroda

[BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?

nethawk 3792 46
ADVERTISEMENT
  • #1 20610350
    nethawk
    Level 3  
    Hello,
    first thanks for your great work.
    I tried to flash 3 different types of LED lamps so far
    with openbeken. 1 works great, 2 not.
    In this thread i ask for help for my first problem LED:

    The LED panel is bought from amazon

    https://www.amazon.de/dp/B09XBNNHHV

    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?

    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED? [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED? [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?

    i identified the CBU chip, connected the serial adapter
    and saved the firmware.
    The BK7231Flasher was not able to extract the GPIO
    informations from the firmware.

    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED? [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED? [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED? [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED? [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?

    Then i flashed the firmware suggested by the flasher.
    Success, but now i have to configure the GPIO pins,
    where i don't have experiences.
    I already tried the GPIO doctor, but i didn't get
    any reaction from the lamp while wildclicking.

    From here i ask you how to go further.

    If i remember correctly, i could open a tuya developer
    account, flash back the original firmware, register the
    device with the tuya developer account and try there
    to get more infomartions about the device.
    Would i get there the necessary informations, is this the way
    to go ?

    I am really not sure.

    I am attaching some pics and the saved firmware.



    Greetings Torsten
  • ADVERTISEMENT
  • #2 20610362
    ferbulous
    Level 18  
    Trial and error by selecting all the pins as relays and toggle each one and see which color you’re getting.
    Then assign the pin as below

    Red - pwm 1
    Green - pwm 2
    Blue - pwm 3
    Cold white - pwm 4
    Warm white - pwm 5
  • #3 20610467
    p.kaczmarek2
    Moderator Smart Home
    The flasher does not fail, it extracts meaningful information.
    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?
    Following config section:
    Code: JSON
    Log in, to see the code

    indicates it's a TuyaMCU devices. Baud (9600 here) is a speed of UART communication, which is used by TuyaMCU.

    You could have done a TuyaMCU capture with original firmware:
    https://www.elektroda.com/rtvforum/topic3970199.html#20528459
    but you can also try just doing a simple autoexec for TuyaMCU:
    
    startDriver TuyaMCU

    and try to guess/play around with dpIDs, but I must admit, I haven't seen many LED TuyaMCU devices. So maybe original packets capture can help.

    In general, it's a bit strange device. As I just said, most of LEDs devices are not TuyaMCU, they are either raw PWM or "I2C" LED drivers like SM2135, SM2235, BP5758D, etc.

    You can see how a "classic" PWM based lamp looks like here:
    https://www.youtube.com/watch?v=YQdR7r6lXRY

    In case of your lamp, if you don't want to use TuyaMCU, you could maybe inspect the PCB and with some electronics knowledge you could figure out which LED drivers are used and interface them with PWM IOs of the BK7231N. Maybe that could work. Just remove TuyaMCU and convert device to raw PWMs.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #4 20611427
    nethawk
    Level 3  
    Thanks for your answers.

    First i will try the TuyaMCU way: playing with dpId
    I saw https://www.elektroda.com/rtvforum/topic3898502.html#20277227
    which seems to lead me to the dpIds:

    
    Info:CMD:[WebApp Cmd 'tuyaMcu_sendQueryState' Result] OK
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 05 14 01 00 01 01 25
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 12 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 20, dataType 1-DP_TYPE_BOOL and 1 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte:
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 20 with value 1 is not mapped
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 05 15 04 00 01 00 28
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 12 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 21, dataType 4-DP_TYPE_ENUM and 1 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte:
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 21 with value 0 is not mapped
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 16 02 00 04 00 00 01 6F 9D
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 22, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 367
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 22 with value 367 is not mapped
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 17 02 00 04 00 00 00 B6 E4
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 23, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 182
    Debug:TuyaMCU:TuyaMCU_ApplyMapping: id 23 with value 182 is not mapped
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 10 18 03 00 0C 30 30 33 38 30 33 45 38 30 33 43 30 C1
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 23 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 24, dataType 3-DP_TYPE_STRING and 12 data bytes
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 06 19 03 00 02 30 30 8D
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 13 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 25, dataType 3-DP_TYPE_STRING and 2 data bytes
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 00 00 01 01 04
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 0 (Hearbeat) with 8 bytes
    


    So i have the dpIds 20, 21, 22, 23, 24, 25

    20 seems easy, the on/off switch, so i created an autoxec.bat with

    
    setChannelType 20 switch
    linkTuyaMCUOutputToChannel 20 1 20
    


    ( startDriver TuyaMCU was already placed somewhere else, as the driver was already loaded )

    In fact this works, although the respnsiveness is sometimes not the best.

    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?

    Now i think the harder parts.

    dpId 21, dataType 4-DP_TYPE_ENUM and 1 data bytes
    raw data 1 byte:
    dpId 22, dataType 2-DP_TYPE_VALUE and 4 data bytes
    raw data 4 int: 367
    dpId 23, dataType 2-DP_TYPE_VALUE and 4 data bytes
    raw data 4 int: 182
    dpId 24, dataType 3-DP_TYPE_STRING and 12 data bytes
    dpId 25, dataType 3-DP_TYPE_STRING and 2 data bytes

    21: probably switch between RGB and white ?
    22: brightness ?
    23: Kelvin value of white ?
    24: RGB value in a string variable ?
    25: ?

    ... yes, sniffing the MCU traffic would be helpful now :-)

    Edit:
    yes, 21 switches the color modes, i use additionally in the autoexec.bat

    
    setChannelType 21 toggle
    linkTuyaMCUOutputToChannel 21 1 21
    


    According to https://tasmota.github.io/docs/TuyaMCU/#lighting this could be scenes too, but i have no interest (in the moment)

    Which ChannelType would you recommend for 22, 23, 24, 25 ?
    How would an entry in the autoexec.bat look like ?
  • #5 20611479
    p.kaczmarek2
    Moderator Smart Home
    Hmm, for the very start, you can just use ReadOnly or a TextField channel types, or just use console command:
    
    setChannel 15 200

    If you link channel 15 to some dpID, and use this command, then value 200 will be send to dpID linked to channel 15.
    You can use this during testing and development.

    And now, for those:
    
    dpId 22, dataType 2-DP_TYPE_VALUE and 4 data bytes
    raw data 4 int: 367
    dpId 23, dataType 2-DP_TYPE_VALUE and 4 data bytes
    raw data 4 int: 182
    

    Can you tell me what is the range of values accepted here? Min and max?

    And regarding this:
    
    dpId 24, dataType 3-DP_TYPE_STRING and 12 data bytes
    

    I think I will add a new channel type for you here. Don't worry, I am online every day, I will do my best to get your device running. It's just that.... it's a first TuyaMCU LED I ever saw. Your device is very unique, that's why we need to do some little work before it will be working.

    I will now update tuyaMcu_sendState command to also support strings. Do you happen to know (or is it in Tasmota docs?) how the values of dpID24 looks like here? If it's a 12 bytes of data, then it's not just an RGB string like "FF0000" for red, because it is just 6 bytes. Is it RGBHSV?
    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?
    With latest update (update your obk first), you can try:
    
    tuyaMcu_sendState 25 3 ff0000646464ff 
    

    this should send that string to dpID 25 (3 is a data type string). This will work without mapping. This is for testing only, I think. Let me know if that command works for you.
    Helpful post? Buy me a coffee.
  • #6 20612603
    nethawk
    Level 3  
    Hello,

    i played a little bit with dpId 22 and 23

    I did setup them with

    
    setChannelType 22 TextField
    linkTuyaMCUOutputToChannel 22 2 22
    setChannelType 23 TextField
    linkTuyaMCUOutputToChannel 23 2 23
    


    Setting 23 to a value sets the colormode (dpId 21) to 0 (white) and
    changes the colortemperature of white.
    The range is from 10 (ww) to 990 (cw).
    How did i find the range ? I did set the value to 2000, which
    is out of range. Then i changed the colormode in the webinterface
    to RGB and then back to white and switched off and on (by using dpId 20).
    It seems the TuyaMCU checks in this case
    the entered min-max values and sets the allowed max and min value, if it's out of range.
    So in my case, the value changed from 2000 to 990.

    Setting 22 to a value sets the colormode (dpId 21) to 0 (white) and
    changes the brightness of white.
    The range is from 50 (dark) to 1000 (light).

    tuyaMcu_sendState 25 3 ff0000646464ff


    forces a reaction of the lamp, it changes to warmwhite (or bright yellow ?).
    How did you generate "ff0000646464ff", so i can test other values ?

    Then i played around and forced an error. This brings up a new dpID 49, but how
    do i show the value of this dpId ?

    Info:CMD:[WebApp Cmd 'tuyaMcu_sendState 24 3 110000' Result] OK
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 0A 18 03 00 00 31 31 30 30 30 30 50 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 17 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 24, dataType 3-DP_TYPE_STRING and 0 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 49, dataType 49-DP_ERROR and 12336 data bytes
    


    I don't know, what dpIDs 24 and 25 contain.
    I saw a refernce at tasmota
    https://tasmota.github.io/docs/TuyaMCU/#lights

    which points to a
    TuyaMCU uses different types of RGB Hex format where the most recent is 0HUE0SAT0BRI0 (type 1) and the older being RRGGBBFFFF6464 (type 2). Depending on the MCU, code can be case sensitive.
    
    After enabling the RGB function check the TuyaReceived information and use TuyaRGB to configure and store the correct (or the closest) format:
    
    TuyaRGB 0 - Type 1, 12 characters uppercase. Example: 00DF00DC0244 (default)
    TuyaRGB 1 - Type 1, 12 characters lowercase. Example: 008003e8037a


    Probably this can be helpful ?
  • #7 20615058
    nethawk
    Level 3  
    Hello again,

    i ordered at amazon 2 of these lamps, so i flashed one lamp back
    with the saved tuya firmware before flashing with openbeken.

    I paired the lamp with the tuya app.
    Then i paired the app (and the included devices) in the tuya developer account (i did this
    to free my AirConditioner from the cloud some weeks ago, but using the LocalTuya plugin of Homeassistant).

    So we get some more acurate informations regarding my lamps:

    Device Information:

    {
      "result": {
        "active_time": 1686608321,
        "category": "xdd",
        "category_name": "Ceiling Light",
        "create_time": 1686608321,
        "gateway_id": "",
        "icon": "smart/icon/bay1629164570516GbnF/8d743070459bb12a7691ce82ac5b662b.png",
        "id": "bf9dcd9d9199f3a829yase",
        "ip": "77.13.89.13",
        "lat": "50.0000",
        "local_key": "obfuscated",
        "lon": "10.7100",
        "model": "",
        "name": "Inteligent Ceiling Lamp gg",
        "online": true,
        "owner_id": "158280677",
        "product_id": "na0ori1qa4xjh1ew",
        "product_name": "Inteligent Ceiling Lamp",
        "sub": false,
        "time_zone": "+02:00",
        "update_time": 1686608346,
        "uuid": "c9ab1693bd7ef5b6"
      },
      "success": true,
      "t": 1686611284762,
      "tid": "fc73ee73097511eebfbfa24bf1d21c99"
    }


    Get Device Specification Attribute
    the dpIds for writing (functions) and
    reading (status)

    {
      "result": {
        "category": "xdd",
        "functions": [
          {
            "code": "switch_led",
            "dp_id": 20,
            "type": "Boolean",
            "values": "{}"
          },
          {
            "code": "work_mode",
            "dp_id": 21,
            "type": "Enum",
            "values": "{\"range\":[\"white\",\"colour\",\"scene\",\"music\"]}"
          },
          {
            "code": "bright_value",
            "dp_id": 22,
            "type": "Integer",
            "values": "{\"min\":10,\"max\":1000,\"scale\":0,\"step\":1}"
          },
          {
            "code": "temp_value",
            "dp_id": 23,
            "type": "Integer",
            "values": "{\"min\":0,\"max\":1000,\"scale\":0,\"step\":1}"
          },
          {
            "code": "colour_data",
            "dp_id": 24,
            "type": "Json",
            "values": "{}"
          },
          {
            "code": "scene_data",
            "dp_id": 25,
            "type": "String",
            "values": "{\"maxlen\":255}"
          },
          {
            "code": "music_data",
            "dp_id": 27,
            "type": "String",
            "values": "{\"maxlen\":255}"
          },
          {
            "code": "control_data",
            "dp_id": 28,
            "type": "String",
            "values": "{\"maxlen\":255}"
          }
        ],
        "status": [
          {
            "code": "switch_led",
            "dp_id": 20,
            "type": "Boolean",
            "values": "{}"
          },
          {
            "code": "work_mode",
            "dp_id": 21,
            "type": "Enum",
            "values": "{\"range\":[\"white\",\"colour\",\"scene\",\"music\"]}"
          },
          {
            "code": "bright_value",
            "dp_id": 22,
            "type": "Integer",
            "values": "{\"min\":10,\"max\":1000,\"scale\":0,\"step\":1}"
          },
          {
            "code": "temp_value",
            "dp_id": 23,
            "type": "Integer",
            "values": "{\"min\":0,\"max\":1000,\"scale\":0,\"step\":1}"
          },
          {
            "code": "colour_data",
            "dp_id": 24,
            "type": "Json",
            "values": "{}"
          },
          {
            "code": "scene_data",
            "dp_id": 25,
            "type": "String",
            "values": "{\"maxlen\":255}"
          }
        ]
      },
      "success": true,
      "t": 1686611460413,
      "tid": "653343fc097611eea4908a3120fb3e2a"
    }
    


    current values while in color mode:
    (take note of the color data output)

    {
      "result": [
        {
          "code": "switch_led",
          "value": true
        },
        {
          "code": "work_mode",
          "value": "colour"
        },
        {
          "code": "bright_value",
          "value": 839
        },
        {
          "code": "temp_value",
          "value": 646
        },
        {
          "code": "colour_data",
          "value": "{\"h\":85,\"s\":950,\"v\":1000}"
        },
        {
          "code": "scene_data",
          "value": "{\"scene_num\":1,\"scene_units\":[]}"
        }
      ],
      "success": true,
      "t": 1686611912973,
      "tid": "72f4a7d3097711eebfbfa24bf1d21c99"
    }
    


    current values while in white mode:

    {
      "result": [
        {
          "code": "switch_led",
          "value": true
        },
        {
          "code": "work_mode",
          "value": "white"
        },
        {
          "code": "bright_value",
          "value": 542
        },
        {
          "code": "temp_value",
          "value": 324
        },
        {
          "code": "colour_data",
          "value": "{\"h\":85,\"s\":950,\"v\":1000}"
        },
        {
          "code": "scene_data",
          "value": "{\"scene_num\":1,\"scene_units\":[]}"
        }
      ],
      "success": true,
      "t": 1686612151828,
      "tid": "0152dd3d097811eebfbfa24bf1d21c99"
    }



    I hope, this helps, to bring us a step further.
  • #8 20615257
    p.kaczmarek2
    Moderator Smart Home
    This is very helpful information. Do you know which one of these is used by your device?
    
    TuyaMCU uses different types of RGB Hex format where the most recent is 0HUE0SAT0BRI0 (type 1) and the older being RRGGBBFFFF6464 (type 2). Depending on the MCU, code can be case sensitive.
    

    If not, you can just check them all and see which one is working ,right? Let me know.
    Helpful post? Buy me a coffee.
  • #9 20616970
    nethawk
    Level 3  

    I tried to use the TuyaMCUAnalyzer.exe to sniff the MCU traffic while changing a color.

    Change with the Tuya app in Color Mode to something like Magenta

    Received by WiFi module:
    55 AA	00	06		00 05	1504000101	25	
    HEADER	VER=00	Unk		LEN	fnId=21 Enum V=1	CHK	
    Received by WiFi module:
    55 AA	00	06		00 10	1803000C303136343033623630336538	02	
    HEADER	VER=00	Unk		LEN	fnId=24 Str V=30 31 36 34 30 33 62 36 30 33 65 38	CHK	
    


    Change to turquoise

    [code:1:f88edfb34b]Received by WiFi module:
    55 AA 00 06 00 05 1504000101 25
    HEADER VER=00 Unk LEN fnId=21 Enum V=1 CHK

    Received by WiFi module:
    55 AA 00 06 00 10 1803000C303039333033623630336538 03
    HEADER VER=00 Unk LEN fnId=24 Str V=30 30 39 33 30 33 62 36 30 33 65 38 CHK
    [/code:1:f88edfb]

    to some different color

    [code:1:f88edfb34b]Received by WiFi module:
    55 AA 00 06 00 10 1803000C303066393033623630336538 36
    HEADER VER=00 Unk LEN fnId=24 Str V=30 30 66 39 30 33 62 36 30 33 65 38 CHK [/code:1:f88edfb]

    change brightness in RGB mode

    [code:1:f88edfb34b]55 AA 00 06 00 05 1504000101 25
    HEADER VER=00 Unk LEN fnId=21 Enum V=1 CHK

    Received by WiFi module:
    55 AA 00 06 00 10 1803000C303066393033623630323464 30
    HEADER VER=00 Unk LEN fnId=24 Str V=30 30 66 39 30 33 62 36 30 32 34 64 CHK
    [/code:1:f88edfb]

    So we see, like expected ID 24 contains the color code. I would say, the color is in HSV format.

    What can I do next?
  • #10 20632786
    Anthrax6937
    Level 1  

    Hi,

    I have the same device and the same problems. Did you have success in controlling the color and brightness?
  • #11 20633721
    nethawk
    Level 3  

    Anthrax6937 wrote:

    Hi,

    I have the same device and the same problems. Did you have success in controlling the color and brightness?


    Not yet,
    I was on vacation for some days, so I will continue investigating in the near future.
    As you can see from the last posts, we are near finding out how to control the color part of this lamp.
  • #12 20633912
    p.kaczmarek2
    Moderator Smart Home
    I can help with C implementation. I could add some kind of interface so we have a colour picker on the WWW page and it sends a proper TuyaMCU packet, but I need to know how to construct that packet.

    So dpID 24 is colour in HSV, type string, Ascii code?

    
    55 AA 00 06 00 10 1803000C303066393033623630323464 30
    HEADER VER=00 Unk LEN fnId=24 Str V=30 30 66 39 30 33 62 36 30 32 34 64 CHK
    

    This as ASCII:
    30 30 66 39 30 33 62 36 30 32 34 64
    translates to:
    00f903b6024d
    and it's TuyaColor:

    
    TuyaMCU uses different types of RGB Hex format where the most recent is 0HUE0SAT0BRI0 (type 1) and the older being RRGGBBFFFF6464 (type 2). Depending on the MCU, code can be case sensitive.
    
    After enabling the RGB function check the TuyaReceived information and use TuyaRGB to configure and store the correct (or the closest) format:
    
    TuyaRGB 0 - Type 1, 12 characters uppercase. Example: 00DF00DC0244 (default)
    TuyaRGB 1 - Type 1, 12 characters lowercase. Example: 008003e8037a
    

    00f903b6024d looks like 008003e8037a, 12 lowercase characters

    It is currently possible to send that data with:
    
    // send string 
    tuyaMcu_sendState 25 3 ff0000646464ff 
    


    That's all I know so far, which brings the question, how to correctly format this string with HSV data?

    What is the meaning of each of the characters here: 00f903b6024d

    Is it:
    
    00f9 03b6 024d 
    0080 03e8 037a
    0HUE 0SAT 0BRI0 
    

    It kinda matches but what is that extra 0 doing? Is this a typo in Tasmota docs?

    I also looked at Tasmota code itself:
    https://github.com/arendst/Tasmota/blob/1e19e...smota_xdrv_driver/xdrv_16_tuyamcu_v2.ino#L492
    They seem to have it implemented here:
    Code: C / C++
    Log in, to see the code

    My TuyaMCU driver is totally, totally different, but we can at least check how do they order bytes in that string.

    It seems that type 1 is indeed hue say bri, each 4 bytes (first byte is 0):
    
                case 1: // Lowercase Type 1 payload
                  snprintf_P(hex_char, sizeof(hex_char), PSTR("%04x%04x%04x"), hue, sat * 10, bri * 10);
    


    They also seem to... scale values from 0-255 to 0-100, but only for sat and bri?
    
          light_state.getHSB(&hue, &sat, &bri);
          sat = changeUIntScale(sat, 0, 255, 0, 100);
          bri = changeUIntScale(bri, 0, 255, 0, 100);
    

    So the hue is [0,359] range, and sat and bri are in [0,100] ranges

    So I added a little function:
    https://github.com/openshwprojects/OpenBK7231...mmit/5a4eac37beae67f9cdc77e719a8a2f46732a0f28
    Usage:
    
     tuyaMCU_sendColor dpID red01 green01 blue01 tuyaRGB1
    


    
    tuyaMCU_sendColor 24 1 0 0 1
    

    will send red color:
    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?
    encoded as:
    0000 03e8 03e8

    now, can anyone play around with it and check if it works correctly?
    Helpful post? Buy me a coffee.
  • #13 20634848
    nethawk
    Level 3  
    p.kaczmarek2 wrote:
    I can help with C implementation. I could add some kind of interface so we have a colour picker on the WWW page and it sends a proper TuyaMCU packet, but I need to know how to construct that packet.

    So dpID 24 is colour in HSV, type string, Ascii code?


    I think so too.

    p.kaczmarek2 wrote:

    Is it:
    
    00f9 03b6 024d 
    0080 03e8 037a
    0HUE 0SAT 0BRI0 
    

    It kinda matches but what is that extra 0 doing? Is this a typo in Tasmota docs?


    I don't think it's a typo, but i only can guess:
    - some sort of delimeter ?
    - bring it to the right string length ?

    p.kaczmarek2 wrote:

    They also seem to... scale values from 0-255 to 0-100, but only for sat and bri?
    
          light_state.getHSB(&hue, &sat, &bri);
          sat = changeUIntScale(sat, 0, 255, 0, 100);
          bri = changeUIntScale(bri, 0, 255, 0, 100);
    

    So the hue is [0,359] range, and sat and bri are in [0,100] ranges

    So I added a little function:
    https://github.com/openshwprojects/OpenBK7231...mmit/5a4eac37beae67f9cdc77e719a8a2f46732a0f28
    Usage:
    
     tuyaMCU_sendColor dpID red01 green01 blue01 tuyaRGB1
    


    
    tuyaMCU_sendColor 24 1 0 0 1
    

    will send red color:
    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?
    encoded as:
    0000 03e8 03e8

    now, can anyone play around with it and check if it works correctly?


    I will play with it, results in the next post.

    Added after 22 [minutes]:

    Here come my results of testing some values.
    First i didn't realize, that
    tuyaMCU_sendColor dpID red01 green01 blue01 tuyaRGB1
    

    tuyaRGB1 can only be 0 or 1 and mean upper or lowercase

    tuyaMCU_sendColor 24 1 0 0 1
    
    Debug:CMD:cmd [tuyaMCU_sendColor 24 1 0 0 1]
    Info:TuyaMCU:Color is sent as 000003e803e8
    Info:CMD:[WebApp Cmd 'tuyaMCU_sendColor 24 1 0 0 1' Result] OK
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 10 18 03 00 0C 30 30 30 30 30 33 65 38 30 33 65 38 00 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 23 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 24, dataType 3-DP_TYPE_STRING and 12 data bytes
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 05 15 04 00 01 01 29 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 12 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 21, dataType 4-DP_TYPE_ENUM and 1 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte: 
    Info:GEN:No change in channel 21 (still set to 1) - ignoring
    

    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?

    tuyaMCU_sendColor 24 30 0 0 1
    
    Debug:CMD:cmd [tuyaMCU_sendColor 24 30 0 0 1]
    Info:TuyaMCU:Color is sent as 000003e87530
    Info:CMD:[WebApp Cmd 'tuyaMCU_sendColor 24 30 0 0 1' Result] OK
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 0 (Hearbeat) with 8 bytes
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 10 18 03 00 0C 30 30 30 30 30 33 65 38 37 35 33 30 CF 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 23 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 24, dataType 3-DP_TYPE_STRING and 12 data bytes
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 05 15 04 00 01 01 29 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 12 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 21, dataType 4-DP_TYPE_ENUM and 1 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte: 
    Info:GEN:No change in channel 21 (still set to 1) - ignoring


    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?

    tuyaMCU_sendColor 24 80 0 0 1
    
    Debug:CMD:cmd [tuyaMCU_sendColor 24 80 0 0 1]
    Info:TuyaMCU:Color is sent as 000003e813880
    Info:CMD:[WebApp Cmd 'tuyaMCU_sendColor 24 80 0 0 1' Result] OK
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 11 18 03 00 0D 30 30 30 30 30 33 65 38 31 33 38 38 30 06 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 24 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 24, dataType 3-DP_TYPE_STRING and 13 data bytes
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 05 15 04 00 01 01 29 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 12 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 21, dataType 4-DP_TYPE_ENUM and 1 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte: 
    Info:GEN:No change in channel 21 (still set to 1) - ignoring
    


    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?

    tuyaMCU_sendColor 24 150 0 0 1
    
    Debug:CMD:cmd [tuyaMCU_sendColor 24 150 0 0 1]
    Info:TuyaMCU:Color is sent as 000003e8249f0
    Info:CMD:[WebApp Cmd 'tuyaMCU_sendColor 24 150 0 0 1' Result] OK
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 11 18 03 00 0D 30 30 30 30 30 33 65 38 32 34 39 66 30 37 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 24 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 24, dataType 3-DP_TYPE_STRING and 13 data bytes
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 05 15 04 00 01 01 29 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 12 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 21, dataType 4-DP_TYPE_ENUM and 1 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte: 
    Info:GEN:No change in channel 21 (still set to 1) - ignoring


    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?

    tuyaMCU_sendColor 24 0 1 0 1
    
    Debug:CMD:cmd [tuyaMCU_sendColor 24 0 1 0 1]
    Info:TuyaMCU:Color is sent as 007803e803e8
    Info:CMD:[WebApp Cmd 'tuyaMCU_sendColor 24 0 1 0 1' Result] OK
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 10 18 03 00 0C 30 30 37 38 30 33 65 38 30 33 65 38 0F 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 23 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 24, dataType 3-DP_TYPE_STRING and 12 data bytes
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 05 15 04 00 01 01 29 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 12 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 21, dataType 4-DP_TYPE_ENUM and 1 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte: 
    Info:GEN:No change in channel 21 (still set to 1) - ignoring
    


    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?

    tuyaMCU_sendColor 24 0 0 1 1
    
    Debug:CMD:cmd [tuyaMCU_sendColor 24 0 0 1 1]
    Info:TuyaMCU:Color is sent as 00f003e803e8
    Info:CMD:[WebApp Cmd 'tuyaMCU_sendColor 24 0 0 1 1' Result] OK
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 10 18 03 00 0C 30 30 66 30 30 33 65 38 30 33 65 38 36 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 23 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 24, dataType 3-DP_TYPE_STRING and 12 data bytes
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 05 15 04 00 01 01 29 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 12 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 21, dataType 4-DP_TYPE_ENUM and 1 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte: 
    Info:GEN:No change in channel 21 (still set to 1) - ignoring
    


    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?

    tuyaMCU_sendColor 24 1 1 0 1
    
    Debug:CMD:cmd [tuyaMCU_sendColor 24 1 1 0 1]
    Info:TuyaMCU:Color is sent as 003c03e803e8
    Info:CMD:[WebApp Cmd 'tuyaMCU_sendColor 24 1 1 0 1' Result] OK
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 10 18 03 00 0C 30 30 33 63 30 33 65 38 30 33 65 38 36 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 23 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 24, dataType 3-DP_TYPE_STRING and 12 data bytes
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 05 15 04 00 01 01 29 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 12 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 21, dataType 4-DP_TYPE_ENUM and 1 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte: 
    Info:GEN:No change in channel 21 (still set to 1) - ignoring
    


    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?

    tuyaMCU_sendColor 24 1 0 1 1
    
    Debug:CMD:cmd [tuyaMCU_sendColor 24 1 0 1 1]
    Info:TuyaMCU:Color is sent as 012c03e803e8
    Info:CMD:[WebApp Cmd 'tuyaMCU_sendColor 24 1 0 1 1' Result] OK
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 0 (Hearbeat) with 8 bytes
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 10 18 03 00 0C 30 31 32 63 30 33 65 38 30 33 65 38 36 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 23 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 24, dataType 3-DP_TYPE_STRING and 12 data bytes
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 05 15 04 00 01 01 29 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 12 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 21, dataType 4-DP_TYPE_ENUM and 1 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte: 
    Info:GEN:No change in channel 21 (still set to 1) - ignoring
    


    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?

    tuyaMCU_sendColor 24 0 1 1 1
    
    Debug:CMD:cmd [tuyaMCU_sendColor 24 0 1 1 1]
    Info:TuyaMCU:Color is sent as 00b403e803e8
    Info:CMD:[WebApp Cmd 'tuyaMCU_sendColor 24 0 1 1 1' Result] OK
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 10 18 03 00 0C 30 30 62 34 30 33 65 38 30 33 65 38 36 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 23 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 24, dataType 3-DP_TYPE_STRING and 12 data bytes
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 05 15 04 00 01 01 29 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 12 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 21, dataType 4-DP_TYPE_ENUM and 1 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte: 
    Info:GEN:No change in channel 21 (still set to 1) - ignoring
    


    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?

    tuyaMCU_sendColor 24 0 60 30 1
    
    Debug:CMD:cmd [tuyaMCU_sendColor 24 0 60 30 1]
    Info:TuyaMCU:Color is sent as 009603e8ea60
    Info:CMD:[WebApp Cmd 'tuyaMCU_sendColor 24 0 60 30 1' Result] OK
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 0 (Hearbeat) with 8 bytes
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 10 18 03 00 0C 30 30 39 36 30 33 65 38 65 61 36 30 3B 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 23 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 24, dataType 3-DP_TYPE_STRING and 12 data bytes
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 05 15 04 00 01 01 29 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 12 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 21, dataType 4-DP_TYPE_ENUM and 1 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte: 
    Info:GEN:No change in channel 21 (still set to 1) - ignoring
    


    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?

    tuyaMCU_sendColor 24 1 30 20 1
    
    Debug:CMD:cmd [tuyaMCU_sendColor 24 1 30 20 1]
    Info:TuyaMCU:Color is sent as 009f03c07530
    Info:CMD:[WebApp Cmd 'tuyaMCU_sendColor 24 1 30 20 1' Result] OK
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 00 00 01 01 04 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 0 (Hearbeat) with 8 bytes
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 10 18 03 00 0C 30 30 39 66 30 33 63 30 37 35 33 30 04 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 23 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 24, dataType 3-DP_TYPE_STRING and 12 data bytes
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 05 15 04 00 01 01 29 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 12 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 21, dataType 4-DP_TYPE_ENUM and 1 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte: 
    Info:GEN:No change in channel 21 (still set to 1) - ignoring
    


    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?

    tuyaMCU_sendColor 24 1 1 1 1
    
    Debug:CMD:cmd [tuyaMCU_sendColor 24 1 1 1 1]
    Info:TuyaMCU:Color is sent as 0000000003e8
    Info:CMD:[WebApp Cmd 'tuyaMCU_sendColor 24 1 1 1 1' Result] OK
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 10 18 03 00 0C 30 30 30 30 30 30 30 30 30 33 65 38 C0 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 23 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 24, dataType 3-DP_TYPE_STRING and 12 data bytes
    ExtraDebug:TuyaMCU:TuyaMCU heartbeat_valid = 1, product_information_valid=1, self_processing_mode = 1, wifi_state_valid = 1, wifi_state_timer=54
    Info:MAIN:Time 2515, idle 183875/s, free 72624, MQTT 0(157), bWifi 1, secondsWithNoPing 2445, socks 2/38 
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 05 15 04 00 01 01 29 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 12 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 21, dataType 4-DP_TYPE_ENUM and 1 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte: 
    Info:GEN:No change in channel 21 (still set to 1) - ignoring
    


    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?

    tuyaMCU_sendColor 24 1 0 1 0
    
    Debug:CMD:cmd [tuyaMCU_sendColor 24 1 0 1 0]
    Info:TuyaMCU:Color is sent as 012C03E803E8
    Info:CMD:[WebApp Cmd 'tuyaMCU_sendColor 24 1 0 1 0' Result] OK
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 10 18 03 00 0C 30 31 32 43 30 33 45 38 30 33 45 38 D6 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 23 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 24, dataType 3-DP_TYPE_STRING and 12 data bytes
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 05 15 04 00 01 01 29 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 12 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 21, dataType 4-DP_TYPE_ENUM and 1 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte: 
    Info:GEN:No change in channel 21 (still set to 1) - ignoring


    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?

    tuyaMCU_sendColor 24 1 0 0 0
    
    Debug:CMD:cmd [tuyaMCU_sendColor 24 1 0 0 0]
    Info:TuyaMCU:Color is sent as 000003E803E8
    Info:CMD:[WebApp Cmd 'tuyaMCU_sendColor 24 1 0 0 0' Result] OK
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 10 18 03 00 0C 30 30 30 30 30 33 45 38 30 33 45 38 C0 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 23 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 24, dataType 3-DP_TYPE_STRING and 12 data bytes
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 05 15 04 00 01 01 29 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 12 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 21, dataType 4-DP_TYPE_ENUM and 1 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte: 
    Info:GEN:No change in channel 21 (still set to 1) - ignoring


    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?

    Added after 5 [minutes]:

    Should i test more commands ?

    Which Rval Gval Bval and 0|1 pairs would help if i test them ?

    tuyaMCU_sendColor 24 Rval Gval Bval 1|0
  • ADVERTISEMENT
  • #14 20646359
    nethawk
    Level 3  
    p.kaczmarek2 wrote:
    now, can anyone play around with it and check if it works correctly?


    I would say: Yes .

    Final destination is the integration into Homeassistant (at least for me).

    So what is the next step ?

    Thank you
  • #15 20646461
    p.kaczmarek2
    Moderator Smart Home
    Sorry, I forgot about this topic. You should feel free to remind me, when I don't reply for some time. I remember that I looked at your images and got confused by their order, but I can see that colors seem to be okay.

    Okay, so now...

    I am adding command:
    
    tuyaMCU_setupLED dpID RGBFormat
    

    Select proper ID here and proper RGB format. You should get RGBCW picker on main menu. Check if it works.

    I haven't tested on physical device, only in Windows simulator:
    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?
    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?
    Please test and let me know if there are any problems.
    Helpful post? Buy me a coffee.
  • #16 20648624
    nethawk
    Level 3  

    p.kaczmarek2 wrote:
    Sorry, I forgot about this topic. You should feel free to remind me when I don't reply for some time.

    No problem, I respect that you invest your time in this project.

    p.kaczmarek2 wrote:
    Please test and let me know if there are any problems.

    OK.
    I tested it and made a "factory reset" and started then with:
    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?

    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?
    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?
    "Toggle Light" works.
    "LED RGB Color" - the color picker works, the chosen color will be presented by the LED.
    "LED Dimmer / Brightness" works, but values below 13 make the LED go off.

    "LED Temperature Slider" doesn't work. Changing something there does turn off the LED, but I think this is not a problem, as this Slider should only work in the white mode of the LED, right?
  • #17 20648693
    p.kaczmarek2
    Moderator Smart Home

    Thank you for your kind words. If you like our project, please post a teardown in our IoT section if you encounter an undocumented IoT device. You can also subscribe to our Elektroda com YT channel: https://www.youtube.com/@elektrodacom

    Regarding the testing, it seems your device is RGB only, right? So there is no way to display cool and warm white...

    It seems we just have to hide the white temperature slider. The only question is, are there also TuyaMCU RGBCW lights? I do not currently have enough knowledge to judge.
    Helpful post? Buy me a coffee.
  • #18 20648716
    nethawk
    Level 3  

    p.kaczmarek2 wrote:
    Regarding the testing, it seems your device is RGB only, right? So there is no way to display cool and warm white...


    It is an RGBCW lamp.

    DP 21: switch between RGB and white mode: 1 -> RGB, 0 -> white
    DP 22: brightness: The range is from 50 (dark) to 1000 (light)
    DP 23: Kelvin value of white: The range is from 10 (ww) to 990 (cw)
    (see posts above https://www.elektroda.com/rtvforum/topic3982779.html#20612603)
  • #19 20648757
    p.kaczmarek2
    Moderator Smart Home

    Hmm, okay, so it seems that we need to support those extra dpIDs. Can you tell me whether dpID 22 (brightness from 50 to 1000) affects the colors sent by OpenBeken?

    I am asking because currently OpenBeken does brightness internally and sends already scaled values as Tuya Color. We do not send anything to dpID 22 yet.
    Helpful post? Buy me a coffee.
  • #20 20649138
    nethawk
    Level 3  

    p.kaczmarek2 wrote:
    Can you tell me whether dpID 22 (brightness from 50 to 1000) affects the colors sent by OpenBeken?


    dpID 22 affects only the brightness in white mode.

    I want to summarize:

    dpID 20: switch the lamp on and off. If the lamp is switched on again, previous color mode and brightness is restored. 0 -> off, 1 -> on
    dpID 21: switch between RGB and white mode: 0 -> white, 1 -> RGB
    dpID 22: brightness only in white mode: The range is from 50 (dark) to 1000 (light), NOTE: when changing this value, dpID 21 is set to 0 -> white automatically
    dpID 23: Kelvin value of white: The range is from 10 (ww) to 990 (cw), NOTE: when changing this value, dpID 21 is set to 0 -> white automatically
    dpID 24: color (and indirectly brightness) in RGB mode, handled by your code already fine
    dpID 25: scene management, not yet investigated more, at least for me not needed, so UNUSED

    So, in white mode the "Toggle Light" switch does not work (I assume it sets the color to black?)

    I hope I described it understandably ;-)
  • #21 20655031
    nethawk
    Level 3  

    @p.kaczmarek2 Hello again,
    Can I do something more to support you in the development?
  • ADVERTISEMENT
  • #22 20655042
    p.kaczmarek2
    Moderator Smart Home

    Hello @nethawk, I will try to add that dpIDs support for your device soon, it's just that I have very limited time and we are also working on simulator Release:
    https://github.com/openshwprojects/obkSimulator
    I can try to come up with something for those dpIDs today, but that may require some more testing.


    But in general, if you like our project and want to help us, you can:
    1. help us spread the word, post on some social media (they may be in your native language or international), or post on Youtube, maybe reach out to YouTubers, etc, so more people know that we are making multiplatform IoT firmware to help users regain their privacy
    2. you can post another teardown of any IoT device on our forum, so we can grow this list: https://openbekeniot.github.io/webapp/devicesList.html (I am doing multiple teardowns per month, starting in 2021, so for 2 years already)
    3. you can also post an IoT guide here: https://www.elektroda.com/rtvforum/forum517.html if you know something interesting or useful related to generic IoT, feel free to add a short article (or even a long one, if you have time)
    4. you can make a donation at my Paypal here: https://www.paypal.com/paypalme/openshwprojects so I can invest more funds into development, mostly devices, parts, dev boards (for example, I recently bricked BL602 dev board by trying to add MAC change feature, silly me... have to buy a new one)

    Of course, if you are a developer, you could also help maintain the code, but that requires some C knowledge.

    Please keep in mind that the project is done by volunteers in their free time and is a non-profit open-source firmware, so it's often hard to get enough manpower and time to get features ready quickly.

    Added after 13 [minutes]:

    @nethawk I didn't have time to add configuration, but, for a quick test, I hardcoded your dpIDs in the code:
    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?
    I didn't add the ON/OFF, only brightness and temperature.
    https://github.com/openshwprojects/OpenBK7231...mmit/d6466ed3a8201599dc354b8ccfdf482dce1d31ea

    Can you test and tell me whether now the device can control cool/warm color? The release will be up in 15 minutes or so...
    Helpful post? Buy me a coffee.
  • #23 20655752
    nethawk
    Level 3  

    p.kaczmarek2 wrote:
    Can you test and tell me whether now the device can control cool/warm color?


    I uploaded OpenBK7231N_1.17.182.rbl and it gives unexpected results:

    If I use the LED temperature slider, the lamp changes to white mode, but the temperature is not adjustable and stays at the same level.

    Using the brightness slider works for the white mode.

    In RGB mode, the brightness slider doesn't work.
    The dimmer does not work for RGB colors.
  • #24 20655824
    p.kaczmarek2
    Moderator Smart Home
    It may be just some kind of silly error, but I don't have this device at hand so it's hard to check.

    I wonder, maybe Tuya requires values to be sent as one packet?

    Please check if it works if sent manually. First, enable white mode like you did, then, in console, try to set WW:
    
    tuyaMcu_sendState 23 2 10
    

    then CW:
    
    tuyaMcu_sendState 23 2 980
    

    then mid:
    
    tuyaMcu_sendState 23 2 444
    

    and let me know if it works.

    PS: What's going on with dimmer on RGB? I thought it was reported to be working and I didn't change RGB handling.
    Helpful post? Buy me a coffee.
  • #25 20656814
    nethawk
    Level 3  

    This is with 1.17.182, autoexec.bat containing


    startDriver TuyaMCU
    tuyaMCU_setupLED 24 1
    


    tuyaMcu_sendState 23 2 10
    -> ww works

    tuyaMcu_sendState 23 2 980
    -> cw works

    tuyaMcu_sendState 23 2 444
    -> "midwhite" works

    tuyaMcu_sendState 22 2 50
    -> white brightness to dark works

    tuyaMcu_sendState 22 2 990
    -> white brightness to light works

    tuyaMcu_sendState 22 2 500
    -> white brightness to mid works


    tuyaMCU_sendColor 24 1 1 0 1
    -> RGB mode, color near yellow works

    tuyaMCU_sendColor 24 1 0 0 1
    -> RGB mode, color red works

    p.kaczmarek2 wrote:
    PS: What's going on with dimmer on RGB? I thought it was reported to be working and I didn't change RGB handling.


    with 1.17.182 the RGB part (on the web interface) is partly broken:
    the color picker: doesn't change the color at all
    the brightness dimmer: doesn't change the brightness at all
  • #26 20656924
    p.kaczmarek2
    Moderator Smart Home
    So my conclusion is that I can't send two consecutive dpID changes, I have to include them in one packet.

    Let me implement that in the code and we will try again.
    Helpful post? Buy me a coffee.
  • #27 20660866
    p.kaczmarek2
    Moderator Smart Home
    Sorry, I forgot to post here, but two days ago I added a test code to send brightness and temperature together:
    https://github.com/openshwprojects/OpenBK7231...mmit/772a818bbced9296bf8f4ae07d9b2bbc849a6a30
    Can you check with the latest release whether dimmer+temperature behaves differently? Btw, thank you for the support!
    Helpful post? Buy me a coffee.
  • #28 20661824
    nethawk
    Level 3  

    p.kaczmarek2 wrote:
    Can you check whether the dimmer and temperature behave differently in the latest release?


    I am sorry, this didn't succeed.

    To enter RGB mode, set the color to red:
    tuyaMCU_sendColor 24 1 0 0 1
    In RGB mode:
    The color picker doesn't work.
    Changing the brightness dimmer causes the lamp to go into white mode and dim white correctly.

    Now we are in white mode:
    The dimmer works,
    The temperature doesn't work.

    I know, this is frustrating. Maybe we should calm down the TuyaMCU LED and wait a few days before continuing?

    Or, for better debugging, I could:

    1. If you like, I can send you the lamp by snail mail.

    2. I can give you direct IP access to the lamp (via VPN or port redirection) and give you access to a webcam to see what happens.

    Am I currently the only one with a TuyaMCU LED?
  • #29 20661863
    p.kaczmarek2
    Moderator Smart Home
    Before we continue, do this again:
    nethawk wrote:

    Now we are in white mode:
    dimmer works,
    temperature don't work

    and then try commands for temperature:
    
    tuyaMcu_sendState 23 2 10
    
    tuyaMcu_sendState 23 2 980
    

    Does temperature at least work with those commands then?


    I have double checked my code in Simulator, and for this CCT color:
    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?
    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?
    It sends:
    55AA0006001016020004000003E817020004000000A5DE
    which is:
    [BK7231N/CBU] LED Panel YB8007/300, BK7231Flasher Extraction of config, TuyaMCU LED?
    55 AA 00 06 00 10 16020004000003E817020004000000A5 DE
    HEADER VER=00 SetDP LEN fnId=22 Val V=1000,fnId=23 Val V=165 CHK

    Maybe it also doesn't like compound packets and i will need to send two dpID values with some interval time... or maybe something else is wrong
    Helpful post? Buy me a coffee.
  • #30 20662274
    nethawk
    Level 3  
    p.kaczmarek2 wrote:
    Does temperature at least work with those commands then?


    RGB mode:
    Starting with 1.17.182 the RGB part does not work like it did with previous versions.
    The color picker doesn't work and the dimmer doesn't work since 1.17.182

    Now testing 1.17.186

    RGB mode:
    Using the webpage nothing new: color picker doesn't work, dimmer doesn't work.
    Using the CMD works:

    tuyaMCU_sendColor 24 1 1 0 1
    -> RGB mode, color near yellow works

    tuyaMCU_sendColor 24 1 0 0 1
    -> RGB mode, color red works


    white mode:
    webpage dimmer for brightness works
    webpage slider for temperature doesn't change something
    Using the CMD works:

    tuyaMcu_sendState 23 2 10
    -> ww works
    Info:CMD:[WebApp Cmd 'tuyaMcu_sendState 23 2 10' Result] OK
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 17 02 00 04 00 00 00 0A 38 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 23, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 10
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 05 15 04 00 01 00 28 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 12 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 21, dataType 4-DP_TYPE_ENUM and 1 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte: 
    


    tuyaMcu_sendState 23 2 980
    -> cw works
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 08 17 02 00 04 00 00 03 D4 05 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 23, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 980
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 05 15 04 00 01 00 28 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 12 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 21, dataType 4-DP_TYPE_ENUM and 1 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte: 
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 00 00 01 01 04 



    Using the webinterface:
    -> does not work
    setting the white temperature using the slider to 190 i see in the logs:
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 10 16 02 00 04 00 00 03 E8 17 02 00 04 00 00 00 6F AC 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 23 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 22, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 1000
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 23, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 111
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 05 15 04 00 01 00 28 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 12 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 21, dataType 4-DP_TYPE_ENUM and 1 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte: 


    So what is the difference between changing the brightness (white) and the tempearature (white)
    Using the webinterface i changed again the brightness
    -> works
    setting the brightness using the slider i see in the logs:
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 10 16 02 00 04 00 00 03 E8 17 02 00 04 00 00 00 6F AC 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 23 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 22, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 1000
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 23, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 111
    Info:TuyaMCU:TUYAMCU received: 55 AA 03 07 00 05 15 04 00 01 00 28 
    Info:TuyaMCU:TuyaMCU_ProcessIncoming[ver=3]: processing command 7 (State) with 12 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 21, dataType 4-DP_TYPE_ENUM and 1 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte: 



    I see no real difference between changing brigtness and temperature (white) in the logs.


    p.kaczmarek2 wrote:
    Maybe it also doesn't like compound packets and i will need to send two dpID values with some interval time... or maybe something else is wrong


    I am not an expert but if i would guess:

    Probably there is an timing issue, TuyaMCU processes dpId 22 while it already
    receives dpId 23 instruction. If that's true:
    If you would first send dpId 23, followed by dpID 22 (in one command) the
    temperature would be processed, but not the brightness.

    Suggestion 1: Send 2 seperate commands for dpId 22 and 23, like you already
    do for dpId 21, so you can include some milliseconds of sleep.

    Suggestion 2: Send only the dpId to the MCU that was changed.

    Added after 7 [minutes]:

    I include one additional link, only to confirm, that we are right about the dpIds in use:

    https://github.com/codetheweb/tuyapi/issues/346#issuecomment-877509896

Topic summary

The discussion revolves around the flashing and configuration of the YB8007/300 LED panel using the BK7231N chip and OpenBeken firmware. The user successfully flashed one LED lamp but faced issues with GPIO extraction using BK7231Flasher. Participants suggested trial and error with pin assignments for color control and identified the device as a TuyaMCU type, requiring specific commands for color and brightness adjustments. The conversation included troubleshooting steps, such as using dpIDs for controlling color modes, brightness, and temperature settings. The user reported mixed results with RGB and white modes, leading to further development of the firmware to improve functionality, including a color picker and adjustments for temperature control. The integration with Home Assistant was also discussed, highlighting the need for a queue system to manage command packets effectively.
Summary generated by the language model.
ADVERTISEMENT