Using LSC 3203632.1 RGBIC+CCTIC Ledstrip with ESPHome

you think its possible to write a little script that runs on the device that converts the blue and red channels that are used for the white/warmwhite leds, to a white-tint slider so its can be used in home assistant?

EDIT:

I removed pin 8 alltogether and enabled it to high at boot. Now switching from color to white rapidly on the remote doesnt make it freak out and toggling pin8 on/off. Remote is more fluent now.

2
added light turn off also for white leds for button 3 because they stayed on when pressed.

Now ill try brightness buttons 1 and 2 to increase brightness for color and white, freeing the arrow buttons on the remote.

esphome:
  name: lsc-32036321-ledstrip
  friendly_name: Lsc 3203632.1 ledstrip
  on_boot:
    priority: 600
    then:
      - output.turn_on: internal_pin

bk72xx:
  board: generic-bk7231n-qfn32-tuya

# Enable logging
logger:
  level: INFO

# Enable Home Assistant API
api:
  encryption:
    key: "-------"

ota:
  - platform: esphome
    password: "-------"

wifi:
  ssid: !secret wifi_ssid_iot_2
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: ""-------""
    password: ""-------""

captive_portal:

web_server:

globals:
  - id: active_effect
    type: int
    restore_value: yes
    initial_value: '0'

output:
  - platform: gpio
    pin: GPIO8
    id: internal_pin

light:
  - platform: beken_spi_led_strip
    id: rgbic_cctic_ledstrip
    pin: 16
    num_leds: 50
    default_transition_length: 0.1s
    chipset: SM16703
    name: "Ledstrip"
    rgb_order: BRG
    internal: true
  - platform: partition
    id: rgb_partition
    name: "RGB LEDs"
    segments:
      - id: rgbic_cctic_ledstrip
        from: 0
        to: 0
      - id: rgbic_cctic_ledstrip
        from: 2
        to: 2
      - id: rgbic_cctic_ledstrip
        from: 4
        to: 4
      - id: rgbic_cctic_ledstrip
        from: 6
        to: 6
      - id: rgbic_cctic_ledstrip
        from: 8
        to: 8
      - id: rgbic_cctic_ledstrip
        from: 10
        to: 10
      - id: rgbic_cctic_ledstrip
        from: 12
        to: 12
      - id: rgbic_cctic_ledstrip
        from: 14
        to: 14
      - id: rgbic_cctic_ledstrip
        from: 16
        to: 16
      - id: rgbic_cctic_ledstrip
        from: 18
        to: 18
      - id: rgbic_cctic_ledstrip
        from: 20
        to: 20
      - id: rgbic_cctic_ledstrip
        from: 22
        to: 22
      - id: rgbic_cctic_ledstrip
        from: 24
        to: 24
      - id: rgbic_cctic_ledstrip
        from: 26
        to: 26
      - id: rgbic_cctic_ledstrip
        from: 28
        to: 28
      - id: rgbic_cctic_ledstrip
        from: 30
        to: 30
      - id: rgbic_cctic_ledstrip
        from: 32
        to: 32
      - id: rgbic_cctic_ledstrip
        from: 34
        to: 34
      - id: rgbic_cctic_ledstrip
        from: 36
        to: 36
      - id: rgbic_cctic_ledstrip
        from: 38
        to: 38
      - id: rgbic_cctic_ledstrip
        from: 40
        to: 40
      - id: rgbic_cctic_ledstrip
        from: 42
        to: 42
      - id: rgbic_cctic_ledstrip
        from: 44
        to: 44
      - id: rgbic_cctic_ledstrip
        from: 46
        to: 46
      - id: rgbic_cctic_ledstrip
        from: 48
        to: 48
    effects:
     - random:
     - pulse:
     - strobe:
     - flicker:
     - addressable_rainbow:
     - addressable_color_wipe:
     - addressable_scan:
     - addressable_twinkle:
     - addressable_random_twinkle:
     - addressable_fireworks:
     - addressable_lambda:
         name: "Sound Rainbow Effect"
         update_interval: 50ms
         lambda: |-
           float mic_level = id(mic).state;
           float normalized = min(mic_level, 1.0);
           int max_distance = floor(normalized * 12.0);  // 12 is max afstand vanaf het midden
           for(int i = 0; i < it.size(); i++) {
             int distance = abs(i - 12);
             if(distance <= max_distance) {
               // Bereken de hue op basis van de LED positie voor een regenboog effect
               float hue = (float)i / 25.0 * 360.0;
               // Handmatige HSV naar RGB conversie
               float h = hue;
               float s = 1.0;
               float v = 1.0;
               int sector = ((int)floor(h / 60.0)) % 6;
               float f = (h / 60.0) - floor(h / 60.0);
               float p = v * (1.0 - s);
               float q = v * (1.0 - f * s);
               float t = v * (1.0 - (1.0 - f) * s);
               float r, g, b;
               if (sector == 0) { r = v; g = t; b = p; }
               else if (sector == 1) { r = q; g = v; b = p; }
               else if (sector == 2) { r = p; g = v; b = t; }
               else if (sector == 3) { r = p; g = q; b = v; }
               else if (sector == 4) { r = t; g = p; b = v; }
               else { r = v; g = p; b = q; }
               uint8_t red = (uint8_t)(r * 255);
               uint8_t green = (uint8_t)(g * 255);
               uint8_t blue = (uint8_t)(b * 255);
               it[i] = Color(red, green, blue);
             } else {
               it[i] = Color(0, 0, 0);  // LED uit
             }
           }
    on_turn_on:
      then:
        
        - if:
            condition:
              light.is_on: cw_ww_partition
            then:
              - light.turn_off: cw_ww_partition
    
  - platform: partition
    id: cw_ww_partition
    name: "CW/WW LEDs"
    segments:
      - id: rgbic_cctic_ledstrip
        from: 1
        to: 1
      - id: rgbic_cctic_ledstrip
        from: 3
        to: 3
      - id: rgbic_cctic_ledstrip
        from: 5
        to: 5
      - id: rgbic_cctic_ledstrip
        from: 7
        to: 7
      - id: rgbic_cctic_ledstrip
        from: 9
        to: 9
      - id: rgbic_cctic_ledstrip
        from: 11
        to: 11
      - id: rgbic_cctic_ledstrip
        from: 13
        to: 13
      - id: rgbic_cctic_ledstrip
        from: 15
        to: 15
      - id: rgbic_cctic_ledstrip
        from: 17
        to: 17
      - id: rgbic_cctic_ledstrip
        from: 19
        to: 19
      - id: rgbic_cctic_ledstrip
        from: 21
        to: 21
      - id: rgbic_cctic_ledstrip
        from: 23
        to: 23
      - id: rgbic_cctic_ledstrip
        from: 25
        to: 25
      - id: rgbic_cctic_ledstrip
        from: 27
        to: 27
      - id: rgbic_cctic_ledstrip
        from: 29
        to: 29
      - id: rgbic_cctic_ledstrip
        from: 31
        to: 31
      - id: rgbic_cctic_ledstrip
        from: 33
        to: 33
      - id: rgbic_cctic_ledstrip
        from: 35
        to: 35
      - id: rgbic_cctic_ledstrip
        from: 37
        to: 37
      - id: rgbic_cctic_ledstrip
        from: 39
        to: 39
      - id: rgbic_cctic_ledstrip
        from: 41
        to: 41
      - id: rgbic_cctic_ledstrip
        from: 43
        to: 43
      - id: rgbic_cctic_ledstrip
        from: 45
        to: 45
      - id: rgbic_cctic_ledstrip
        from: 47
        to: 47
      - id: rgbic_cctic_ledstrip
        from: 49
        to: 49
    on_turn_on:
      then:
        - if:
            condition:
              light.is_on: rgb_partition
            then:
              - light.turn_off: rgb_partition
    
              
