Aldi Casa Life 9W Downlight config help needed

Hi,

I have a few Aldi Casa Life 9W downlights.
They all have BK7231T/WB2L chipset one them. Currently they are al running OpenBeken wiht the following configuration:

  PIN 6: PWM-2 - Blue
  PIN 7: PWM_n-3  - C/W TEMP
  PIN 8: PWM-4 - C/W BRIGHTNESS
  PIN 24: PWM-1 -GREEN
  PIN 26: PWM-0 - RED

It also has OpenBeken flag 8 selected in order to work properly:

“[LED] Alternate CW light mode (first PWM for warm/cold slider, second for brightness)”

With LibreTiny supporting OpenBeken chipsets I will like to try and run ESPHome on a few of these downlights.

The issues is that I am really new to ESPHome and will like some help with the Output section (GPIO configuration), especially how should I go about PIN7, which uses PWM_N (reverse PWM).
Also the OpenBeken flag 8. I am not sure how to go about defining these in ESPHome.

And just to be safe maybe the light section too.

Thanks guys.

I don’t have the RGB-CW version only the CW/WW one but here is my working ESPHome code which required the 'color_temperature" platform for the controls.

# Aldi Casa AL2017-TGTS CWWW Down Light
# Beken BK7231t with LibreTiny
# casa-dl-3.yaml
# V1a - default generated code from itchiptool, <s>reversed pins</s>
# V1b - added restore mode and wifi sensor
# V1c - change to colour temperature component, P7-colour temp  , P8-brightness
# P7/Channel 0/PWM1 Controls the colour temperature with values 0(warm) - 100(cool)
# P8/Channel 1/PWM2 Controls the brightness with values 0 - 100 as a percentage
# V1d - cold/warm swapped, invert P7
# V1e - added initial turn on colour and brightness


esphome:
  name: casa-dl-3
  friendly_name: casa-dl-3
  
  on_boot:
    priority: 600
    then:
      - light.turn_on: 
          id: light_cwww
          brightness: 35%
          color_temperature: 3000K

bk72xx:
  board: generic-bk7231t-qfn32-tuya

logger:

web_server:

captive_portal:

mdns:

api:
  password: ""

ota:
  password: ""

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

text_sensor:
  - platform: libretiny
    version:
      name: LibreTiny Version

output:
  - platform: ledc
    id: colour_temp
    pin: P7
    inverted: True
  - platform: ledc
    id: bright
    pin: P8

light:
  - platform: color_temperature
    id: light_cwww
    name: Light1
    color_temperature: colour_temp
    brightness: bright    
    cold_white_color_temperature: 6500 K
    warm_white_color_temperature: 2700 K
# Ensure the light turns on by default if the physical switch is actuated.
    restore_mode: ALWAYS_ON

sensor:
  - platform: wifi_signal
    name: "Casa3 WiFi"
    update_interval: 60s
1 Like

Hi,

Thank you for sharing your config.
I tested the white component with your code and it works perfectly.

I will work on the RGB next.

Just for the record this is the configuration I ended up with. It works perfectly (only showing the Output and Light sections)

output:
  - platform: ledc
    id: output_red
    pin: P26
    max_power: 100%
    frequency: ${frequency_rgb}
  - platform: ledc
    id: output_green
    pin: P24
    max_power: 100%
    frequency: ${frequency_rgb}
  - platform: ledc
    id: output_blue
    pin: P6
    max_power: 100%
    frequency: ${frequency_rgb}
  - platform: ledc
    id: output_cold_white
    max_power: 100%
    frequency: ${frequency_cw}
    pin: P7
    inverted: True
  - platform: ledc
    id: output_warm_white
    pin: P8
    max_power: 100%
    frequency: ${frequency_ww}

