I need a few Bluetooth proxy devices around my house. I found the ESPhome page to create a Bluetooth proxy from an ESP32. I already have several ESPhome BLE trackers around the house monitoring my Xiaomi temp sensors. Can I just add some code to those devices so the act as a BLE tracker and a Bluetooth proxy?
yes you can
Don’t add the scan parameters options unless you have an Ethernet connection to your ESPs (for some reason a lot of people add that when they don’t, even though the docs are pretty clear that your shouldn’t).
Depending on the devices you’re connecting to, you may need to set the active connection to true.
I’ve read this a few times, could you please point me to where I can find this in the documentation? Thanks!
The giant note underneath it?
Note
For WiFi-based proxies, changing the interval or window from their default values may result in an unstable WiFi connection. Using the default values for interval and window will usually resolve any instability.
The entire section with those values is specifically for using a board with an Ethernet connection (and is why it has YAML for changing the default values).
Thanks, that’s what I read as well, but it doesn’t state that you have to leave it out. It says changing … may result in.
If you don’t set the values, you are using the defaults, so no harm done. Even changing may result in unstable connections, but it doesn’t mean it has to be.
Thanks for the clarification, what I got from your post was more like a rule, than like a recommendation. I for one do set these values on some of my ESP devices, as I can reproducable get better results, by fitting these values to the actual location of the device. But I do need to monitor these for longer times, and it’s a try&error approach, only suitable for “crazy people” with a fable for statistics.
What values do you use for yours? I’ve never messed with them, since I read the note as a pretty strong “Don’t mess with this unless you really know what you’re doing/have a really good reason.”
What code do I add to the BLE tracker?
Here is my current BLE tracker code:
esphome:
name: ble-for-temp-sensors-main-floor
platform: ESP32
board: nodemcu-32s
wifi:
ssid: "xxxxxxxxxx"
password: "xxxxxxxxxx"
#Static IP
manual_ip:
static_ip: 192.168.1.140
gateway: 192.168.1.1
subnet: 255.255.255.0
#Turn Off Power Save Mode
fast_connect: on
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "zzzzzzzzzzzz"
password: "zzzzzzzzzzzz"
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
password: "yyyyyyyyyyyyyyyyyyy"
captive_portal:
esp32_ble_tracker:
sensor:
#Xiaomi Temp Sensor 1
- platform: pvvx_mithermometer
mac_address: "XXXXXXXXXXX"
temperature:
name: "Humidor Temperature"
filters:
- lambda: return x * (9.0/5.0) + 32.0;
unit_of_measurement: "°F"
accuracy_decimals: 1
humidity:
name: "Humidor Humidity"
battery_level:
name: "Humidor Temp Sensor Battery-Level"
# battery_voltage:
# name: "Xiaomi Sensor 1 Battery-Voltage"
Do I just add
bluetooth_proxy:
active: true
anywhere in the file?
Yep, that’s it!
May result in is programmer speak for I’m 99.95% sure this will break your setup, but one wanker four years ago found an edge case where it didn’t, and I don’t feel like fighting about it.
I added the Bluetooth proxy code:
bluetooth_proxy:
active: true
to my BLE sensors and I get the following error in the logs after installing
[23:14:05][E][bluetooth_proxy:439]: Only one API subscription is allowed at a time
Is that an issue?