#switch:
#  - platform: gpio
#    pin: P8
#    id: power_switch
#    name: power

remote_receiver:
  pin:
    number: P26
    inverted: true
  dump: nec

sensor:
  - platform: adc
    id: mic
    pin: ADC3
    internal: true
    name: "Mic"
    update_interval: 50ms

script:
  # Timer scripts to turn off RGB and White after specific durations
  - id: timer_1h
    mode: single
    then:
      - delay: 1h
      - light.turn_off:
          id: rgb_partition
      - light.turn_off:
          id: cw_ww_partition

  - id: timer_2h
    mode: single
    then:
      - delay: 2h
      - light.turn_off:
          id: rgb_partition
      - light.turn_off:
          id: cw_ww_partition

  - id: timer_3h
    mode: single
    then:
      - delay: 3h
      - light.turn_off:
          id: rgb_partition
      - light.turn_off:
          id: cw_ww_partition

binary_sensor:
  # Button 3
  - platform: gpio
    pin:
      number: P9
      mode: INPUT_PULLUP
    name: "Button 3"
    internal: true

  # Button 4
  - platform: gpio
    pin:
      number: P24
      mode: INPUT_PULLUP
    name: "Button 4"
    internal: true

  # Button 50
  - platform: gpio
    pin:
      number: P28
      mode: INPUT_PULLUP
    name: "Button 50"
    internal: true

  # Button 1: Brightness RGB Up
  - platform: remote_receiver
    name: "Brightness RGB Up"
    internal: true
    nec:
      address: 0xEF00
      command: 0xE31C
    on_press:
      - light.dim_relative:
          id: rgb_partition
          relative_brightness: 10%

  # Button 2: Brightness RGB Down
  - platform: remote_receiver
    name: "Brightness RGB Down"
    internal: true
    nec:
      address: 0xEF00
      command: 0xE21D
    on_press:
      - light.dim_relative:
          id: rgb_partition
          relative_brightness: -10%

  # Button 3: OFF
  - platform: remote_receiver
    name: "Button OFF"
    internal: true
    nec:
      address: 0xEF00
      command: 0xE11E
    on_press:
      - light.turn_off:
          id: rgb_partition
      - light.turn_off:
          id: cw_ww_partition

  # Button 4: ON
  - platform: remote_receiver
    name: "Button ON"
    internal: true
    nec:
      address: 0xEF00
      command: 0xE01F
    on_press:
      - light.turn_on:
          id: rgb_partition


  # Button 5: RGB Red
  - platform: remote_receiver
    name: "RGB Red"
    internal: true
    nec:
      address: 0xEF00
      command: 0xFF00
    on_press:
      - light.turn_on:
          id: rgb_partition
          red: 1.0
          green: 0.0
          blue: 0.0

  # Button 6: RGB Green
  - platform: remote_receiver
    name: "RGB Green"
    internal: true
    nec:
      address: 0xEF00
      command: 0xFE01
    on_press:
      - light.turn_on:
          id: rgb_partition
          red: 0.0
          green: 1.0
          blue: 0.0

  # Button 7: RGB Blue
  - platform: remote_receiver
    name: "RGB Blue"
    internal: true
    nec:
      address: 0xEF00
      command: 0xFD02
    on_press:
      - light.turn_on:
          id: rgb_partition
          red: 0.0
          green: 0.0
          blue: 1.0

  # Button 8: Timer 1H
  - platform: remote_receiver
    name: "Timer 1H"
    internal: true
    nec:
      address: 0xEF00
      command: 0xFC03
    on_press:
      - script.execute: timer_1h

  # Button 9: Orange
  - platform: remote_receiver
    name: "Oranje"
    internal: true
    nec:
      address: 0xEF00
      command: 0xFB04
    on_press:
      - light.turn_on:
          id: rgb_partition
          red: 1.0
          green: 0.5
          blue: 0.0

  # Button 10: Light Green
  - platform: remote_receiver
    name: "Lichtgroen"
    internal: true
    nec:
      address: 0xEF00
      command: 0xFA05
    on_press:
      - light.turn_on:
          id: rgb_partition
          red: 0.5
          green: 1.0
          blue: 0.0

  # Button 11: Light Blue
  - platform: remote_receiver
    name: "Lichtblauw"
    internal: true
    nec:
      address: 0xEF00
      command: 0xF906
    on_press:
      - light.turn_on:
          id: rgb_partition
          red: 0.0
          green: 1.0
          blue: 1.0

  # Button 12: Timer 2H
  - platform: remote_receiver
    name: "Timer 2H"
    internal: true
    nec:
      address: 0xEF00
      command: 0xF807
    on_press:
      - script.execute: timer_2h

  # Button 13: Yellow
  - platform: remote_receiver
    name: "Geel"
    internal: true
    nec:
      address: 0xEF00
      command: 0xF708
    on_press:
      - light.turn_on:
          id: rgb_partition
          red: 1.0
          green: 1.0
          blue: 0.0

  # Button 14: Dark Green
  - platform: remote_receiver
    name: "Donkergroen"
    internal: true
    nec:
      address: 0xEF00
      command: 0xF609
    on_press:
      - light.turn_on:
          id: rgb_partition
          red: 0.0
          green: 0.5
          blue: 0.0

  # Button 15: Purple
  - platform: remote_receiver
    name: "Paars"
    internal: true
    nec:
      address: 0xEF00
      command: 0xF50A
    on_press:
      - light.turn_on:
          id: rgb_partition
          red: 0.5
          green: 0.0
          blue: 0.5

  # Button 16: Timer 3H
  - platform: remote_receiver
    name: "Timer 3H"
    internal: true
    nec:
      address: 0xEF00
      command: 0xF40B
    on_press:
      - script.execute: timer_3h

  # Button 17: WW (Warm White)
  - platform: remote_receiver
    name: "WW (Warm Wit)"
    internal: true
    nec:
      address: 0xEF00
      command: 0xF30C
    on_press:
      - light.turn_on:
          id: cw_ww_partition
          red: 1.0
          green: 0.0
          blue: 0.0

  # Button 18: NW (Neutral White -> Orange)
  - platform: remote_receiver
    name: "NW (Neutral White)"
    internal: true
    nec:
      address: 0xEF00
      command: 0xF20D
    on_press:
      - light.turn_on:
          id: cw_ww_partition
          red: 1.0
          green: 0.0
          blue: 1.0

  # Button 19: CW (Cool White -> Blue)
  - platform: remote_receiver
    name: "CW (Cool White)"
    internal: true
    nec:
      address: 0xEF00
      command: 0xF10E
    on_press:
      - light.turn_on:
          id: cw_ww_partition
          red: 0.0
          green: 0.0
          blue: 1.0

  # Button 20: Brightness White Up
  - platform: remote_receiver
    name: "Brightness White Up"
    internal: true
    nec:
      address: 0xEF00
      command: 0xF00F
    on_press:
      - light.dim_relative:
          id: cw_ww_partition
          relative_brightness: 10%

  # Button 21: Effect Speed+
  - platform: remote_receiver
    name: "Effect Speed+"
    internal: true
    nec:
      address: 0xEF00
      command: 0xEF10
    on_press:
      - lambda: |-
          id(active_effect) += 1;
          if (id(active_effect) > 7) id(active_effect) = 1;  // Restart at the first effect
          auto call = id(rgb_partition).turn_on();
          switch (id(active_effect)) {
            case 1:
              call.set_effect("Rainbow");
              break;
            case 2:
              call.set_effect("Color Wipe");
              break;
            case 3:
              call.set_effect("Scan");
              break;
            case 4:
              call.set_effect("Twinkle");
              break;
            case 5:
              call.set_effect("Random Twinkle");
              break;
            case 6:
              call.set_effect("Fireworks");
              break;
            case 7:
              call.set_effect("Sound Rainbow Effect");
              break;
          }
          call.perform();

  # Button 22: Mode Stop Effect
  - platform: remote_receiver
    name: "Next Effect"
    internal: true
    nec:
      address: 0xEF00
      command: 0xEE11
    on_press:
      - lambda: |-
          id(active_effect) = 0;  // Set active effect to none
          auto call = id(rgb_partition).turn_on();
          call.set_effect("None");  // Stop effects
          call.perform();


  # Button 23: Effect Speed-
  - platform: remote_receiver
    name: "Effect Speed-"
    internal: true
    nec:
      address: 0xEF00
      command: 0xED12
    on_press:
      - lambda: |-
          id(active_effect) -= 1;
          if (id(active_effect) < 1) id(active_effect) = 7;  // Go to the last effect
          auto call = id(rgb_partition).turn_on();
          switch (id(active_effect)) {
            case 1:
              call.set_effect("Rainbow");
              break;
            case 2:
              call.set_effect("Color Wipe");
              break;
            case 3:
              call.set_effect("Scan");
              break;
            case 4:
              call.set_effect("Twinkle");
              break;
            case 5:
              call.set_effect("Random Twinkle");
              break;
            case 6:
              call.set_effect("Fireworks");
              break;
            case 7:
              call.set_effect("Sound Rainbow Effect");
              break;
          }
          call.perform();

  # Button 24: Brightness White Down
  - platform: remote_receiver
    name: "Brightness White Down"
    internal: true
    nec:
      address: 0xEF00
      command: 0xEC13
    on_press:
      - light.dim_relative:
          id: cw_ww_partition
          relative_brightness: -10%

  # Button 25: sound effect
  - platform: remote_receiver
    name: "sound effect"
    internal: true
    nec:
      address: 0xEF00
      command: 0xEB14
    on_press:
      then:
        - light.turn_on:
            id: rgb_partition
            effect: "Sound Rainbow Effect"

