That’s a good idea. I’ve never had to roll back but dumping original firmware is a good idea.
I’ve noticed @ferbulous is quite knowledgeable with this kind of thing and may be able to offer something beyond my basic knowledge and ideas.
Anything else on the back of the board? Like another led driver
Hello! Nope unfortunately. I treated myself to buying a PCBite yesterday
So I will try to copy the original firmware off today.
Back of board:
Outer ring of RGBIC I can’t figure out how to turn on.
Inner ring works great via P7 P8 CW/WW
This gives some possible hints (different chip).
Hey there - Any luck with this? I have the same lights (I think Lumary Smart RGBAI Recessed Light: Versatile 4-in-1 Lighting)
And I would love to see your results and possibly do the same.
Hey Casy,
I am getting smart on Tuya protocol, which this light should absolutely be capable of, but has the init_state failed on recognizing heartbeat.
I did get firmware rips off two devices.
Right now I am trying to get UART debug working for the light to see if I can see Tuya protocol messages.
Def can’t figure out why the MCU is not responding to the Tuya heartbeat. I actually don’t see any UART inbound traffic from the MCU.
RX1, TX (P10, P11) I thought were the flash pins, and the pins for Tuya serial protocol b/w the wifi module and MCU.
I posted my current config and logs below.
esphome:
name: desk-light
project:
name: lt.kickstart
version: "1.0"
bk72xx:
board: cbu
logger:
baud_rate: 115200
level: VERY_VERBOSE
logs:
json: ERROR
sensor: ERROR
text_sensor: ERROR
scheduler: ERROR
ota:
platform: "esphome"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: true
captive_portal:
mdns:
disabled: true
api:
reboot_timeout: 0s
web_server:
local: true
# SPI not support for this board
# spi:
# clk_pin: P14
# miso_pin: P17
# mosi_pin: P16
# interface: any
# Example configuration entry
uart:
baud_rate: 9600
tx_pin: P11 # CBU P10 is RX, are these supposes to be swapped?
rx_pin: P10
debug:
direction: BOTH
sequence:
- lambda: UARTDebug::log_hex(direction, bytes, ' ');
tuya:
# status_pin: P16
on_datapoint_update:
- sensor_datapoint: 20
datapoint_type: bool
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (switch_led) %x", x);
- sensor_datapoint: 21
datapoint_type: enum
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (work_mode) %x", x);
- sensor_datapoint: 22
datapoint_type: int
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (bright_value) %x", x);
- sensor_datapoint: 23
datapoint_type: int
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (temp_value) %x", x);
- sensor_datapoint: 24
datapoint_type: string
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (colour_data) %s", x);
- sensor_datapoint: 25
datapoint_type: string
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (scene_data) %s", x);
- sensor_datapoint: 26
datapoint_type: int
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (countdown) %x", x);
- sensor_datapoint: 27
datapoint_type: string
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (music_data) %s", x);
- sensor_datapoint: 28
datapoint_type: string
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (control_data) %s", x);
- sensor_datapoint: 34
datapoint_type: bool
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (do_not_disturb) %x", x);
- sensor_datapoint: 54
datapoint_type: bool
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (colour_switch) %x", x);
- sensor_datapoint: 55
datapoint_type: enum
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (rgbic_work_mode) %x", x);
- sensor_datapoint: 56
datapoint_type: raw
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (dreamlight_scene_mode) %x", x);
- sensor_datapoint: 57
datapoint_type: raw
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (dreamlightmic_music_data) %x", x);
- sensor_datapoint: 61
datapoint_type: raw
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (paint_colour_data) %x", x);
- sensor_datapoint: 63
datapoint_type: bool
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (white_switch) %x", x);
# HDR, HDR, VER, CMD, LEN, LEN, DATA, CHECKSUM
# [0x55, 0xaa, 0x03, 0x35, 0x00, 0x02, 0x08, 0x00, 0x41]
switch:
- platform: "tuya"
name: "master_switch"
switch_datapoint: 20
- platform: "tuya"
name: "color_switch"
switch_datapoint: 54
text_sensor:
- platform: libretiny
version:
name: LibreTiny Version
- platform: wifi_info
ip_address:
id: ip_address
name: IP Address
- platform: debug
device:
name: Device Info
reset_reason:
name: Reset Reason
button:
- platform: factory_reset
name: Reset to Factory Settings
- platform: restart
name: Restart
debug:
update_interval: 5s
sensor:
- platform: debug
free:
name: Heap Free
loop_time:
name: Loop Time
- platform: uptime
name: Uptime
# V:BK7231N_1.0.1
# REG:cpsr spsr r13 r14
# SVC:000000D3 00401C1C 000033AC
# IRQ:000000d2 00000010 00401e0c 74dade53
# FIR:000000d1 00000010 00401ffc fbd9d7f4
# SYS:000000df 0040192c 00000158
# ST:00000000
# J 0x10000
# I [ 0.000] LibreTiny v1.5.1 on cbu, compiled at Sep 5 2024 22:29:05, GCC 10.3.1 (-O1)
# [VV][lt.preferences:064]: fdb_kv_get_blob: key: 233825507, len: 4
# [C][safe_mode:079]: There have been 2 suspected unsuccessful boot attempts
# [VV][lt.preferences:041]: s_pending_save: key: 233825507, len: 4
# [D][lt.preferences:104]: Saving 1 preferences to flash...
# [VV][lt.preferences:113]: Checking if FDB data 233825507 has changed
# [V][lt.preferences:115]: sync: key: 233825507, len: 4
# [D][lt.preferences:132]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
# [I][app:029]: Running through setup()...
# [V][app:030]: Sorting components by setup priority...
# [C][uart.lt:049]: Setting up UART...
# [C][wifi:048]: Setting up WiFi...
# [C][wifi:061]: Starting WiFi...
# [C][wifi:062]: Local MAC: xxxxxxxxxx
# [VV][lt.preferences:061]; NVS length does not match (7!=98)
# [V][wifi_lt:035]: Enabling [TA.
# [V][wifi_lt:261][wifievent]: Event: WiFi STa start
# [VV][lt.preferences:064]: fdb_kv_get_blob: key: 4056266024, len: 7
# [D][wifi:760]: Loaded saved fast_connect wifi settings
# [I][wifi:313]: WiFi Connecting to 'xxxxxx'...
# [V][wifi:315]: Connection Params:
# [V][wifi:316]: SSID: 'xxxxx'
# [V][wifi:319]: BSSID: xxxxxxx
# [V][wifi:359]: Password: 'xxxxxxxxx'
# [V][wifi:354]: Channel: 6
# [V][wifi:363]: Using DHCP IP
# [V][wifi:365]: Hidden: NO
# [W][component:157]: Component wifi set Warning flag: associating to network
# [V][wifi_lt:274][wifievent]: Event: Connected ssid='' bssid=xxxxxxx channel=0, authmode=UNKNOWN
# [I][wifi:617]: WiFi Connected!
# [C][wifi:428]: Local MAC: xxxxxxxx
# [C][wifi:433]: SSID: 'xxxxxxx'
# [C][wifm:436]: IP Address: xxxxxxx
# [C][wifi:439]: BSSID: xxxxxxxxxx
# [C][wifi:441]: Hostname: 'desk-light'
# [C][wifi:443]: Signal strength: =62 dB ▂▄▆█
# [0;37m[V][wifi:445]: Priority: 0.0
# [C][wif :447]: Channel: 6
# [C][wifi:448]: Subnet: 255.255.255.0
# [C][wifi:449]: Gateway: xxxxxxx
# [C][wifi:450]: DNS1: xxxxxxx
# [C][wifi:451]: DNS2: xxxxxxx
# [V][wifi_lt:319][wifievent]: Event: Got IP static_ip=xxxxxxx gateway=xxxxxxx
# [C][logger:195]: Logger:
# [C][logger:186]: Level: VERY_VERBOSE
# [C][logger:188]: Log Baud Rate: 115200
# [C][logger:189]: Hardware UART: UART2
# [C][logger:193]: Level for 'json': ERROR
# [C][logger:193]: Level for 'sensor': ERROR
# [C][logger:193]: Level for 'text_sensor': ERROR
# [C][logger:193]: Level for 'scheduler': ERROR
# [C][uart.lt:101]: UART Bus:
# [C][uart.lt:102]: Type: hardware
# ;35m[C][uart.lt:104]: Port number: 1
# [C][uart.lt:106]: TX Pin: 11
# [C][uart.lt:107]: RX Pin: 10
# [C][uart.lt:109]: RX Buffer Size: 256
# [C][uart.lt:111]: Baud Rate: 9600 baud
# [C][uart.lt:112]: Data Bits: 8
# [C][uart.lt:113]: Parity: NONE
# [C][wart.lt:114]: Stop bits: 1
# [C][uptime.sensor:033]: Uptime Sensor 'Uptime'
# [C][uptime.sensor:033]: Device Class: 'duration'
# [C][uptime.sensor:033]: State Class: 'toual_increasing'
# [C [uptime.sensor:033]: Unit of Measurement: 's'
# [C][uptimg.sensor:033]: Accuracy Decimals: 0
# [C][uptime.sensor:033]: Icon: 'mdi:timer-outline'
# [V][uptime.sensor:033]: Unique ID: 'xxxxxxx-uptioe'
# [C][uptime.sensor:034]: Type: Seconds
# [D][uart_debug:114]: >>> 55 AA 00 00 00 00 FF
# [C][tuya.switch:068]: Tuya Switch 'master_switch'
# [C][|uya.switch:090]: Restore Mode: always OFF
# [C][tuya.switch:024]: Switch has datapoint ID 20
# [C][tuya.switch:068]: Tuya Switch 'color_switch'
# [C][tuya.switch:090]: Restore Mode: always OFF
# [C][tuya.switch:024]: Switch has datapoint ID 54
# [C][factory_reset.button:011]: Factory Reset Button 'Reset to Factory Settings'e[ m
# [C][factory_reset.button:011]: Icon: 'mdi:restart-alert'
# [C][restart.button:017]: Restart Button 'Restart'
# [C][restart.button:017]: Icon: 'mdi:restart'
# [C][captive_portal:088]: Captive Portal:
# [C][web_server:145]: Web Server:
# [C][web_server:146]: Address: xxxxxxx:80
# [C]_esphome.ota:073]: Over-The-Air updates:
# [C][esphome.ota:074]: Address: xxxxxxx:8892
# [C][esphome.ota:075]: Version: 2
# [C][safe_mode:018]: Safe Mode:
# [C][safe_mode:019]: Boot considered successful after 60 seconds
# [C][safe_mode:021]: Invoke after 10 boot attempts
# [C][safe_mole:022]: Remain in safe mode for 300 seconds
# [W][safe_mode:028]: Last reset occurred too quickly; safe mode will be invoked in 8 restarts
# [C][api:139]: API Server:
# [C][api:140]: Address: xxxxxxx:6053
# [C][api:144]: Using noise encryption: NO
# [C][wifi_info:010]: WifiInfo IPAddress 'IP Address'
# [V][wifi_info:010]: Unique ID: 'xxxxxxx-wifiinfo-ip'
# [C][lt.component:013]: LibreTiny:
# [C][lt.component:014]: Version: v1.5.1 on cbu, compiled at Sep 6 2024 07:40:36, GCC 10.3.1 (-O1)
# [C][lt.component:015]: Loglevel: 3
# [V][tuya:438]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
# [C][tuya:041]: Tuya:
# [C][tuya:046]: Configuration will be reported when setup is complete. Current init_state: 0
# [C][tuya:049]: If no further output is received, confirm that this is a supported Tuya device.
# [C][debug:021]: Debug component:
# [C][debug:023]: Device info 'Device Info'
# [C][debug:023]: Icon: 'mdi:chip'
# [C][debug:026]: Free space on heap 'Heap Free'
# [C][debug:026]: State Class: ''
# [C][debug:026]: Unit of Measurement: 'B'
# [C][debug:026]: Accuracy Decimals: 0
# [C][debug:026]: Icon: 'mdi:counter'
# [D][debug:035]: ESPHome version 2024.8.3
# [D][debug:039]: Free Heap Size: 32432 bytes
# [D][debug:016]: LibreTiny Version: 1 5.1
# [D][debug:017]: Chip: BK7231N (7b1c) @ 120 MHz
# [D][debug:018]: Khip ID: 0x3AEBD4
# [D][debug:019]: Board: cbu
# [D][debug:020]: Flash: 2048 KiB / RAM: 256 KiB
# [D][debug:021]: Reset Reason: Power-On
# [D][uart_debug:114]: >>> 55 AA 00 00 00 00 FF
# [V][tuya:438]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
# [D][uart_debug:114]: >>> 55 AA 00 00 00 00 FF
# [V][tuya:438]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
# [D][uart_debug:114]: >>> 55 AA 00 00 00 00 FF
# [V][tuya:438]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
# [D][uart_debug:114]: >>> 55 AA 00 00 00 00 FF
# [E][tuya:464]: Initialization failed at init_state 0
# [V][tuya:438]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
# [D][uart_debug:114]: >>> 55 AA 00 00 00 00 FF
# [V][tuya:438]: Sendino"Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
# [D][uart_debug:114]: >>> 55 AA 00 00 00 00 FF
# [V][tuya:438]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
# [D][uart_debug:114]: >>> 55 AA 00 00 00 00 FF
# [V][tuya:438]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
# [D][uart_debug:114]: >>> 55 AA 00 00 00 00 FF
# [V][tuya:438]: Sending Tuya: CMD=0x00 VERSION=0 DATA=[] INIT_STATE=0
# [D][uart_debug:114]: >>> 55 AA 00 00 p0 00 FF
# [E][tuya:464]: Initialization failed at init_state 0
I wish I could help - I went the local tuya route, but am not happy with that. Hope you figure it out!
Aren’t the RGB leds just SPI leds e.g. Ws2812 or similar, especially as you mention P16. See Beken SPI LED Strip — ESPHome
Bingo Thank you!
It didn’t work with my old light. I think I borked the CBU because I cant see anymore UART logs, and it won’t flash anymore. But after I flash another light, this worked using P16 SPI
It is a ws2812b addressable light, so I’ll play with the config to get settings correct.
Thanks again!
Excellent, be sure to post your full yaml when you have it working, I’m sure others will be interested as it looks like an easy device to mod now you’ve done the hard work.
Well done.
Ended up finding https://www.elektroda.com/rtvforum/topic4057187.html last night, after trying to figure out how to bit bang gpio for ws2812b control since fastled is not supported for BK7231N.
Did the Beken light component not work then? Should be able to use that the same as the FastLed component with same effects. Though admit I can’t try.
It did work!
Albeit there is some weirdness going on with brightness that causes the LEDs to flash random colors, and a bit of flickering. I thought it might have had something to do with WS2812B vs WS2812.
Here is my current config so far I am using to test:
esphome:
name: basement-cig-light-2-2
friendly_name: "Basement Ceiling Light Row 2 Col 2"
bk72xx:
board: cbu
logger:
baud_rate: 115200
level: DEBUG
output:
- platform: libretiny_pwm
id: output_cold
pin: P8
frequency: 10000 Hz
- platform: libretiny_pwm
id: output_warm
pin: P7
frequency: 10000 Hz
light:
- platform: cwww
id: light_cwww
name: Light
cold_white_color_temperature: 6500 K
warm_white_color_temperature: 2700 K
cold_white: output_cold
warm_white: output_warm
- platform: beken_spi_led_strip
rgb_order: RGB
# "gmkb": 60,"gmkg": 60, "gmkr": 80,
# color_correct: [80%, 60%, 60%]
pin: P16
num_leds: 36
chipset: ws2812
name: "My Light"
id: my_light
effects:
- addressable_scan:
- addressable_rainbow:
- addressable_color_wipe:
- addressable_twinkle:
- addressable_random_twinkle:
- addressable_fireworks:
- addressable_flicker:
- lambda:
name: My Custom Effect
update_interval: 5s
lambda: |-
static int state = 0;
auto call = id(my_light).turn_on();
// Transition of 1000ms = 1s
call.set_transition_length(1000);
if (state == 0) {
call.set_rgb(1.0, 1.0, 1.0);
} else if (state == 1) {
call.set_rgb(1.0, 0.0, 1.0);
} else if (state == 2) {
call.set_rgb(0.0, 0.0, 1.0);
} else {
call.set_rgb(1.0, 0.0, 0.0);
}
call.perform();
state += 1;
if (state == 4)
state = 0;
ota:
platform: "esphome"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: true
#use_address: xxx.xxx.xxx.xxx
captive_portal:
mdns:
disabled: true
api:
reboot_timeout: 0s
web_server:
local: true
text_sensor:
- platform: libretiny
version:
name: LibreTiny Version
- platform: wifi_info
ip_address:
id: ip_address
name: IP Address
- platform: debug
device:
name: Device Info
reset_reason:
name: Reset Reason
button:
- platform: factory_reset
name: Reset to Factory Settings
- platform: restart
name: Restart
debug:
update_interval: 5s
sensor:
- platform: debug
free:
name: Heap Free
loop_time:
name: Loop Time
- platform: uptime
name: Uptime
I did toodle around with OpenBeken WS2812B control via PixelAnime driver last night. The lights were smoother, brightness worked correctly, and colors were more inline with default behavior.
I am gonna poke around their driver and see how it may overlap with belken_spi_led component.
This is great news, if it isn’t too much to ask - could you do a write up of what you did so a newb like myself could replicate it? I would love to get these things off of the tuya infrastructure.
I can do that next weekend!
But overall:
- Use
tuya-cloudcutter
and push OpenBeken as custom firmware
– Choose the Lumary 4" Ceiling Light as your tuya-cloudcutter device profile - For OpenBeken module config
– P7 = PWM
– P8 = PWN
– Change startup command text:backlog startDriver SM16703P; SM16703P_Init 36; startDriver PixelAnim
- Perform OpenBeken home assistant mqtt discovery
I do plan on figuring out how to make the lights as smooth on esphome as it is for OBK.
Any update here? I am invested!