light:
  - platform: rgbct
    name: ${device_name}
    id: ${device_id}
    red: output_red
    green: output_green
    blue: output_blue
    color_temperature: output_cold_white
    white_brightness: output_warm_white
    cold_white_color_temperature: 6500 K
    warm_white_color_temperature: 2700 K
    gamma_correct: 0
    default_transition_length: 0.5s
    restore_mode: RESTORE_DEFAULT_OFF

Hi @MnM

Your code above refers to a bunch of ‘substitutions’, that you haven’t included above. Any chance you could confirm:

frequency: ${frequency_rgb}
frequency: ${frequency_cw}
frequency: ${frequency_ww}

Also ‘platform: ledc’ no longer works as ESPHome incorporated LibreTiny in September 2023 and ESPHome requires an ESP32 for LEDC. Instead ‘platform: libretiny_pwm’ should now be used for these Aldi lights.

Edit: Using the above, I end up with the device flashed with ESPHome, but only showing a single light switch (on/off) button and with a 0 to 255 slider below it, that control 0-100% brightness. Any idea how you can control the RGB colour(s) of the light and its brightness, plus slider for 2700k - 6500k on the white LED?

Thanks.

Have recently put a number of these downlights through cloudcutter and into ESPHome. Below is my current configuration that is working with control over CW/WW as well as RGB:

substitutions:
  friendly_name: "Light"

esphome:
  name: aldi-downlight
  friendly_name: Aldi Downlight
  
  on_boot:
    priority: 600
    then:
      - light.turn_on: 
          id: Downlight
          color_temperature: 3200K
          color_mode: COLOR_TEMPERATURE

bk72xx:
  board: generic-bk7231t-qfn32-tuya

# Enable logging
logger:

mdns:

web_server:

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

ota:
  password: !secret ota_password

debug:
  update_interval: 30s

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Aldi Downlight AP"
    password: !secret ap_password

captive_portal:

button:
  - platform: restart
    name: Restart

text_sensor:
  - platform: wifi_info
    ssid: 
      name: SSID

    ip_address: 
      name: IP Address

    mac_address:
      name: MAC Address

    dns_address: 
      name: DNS Address
  
  - platform: libretiny
    version:
      name: LibreTiny Version
  
  - platform: debug
    reset_reason:
      name: Last Reset Reason

sensor:
  - platform: wifi_signal # Reports the Wifi signal strength/RSSI in dB
    name: "Wifi Signal (dB)"
    unit_of_measurement: dB
    id: wifi_signal_db
    update_interval: 90s
    entity_category: "diagnostic"

  - platform: copy # Reports the Wifi signal strength in %
    source_id: wifi_signal_db
    name: "Wifi Signal (%)"
    filters:
      - lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
    unit_of_measurement: "%"
    entity_category: "diagnostic"
    device_class: ""
  
  - platform: uptime
    name: Uptime

# Define the pin outs and PWM values for the downlight
output:
  - platform: libretiny_pwm # Red
    id: output_red
    pin: P26
    max_power: 100%
    frequency: 1000 Hz

  - platform: libretiny_pwm # Green
    id: output_green
    pin: P24
    max_power: 100%
    frequency: 1000 Hz

  - platform: libretiny_pwm # Blue
    id: output_blue
    pin: P6
    max_power: 100%
    frequency: 1000 Hz

  - platform: libretiny_pwm # CW
    id: output_cold_white
    max_power: 100%
    frequency: 1000 Hz
    pin: P7
    inverted: True

  - platform: libretiny_pwm # WW
    id: output_warm_white
    pin: P8
    max_power: 100%
    frequency: 1000 Hz

# Create the light device for use within Home Assistant
light:
  - platform: rgbct
    name: ${friendly_name}
    id: Downlight
    red: output_red
    green: output_green
    blue: output_blue
    color_temperature: output_cold_white
    white_brightness: output_warm_white
    cold_white_color_temperature: 6500 K
    warm_white_color_temperature: 2700 K
    gamma_correct: 2.8
    default_transition_length: 0.5s
    restore_mode: RESTORE_DEFAULT_ON
    color_interlock: True # Prevent the CW/WW LED's being on the same time as the RGB LED's  
    on_turn_on: # Reset the light to a predefined state each time it is turned on
      then:
        - light.control:
            id: Downlight
            color_temperature: 3200K
            color_mode: COLOR_TEMPERATURE