New config, with working CW/WW with color temperature. Also usage of powersupply and maybe some extra things:

esphome:
  name: "5m-ledstrip"
  friendly_name: 5m_ledstrip

bk72xx:
  board: generic-bk7231n-qfn32-tuya
  framework:
    version: dev

logger:
  level: INFO

# Enable Home Assistant API
api:

ota:
  - platform: esphome

web_server:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  ap:

captive_portal:

globals:
  - id: active_effect
    type: int
    restore_value: yes
    initial_value: '0'

output:
  - platform: template
    id: output_component1
    type: float
    power_supply: powersupply
    zero_means_zero: True
    write_action:
      lambda: |-
        auto call = id(cw_ww_partition).turn_on();
        call.set_red(state);
        call.set_transition_length(100);
        call.perform();
  - platform: template
    id: output_component2
    type: float
    power_supply: powersupply
    zero_means_zero: True
    write_action:
      lambda: |-
        auto call = id(cw_ww_partition).turn_on();
        call.set_blue(state);
        call.set_transition_length(100);
        call.perform();
power_supply:
  - id: powersupply
    pin: 8
light:
  - platform: cwww
    id: cw_ww
    name: "CWWW"
    cold_white: output_component2
    warm_white: output_component1
    cold_white_color_temperature: 6500 K
    warm_white_color_temperature: 2700 K
    gamma_correct: 1
    constant_brightness: False
    on_turn_on: 
      then:
        - light.turn_off: rgb_partition
  - platform: beken_spi_led_strip
    id: rgbic_cctic_ledstrip
    pin: 16
    num_leds: 50
    chipset: SM16703
    name: "Ledstrip"
    rgb_order: BRG
    internal: true
  - platform: partition
    id: rgb_partition
    default_transition_length: 0.5s
    name: "RGB LEDs"
    power_supply: powersupply
    segments:
      - id: rgbic_cctic_ledstrip
        from: 0
        to: 0
      - id: rgbic_cctic_ledstrip
        from: 2
        to: 2
      - id: rgbic_cctic_ledstrip
        from: 4
        to: 4
      - id: rgbic_cctic_ledstrip
        from: 6
        to: 6
      - id: rgbic_cctic_ledstrip
        from: 8
        to: 8
      - id: rgbic_cctic_ledstrip
        from: 10
        to: 10
      - id: rgbic_cctic_ledstrip
        from: 12
        to: 12
      - id: rgbic_cctic_ledstrip
        from: 14
        to: 14
      - id: rgbic_cctic_ledstrip
        from: 16
        to: 16
      - id: rgbic_cctic_ledstrip
        from: 18
        to: 18
      - id: rgbic_cctic_ledstrip
        from: 20
        to: 20
      - id: rgbic_cctic_ledstrip
        from: 22
        to: 22
      - id: rgbic_cctic_ledstrip
        from: 24
        to: 24
      - id: rgbic_cctic_ledstrip
        from: 26
        to: 26
      - id: rgbic_cctic_ledstrip
        from: 28
        to: 28
      - id: rgbic_cctic_ledstrip
        from: 30
        to: 30
      - id: rgbic_cctic_ledstrip
        from: 32
        to: 32
      - id: rgbic_cctic_ledstrip
        from: 34
        to: 34
      - id: rgbic_cctic_ledstrip
        from: 36
        to: 36
      - id: rgbic_cctic_ledstrip
        from: 38
        to: 38
      - id: rgbic_cctic_ledstrip
        from: 40
        to: 40
      - id: rgbic_cctic_ledstrip
        from: 42
        to: 42
      - id: rgbic_cctic_ledstrip
        from: 44
        to: 44
      - id: rgbic_cctic_ledstrip
        from: 46
        to: 46
      - id: rgbic_cctic_ledstrip
        from: 48
        to: 48
    effects:
     - random:
     - pulse:
     - strobe:
     - flicker:
     - addressable_rainbow:
     - addressable_color_wipe:
     - addressable_scan:
     - addressable_twinkle:
     - addressable_random_twinkle:
     - addressable_fireworks:
     - addressable_lambda:
         name: "Sound Rainbow Effect"
         update_interval: 50ms
         lambda: |-
           float mic_level = id(mic).state;
           float normalized = min(mic_level, 1.0);
           int max_distance = floor(normalized * 12.0);  // 12 is max afstand vanaf het midden
           for(int i = 0; i < it.size(); i++) {
             int distance = abs(i - 12);
             if(distance <= max_distance) {
               // Bereken de hue op basis van de LED positie voor een regenboog effect
               float hue = (float)i / 25.0 * 360.0;
               // Handmatige HSV naar RGB conversie
               float h = hue;
               float s = 1.0;
               float v = 1.0;
               int sector = ((int)floor(h / 60.0)) % 6;
               float f = (h / 60.0) - floor(h / 60.0);
               float p = v * (1.0 - s);
               float q = v * (1.0 - f * s);
               float t = v * (1.0 - (1.0 - f) * s);
               float r, g, b;
               if (sector == 0) { r = v; g = t; b = p; }
               else if (sector == 1) { r = q; g = v; b = p; }
               else if (sector == 2) { r = p; g = v; b = t; }
               else if (sector == 3) { r = p; g = q; b = v; }
               else if (sector == 4) { r = t; g = p; b = v; }
               else { r = v; g = p; b = q; }
               uint8_t red = (uint8_t)(r * 255);
               uint8_t green = (uint8_t)(g * 255);
               uint8_t blue = (uint8_t)(b * 255);
               it[i] = Color(red, green, blue);
             } else {
               it[i] = Color(0, 0, 0);  // LED uit
             }
           }
    on_turn_on: 
      then:
        - light.turn_off: cw_ww
  - platform: partition
    id: cw_ww_partition
    internal: True
    name: "CW/WW LEDs"
    default_transition_length: 0.5s
    segments:
      - id: rgbic_cctic_ledstrip
        from: 1
        to: 1
      - id: rgbic_cctic_ledstrip
        from: 3
        to: 3
      - id: rgbic_cctic_ledstrip
        from: 5
        to: 5
      - id: rgbic_cctic_ledstrip
        from: 7
        to: 7
      - id: rgbic_cctic_ledstrip
        from: 9
        to: 9
      - id: rgbic_cctic_ledstrip
        from: 11
        to: 11
      - id: rgbic_cctic_ledstrip
        from: 13
        to: 13
      - id: rgbic_cctic_ledstrip
        from: 15
        to: 15
      - id: rgbic_cctic_ledstrip
        from: 17
        to: 17
      - id: rgbic_cctic_ledstrip
        from: 19
        to: 19
      - id: rgbic_cctic_ledstrip
        from: 21
        to: 21
      - id: rgbic_cctic_ledstrip
        from: 23
        to: 23
      - id: rgbic_cctic_ledstrip
        from: 25
        to: 25
      - id: rgbic_cctic_ledstrip
        from: 27
        to: 27
      - id: rgbic_cctic_ledstrip
        from: 29
        to: 29
      - id: rgbic_cctic_ledstrip
        from: 31
        to: 31
      - id: rgbic_cctic_ledstrip
        from: 33
        to: 33
      - id: rgbic_cctic_ledstrip
        from: 35
        to: 35
      - id: rgbic_cctic_ledstrip
        from: 37
        to: 37
      - id: rgbic_cctic_ledstrip
        from: 39
        to: 39
      - id: rgbic_cctic_ledstrip
        from: 41
        to: 41
      - id: rgbic_cctic_ledstrip
        from: 43
        to: 43
      - id: rgbic_cctic_ledstrip
        from: 45
        to: 45
      - id: rgbic_cctic_ledstrip
        from: 47
        to: 47
      - id: rgbic_cctic_ledstrip
        from: 49
        to: 49
