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

Hey does anybody know how to get these to work with the Valve Index Basestations integration?

I am also playing with ESP proxy. What i do not understand is what exactly an adoption is doing?
What is the advantage of it and when i am doing this is it necessary to tweak the config?

Bildschirmfoto 2022-10-12 um 13.24.59

Enabling “track_new_devices” I faced an issue with tons devices added, I guess some devices keep changing their BT MAC address thus keep being added as new devices. I had to remove that entry from the config.

Update/Edit: TL;DR: DO NOT RENAME YOUR BLUETOOTH PROXIES!

Original Post:

Adding to the growing list of people who can’t seem to get it working.
I flashed 3 ESP-WROOM-32 with esphome using the web flasher shortly before 2022.10 was released (passive-only proxies at that moment).
A few days later, when 2022.10 was released, I added them to Home Assistant and adpopted them in the esphome addon. At the time I did this an update was present, which I immediately applied. This brought all proxies to 2022.9.4.

I have four Mi thermostats, three of them still running on stock firmware, one with modified firmware set to use the “BTHome” broadcast mode (I triple checked this). None of them are turning up in the integrations tab and when I try to manually add an integration (either Xiamo BLE or BTHome), the software states that no devices could be found.

I configured one of the proxies to use verbose logging to validate visibility of the devices:

substitutions:
  name: "bluetooth-proxy-asdf"
packages:
  esphome.bluetooth-proxy: github://esphome/bluetooth-proxies/esp32-generic.yaml@main
esphome:
  name: ${name}
  name_add_mac_suffix: false

bluetooth_proxy:
  active: true
logger:
  level: VERBOSE
# Enable Home Assistant API
api:
ota:
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

In its log, I can see the following lines, among others:

[...]
[00:13:54][V][bluetooth_proxy:023]: Proxying packet from ATC-Bed - A4:C1:38:22:D4:F2. RSSI: -54 dB
[00:14:04][V][bluetooth_proxy:023]: Proxying packet from LYWSD03MMC - A4:C1:38:A9:75:08. RSSI: -94 dB
[00:14:04][V][bluetooth_proxy:023]: Proxying packet from LYWSD03MMC - A4:C1:38:90:51:68. RSSI: -53 dB
[...]

The LYWSD03MMC devices seem to be two of the stock Mi thermostats, ATC-Bed is my bedroom thermostat flashed with ATC custom firmware.
So apparently the bluetooth proxy sees everything that it should (the range seems to be quite impressive, I don’t think I would have needed three proxies for my appartment), but Home Assistant somehow doesn’t pick it up.

Any idea what the problem could be in my case?

Edit:

There must have been a short timeframe in which it was working (either before I upgraded the ESP32 or even before I adopted them). A few days ago, I had integrations detected for the Mi thermostats. However, when I tried to add them it showed zero devices and zero entities, as if they had dissappeared in the meantime. I deleted these non-working integrations.

Edit2 and potential solution:

Aaaaaalright. It seems that, by chance, I found the solution to my problem.
While looking for something else, I found that my /config/home-assistant.log was spammed with the following lines every minute:

2022-10-19 00:47:34.449 WARNING (MainThread) [homeassistant.components.esphome] Name of device esp32-bluetooth-proxy-cd350c changed to bluetooth-proxy-fancyname1, potentially due to IP reassignment
2022-10-19 00:47:48.889 WARNING (MainThread) [homeassistant.components.esphome] Name of device esp32-bluetooth-proxy-9e103c changed to bluetooth-proxy-fancyname2, potentially due to IP reassignment
2022-10-19 00:48:13.756 WARNING (MainThread) [homeassistant.components.esphome] Name of device esp32-bluetooth-proxy-fc5e8c changed to bluetooth-proxy-fancyname3, potentially due to IP reassignment

Two days earlier, the same log stated:

2022-10-16 23:26:08.419 WARNING (MainThread) [aioesphomeapi.reconnect_logic] Can't connect to ESPHome API for esp32-bluetooth-proxy-9e103c @ 192.168.0.122: Server sent a different name 'bluetooth-proxy-fancyname2'

I went right back into ESPHome and changed all fancy names I had given back to the original ones (just copy them out of home-assistant.log) and almost immediately, my Mi thermostats showed up as available integrations.