Here are the relevant ESPHome sections that I use (you bring your own OTA, web_server, etc):

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

output:
  - platform: libretiny_pwm
    id: output_red
    pin: P26
    max_power: 100%
    frequency: ${frequency_rgb}
  - platform: libretiny_pwm
    id: output_green
    pin: P24
    max_power: 100%
    frequency: ${frequency_rgb}
  - platform: libretiny_pwm
    id: output_blue
    pin: P6
    max_power: 100%
    frequency: ${frequency_rgb}
  - platform: libretiny_pwm
    id: output_cold_white
    max_power: 100%
    frequency: ${frequency_cw}
    pin: P7
    inverted: True
  - platform: libretiny_pwm
    id: output_warm_white
    pin: P8
    max_power: 100%
    frequency: ${frequency_ww}

light:
  - platform: rgbct
    name: ${device_name}
    id: ${device_id}
    red: output_red
    green: output_green
    blue: output_blue
    color_temperature: output_cold_white
    white_brightness: output_warm_white
    cold_white_color_temperature: 6500 K
    warm_white_color_temperature: 2700 K
    gamma_correct: 0
    default_transition_length: 0.5s
    restore_mode: RESTORE_AND_ON
    on_turn_on:
      - globals.set:
          id: last_light_state
          value: "true"
    on_turn_off:
      - globals.set:
          id: last_light_state
          value: "false"

and the frequency

  frequency_rgb: 5000 Hz
  frequency_cw: 5000 Hz
  frequency_ww: 5000 Hz

I am only showing the relevant sections as the rest is largely dependent on how you structured your ESPHome sections.

Have been running these downlights since I got them, almost 1 year ago without any issues at all (initially on OpenBeken and then with ESPHome).

If any use to anyone, I ended up just making this into a template, to allow rolling out multiple lights and centrally control their configuration.

The template is at: myHomeAssistant/esphome/aldi-casalux-smart-led-rgbw.yaml at main · Roving-Ronin/myHomeAssistant · GitHub

and can be used with the following in your individual lights yaml file (or download and modify the template and call it using local packages command).

substitutions:
  name: "light-front-patio"
  friendly_name: "Light - Front Patio"
  device_description: "Aldi Casalux - 8W RGBW LED Downlight at Front Door Patio"
  location: "Front Door"
  # The phase in the home power supply, upon which this plug is utilsed. 1p = A. 3p = A, B or C.  (myHome GPO 1 = Phase C, GPO 2 = Phase A, GPO 3 = Phase B)
  power_circuit: "Lights" 
   # Restore the relay (Light switch) upon reboot to state:
  light_restore_mode: RESTORE_DEFAULT_OFF
   # Set your locations latitude and longitude. Useful if you want to use the sun and its location in relation to the horizon to on/off (or as a condition) to control lights.
  my_latitude: ""
  my_longitude: ""
   # Define a domain for this device to use. i.e. iot.home.lan (so device will appear as athom-smart-plug-v2.iot.home.lan in DNS/DHCP logs)
  dns_domain: ""
   # Set timezone of the device. Useful if the plug is in a location different to the HA server. Can be entered in unix Country/Area format (i.e. "Australia/Sydney")
  timezone: "Australia/Sydney"
   # Set the duration between the sntp service polling ntp.org servers for an update
  sntp_update_interval: 6h
   # Network time servers for your region, enter from lowest to highest priority
  sntp_server_1: "2.pool.ntp.org"
  sntp_server_2: "1.pool.ntp.org"
  sntp_server_3: "0.pool.ntp.org"  