remote_receiver:
  pin:
    number: P26
    inverted: true
  dump: nec
sensor:
  - platform: adc
    id: mic
    pin: ADC3
    internal: true
    name: "Mic"
    update_interval: 50ms
script:
  # Timer scripts to turn off RGB and White after specific durations
  - id: timer_1h
    mode: single
    then:
      - delay: 1h
      - light.turn_off:
          id: rgb_partition
      - light.turn_off:
          id: cw_ww_partition
  - id: timer_2h
    mode: single
    then:
      - delay: 2h
      - light.turn_off:
          id: rgb_partition
      - light.turn_off:
          id: cw_ww_partition
  - id: timer_3h
    mode: single
    then:
      - delay: 3h
      - light.turn_off:
          id: rgb_partition
      - light.turn_off:
          id: cw_ww_partition
binary_sensor:
  # Pushbutton 1
  - platform: gpio
    pin:
      number: P9
      mode: INPUT_PULLUP
    name: "Button 3"
    internal: true
  # Pushbutton 2
  - platform: gpio
    pin:
      number: P24
      mode: INPUT_PULLUP
    name: "Button 4"
    internal: true
  # Pushbutton 3
  - platform: gpio
    pin:
      number: P28
      mode: INPUT_PULLUP
    name: "Button 50"
    internal: true
  # Button 1: Brightness RGB Up
  - platform: remote_receiver
    name: "Brightness RGB Up"
    internal: true
    nec:
      address: 0xEF00
      command: 0xE31C
    on_press:
      - if:
          condition:
            - light.is_on: cw_ww
          then: 
            - light.dim_relative:
                id: cw_ww
                relative_brightness: 10%
          else:
            - light.dim_relative:
                id: rgb_partition
                relative_brightness: 0%
  # Button 2: Brightness RGB Down
  - platform: remote_receiver
    name: "Brightness RGB Down"
    internal: true
    nec:
      address: 0xEF00
      command: 0xE21D
    on_press:
      - if:
          condition:
            - light.is_on: cw_ww
          then: 
            - light.dim_relative:
                id: cw_ww
                relative_brightness: -10%
          else:
            - light.dim_relative:
                id: rgb_partition
                relative_brightness: -10%
  # Button 3: OFF
  - platform: remote_receiver
    name: "Button OFF"
    internal: true
    nec:
      address: 0xEF00
      command: 0xE11E
    on_press:
      - light.turn_off:
          id: rgb_partition
      - light.turn_off:
          id: cw_ww_partition
  # Button 4: ON
  - platform: remote_receiver
    name: "Button ON"
    internal: true
    nec:
      address: 0xEF00
      command: 0xE01F
    on_press:
      - light.turn_on:
          id: rgb_partition
  # Button 5: RGB Red
  - platform: remote_receiver
    name: "RGB Red"
    internal: true
    nec:
      address: 0xEF00
      command: 0xFF00
    on_press:
      - light.turn_on:
          id: rgb_partition
          red: 1.0
          green: 0.0
          blue: 0.0
  # Button 6: RGB Green
  - platform: remote_receiver
    name: "RGB Green"
    internal: true
    nec:
      address: 0xEF00
      command: 0xFE01
    on_press:
      - light.turn_on:
          id: rgb_partition
          red: 0.0
          green: 1.0
          blue: 0.0
  # Button 7: RGB Blue
  - platform: remote_receiver
    name: "RGB Blue"
    internal: true
    nec:
      address: 0xEF00
      command: 0xFD02
    on_press:
      - light.turn_on:
          id: rgb_partition
          red: 0.0
          green: 0.0
          blue: 1.0
  # Button 8: Timer 1H
  - platform: remote_receiver
    name: "Timer 1H"
    internal: true
    nec:
      address: 0xEF00
      command: 0xFC03
    on_press:
      - script.execute: timer_1h
  # Button 9: Orange
  - platform: remote_receiver
    name: "Oranje"
    internal: true
    nec:
      address: 0xEF00
      command: 0xFB04
    on_press:
      - light.turn_on:
          id: rgb_partition
          red: 1.0
          green: 0.5
          blue: 0.0
  # Button 10: Light Green
  - platform: remote_receiver
    name: "Lichtgroen"
    internal: true
    nec:
      address: 0xEF00
      command: 0xFA05
    on_press:
      - light.turn_on:
          id: rgb_partition
          red: 0.5
          green: 1.0
          blue: 0.0
  # Button 11: Light Blue
  - platform: remote_receiver
    name: "Lichtblauw"
    internal: true
    nec:
      address: 0xEF00
      command: 0xF906
    on_press:
      - light.turn_on:
          id: rgb_partition
          red: 0.0
          green: 1.0
          blue: 1.0
  # Button 12: Timer 2H
  - platform: remote_receiver
    name: "Timer 2H"
    internal: true
    nec:
      address: 0xEF00
      command: 0xF807
    on_press:
      - script.execute: timer_2h
  # Button 13: Yellow
  - platform: remote_receiver
    name: "Geel"
    internal: true
    nec:
      address: 0xEF00
      command: 0xF708
    on_press:
      - light.turn_on:
          id: rgb_partition
          red: 1.0
          green: 1.0
          blue: 0.0
  # Button 14: Dark Green
  - platform: remote_receiver
    name: "Donkergroen"
    internal: true
    nec:
      address: 0xEF00
      command: 0xF609
    on_press:
      - light.turn_on:
          id: rgb_partition
          red: 0.0
          green: 0.5
          blue: 0.0
  # Button 15: Purple
  - platform: remote_receiver
    name: "Paars"
    internal: true
    nec:
      address: 0xEF00
      command: 0xF50A
    on_press:
      - light.turn_on:
          id: rgb_partition
          red: 0.5
          green: 0.0
          blue: 0.5
  # Button 16: Timer 3H
  - platform: remote_receiver
    name: "Timer 3H"
    internal: true
    nec:
      address: 0xEF00
      command: 0xF40B
    on_press:
      - script.execute: timer_3h
  # Button 17: WW (Warm White)
  - platform: remote_receiver
    name: "WW (Warm Wit)"
    internal: true
    nec:
      address: 0xEF00
      command: 0xF30C
    on_press:
      - light.turn_on:
          id: cw_ww
          warm_white : 1.0
          cold_white: 0.0
  # Button 19: CW (Neutral White)
  - platform: remote_receiver
    name: "NW (Neutral White)"
    internal: true
    nec:
      address: 0xEF00
      command: 0xF20D
    on_press:
      - light.turn_on:
          id: cw_ww
          warm_white : 1.0
          cold_white: 1.0
  # Button 19: CW (Cool White)
  - platform: remote_receiver
    name: "CW (Cool White)"
    internal: true
    nec:
      address: 0xEF00
      command: 0xF10E
    on_press:
      - light.turn_on:
          id: cw_ww
          warm_white : 0.0
          cold_white: 1.0
  # Button 20: Colortemperature up
  - platform: remote_receiver
    name: "Colortemperature Up"
    internal: true
    nec:
      address: 0xEF00
      command: 0xF00F
    on_press:
      - light.turn_on:
          id: cw_ww
          color_temperature: !lambda |-
            float current_temp = id(cw_ww).current_values.get_color_temperature();
            // Verhoog (koelere lichtkleur) door mireds met 10% te verlagen
            float new_temp = current_temp * 1.1;
            // Bewaak de grenzen
            if(new_temp < 153) new_temp = 153;   // ~6500K
            if(new_temp > 370) new_temp = 370;   // ~2700K
            return new_temp;
  # Button 21: Effect Speed+
  - platform: remote_receiver
    name: "Effect Speed+"
    internal: true
    nec:
      address: 0xEF00
      command: 0xEF10
    on_press:
      - lambda: |-
          id(active_effect) += 1;
          if (id(active_effect) > 7) id(active_effect) = 1;  // Restart at the first effect
          auto call = id(rgb_partition).turn_on();
          switch (id(active_effect)) {
            case 1:
              call.set_effect("Rainbow");
              break;
            case 2:
              call.set_effect("Color Wipe");
              break;
            case 3:
              call.set_effect("Scan");
              break;
            case 4:
              call.set_effect("Twinkle");
              break;
            case 5:
              call.set_effect("Random Twinkle");
              break;
            case 6:
              call.set_effect("Fireworks");
              break;
            case 7:
              call.set_effect("Sound Rainbow Effect");
              break;
          }
          call.perform();
  # Button 22: Mode Stop Effect
  - platform: remote_receiver
    name: "Next Effect"
    internal: true
    nec:
      address: 0xEF00
      command: 0xEE11
    on_press:
      - lambda: |-
          id(active_effect) = 0;  // Set active effect to none
          auto call = id(rgb_partition).turn_on();
          call.set_effect("None");  // Stop effects
          call.perform();
  # Button 23: Effect Speed-
  - platform: remote_receiver
    name: "Effect Speed-"
    internal: true
    nec:
      address: 0xEF00
      command: 0xED12
    on_press:
      - lambda: |-
          id(active_effect) -= 1;
          if (id(active_effect) < 1) id(active_effect) = 7;  // Go to the last effect
          auto call = id(rgb_partition).turn_on();
          switch (id(active_effect)) {
            case 1:
              call.set_effect("Rainbow");
              break;
            case 2:
              call.set_effect("Color Wipe");
              break;
            case 3:
              call.set_effect("Scan");
              break;
            case 4:
              call.set_effect("Twinkle");
              break;
            case 5:
              call.set_effect("Random Twinkle");
              break;
            case 6:
              call.set_effect("Fireworks");
              break;
            case 7:
              call.set_effect("Sound Rainbow Effect");
              break;
          }
          call.perform();
  # Button 24: Colortemperature Down
  - platform: remote_receiver
    name: "Colortemperature Down"
    internal: true
    nec:
      address: 0xEF00
      command: 0xEC13
    on_press:
      - light.turn_on:
          id: cw_ww
          color_temperature: !lambda |-
            float current_temp = id(cw_ww).current_values.get_color_temperature();
            // Verhoog (koelere lichtkleur) door mireds met 10% te verlagen
            float new_temp = current_temp * 0.9;
            // Bewaak de grenzen
            if(new_temp < 153) new_temp = 153;   // ~6500K
            if(new_temp > 370) new_temp = 370;   // ~2700K
            return new_temp;
  # Button 25: sound effect
  - platform: remote_receiver
    name: "sound effect"
    internal: true
    nec:
      address: 0xEF00
      command: 0xEB14
    on_press:
      then:
        - light.turn_on:
            id: rgb_partition
            effect: "Sound Rainbow Effect"