I consider this a bug and would like to report it. Does anyone have an idea where the right place might be? Is this an issue in the Home Assistant core? Is this an ESPHome issue? Is it something entirely different?

Hopefully the last edit:

People have already identified this issue before. Here’s the related Github issue: renamed ESPHome entities cause endless 'potentially due to IP reassignment' Error in HA log · Issue #79917 · home-assistant/core · GitHub

2 Likes

I moved one device to new location

I wanted to monitor humidity in cellar before installing some photovoltaic stuff there.
So the name of the device is misleading, but
I can see packets being picked up by device i intentionally put close to it, but it is still unavailable in HA.

I tried deleting the device in HA, but it does not appear again.

Update:
I have deleted and added esphome proxy device in HA and the bluetooth device appeared in HA again as available and even the history is kept.

I can see some BT devices in the Esp LOG. Now what?
How can I add them to HA?

Someone, please?

Usually they will be added automatically through auto discovery when your bluetooth integration is active. As example this happend for my Switchbot devices as well as for some Eve devices and Xiaomi devices.

Is your Bluetooth Integration active and working?

Damn!
I’m having some trouble installing BT on my HA Supervised.
Could someone help me here?

I am using integrated BT from my RPI. For the case you are using a USB BT Stick on a virtual machine you might be assign the USB Device to the machine that the integration can use it.

1 Like

I’m using Debian 11 Bullseye on a NUC with an integrated wifi/bluetooth card.
Is there a way to make this work? I’m not an Linux expert on any means. :frowning:

Hi guys , quick question , I bought a flood lamp Ble from Amazon , I connected it in my studio as I have the main Bluetooth adapter there, the lamp works perfectly there.
I wanted to try the connection with one of the Bluetooth proxy’s I have in my living room so I decided to move the lamp there , well it didn’t connect at all , I even put it next to the esp32 , I restarted HA and I couldn’t get the BLE connection to work. So I moved it back to the studio and it worked normally again , the connection was fine .

My question is : Once the device is connected to a specific adapter either Bluetooth proxy or main adapter that connection can’t be change?

Just like the zigbee network , once a device it’s connected to a router , it’ll always connect to the same router unless the device is re-set up . Is it the same with BLE ?

I have 3 Bluetooth proxy’s around the house but I have few Bluetooth devices , I want to start adding lights .

Thanks for your help

I would recommend to turn on debug logging for your proxies. Once active you can check if your device is communicating with Bluetooth Proxy or not. You should see the BLE Mac and a value for RSSI

I wanted to increase the bluetooth range my Home Assistant by introducing a ESPHome Bluetooth proxy, just like the image shown on the installer page ESPHome Bluetooth Proxy

I’ve got it working on the ESP-WROOM-32 board i purchased however the range is absolutely woeful. I’ve got a xiaomi humidity and themometer about 2.5m away with a clear line of sight and it’s not picking it up.

Can anyone recommend a board that can acheive results like the image from the installer page linked above. I would like a 5m range through a single plaster and lath wall?

I use several different ESP32-WROOM boards purchased from Ali over the last few of years. They are working reliably at distances up to 5-10 meters, and through double pane windows and plaster walls. So you must have a bad batch or some other problem.
I just checked an ESP32 proxying an LYWSD03MMC (with BTHome). The sensor is inside a refrigerator, one floor (wooden) above and appx. 5 meters away from the the ESP. Still the the signal level is reported as -72db.

1 Like

Is possible to do both, use the ESP32 as a (1) Bluetooth proxy beacon and (2) also add a sensor in the same board ???

Does anyone has an example ? I tried to do it but I have not been successful.

Yes of course, you can just use the GPIO pins as any other ESP device. One of my proxy has a volume control for my music, another takes care of reading my warm water usage (using a flow meter).

Do I have to restart HA after changing the log level for homeassistant.components.bluetooth to debug? And where do I look to see which advertisements are being relayed by which proxies?

Thanks

1 Like

Hello!
Please help.
Devices do not transmit data via Proxy. The data from the devices is updated only if the main Bluetooth USB is in the zone.

proxymain.yaml:

substitutions:
  name: proxymain
  board: esp32dev

esphome:
  name: ${name}
  name_add_mac_suffix: False

esp32:
  board: ${board}
  framework:
    type: esp-idf

# Enable logging
logger:
  level: VERBOSE
  
# Enable Home Assistant API
api:
  encryption:
    key: "M/Oar3zmRxaMG3pau/n+/yAxk93KWkvV18oFjY9frD4="

ota:
  password: "935d356662e27c85682d9a3985382d7c"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

esp32_ble_tracker:
  scan_parameters:
    interval: 1100ms
    window: 1100ms
    
bluetooth_proxy:
  active: true    
  #cache_services: false

log:

[11:36:58][I][app:102]: ESPHome version 2023.3.0 compiled on Mar 17 2023, 11:33:30
[11:36:58][C][wifi:504]: WiFi:
[11:36:58][C][wifi:362]:   Local MAC: xx:E3:xx:0F:xx:EC
[11:36:58][C][wifi:363]:   SSID: 'xxx'[redacted]
[11:36:58][C][wifi:364]:   IP Address: 192.168.1.133
[11:36:58][C][wifi:366]:   BSSID: xx:FF:xx:53:xx:E8[redacted]
[11:36:58][C][wifi:367]:   Hostname: 'proxymain'
[11:36:58][C][wifi:369]:   Signal strength: -75 dB ▂▄▆█
[11:36:58][V][wifi:371]:   Priority: 0.0
[11:36:58][C][wifi:373]:   Channel: 5
[11:36:58][C][wifi:374]:   Subnet: 255.255.255.0
[11:36:58][C][wifi:375]:   Gateway: 192.168.1.1
[11:36:58][C][wifi:376]:   DNS1: 192.168.1.1
[11:36:58][C][wifi:377]:   DNS2: 0.0.0.0
[11:36:58][V][esp32_ble:178]: (BLE) gap_event_handler - 3
[11:36:58][V][bluetooth_proxy:033]: Proxying packet from  - D4:9D:C0:A3:F7:05. RSSI: -97 dB
[11:36:58][C][logger:293]: Logger:
[11:36:58][C][logger:294]:   Level: VERBOSE
[11:36:58][C][logger:295]:   Log Baud Rate: 115200
[11:36:58][C][logger:296]:   Hardware UART: UART0
[11:36:58][C][bluetooth_proxy:065]: Bluetooth Proxy:
[11:36:58][C][bluetooth_proxy:066]:   Active: YES
[11:36:58][C][esp32_ble:214]: ESP32 BLE:
[11:36:58][C][esp32_ble_tracker:591]: BLE Tracker:
[11:36:58][C][esp32_ble_tracker:592]:   Scan Duration: 300 s
[11:36:58][C][esp32_ble_tracker:593]:   Scan Interval: 1100.0 ms
[11:36:58][C][esp32_ble_tracker:594]:   Scan Window: 1100.0 ms
[11:36:58][C][esp32_ble_tracker:595]:   Scan Type: ACTIVE
[11:36:58][C][esp32_ble_tracker:596]:   Continuous Scanning: True
[11:36:58][C][mdns:108]: mDNS:
[11:36:58][C][mdns:109]:   Hostname: proxymain
[11:36:58][V][mdns:110]:   Services:
[11:36:58][V][mdns:112]:   - _esphomelib, _tcp, 6053
[11:36:58][V][mdns:114]:     TXT: version = 2023.3.0
[11:36:58][V][mdns:114]:     TXT: mac = 78e36d0f16ec
[11:36:58][V][mdns:114]:     TXT: platform = ESP32
[11:36:58][V][mdns:114]:     TXT: board = esp32dev
[11:36:58][V][mdns:114]:     TXT: network = wifi
[11:36:58][C][ota:093]: Over-The-Air Updates:
[11:36:58][C][ota:094]:   Address: proxymain.local:3232
[11:36:58][C][ota:097]:   Using Password.
[11:36:58][V][esp32_ble:178]: (BLE) gap_event_handler - 3
[11:36:58][V][bluetooth_proxy:033]: Proxying packet from  - 4C:C9:5E:11:26:1B. RSSI: -94 dB
[11:36:58][C][api:138]: API Server:
[11:36:58][C][api:139]:   Address: proxymain.local:6053
[11:36:58][C][api:141]:   Using noise encryption: YES
[11:36:58][V][esp32_ble:178]: (BLE) gap_event_handler - 3
[11:36:58][V][bluetooth_proxy:033]: Proxying packet from  - 78:74:42:1F:E0:60. RSSI: -49 dB
[11:36:58][V][esp32_ble:178]: (BLE) gap_event_handler - 3
[11:36:58][V][bluetooth_proxy:033]: Proxying packet from LYWSD03MMC - A4:C1:38:1F:4C:F4. RSSI: -79 dB
[11:36:58][D][api:102]: Accepted 192.168.1.123
[11:36:59][V][esp32_ble:178]: (BLE) gap_event_handler - 3
[11:36:59][V][esp32_ble:178]: (BLE) gap_event_handler - 3
[11:36:59][V][esp32_ble:178]: (BLE) gap_event_handler - 3
[11:36:59][V][bluetooth_proxy:033]: Proxying packet from  - EC:42:70:DC:D3:27. RSSI: -86 dB
[11:36:59][V][bluetooth_proxy:033]: Proxying packet from  - 4C:C9:5E:0F:BE:B7. RSSI: -89 dB
[11:36:59][V][bluetooth_proxy:033]: Proxying packet from  - 4C:C9:5E:10:C7:BF. RSSI: -94 dB
[11:36:59][V][api.connection:902]: Hello from client: 'Home Assistant 2023.3.5 (192.168.1.123)' | API Version 1.7
[11:36:59][D][api.connection:920]: Home Assistant 2023.3.5 (192.168.1.123): Connected successfully
[11:36:59][V][esp32_ble:178]: (BLE) gap_event_handler - 3
[11:36:59][V][bluetooth_proxy:033]: Proxying packet from  - 4C:C9:5E:10:C7:BF. RSSI: -92 dB
[11:36:59][V][esp32_ble:178]: (BLE) gap_event_handler - 3
[11:36:59][V][esp32_ble:178]: (BLE) gap_event_handler - 3
[11:36:59][V][bluetooth_proxy:033]: Proxying packet from  - 42:CF:3E:2C:D2:04. RSSI: -93 dB
[11:36:59][V][bluetooth_proxy:033]: Proxying packet from  - 4C:C9:5E:0F:BE:B7. RSSI: -90 dB
[11:36:59][V][bluetooth_proxy:074]: [0] Free connection
[11:36:59][V][bluetooth_proxy:074]: [1] Free connection
[11:36:59][V][bluetooth_proxy:074]: [2] Free connection
[11:36:59][V][esp32_ble:178]: (BLE) gap_event_handler - 3
[11:36:59][V][bluetooth_proxy:033]: Proxying packet from  - 78:74:42:1F:E0:60. RSSI: -50 dB
[11:36:59][V][esp32_ble:178]: (BLE) gap_event_handler - 3
[11:36:59][V][esp32_ble:178]: (BLE) gap_event_handler - 3
[11:36:59][V][bluetooth_proxy:033]: Proxying packet from  - 4C:C9:5E:0F:BE:B7. RSSI: -90 dB
[11:36:59][V][bluetooth_proxy:033]: Proxying packet from  - 4C:C9:5E:10:C7:BF. RSSI: -92 dB
[11:37:00][V][esp32_ble:178]: (BLE) gap_event_handler - 3
[11:37:00][V][esp32_ble:178]: (BLE) gap_event_handler - 3
[11:37:00][V][bluetooth_proxy:033]: Proxying packet from  - 5C:C1:D7:61:50:43. RSSI: -85 dB
[11:37:00][V][bluetooth_proxy:033]: Proxying packet from  - 42:CF:3E:2C:D2:04. RSSI: -88 dB
[11:37:00][V][esp32_ble:178]: (BLE) gap_event_handler - 3
[11:37:00][V][esp32_ble:178]: (BLE) gap_event_handler - 3

a newbie question… i have a virtualized computer without access to a bluetooth adapter, but with an Olimex esp32-poe proxy over the network, can i install the bluetooth integration in HA?