New ESP32 bluetooth proxy - how is it supposed to work?

I just add this to my sonoff m5 devices:

esp32_ble_tracker:
  scan_parameters:
    interval: 1100ms
    window: 1100ms
    active: true

bluetooth_proxy:

and its working on all m5 models, 1, 2 and 3 buttons… later I’m going to try on nspanel, but I expect that it also works, because is basically the same thing, an esp32 board…

1 Like

In fact, you can use the defaults:

esp32_ble_tracker:
bluetooth_proxy:

and you want to see what is going on the proxy just add:

logger:
  level: VERBOSE

on NSPanel I run out of space, at least with my config I ended up with an image that exceed the max. allowed size…

2 Likes

Running out of space for ota is certainly annoying. I wish there was a simple button to just load a minimal configuration, since the way to fix this is to load a min config and then what you want, but since there are no block comments in YAML it’s more annoying than it should be.

1 Like

After flashing the ESP the device is visible in ESPHome. There is an option to Adopt the ESP.
What does this adoption?

Adoption means the device can be adopted to the ESPHome instance in Home Assistance to monitor and update it from there with your other devices.
There is some really good documentation on how it all works on the ESPHome site.

I would suggest anyone wanting to know about the Bluetooth Proxy and ESP Home to go and actually read the documentation and to watch the release video as most of the things I see being asked in forums at the moment are very clearly explained in documentation and videos.

Also, do rememebr the ESPHome bluetooth proxy is passive only. Locks and other devices that need to be actively connected to bluetooth currently (as of 2022.8.3 of ESPHome) do not work with bluetooth proxy

1 Like

Here’s some info for those wanting to use this new BTProxy as device trackers. Once you add:

device_tracker:
  - platform: bluetooth_le_tracker  
    interval_seconds: 12
    consider_home: 180
    track_new_devices: true

…the ESP32 Bluetooth Proxy starts writing discovered devices into the known_devices.yaml, and creating the corresponding entities.

Now, there seems to be a problem with the Bluetooth LE tracker component. Once a known device is found in the scan, it changes from not_home to home, but it will never update anymore after that. This seems to be a known issue documented here, here and here, so regrettably while the new ESP32 BTProxy is a great addition, it won’t work for presence detection until the underlying code is updated.

6 Likes

Cool, hopefully that comes soon.

Really cool developments. I hope this will eventually allow us to triangulate devices between the proxies to enable room level tracking :smiley:
That would require to have access to the RSSI signal per proxy

2 Likes

i have two devices LYWSD03MMC with custom firmware in the same room of esp32 configured like this, but it cant find the devices, i dont know why