2 Likes

I wrote a blogpost about my process (in Dutch) :

1 Like

Would this also work with the 10m variant? Upto 18/2/25 on sale at €20

Yes I think so, if it is the same strip but longer… Sure you have to number the rest of the leds :wink:

10m variant not work :frowning: despite testing various codes from this thread the strip does not light up in any way :frowning:
Small Edit:
:grinning:
I spent some time on your code and launched a 10-meter LED strip on the LSC 3202086.2 controller.
What works:

  • full RGB control with effects.
    • control of cold and warm white.
      What doesn’t work:
    • remote control
    • button on the controller
    • Mic

I’m uploading my TUYA config, as you can see I have different pins for power supply (pin 22) and white control C (pin 24) and W (pin 6):

{
	"Jsonver":"1.0.5",
	"brightmin":"10",
	"gmwb":"75",
	"title20":"0",
	"cdtime1":"60",
	"1err":"40",
	"cdtime3":"180",
	"cdtime2":"120",
	"totallen":"1000",
	"gmwg":"70",
	"knum":"1",
	"leaderr":"15",
	"wfcfg":"spcl_auto",
	"colormin":"10",
	"bitseq":"0",
	"pmemory":"1",
	"gmkb":"60",
	"pairt":"180",
	"cmod":"rgbcw",
	"slidemod":"2",
	"micpin":"23",
	"customcode":"00ff",
	"rstbr":"50",
	"ktime":"5",
	"0err":"70",
	"colormax":"100",
	"c_pin":"24",
	"module":"CBU",
	"ctrl_lv":"1",
	"rstmode":"2",
	"irpin":"26",
	"brightmax":"100",
	"sfunc":"1",
	"key_lv":"0",
	"wfct":"3",
	"pwmhz":"1000",
	"defbri{nc_tp":"0",
	"ssid":"null",
	"passwd":"null",
	"md":"0",
	"wfb64":"1",
	"stat":"0",
	"token":"null",
	"region":"null",
	"reg_key":"null",
	"dns_prio":"0 }{uuid",
	"psk_key":"bla bla",
	"auth_key":"bla bla",
	"ap_ssid":"SmartLife",
	"ap_passwd":"null",
	"country_code":"CN",
	"bt_mac":"null",
	"bt_hid":"null",
	"prod_test":"false",
	"fac_pin":"tiwbma6desgbs2if }ght",
	"starterr":"20",
	"rstcor":"c",
	"rstnum":"3",
	"deftemp":"100",
	"sensimax":"750",
	"micproc":"300",
	"c_lv":"1",
	"miso":"17",
	"mosi":"16",
	"k1dfunc":"0",
	"irfunc":"1",
	"keyfunc":"1",
	"brifollow":"1",
	"ctrl_pin":"22",
	"adclimit":"1250",
	"sensimin":"50",
	"ismusic":"1",
	"wt":"20",
	"prodagain":"1",
	"key_pin":"20",
	"brightstep":"20",
	"remdmode":"0",
	"cagt":"20",
	"w_lv":"1",
	"colorpfun":"1",
	"CS":"15",
	"gmwr":"80",
	"rgbt":"20",
	"colormaxp":"100",
	"gmkg":"60",
	"onoffmode":"1",
	"colororder":"1",
	"w_pin":"6",
	"LedNum":"40",
	"irfunset":"[[2",
	"aging":"1",
	"rsttemp":"100",
	"category":"0505",
	"SCL":"14",
	"gmkr":"65",
	"defcolor":"c",
	"crc":"22"
}

