Bluetooth Proxy Error During Switchbot Connection

Hey everyone,

So I just got an Atom Lite set up with bluetooth proxy for Home Assistant. I’m using for Switchbot products, as I saw in the latest release video they used a Switchbot lock with very minimal response times. Much better than the internal Rasp Pi 4 chipset. It works, but has a very slow delay (just about as bad as it was before). I was watching the logs as it tries to connect to the devices, and this is what it was saying.

[19:46:11][I][bluetooth_proxy:250]: [0] [F0:8E:0D:FE:E8:0C] Connecting v3 with cache
[19:46:11][D][esp32_ble_tracker:216]: Pausing scan to make connection...
[19:46:11][I][esp32_ble_client:064]: [0] [F0:8E:0D:FE:E8:0C] 0x01 Attempting BLE connection
[19:46:12][D][esp-idf:000]: W (112743) BT_HCI: hcif disc complete: hdl 0x0, rsn 0x3e

[19:46:12][D][esp-idf:000]: W (113400) BT_HCI: hcif disc complete: hdl 0x0, rsn 0x3e

[19:46:15][D][esp-idf:000]: W (116037) BT_HCI: hcif disc complete: hdl 0x0, rsn 0x3e

[19:46:16][D][esp-idf:000]: W (117348) BT_HCI: hcif disc complete: hdl 0x0, rsn 0x3e

[19:46:16][D][esp-idf:000]: W (117353) BT_APPL: gattc_conn_cb: if=3 st=0 id=3 rsn=0x3e

[19:46:16][D][esp-idf:000]: W (117355) BT_APPL: gattc_conn_cb: if=4 st=0 id=4 rsn=0x3e

[19:46:16][D][esp-idf:000]: W (117356) BT_APPL: gattc_conn_cb: if=5 st=0 id=5 rsn=0x3e

[19:46:16][W][esp32_ble_client:131]: [0] [] Connection failed, status=133
[19:46:16][D][esp32_ble_tracker:327]: Starting scan...
[19:46:17][I][bluetooth_proxy:250]: [0] [F0:8E:0D:FE:E8:0C] Connecting v3 with cache
[19:46:17][D][esp32_ble_tracker:216]: Pausing scan to make connection...
[19:46:17][I][esp32_ble_client:064]: [0] [F0:8E:0D:FE:E8:0C] 0x01 Attempting BLE connection
[19:46:18][D][esp-idf:000]: W (118669) BT_HCI: hcif disc complete: hdl 0x0, rsn 0x3e

[19:46:19][D][esp32_ble_tracker:327]: Starting scan...
[19:46:28][I][esp32_ble_client:078]: [0] [F0:8E:0D:FE:E8:0C] Disconnecting.
[19:46:28][D][esp-idf:000]: W (128917) BT_HCI: hci cmd send: disconnect: hdl 0x0, rsn:0x13

[19:46:28][D][esp-idf:000]: W (128920) BT_APPL: gattc_conn_cb: if=3 st=0 id=3 rsn=0x16

[19:46:28][D][esp-idf:000]: W (128922) BT_APPL: gattc_conn_cb: if=4 st=0 id=4 rsn=0x16

[19:46:28][D][esp-idf:000]: W (128923) BT_APPL: gattc_conn_cb: if=5 st=0 id=5 rsn=0x16

[19:46:28][D][esp-idf:000]: W (128977) BT_HCI: hcif disc complete: hdl 0x0, rsn 0x16

When I do get the delay is where it fails to connect and throws (Connection failed, status = 133). It will then attempt to reconnect and sometimes fail multiple times in a row before successfully connecting. Does anyone know what would cause this?

1 Like

I got the lock too and after its been idle for 30-ish seconds it seems to go to sleep and turn off bluetooth. After this reconmecting can take 10-30 seconds to recognize a command.

I recently got a switchbot door lock and noticed a little bit of a random delay (although it seemed to become mostly instantaneous after it finally connected). It’s near but not right next to my Bluetooth adapter for my HA instance.

Ended up putting a generic ESP32 development board nearby with Bluetooth proxy (and active connections set to true). Essentially instantaneous response both for commands and states regardless of when I last interacted with the lock. I started off with the ESP RIGHT next to the lock to test but now it’s maybe 10 ft away in a drawer and have noticed that the Bluetooth signal strength varies A LOT depending on whether the door is open or closed; not sure if it’s the change in reflection off of the metal door or if the SwitchBot antenna is somewhat directional.

1 Like

Thats good to know, thanks for the info. I contacted switchbot and they told me the home assistant integration closes the connection after 8.5s. i wonder if theres a way to automate re-establishing the connection.

I suspect this would impact battery life of the lock significantly.

Like I said previously though, with a BT Proxy nearby mine works instantaneously all the time, so it’s not an issue if you have a solid BT connection.

1 Like