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.
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.
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.
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:
So far having one BLE proxy on ESP32-C3 SuperMini.
Tried on Arduion & IDF frameworks - both works fine.
To solve issue with WiFi/BLE simultenious working using following:
@Masterzz oh, mine is a mess compared to that. Here is what is on my C3 superminis that I copied from somewhere here or on the wiki:
substitutions:
name: esp32-bluetooth-proxy-1c9da0
friendly_name: Bluetooth Proxy Bathroom
packages:
esphome.bluetooth-proxy: github://esphome/bluetooth-proxies/esp32-generic/esp32-generic-c3.yaml@main
esphome:
name: ${name}
name_add_mac_suffix: false
friendly_name: ${friendly_name}
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
esp32:
board: esp32-c3-devkitm-1 # Feel free to use a more specific board if that's what you have
framework:
type: esp-idf # This is important: the default "arduino" framework does not perform well.
sdkconfig_options:
# @grigi found in testing that these options resulted in better responsiveness.
# BLE 4.2 is supported by ALL ESP32 boards that have bluetooth, the original and derivatives.
CONFIG_BT_BLE_42_FEATURES_SUPPORTED: y
# Also enable this on any derivative boards (S2, C3 etc) but not the original ESP32.
CONFIG_BT_BLE_50_FEATURES_SUPPORTED: y
# Extend the watchdog timeout, so the device reboots if the device appears locked up for over 10 seconds.
CONFIG_ESP_TASK_WDT_TIMEOUT_S: "10"
logger:
baud_rate: 0 # 0 Enables logging, but disables serial-port logging to free CPU and memory
ota:
platform: esphome
api:
encryption:
key: redacted
# Only enable BLE tracking when wifi is up and api is connected
# Gives single-core ESP32-C3 devices time to manage wifi and authenticate with api
on_client_connected:
- esp32_ble_tracker.start_scan:
continuous: true
# Disable BLE tracking when there are no api connections live
on_client_disconnected:
if:
condition:
not:
api.connected:
then:
- esp32_ble_tracker.stop_scan:
esp32_ble_tracker:
scan_parameters:
# Don't auto start BLE scanning, we control it in the `api` block's automation.
continuous: False
active: True # send scan-request packets to gather more info, like device name for some devices.
interval: 320ms # default 320ms - how long to spend on each advert channel
window: 300ms # default 30ms - how long to actually "listen" in each interval. Reduce this if device is unstable.
# If the device cannot keep up or becomes unstable, reduce the "window" setting. This may be
# required if your device is controlling other sensors or doing PWM for lights etc.
bluetooth_proxy:
active: true # allows outbound connections from HA to devices.
sensor:
- platform: uptime
# The uptime sensor is extremely helpful to know if your device is rebooting
# when it shouldn't be. This might indicate your interval-to-window timing is
# too tight, and the window needs to be reduced.
name: "Uptime Sensor"
update_interval: 60s
At the same time? So you can collect battery data but, having issues?
That statement gives me the impression that your collecting battery data by creating an active connection between the 2 devices which doesn’t make sense to me why someone would do that for BT Beacons when it could more easily transmit the battery level data and be received from just a passive(listening only) setup which is the overwhelmingly most common method.
Also, even if for some freakish reason you cant read both senors at the same time then its really no nig deal if you have to do 1 and the other delayed because theres absolutely no reason to need to be doing frequent sensor updates and just draining the battery even faster when its not necessary. You only need to update sensor values like batteries at the absolute most 10 times a day or arguably far fewer times like 3 times.
What beacons are using and how are you getting the battery data from them? I myself use BlueCharmBeacons and dont have any issues.
The code snippet below works fine if used alone on my ESP32-C3, S or S3 devices. But if I add most of the code to an existing ESPHome ESP32-S or ESP32-S3 already setup with BT Proxy and BLE tracking, the battery levels are not working for me when the active scan script is run. There is no active connection to each fob.
I have not spent any time looking into it as I use a stand-alone ESP32-C3 at the entrance just for beacon battery checks - Home Assistant runs the active scan script once a day to pick up the battery levels.
Where is your esphome config for where you’ve created sensors for the devices that correspond with each one’s mac address? For each device that you intend to track, there needs to be a sensor for it as well.
You really need to just pick either Espresence or Bermuda to handle the actual tracking because there aren’t any good native options specifically for Esphome that allows you to determine what devices are in what rooms and their distances. At best all your going to get is either (Home/Away) and or RSSI value which isnt all that helpful by itself.
I use Espresence myself but, Bermuda appears to work pretty good as far as i know. Im still playing around with how i want to display BT trackers/beacons in HA but this is sort of what im thinking, i just need to figire out how to keep everything lined up and to stop shifting…
This is how i used to have them displayed in HA. Just showing as examples if they help you out. If you have any suggestions of your own, id be glad to hear them because creativity/artistic abilities arent my strong area lol.