And this is the ESP code:

esphome:
  name: ledy-rgb-ic
  friendly_name: LEDY RGB IC

bk72xx:
  board: generic-bk7231n-qfn32-tuya

# Enable logging
logger:
  level: INFO

# Enable Home Assistant API
api:
  encryption:
    key: "HIDDEN"

ota:
  - platform: esphome
    password: "HIDDEN"

wifi:
  ssid: wifi
  password: pass

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Ledy-Rgb-Ic Fallback Hotspot"
    password: "pass"

captive_portal:

web_server:
#####################################  

light:
  - platform: beken_spi_led_strip
    rgb_order: RBG   # Zmienione na BGR
    id: RGBIC_CCTIC_ledstrip
    pin: P16
    num_leds: 40
    chipset: SM16703
    name: None
    #power_supply: led_power
    internal: true
#####################################

  - platform: cwww
    name: "LED CCT"
    warm_white: warm_output
    cold_white: cold_output
    warm_white_color_temperature: 2700 K
    cold_white_color_temperature: 6500 K

### ALL RGB LEDS IN 1 LIGHT ########
  - platform: partition
    name: "RGB"
    effects:
     - random:
     - pulse:
     - strobe:
     - flicker:
     - addressable_rainbow:
     - addressable_rainbow:
        name: Rainbow Effect Custom
        speed: 15
        width: 50
     - addressable_color_wipe:
     - addressable_scan:
     - addressable_twinkle:
     - addressable_random_twinkle:
        name: Random Twinkle Custom
        twinkle_probability: 10%
        progress_interval: 32ms 
     - addressable_random_twinkle:
     - addressable_fireworks: 

    segments:
      # RGB LEDS AT EVEN ADDRESSES
      - id: RGBIC_CCTIC_ledstrip
        from: 0
        to: 0
      - id: RGBIC_CCTIC_ledstrip
        from: 2
        to: 2
      - id: RGBIC_CCTIC_ledstrip
        from: 4
        to: 4
      - id: RGBIC_CCTIC_ledstrip
        from: 6
        to: 6
      - id: RGBIC_CCTIC_ledstrip
        from: 8
        to: 8
      - id: RGBIC_CCTIC_ledstrip
        from: 10
        to: 10
      - id: RGBIC_CCTIC_ledstrip
        from: 12
        to: 12
      - id: RGBIC_CCTIC_ledstrip
        from: 14
        to: 14
      - id: RGBIC_CCTIC_ledstrip
        from: 16
        to: 16
      - id: RGBIC_CCTIC_ledstrip
        from: 18
        to: 18
      - id: RGBIC_CCTIC_ledstrip
        from: 20
        to: 20
      - id: RGBIC_CCTIC_ledstrip
        from: 22
        to: 22
      - id: RGBIC_CCTIC_ledstrip
        from: 24
        to: 24
      - id: RGBIC_CCTIC_ledstrip
        from: 26
        to: 26
      - id: RGBIC_CCTIC_ledstrip
        from: 28
        to: 28
      - id: RGBIC_CCTIC_ledstrip
        from: 30
        to: 30
      - id: RGBIC_CCTIC_ledstrip
        from: 32
        to: 32
      - id: RGBIC_CCTIC_ledstrip
        from: 34
        to: 34
      - id: RGBIC_CCTIC_ledstrip
        from: 36
        to: 36
      - id: RGBIC_CCTIC_ledstrip
        from: 38
        to: 38
