Hi All,
I bought these recessed Sunco lights and realized too late that they only worked with the proprietary Sunco app. Apparently I could have bought a Tuya bridge but I didn’t wanna. With the help of ChatGPT I was able to figure out how to reflash the board and integrate into ESPhome.
[Guide] Flashing Sunco Smart Downlights with ESPHome (Tuya CBU / BK7231N)
I successfully replaced the original firmware on a Sunco smart downlight with ESPHome, using a CP2102 USB-to-serial adapter and ltchiptool.
I’m sharing the process for anyone who wants local Home Assistant control without relying on the Sunco app or cloud.
Hardware
| Item | Details |
|---|---|
| Manufacturer | Sunco Lighting |
| Model | DL_SL6_S_NF-WH-2760K |
| Light | 6-inch smart downlight |
| Wi-Fi module | Tuya CBU |
| Chipset | Beken BK7231N |
| Firmware | ESPHome / LibreTiny |
| LED channels | RGB + Cool White + Warm White |
| PWM frequency | 4000 Hz |
Tools required
-
CP2102 USB-to-TTL adapter (3.3V logic)
-
Regulated 3.3V bench power supply
-
Multimeter with continuity mode
-
Soldering iron and small insulated wires
-
Windows computer
-
ESPHome Device Builder
Electrical safety: The original fixture operates from 120V AC and uses a separate high-voltage LED driver. Disconnect the controller PCB completely from the mains driver before programming. Never connect the USB adapter or bench supply to an energized fixture. Capacitors can retain charge. Modifying the fixture may affect its electrical safety certification.
1. Identify the controller
Opening the controller assembly revealed a Tuya CBU module containing a BK7231N.
The controller PCB is marked:
EPCL-WiFi-RGBCW-MOS-V1.0
2. Programming connections
The CBU uses UART1 for serial programming.
| CP2102 | CBU module |
|---|---|
| TXD | RX1 / P10 |
| RXD | TX1 / P11 |
| GND | PCB GND |
| 3V3 | Not connected |
| 5V | Not connected |
TX and RX must be crossed.
With the CBU antenna oriented at the top, the programming contacts identified from the module pinout are:
| Module pin | Function |
|---|---|
| 15 | TX1 |
| 16 | RX1 |
| 18 | CEN (chip enable/reset) |
Verify the pin orientation against the official Tuya CBU datasheet before soldering.
Power connections
I used a separate bench supply rather than the CP2102’s 3.3V output.
On my PCB, continuity testing identified:
-
3.3V: Right-hand pad of capacitor C8.
-
GND: Solder pad beside the original black power wire.
-
C8 left-hand pad: Ground.
-
C8 right-hand pad: Continuity to CBU VCC.
[UPLOAD IMAGE: Annotated C8 3.3V and GND solder points]
The PCB’s original +48V connection must never be connected to the USB adapter or 3.3V bench supply.
The onboard regulator’s reverse-current tolerance was not independently established. Powering the 3.3V rail in circuit carries a risk of backfeeding the regulator. Verify the electrical arrangement on your own board before attempting this.
My bench supply was set to 3.30V with current limiting. The controller drew approximately 50mA during one idle measurement.
3. Back up the original firmware
Before replacing the firmware, I used ltchiptool to read the original flash contents.
Settings:
| Setting | Value |
|---|---|
| Device port | CP2102 COM port |
| Chip family | Beken 72xx |
| Operation | Read flash |
| Linking baud | 115200 |
| Flashing baud | 115200 |
To enter the BK7231N download mode:
-
Connect the CP2102 TX, RX, and common ground.
-
Supply a stable 3.3V to the controller.
-
Select Read flash and click Start in ltchiptool.
-
While the tool waits for the chip, momentarily connect the verified CEN contact to GND.
-
Release CEN and allow the flash read to complete.
-
Save the original
.binbackup in a safe location.
Do not proceed with flashing if the backup fails integrity checks.
Troubleshooting: Incomplete response / CRC mismatch
I initially encountered errors such as:
Incomplete response read: 4089 != 4101
Chip CRC value does not match calculated CRC value
I tried lowering the baud rate, but the problem persisted.
The actual problem was a disconnected CP2102 ground wire.
After restoring the common ground connection, the firmware backup completed successfully.
If you experience similar errors, check the common ground, TX/RX solder joints, wire length, and supply voltage before changing software settings.
4. ESPHome GPIO mapping
The original Tuya firmware configuration yielded these LED channel assignments:
| Channel | BK7231N GPIO |
|---|---|
| Red | P8 |
| Green | P7 |
| Blue | P6 |
| Cool White | P26 |
| Warm White | P24 |
The original configuration also specified:
cmod: rgbcw
pwmhz: 4000
r_lv: 1
g_lv: 1
b_lv: 1
c_lv: 1
w_lv: 1
These GPIOs initialized successfully under ESPHome. Physical LED behavior still needs testing.
5. ESPHome configuration
This is the configuration I installed. Replace the API key and fallback hotspot password with your own values.
# Sunco Smart Downlight
# Tuya CBU / BK7231N
esphome:
name: basement-light-1
friendly_name: Basement Light 1
bk72xx:
board: cbu
logger:
api:
encryption:
key: "REPLACE_WITH_YOUR_OWN_API_KEY"
ota:
- platform: esphome
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
ssid: "Basement Light 1 Hotspot"
password: "REPLACE_WITH_STRONG_PASSWORD"
captive_portal:
output:
- platform: libretiny_pwm
id: red_output
pin: P8
frequency: 4000 Hz
- platform: libretiny_pwm
id: green_output
pin: P7
frequency: 4000 Hz
- platform: libretiny_pwm
id: blue_output
pin: P6
frequency: 4000 Hz
- platform: libretiny_pwm
id: cold_white_output
pin: P26
frequency: 4000 Hz
- platform: libretiny_pwm
id: warm_white_output
pin: P24
frequency: 4000 Hz
light:
- platform: rgbww
name: "Basement Light 1"
id: basement_light
red: red_output
green: green_output
blue: blue_output
cold_white: cold_white_output
warm_white: warm_white_output
cold_white_color_temperature: 6000 K
warm_white_color_temperature: 2700 K
color_interlock: true
constant_brightness: false
restore_mode: ALWAYS_OFF
The color_interlock: true setting prevents simultaneous RGB and white-channel operation. The original Sunco nightlight functionality may require additional configuration.
6. Compile and flash ESPHome
In ESPHome Device Builder:
-
Create a device using CBU Wi-Fi Module.
-
Paste the YAML configuration.
-
Select Install → Manual download.
-
Choose Beken Application Image.
-
Download the resulting
.rblfirmware file.
In ltchiptool:
-
Select Write flash / identify file.
-
Load the ESPHome
.rblfile. -
Verify that ltchiptool identifies it as
Beken CRC/UA App. -
For my build, the automatically detected application start address was
0x11000. -
Click Start and briefly reset the CBU using CEN-to-GND when prompted.
-
Allow the flash operation to finish.
I had already saved a verified backup of the factory firmware before performing the write.
7. Verify ESPHome and Home Assistant
After flashing, I power-cycled the CBU using the 3.3V bench supply.
The device successfully connected to Wi-Fi and appeared ONLINE in ESPHome Device Builder.
The logs confirmed:
ESPHome version 2026.11.1
LibreTiny on cbu
WiFi Connected: YES
Noise encryption: YES
PWM Output: Frequency 4000.0 Hz
Pin 8
Pin 7
Pin 6
Pin 26
Pin 24
Light 'Basement Light 1'
I then added the device through Home Assistant’s ESPHome integration.
The ESPHome native API and OTA update functionality were working.
Current validation status: Firmware flashing, Wi-Fi, Home Assistant integration, and initialization of all five PWM outputs succeeded. Physical LED illumination, dimming accuracy, color-temperature mixing, and the original nightlight behavior have not yet been verified.
8. Remaining work
I have six of these Sunco lights and intend to migrate the remaining five after validating the first fixture’s physical LED behavior.
The goal is completely local control through ESPHome and Home Assistant, without depending on the Sunco app.
Once the fixture is safely reassembled, I’ll test RGB, tunable white, brightness, and nightlight behavior and update this post with the results.

