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

Hi @Dilby
This may be best presented in it’s own topic as Bluetooth tracking is a different topic to the Bluetooth Proxy.
Bluetooth Proxy is for connecting Bluetooth devices, such as sensors, light globes and other bluetooth devices to Home Assistant. Although it is Bluetooth, it is not the Bluetooth tracking integration.
You will need to setup using the ble tracking component.
The below link may give some ideas.
ESP32 Bluetooth Low Energy Tracker Hub — ESPHome

I haven’t used Bluetooth Proxy to detect devices for tracking as ESP Home has it’s own BLE Tracking component that works quite well and would likely be more reliable.

Ah ok thanks, so the bluetooth proxy feature cannot be used for tracking devices ?

I absolutely cannot figure this out. Today I installed Passive BLE Monitor via HACS to try to detect my device, a SmartDry, but it cannot detect it with my esp32 nor any BLE signals if I don’t have a USB bluetooth adapter plugged in. I have tried three different esp32 boards all flashed with the same configuration:

esphome:
  name: board-3

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:
  level: VERY_VERBOSE

# Enable Home Assistant API
api:
  encryption:
    key: "KEY IS HERE"

ota:
  password: "PASSWORD HERE"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Board-3 Fallback Hotspot"
    password: "Xy5eipCQEMtT"

captive_portal:

esp32_ble_tracker:

bluetooth_proxy:
  active: true

And nothing every pops up under the BLE integration. However, if I plug in my USB bluetooth adapter, it is able to find things. What am I doing wrong here? Any help would be greatly appreciated, I’ve spent all weekend testing this…

@Dilby It can be used for tracking devices, see #29. But After some testing, ESPresense seems to work way better using the same hardware, though it requieres MQTT server add-on. It’s also fine-tuned for Apple Watches, etc.

Same problem here, had to add sensors manually in the ESP32:

sensor:
  - platform: atc_mithermometer
    mac_address: "A4:C1:38:xx:xx:xx"
    temperature:
      name: "Temperature"
    humidity:
      name: "Humidity"
    battery_level:
      name: "BatteryLevel"

I wound up using openmqttgateway gateway, as shown in this post:

That works very well with smartdry and the mi scale.

1 Like

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?