#################################################
      - id: RGBIC_CCTIC_ledstrip
        from: 1
        to: 1
      - id: RGBIC_CCTIC_ledstrip
        from: 3
        to: 3
      - id: RGBIC_CCTIC_ledstrip
        from: 5
        to: 5
      - id: RGBIC_CCTIC_ledstrip
        from: 7
        to: 7
      - id: RGBIC_CCTIC_ledstrip
        from: 9
        to: 9
      - id: RGBIC_CCTIC_ledstrip
        from: 11
        to: 11
      - id: RGBIC_CCTIC_ledstrip
        from: 13
        to: 13
      - id: RGBIC_CCTIC_ledstrip
        from: 15
        to: 15
      - id: RGBIC_CCTIC_ledstrip
        from: 17
        to: 17
      - id: RGBIC_CCTIC_ledstrip
        from: 19
        to: 19
      - id: RGBIC_CCTIC_ledstrip
        from: 21
        to: 21
      - id: RGBIC_CCTIC_ledstrip
        from: 23
        to: 23
      - id: RGBIC_CCTIC_ledstrip
        from: 25
        to: 25
      - id: RGBIC_CCTIC_ledstrip
        from: 27
        to: 27
      - id: RGBIC_CCTIC_ledstrip
        from: 29
        to: 29
      - id: RGBIC_CCTIC_ledstrip
        from: 31
        to: 31
      - id: RGBIC_CCTIC_ledstrip
        from: 33
        to: 33
      - id: RGBIC_CCTIC_ledstrip
        from: 35
        to: 35
      - id: RGBIC_CCTIC_ledstrip
        from: 37
        to: 37
      - id: RGBIC_CCTIC_ledstrip
        from: 39
        to: 39