INFO Reading configuration /config/esphome/pir-sensor.yaml...
INFO Starting log output from pir-sensor.local using esphome API
INFO Successfully connected to pir-sensor.local
[14:15:16][I][app:102]: ESPHome version 2022.8.3 compiled on Sep 17 2022, 14:10:48
[14:15:16][C][wifi:491]: WiFi:
[14:15:16][C][wifi:353]:   Local MAC: EC:94:CB:70:14:C4
[14:15:16][C][wifi:354]:   SSID: 'wireless'[redacted]
[14:15:16][C][wifi:355]:   IP Address: 192.168.1.10
[14:15:16][C][wifi:357]:   BSSID: 9C:9D:7E:87:1F:65[redacted]
[14:15:16][C][wifi:358]:   Hostname: 'pir-sensor'
[14:15:16][C][wifi:360]:   Signal strength: -62 dB ▂▄▆█
[14:15:16][C][wifi:364]:   Channel: 1
[14:15:16][C][wifi:365]:   Subnet: 255.255.255.0
[14:15:16][C][wifi:366]:   Gateway: 192.168.1.4
[14:15:16][C][wifi:367]:   DNS1: 192.168.1.4
[14:15:16][C][wifi:368]:   DNS2: 0.0.0.0
[14:15:16][C][logger:275]: Logger:
[14:15:16][C][logger:276]:   Level: DEBUG
[14:15:16][C][logger:277]:   Log Baud Rate: 115200
[14:15:16][C][logger:278]:   Hardware UART: UART0
[14:15:16][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'PIR Sensor'
[14:15:16][C][gpio.binary_sensor:015]:   Device Class: 'motion'
[14:15:16][C][gpio.binary_sensor:016]:   Pin: GPIO13
[14:15:16][C][bluetooth_proxy:053]: Bluetooth Proxy:
[14:15:16][C][esp32_ble_tracker:717]: BLE Tracker:
[14:15:16][C][esp32_ble_tracker:718]:   Scan Duration: 300 s
[14:15:16][C][esp32_ble_tracker:719]:   Scan Interval: 1100.0 ms
[14:15:16][C][esp32_ble_tracker:720]:   Scan Window: 1100.0 ms
[14:15:16][C][esp32_ble_tracker:721]:   Scan Type: ACTIVE
[14:15:16][C][captive_portal:088]: Captive Portal:
[14:15:16][C][mdns:094]: mDNS:
[14:15:16][C][mdns:095]:   Hostname: pir-sensor
[14:15:16][C][ota:085]: Over-The-Air Updates:
[14:15:16][C][ota:086]:   Address: pir-sensor.local:3232
[14:15:16][C][ota:089]:   Using Password.
[14:15:16][C][api:138]: API Server:
[14:15:16][C][api:139]:   Address: pir-sensor.local:6053
[14:15:16][C][api:141]:   Using noise encryption: YES

After flashing, you need to connect again to configure. You need the Advertising type to be BThome.

Also, dont forget to disconnect from the webUI flasher. If you don’t the device will not broadcast advertisements, so Home Assistant won’t discover new device. Took me a while to figure that out.

4 Likes

Is there a list which devices will Work?
I Just tried to flash and See If Something is coming Up as detected.

But my Mi scale, amazfit band, oralb brush and many other Bluetooth devices are Not making it to HA …
So unsupported?

Also interesting If a ekey Bluetooth lock would be possible in the Future.

1 Like

My understanding is that the devices that are currently supported by the passive Bluetooth custom component are being moved gradually in to the core and will therefore be supported. But the stuff that requires an active connection will take longer to support. The oralb toothbrush was actually mentioned on the live stream as being something that it was hoped could get support. But the proxies only support passive Bluetooth for the moment, and work is going on to eventually allow the proxies to make active connections

before i start playing with this new feature… can anyone tell me if homeassistant can send ble packets other than receive them?! thanks

now it works thx

As it was not completely clear for me and sometimes I’m confuse about Bluetoooth, here my actual conclusion that may help you :slight_smile:
This is my proper research, it may have something wrong, in that case, please correct me

If your HA is running on a raspberry, there is one BT component that you can use for Active BT connection with HA. You can also use a BT dongle and even have multiple BT component active to extend the signal range.
Active BlueTooth means you can control a light for instance. Your BT light need to be near your Raspberry device in order to receive the radio signal. The integration is Bluetooth. The passive connection is of course possible.

To listen a thermostat/humidity BT sensor for instance, you only need a passive BT connection. This can be done via the BT proxy in esphome in order to extend in multiple rooms the detection of those devices. We don’t need to add any integration into HA (except having esphome add-on)

I think it’s possible to see all the devices into the diagnostic file that you can download from the BT integration for the active and passive connection. It’s one way to see that your ESP proxy is running and communicating.

About BTHome integration, it’s not so clear to me that is needed or not but I’m refering to this document: BTHome: Open standard for broadcasting sensor data over Bluetooth LE

There is a PR to have BT proxy also for active connections: Bluetooth Proxy active connections by jesserockz · Pull Request #3817 · esphome/esphome (github.com)

Then both world will use same functionality.

About BT presence detection, I guess this will move to another level once all developments are done because from now, if you active the proxy, the presence detection is not possible.

same here: Xiaomi scale not appearing in HA (Xiaomi BLE integration is not seeing anything), with the m5stack-atom-lite sending events to HA

I had the same issue. I found they weren’t showing up as auto discovery, but if I added a new instance of the xiaomi integration, I was given a choice of discovered mac addresses to add.

So I bought 3 of the devices pictured here https://bthome.io/ esp32 did pick them up, then it added xiaomi ble integration automatically, but in only got data for signal strength, no other sensor shown, so I went for the Telink Flasher v4.4 firmware, added the integration to HA and and again, only showing signal strength.

Gets the data

device in HA

OK I scrolled a bit up in this thread :smiley: image

I’ve got several of these devices working just fine using the RPi4 built-in Bluetooth. The trick (as you have likely found out through scrolling here etc) is to have them advertise as BTHome, not the other choices. My sensors are transmitting temperature, humidity, and all their other usual data.

Can you please elaborate on this more? I flashed the esp chip using Bluetooth proxy website and that’s all I did. Should I add BTHome integration and connect the esp again? Sorry I am still learning