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:
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.
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
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?
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
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"
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).
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!
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:
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 ???