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

Thanks to @jbhobson @MnM for your efforts on this! I bought a bunch of these downlights I think around May 2024 that have sat in the to do list for a long time and finally delving down the rabbit hole to integrate them into HA etc. They are Casalux 706391 Smart-AL2017-RGB-TGTS - I haven’t pulled one apart because I can’t seem to prise the blue part off without anything except a reciprocating saw…! But I believe from my research they are the W2BL / bk7231T beken chipsets…

I was very close to flashing OpenBK7231T_1.18.72.rbl via tuya-cloudcutter and at the last minute saw this thread and it seems ESPHome may be the better choice for simplicity, although it’s a bit over my head… ?

I run a pretty simple home assistant server and don’t need to do anything too fancy except want reliable lights, I haven’t yet got a proper switch system set up so there’s quite a chance random people may accidentally turn off by the switch which completely kills the power etc so will want to make sure they can re-join/pair back to wifi and not get wiped or be unreliable.

Is there any pros/cons for ESPHome vs OpenBeken before I go ahead and flash them all? I have about 15 of them.

I setup an ubuntu VM for the first time and got cloudcutter etc on it, and a USB TPLink T3U usb wifi dongle, although I’ve seen some reports that the wifi adapter needs to be able to do an AP Mode for you to be able to do this?

Appreciate any help for my first true smart home project where once the firmware is flashed there’s no going back! :slight_smile: :slight_smile:

I have been running these lights since September 2023 with ESPHome. They run great. I had them running on OpenBeken for a few days but then I decide to move them to ESPhome.
I went with ESPHome for simplicity reasons as it is integrated into Home Assistant.
But both OpenBeken and ESPhome will do the job.

Please also see this if you decide to use ESPHome, as you will have the same issue I had:

https://github.com/esphome/issues/issues/5196

This will work with your use case where the switch cuts off power to downlight.

Thanks so much for the info! I didn’t realise you can flash as openbeken then reflash as esphome. Makes sense.

I am thinking best answer for me is ESPHome. You don’t happen to know a good guide to do this? I’m guessing something like this video?

Any chance you can give a bit more info on how to find the “ESPHome basic option”? I’m a little lost with this, is it just under standard devices within cloud cutter ?

This sounds more like an issue with the way you’ve wired and use them. These lights should have permanent power supplied to them, with the On/Off function being sent/controlled by command from a source like Home Assistant.

Apart from adding voice control to HA for making it easier to turn these on/off, if wanting to have it so that they can be also turned off by a wall switch then this requires permanent power to the light (still) and some sort of either ‘smart’ wall switch (with its own power permanently on) that can send a command back to the HA (and/or a Loxone type controller) to in turn tell the light to on/off.

Trying to work out myself, if something like a Shelly connected to the legacy wall switch (or the button itself replaced with a push and release type button) setup to send these triggers to HA ???