packages:
#  Aldi_Casalux.Smart_LED_Downlight_RGBW: github://roving-ronin/myHomeAssistant/esphome/aldi-casalux-smart-led-rgbw.yaml
  remote_package:
    url: https://github.com/Roving-Ronin/myHomeAssistant/
    ref: main 
    files: [esphome/aldi-casalux-smart-led-rgbw.yaml]
    refresh: 1d # optional

esphome:
  name_add_mac_suffix: false

bk72xx:
  board: generic-bk7231t-qfn32-tuya

binary_sensor:
   - id: !remove device_status

# Enable Home Assistant API
api:
  encryption:
    key: "YOUR KEY"

ota:
  password: "YOUR PASSWORD"

Interesting how that doesn’t work for you. It works fine for me.
I might give your frequencies a test and see the difference .
Cheers.

“board: generic-bk7231t-qfn32-tuya is also usable

As per comment in the yaml, it does work. I have 1 running each board version currently (and 5 more to cloudcutter yet).

Ahhh OK :slight_smile:

Have you seen any difference between the boards?

No idea, I’m not cracking open the shell on the lights, just CloudCutter —> ESPHome Basic option, then use the template I posted with the individual devices yaml (leaving whatever board type if came up with when detected).

I meant in how they operate.
Any differences? Or both (with different bords in yaml) operate the same?

Both operate exactly the same.

If anyone wants it, just published a config you can pull from GitHub, but for the CW+WW version.

Here’s the the file config you’d need to enter on your local / device setup in ESPHome to use this template. I’ve included the suggested substitutions you’ll need to update to customised it to your LAN and location the world.

The RGBW version I posted previously is called the same way, but update the example below to call it, not the CWWW version, by changing to: files: [esphome/aldi-casalux-smart-led-cwww.yaml]

substitutions:
  name: "aldi-led-cwww"
  friendly_name: "Aldi Casalux - LED CWWW"
  device_description: "Aldi Casalux - 8W LED Downlight CW+WW"
   # Allows ESP device to be automatically lined to an 'Area' in Home Assistant. Typically used for areas such as 'Lounge Room', 'Kitchen' etc  
  location: "Study"
  # The phase in the home power supply, upon which this plug is utilsed. 1p = A. 3p = A, B or C.  (myHome GPO 1 = Phase C, GPO 2 = Phase A, GPO 3 = Phase B)
  power_circuit: "Lights"     
   # Set your locations latitude and longitude. Useful if you want to use the sun and its location in relation to the horizon to on/off (or as a condition) to control lights.
  my_latitude: ""
  my_longitude: ""
   # Define a domain for this device to use. i.e. .iot.home.lan (so device will appear as athom-smart-plug-v2.iot.home.lan in DNS/DHCP logs)
  dns_domain: ""
   # Set timezone of the smart plug. Useful if the plug is in a location different to the HA server. Can be entered in unix Country/Area format (i.e. "Australia/Sydney")
  timezone: "Australia/Sydney"
   # Set the duration between the sntp service polling ntp.org servers for an update
  sntp_update_interval: 6h
   # Network time servers for your region, enter from lowest to highest priority
  sntp_server_1: "2.pool.ntp.org"
  sntp_server_2: "1.pool.ntp.org"
  sntp_server_3: "0.pool.ntp.org"

esphome:
  name_add_mac_suffix: false

bk72xx:
  board: generic-bk7231t-qfn32-tuya

packages:
#  Aldi_Casalux.Smart_LED_Downlight_RGBW: github://roving-ronin/myHomeAssistant/esphome/aldi-casalux-smart-led-cwww.yaml
  remote_package:
    url: https://github.com/Roving-Ronin/myHomeAssistant/
    ref: main 
    files: [esphome/aldi-casalux-smart-led-cwww.yaml]
    refresh: 1d # optional

binary_sensor:
   - id: !remove device_status