Skip to content

Commit 59595e3

Browse files
committed
[bluetooth_proxy] Document LibreTiny BLE hub support (BK7231N / BK7238 / LN882H)
The bluetooth_proxy component is now hub-agnostic: add a Supported platforms section noting it works on LibreTiny BLE hubs as an advertisement proxy (active GATT connections remain ESP32-only), attaching to bk72xx_ble_tracker / ln882h_ble_tracker.
1 parent 88dfe51 commit 59595e3

1 file changed

Lines changed: 115 additions & 27 deletions

File tree

src/content/docs/components/bluetooth_proxy.mdx

Lines changed: 115 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,33 @@ are supported.
1717
If you'd like to buy a ready-made Bluetooth proxy or flash your own device, see
1818
[ESPHome projects with Bluetooth proxy support](/projects/?type=bluetooth).
1919

20+
## Scan source and platform support
21+
22+
The Bluetooth proxy does not scan on its own. It attaches to a **BLE tracker hub** — the BLE scanner for
23+
your chip — which supplies the advertisements, and forwards them to Home Assistant. Add the tracker for
24+
your platform to the configuration alongside `bluetooth_proxy`:
25+
26+
| Platform | BLE tracker hub | Raw advertisements | Active connections |
27+
|---|---|:---:|:---:|
28+
| ESP32 | [ESP32 BLE Tracker](/components/esp32_ble_tracker) |||
29+
| BK7231N / BK7238 (LibreTiny) | `bk72xx_ble_tracker` |||
30+
| LN882H (LibreTiny) | `ln882h_ble_tracker` |||
31+
32+
**Raw advertisement proxying** — forwarding the advertisements that BLE devices broadcast (BTHome, ATC,
33+
iBeacon and similar) — works on every platform. **Active connections**, which let Home Assistant read from
34+
and write to a device over a live GATT connection, are **ESP32-only**; on LibreTiny hubs the Bluetooth proxy
35+
is an advertisement proxy.
36+
37+
```yaml
38+
# ESP32
39+
esp32_ble_tracker:
40+
bluetooth_proxy:
41+
42+
# LibreTiny (BK7231N / BK7238 / LN882H)
43+
bk72xx_ble_tracker: # or ln882h_ble_tracker
44+
bluetooth_proxy: # attaches to the tracker hub (auto-resolved)
45+
```
46+
2047
## Configuration
2148
2249
```yaml
@@ -26,22 +53,26 @@ bluetooth_proxy:
2653
# active: false
2754
```
2855

56+
The options below configure **active connections and apply to ESP32 only**. On LibreTiny hubs the proxy
57+
accepts only `id` and `ble_id` (the BLE tracker to attach to — auto-resolved when a single tracker is
58+
configured).
59+
2960
- **active** (*Optional*, boolean): Enables proxying active GATT connections to BLE devices.
30-
This is separate from active *scanning* (configured in [ESP32 BLE Tracker](/components/esp32_ble_tracker)).
31-
Defaults to `true`.
61+
This is separate from active *scanning* (configured on the BLE tracker). Defaults to `true`. *ESP32-only.*
3262
- **cache_services** (*Optional*, boolean): Enables caching GATT services in NVS flash storage which
33-
significantly speeds up active connections. Defaults to `true`.
63+
significantly speeds up active connections. Defaults to `true`. *ESP32-only.*
3464
- **connection_slots** (*Optional*, int): The maximum number of BLE connection slots to use.
3565
Each configured slot consumes ~1KB of RAM, with a maximum of `9`. It is recommended not to exceed `5`
3666
connection slots to avoid stability and memory issues. Defaults to `3`.
3767
Ethernet-based proxies can generally handle `4` connection slots reliably.
3868
The value must not exceed the total configured `max_connections`
39-
for [ESP32 BLE](/components/esp32_ble).
69+
for [ESP32 BLE](/components/esp32_ble). *ESP32-only.*
4070

41-
The Bluetooth proxy depends on [ESP32 BLE Tracker](/components/esp32_ble_tracker) so make sure to add that
42-
to your configuration.
71+
The Bluetooth proxy depends on the BLE tracker for your platform — [ESP32 BLE Tracker](/components/esp32_ble_tracker)
72+
on ESP32, or `bk72xx_ble_tracker` / `ln882h_ble_tracker` on LibreTiny — so make sure to add it to your
73+
configuration.
4374

