esphome-yeelight-ceiling-light icon indicating copy to clipboard operation
esphome-yeelight-ceiling-light copied to clipboard

Anyone expirience with BL proxy from ESPHome on yeelight?

Open Jamjon opened this issue 2 years ago • 8 comments

Like the title already say, i was wondering if anybody already tried the new BL proxy feature from ESP home on one of this lights? Since the Xiaomi BLE creates boot-loops i was wondering if the new Proxy is working better.

Jamjon avatar Dec 20 '22 21:12 Jamjon

I just did. Lost connectivity to my lamp completely. Doesn't even go to the safe mode, need to disassemble and reflash :(

Update: Getting the following assert

assert failed: s_prepare_reserved_regions memory_layout_utils.c:100 (reserved[i + 1].start > reserved[i].start)

yvolchkov avatar Dec 26 '22 13:12 yvolchkov

turns out if I disable encryption in my config, lamp even boots, and responds to pings, but refuses connection to 6053 port.

yvolchkov avatar Dec 26 '22 15:12 yvolchkov

thank you for testing! hope its not too much hustle to bring it down and up again.

Jamjon avatar Dec 26 '22 19:12 Jamjon

Will not work, since in Yeelights they use a stripped version of ESP32 - which uses only 1 core of the 2, so simply don't have enough resources to handle the ESPHome code, and the BT too.

ExPeacer avatar Dec 27 '22 09:12 ExPeacer

@ExPeacer You are right about the number of CPU cores but are you sure about the limitations? I'm aware of some people running a single core ESP32 with ESPHome and bluetooth in general. It's not as smooth/solid as having two cores but it's possible.

syssi avatar Dec 27 '22 09:12 syssi

it's also enough resources for the original yeelight firmware. Perhaps it is possible to tune FreeRtos to run both stacks.

Also my board response to pings, when it boots WITH bluetooth stack enabled. But it doesn't respond to api. Unfortunately I don't have tools to boot it properly with serial attached, to see what is going on.

yvolchkov avatar Dec 28 '22 14:12 yvolchkov

This is the workaround to avoid the boot loop (Task watchdog got triggered. The following tasks did not reset the watchdog in time): https://github.com/syssi/esphome-yeelight-ceiling-light/blob/main/yeelight_light_fancl5.yaml#L8-L13

An unresponsible native API and the assert failed: s_prepare_reserved_regions memory_layout_utils.c:100 looks like other issues.

syssi avatar Dec 28 '22 15:12 syssi

As far as I'm aware Yeelight uses ESP32s with only 2MB of flash. This issue can be circumvented when using a correct partition table. ESPHome won't flash since the fw would be too big for the two app partitions with bt proxy enabled.

esphome:
  platformio_options:
    board_build.partitions: "../../../boards/2mb_partition.csv"

partition table csv:

# Name,   Type, SubType, Offset,   Size, Flags
nvs,      data, nvs,     ,        0x4000,
otadata,  data, ota,     ,        0x2000,
phy_init, data, phy,     ,        0x1000,
app0,     app,  ota_0,   ,        0xEA640,
app1,     app,  ota_1,   ,        0xEA640,

When trying to flash with bt proxy and partition table:

Error: The program size (1327701 bytes) is greater than maximum allowed (960064 bytes)
RAM:   [==        ]  15.4% (used 50420 bytes from 327680 bytes)
*** [checkprogsize] Explicit exit, status 1
Flash: [==========]  138.3% (used 1327701 bytes from 960064 bytes)

lorenzspenger avatar Nov 22 '23 22:11 lorenzspenger