adynis
(adynis)
January 29, 2023, 1:10am
1
Introduction:
I have this: Wemos C3 Mini - Lolin ESP32-C3 ( C3 mini — WEMOS documentation )
I wanted to use it as a Bluetooth proxy and to use also the onboard RGB Led so I wanted an arduino platform, not esp_idf.
Problem
I was having a strange behaviour: very loooong time t oconnect to WiFi (1 … 2 or even 3 minutes) or sometimes it was even not connecting (I was restarting it until it was connecting in some minutes).
I tried and tried, various variants and … nothing.
Solution
Until … I found this answer:
opened 02:43AM - 15 Jan 22 UTC
integration: esp32_ble_tracker
### The problem
Trying to use the BLE tracker hub on the C3 hits a couple roadb… locks. First, it requires changing /config/.esphome/build/node-name/sdkconfig.node-name by either 1) setting `CONFIG_BT_BLE_50_FEATURES_SUPPORTED=n` or 2) setting `CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y`. Either one allows the build to compile and has the same second problem.
The second problem is that builds including esp32_ble_tracker refuse to be uploaded via OTA. The esphome log shows:
```
========================= [SUCCESS] Took 40.25 seconds =========================
INFO Successfully compiled program.
INFO Connecting to 192.168.0.180
INFO Uploading /config/.esphome/build/node-name/.pioenvs/node-name/firmware.bin (1293824 bytes)
ERROR Error receiving acknowledge binary size: timed out
```
and the device log (set to VERY_VERBOSE) shows
```
[21:37:37][D][ota:136]: Starting OTA Update from 192.168.0.10...
[21:37:37][V][ota:167]: OTA features is 0x01
[21:37:37][V][ota:250]: OTA size is 1293824 bytes
INFO node-name.local: Error while reading incoming messages: Error while reading data: [Errno 104] Connection reset by peer
INFO Disconnected from ESPHome API for node-name.local
WARNING Disconnected from API
INFO node-name.local: Ping Failed: Error while reading data: [Errno 104] Connection reset by peer
INFO Successfully connected to node-name.local
```
### Which version of ESPHome has the issue?
2021.12.3
### What type of installation are you using?
Docker
### Which version of Home Assistant has the issue?
n/a
### What platform are you using?
ESP32-IDF
### Board
M5Stack Stamp C3
### Component causing the issue
esp32_ble_tracker
### Example YAML snippet
```yaml
esphome:
name: node-name
esp32:
board: esp32-c3-devkitm-1
variant: esp32c3
framework:
type: esp-idf
logger:
level: VERY_VERBOSE
# Enable Home Assistant API
api:
password: ""
ota:
password: ""
wifi:
ssid: "xxx"
password: "xxx"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Fallback Hotspot"
password: "xxx"
esp32_ble_tracker:
```
### Anything in the logs that might be useful for us?
_No response_
### Additional information
_No response_
Thanks chose007
The final code I have:
esphome:
name: my-c3-mini-bt
on_boot: #this is to avoid slow startup time because of BT and WiFi "interactions?" , check https://github.com/esphome/issues/issues/2941#issuecomment-1331851692
priority: 250
then:
- delay: 15s
- lambda: |-
id(ble_tracker).set_scan_continuous(true);
id(ble_tracker).start_scan();
esp32:
board: esp32-c3-devkitm-1
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: ":) :) :)"
ota:
password: ":) :) :)"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
output_power: "8.5" # sometimes results in a bootloop without it
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "My-C3-Mini-Bt Fallback Hotspot"
password: ":) :) :)"
captive_portal:
esp32_ble_tracker:
id: ble_tracker
scan_parameters:
continuous: false
bluetooth_proxy:
active: true
light:
- platform: neopixelbus
id: myC3MiniBt_led
type: GRB
variant: WS2812
method: ESP32_RMT_1
num_leds: 1
pin: GPIO7
name: "My C3 Mini BT Led"
effects:
- addressable_rainbow:
name: Rainbow Effect With Custom Values
speed: 10
width: 50
10 Likes
erdek
February 5, 2023, 1:43pm
2
Thanks for sharing!
Finally got the RGB LED working on a M5stamp-C3U, for that specific board the pin is GPIO2.
Thanks for sharing this. Fixed my ESP32-C3’s WiFi connection issues. My garage door remote is now totally reliable (M5Stamp C3 + M5 3A Relay Unit).
Great find!
Thanks for sharing. My Seeed Xiao now works as my bluetooth proxy that enables my switchbot again (which failed since I installed USB3.0 SSD on HA).
However I have one observation. If i connect to my Seeed Xiao with ESPHome web through USB, it boots just fine. If I don’t do it and just plug in USB power, it doesn’t seem to boot and I can’t reach it wirelessly through esphome. That’s one weird thing. I’ll do more tests in the coming days.
blalor
July 28, 2023, 4:23pm
5
I’m having the same issue. Did you have any luck getting that sorted?
[edit] looks like there’s an issue with logger
: ESPHome device does not restart without serial port active (apparently!) - #10 by tom_l
1 Like
Yeah I found that out too. However I still can’t get that resolved so I just disconnect the power and let my Seeed xiao collect dust now. I have another esp32 board serving as my bluetooth proxy now but ironically it stopped working suddenly two days ago, without me doing any software updates. Hence why I am back to this forum again.
napalmz
(NapalmZ)
August 22, 2023, 8:50am
7
I am still trying to turn on the RGB LED using NeoPixel, without success.
At the moment, the only way I have found to turn on the led is to ground pins 3,4 and 5. Which are Red, Green and Blue respectively.
So i’ve made this and it works:
light:
- platform: rgb
name: "RGB Led"
red: output_component1
green: output_component2
blue: output_component3
output:
- platform: ledc
pin: GPIO3
inverted: true
id: output_component1
- platform: ledc
pin: GPIO4
inverted: true
id: output_component2
- platform: ledc
pin: GPIO5
inverted: true
id: output_component3
My board is a generic ESP32-C3-MINI-1
bipsen
(bipsen)
November 19, 2023, 9:10pm
8
I found this thread, as I am trying to sort out if it actually is possible to get the BLE proxy to run on an ESP32-C3 (I have an ESP32-C3 Super Mini).
The config is like:
esphome:
name: c3-ble-proxy
friendly_name: c3-ble-proxy
platformio_options:
board_build.mcu: esp32c3
board_build.variant: esp32c3
on_boot: #this is to avoid slow startup time because of BT and WiFi "interactions?" , check https://github.com/esphome/issues/issues/2941#issuecomment-1331851692
priority: 250
then:
- delay: 15s
- lambda: |-
id(ble_tracker).set_scan_continuous(true);
id(ble_tracker).start_scan();
esp32:
variant: ESP32C3
board: esp32-c3-devkitm-1
framework:
type: esp-idf
sdkconfig_options:
CONFIG_BT_BLE_50_FEATURES_SUPPORTED: y
CONFIG_BT_BLE_42_FEATURES_SUPPORTED: y
CONFIG_ESP_TASK_WDT_TIMEOUT_S: "10"
# Enable logging
logger:
level: verbose
# Enable Home Assistant API
api:
encryption:
key: ":-) :-) :-)"
ota:
password: ":-) .-) :-)"
button:
- platform: safe_mode
name: ${friendly_name} (Safe Mode)
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
output_power: "8.5" # sometimes results in a bootloop without it
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "C3-Ble-Proxy Fallback Hotspot"
password: "secret"
captive_portal:
esp32_ble_tracker:
id: ble_tracker
scan_parameters:
continuous: false
active: True
bluetooth_proxy:
active: true
But the log after boot gives me:
[18:29:34][D][esp32_ble_tracker:266]: Starting scan...
[18:29:34][V][esp32_ble:314]: (BLE) gap_event_handler - 2
[18:29:34][V][esp32_ble:314]: (BLE) gap_event_handler - 7
[18:29:34][V][esp32_ble:314]: (BLE) gap_event_handler - 3
[18:29:34][V][esp32_ble:314]: (BLE) gap_event_handler - 3
Any hints ?
1 Like
maruel
(M-A)
December 19, 2023, 12:35pm
9
What about using wait_until / wifi_connected as shown at https://github.com/damex/esphome/blob/116e5836fd4fb501bb72aad9fa970cd7fb4ce512/bluetooth-proxies/weactstudio-esp32c3-core-bt-proxy.yaml#L15-L22 ? A hardcoded sleep value is bound to be flaky. Pasting here for posterity:
esphome:
# Rest of config (...)
on_boot:
then:
- wait_until:
condition:
wifi.connected:
- lambda: >
id(ble_tracker).set_scan_continuous(true);
id(ble_tracker).start_scan();
1 Like
laca75tn
(My Home)
October 10, 2024, 4:10pm
10
You code is using the eps-idf framework, the original example is using arduino.