44-
### How Active Connections Work
75+
### How active connections work (ESP32 only)
4576

4677
The Bluetooth proxy provides Home Assistant with a limited number of simultaneous active GATT connections
4778
(configured via `connection_slots`). The default is 3 slots. Ethernet-based proxies can generally handle
@@ -53,46 +84,56 @@ Devices that connect briefly to exchange data and then disconnect (like many sen
5384
for other devices, so you can use more devices than you have slots.
5485

5586
Passively broadcasted sensor data (advertised by devices without requiring active connections, such as
56-
many BTHome sensors) is received separately and is not limited by the number of connection slots.
87+
many BTHome sensors) is received separately and is not limited by the number of connection slots — and is
88+
the only mode used by LibreTiny hubs.
5789

5890
## Improving reception performance
5991

60-
Use a board with an Ethernet connection to the network to offload ESP32's radio module
61-
from WiFi traffic, which improves Bluetooth performance. For best results, use a board
62-
with an external antenna (e.g., Olimex ESP32-PoE-ISO-EA over Olimex ESP32-PoE-ISO).
63-
6492
> [!NOTE]
6593
> The default scan parameters are recommended for most users. Changing `interval` or
6694
> `window` from their defaults typically provides no meaningful benefit while increasing
6795
> CPU usage and network traffic. Aggressive scan settings can cause overheating on
6896
> PoE-based proxies and WiFi instability on WiFi-based proxies.
6997
70-
### Passive vs Active Scanning
98+
On **ESP32**, use a board with an Ethernet connection to the network to offload the radio module from WiFi
99+
traffic, which improves Bluetooth performance. For best results, use a board with an external antenna (e.g.,
100+
Olimex ESP32-PoE-ISO-EA over Olimex ESP32-PoE-ISO).
101+
102+
On **LibreTiny**, the BK7231N / BK7238 / LN882H are single-core, WiFi-only modules — WiFi and BLE share one
103+
CPU core, so continuous scanning can interfere with the initial connection to Home Assistant. Start scanning
104+
only once Home Assistant connects; see the single-core guidance on the `bk72xx_ble_tracker` /
105+
`ln882h_ble_tracker` pages (and the [LibreTiny sample](#libretiny-sample) below).
106+
107+
### Passive vs active scanning
71108

72109
Passive scanning works for most BLE devices and is sufficient for ongoing operation.
73110
Active scanning requests additional scan response data from devices and is typically
74111
only needed when initially adding new devices to Home Assistant. Active scanning also
75112
increases battery drain on battery-powered BLE devices.
76113

77-
The [ESP32 BLE Tracker](/components/esp32_ble_tracker) component defaults to active scanning
78-
(`active: true`). If you experience overheating, you can try switching to passive scanning
79-
if your devices don't require active scans:
114+
Passive vs active scanning is configured on the **BLE tracker**, not on the proxy. The
115+
[ESP32 BLE Tracker](/components/esp32_ble_tracker) defaults to active scanning (`active: true`); if you
116+
experience overheating you can switch to passive scanning when your devices don't require active scans:
80117

81118
```yaml
82119
esp32_ble_tracker:
83120
scan_parameters:
84121
active: false
85122
```
86123
87-
Avoid placing the ESP node in racks, close to routers/switches or other network equipment as EMI
124+
On LibreTiny, set `active:` on `ln882h_ble_tracker` the same way; the BK7231N / BK7238 scan passively only.
125+
126+
Avoid placing the node in racks, close to routers/switches or other network equipment as EMI
88127
interference will degrade Bluetooth signal reception. For best results put as far away as possible,
89128
at least 3 meters distance from any other such equipment. Place your ESPHome devices close to the
90129
Bluetooth devices that you want to interact with for the best experience.
91130

92-
## Complete sample recommended configuration for a WiFi-connected Bluetooth proxy
131+
## Complete sample configurations
93132

94-
Below is a complete sample recommended configuration for a WiFi-connected Bluetooth proxy. If you
95-
experience issues with your proxy, try reducing your configuration to be as similar to this as possible.
133+
### ESP32 — Wi-Fi
134+
135+
A complete sample recommended configuration for a Wi-Fi-connected Bluetooth proxy. If you experience issues
136+
with your proxy, try reducing your configuration to be as similar to this as possible.
96137

97138
```yaml
98139
substitutions:
@@ -126,11 +167,11 @@ bluetooth_proxy:
126167
active: true
127168
```
128169

129-
## Complete sample recommended configuration for an ethernet-connected Bluetooth proxy
170+
### ESP32 — Ethernet
130171

131-
Below is a complete sample recommended configuration for an ethernet-connected Bluetooth proxy. This
132-
configuration is not for a Wi-Fi based proxy. If you experience issues with your proxy, try reducing
133-
your configuration to be as similar to this as possible.
172+
A complete sample recommended configuration for an Ethernet-connected Bluetooth proxy. This configuration is
173+
not for a Wi-Fi based proxy. If you experience issues with your proxy, try reducing your configuration to be
174+
as similar to this as possible.
134175

135176
This configuration is for an Olimex ESP32-PoE-ISO board with an Ethernet connection to the network.
136177
If you use a different board, you must change the `board` substitution to match your board.
@@ -180,11 +221,56 @@ bluetooth_proxy:
180221
connection_slots: 4
181222
```
182223

224+
<span id="libretiny-sample"></span>
225+
226+
### LibreTiny — BK7231N / BK7238 / LN882H
227+
228+
A LibreTiny hub is Wi-Fi-only and proxies advertisements only. Because WiFi and BLE share a single CPU core,
229+
this configuration starts scanning only once Home Assistant connects, which keeps the radio free for the
230+
initial handshake.
231+
232+
```yaml
233+
substitutions:
234+
name: my-bluetooth-proxy
235+
236+
esphome:
237+
name: ${name}
238+
name_add_mac_suffix: true
239+
240+
bk72xx: # or ln882x for the LN882H
241+
board: cb3s # set to your module's board
242+
243+
wifi:
244+
ssid: !secret wifi_ssid
245+
password: !secret wifi_password
246+
247+
# Enable logging
248+
logger:
249+
250+
ota:
251+
platform: esphome
252+
253+
bk72xx_ble_tracker: # or ln882h_ble_tracker
254+
id: ble_tracker
255+
scan_parameters:
256+
continuous: false # WiFi/BLE share one core — start scanning only when HA connects
257+
258+
bluetooth_proxy:
259+
260+
# Enable Home Assistant API and drive scanning from its connection state
261+
api:
262+
on_client_connected:
263+
- bk72xx_ble_tracker.start_scan:
264+
continuous: true
265+
on_client_disconnected:
266+
- bk72xx_ble_tracker.stop_scan:
267+
```
268+
183269
## Troubleshooting
184270

185-
### Memory Issues
271+
### Memory issues (ESP32)
186272

187-
If you experience memory issues, consider the following:
273+
If you experience memory issues on ESP32, consider the following:
188274

189275
- **Framework:** The `esp-idf` framework is recommended over `arduino` as it uses less memory.
190276
- **NVS Partition Size:** If you last updated your ESP32 via serial before 2022.12.0 on `esp-idf`
@@ -194,7 +280,7 @@ If you experience memory issues, consider the following:
194280
- **Web Server:** The [Web Server](/components/web_server) component uses additional RAM.
195281
Disabling it can help if you experience memory-related issues.
196282

197-
### Device Compatibility
283+
### Device compatibility
198284

199285
Not all BLE devices are supported and ESPHome does not decode or keep a list. To find out if your device
200286
is supported, please search for it in the
@@ -203,5 +289,7 @@ is supported, please search for it in the
203289
## See Also
204290

205291
- [ESP32 Bluetooth Low Energy Tracker Hub](/components/esp32_ble_tracker)
292+
- `bk72xx_ble_tracker` — BK7231N / BK7238 BLE tracker hub
293+
- `ln882h_ble_tracker` — LN882H BLE tracker hub
206294
- BTHome [https://bthome.io/](https://bthome.io/)
207295
- <APIRef text="bluetooth_proxy.h" path="bluetooth_proxy/bluetooth_proxy.h" />

0 commit comments

Comments
 (0)