output:
  - platform: libretiny_pwm
    id: warm_output
    pin: P6
    frequency: 1000 Hz

  - platform: libretiny_pwm
    id: cold_output
    pin: P24
    frequency: 1000 Hz

switch:
  - platform: gpio
    name: "LED Power"
    pin: P22
    id: led_power_switch
    restore_mode: ALWAYS_ON

Hey, thank you for your work!
For me, the light on transition for cct light didnt work as expected. It just turned direct from 0 to 100 after transition time.

The solution was to add ā€œgamma_correct: 1.0ā€ to Platform cct section.

Hi there, i had this lsc ledstrip action laying around, and now i’m trying to replecate your way for implemant in HA.

However, not being as smart as you guys, i’m not getting the point

After flashing the OpenBeken software, I performed an OTA update to ESPHome.

Flashing to ESPHome
I first created a new device in ESPHome Compiler based on the generic-bk7231n-qfn32-tuya board. I downloaded the ESPHome firmware as a Beken OTA file and renamed it to ā€œOpenBK7231N_esphome.rblā€ to avoid an invalid firmware error.

so in esphome builder, i created a new device, named is OpenBK7231N_esphome, can’t connect so skip this step, select the generic-bk7231n board, and now HA ask me to install, but with cable??, can’t do this, so manual download, installation started, but i get an error. missing a library?


how to resolve this?