Esphome BT proxy and Switchbot curtains

I have an esp32-wroom-32 setup as a BT proxy but it is not detecting my switchbot curtains.
This is my setup, is it missing any BT proxy settings?

esphome:
  name: btproxy

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "..."

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Btproxy Fallback Hotspot"
    password: "..."

captive_portal:

bluetooth_proxy:

The curtains are connecting just fine to my android phone (I don’t have a hub for them I want to connect to the BT proxy)

Just getting started with ESPHome myself.

Try enabling verbose logging so you can see if the blue tooth broadcasts are being seen by the ESP:

logger:
 level: VERBOSE     # {or VERY_VERBOSE}

That will show you the MAC address you’ll need to create the sensor that will show up in HA.

And I don’t see a sensor in your code. You’ll need that to create the entity in HA. Plenty of examples here:
ESPHome Sensor

Not sure why it didn’t work manually just adding bluetooth_proxy as it says in the instructions but I created a new one directly ESPHome Bluetooth Proxy and that worked, detected the switchbot curtains right after

The integration is not very stable it seems, not sure what is the issue here, BT proxy?
image
Seems like it was ok during the night and as soon as HA opened the curtains in the morning it started to go unavailable:
image
If I do reload integration it comes online, is this a known issue?

When I started working with a Switchbot, the HA-internal switchbot integration turned out quite bumpy, to say the least. I’m at the moment working with GitHub - devWaves/SwitchBot-MQTT-BLE-ESP32: Allows for multiple SwitchBot bots and curtains to be controlled via MQTT sent to ESP32. ESP32 will send BLE commands to switchbots and return MQTT responses to the broker. Also supports Temperature, Motion, Contact sensors (which works flawlessly), but needs a dedicated esp32 that does nothing else. I was hoping the bluetooth proxy feature would solve my problem, but from what I read here the integration itself is still a bit wonky?

I need it to run on a normal esp32 with BT proxy else I might as well just get the hub mini

Not sure if the esp32 is also having issues, i.e. all those unavailables at the side?:


Is this normal behaviour for bt proxy?

I only see one connection made to Home Assistant within a minute of uploading new code to the the ESP.

Yours seems to be continually disconnecting/reconnecting, and the Safe Mode switch entries in the logbook confirm that. Do you have VERY_VERBOSE logging enabled? That might shed some light on what’s happening. I’d suspect either poor WiFi signal strength or a problem with the ESP itself.

Something was up with HA server.
After a restart it is all stable, the esp and the curtains have stayed connected.
I have read about this somewhere here that it works for some time and then need to restart HA to get it to work again but so far so good :slight_smile:

im also trying to get the curtains working via proxy. I can see in the verbose logs packets are being proxied but when clicking on the curtain the logs for the esphome proxy say:

[21:01:42][I][esp32_ble_client:058]: Attempting BLE connection to e3:f5:18:1f:f5:3c
[21:01:42][V][esp32_ble_client:123]: [e3:f5:18:1f:f5:3c] ESP_GATTC_DISCONNECT_EVT, reason 62
[21:01:42][V][esp32_ble_client:086]: [00:00:00:00:00:00] ESP_GATTC_OPEN_EVT
[21:01:42][W][esp32_ble_client:089]: connect to 00:00:00:00:00:00 failed, status=133

How did you create the create the BT proxy a blank esp32 via ESPHome Bluetooth Proxy or did you just add the bluetooth_proxy: to a new/existing device?
BT proxy didn’t work for me when I added it manually but works ok when creating it via github link.

i used the website. looks like it sometimes works but mostly fails to connect to device. overall, the proxy function seems to work as HA can tell the proxy device to find the curtain and open it but its the actual command from the proxy to the curtain that’s a hit or miss