Paul Lazarre 8c0b0b1302 [esp32_ble_tracker] Hold COEX_PREFER_BT for the lifetime of any active connection
count_client_states_() only tracks transient states (CONNECTING, DISCOVERED,
DISCONNECTING). When a connection settles into CONNECTED/ESTABLISHED, all
counted states go to zero, and loop() reverts coex from PREFER_BT back to
BALANCE while the connection is still live. Sustained WiFi traffic then
crowds out the BT radio's ability to receive the peer's GATT response,
causing esp_ble_gattc_write_char_descr to time out at ~20s with a
host-synthesized status=0x85 (commonly reported as status=133).

Fix: count CONNECTED + ESTABLISHED clients as "active" and gate the coex
revert on the active count. Coex now stays at PREFER_BT for the entire
lifetime of any active connection and only returns to BALANCE when all
connections are torn down.

Validated end-to-end: aioesphomeapi-driven write_descriptor on a Yale
BETA211123 lock at LOG_LEVEL_VERBOSE (heavy WiFi traffic, the
bug-triggering condition) — pre-patch: 19s hang then status=133.
Post-patch: 228ms SUCCESS. Verified live on an M5 Atom Lite running as a
bluetooth_proxy with host BlueZ stopped (M5 as the only path): lock ops
succeed cleanly with zero status=133 errors. A multi-day production
soak window will be added to the PR body before merge.
2026-04-26 19:23:20 -05:00
2023-06-12 17:00:34 +12:00
2022-09-06 15:48:01 +12:00
2025-12-21 09:26:03 -05:00
2024-03-28 10:20:51 +13:00
2025-07-17 22:40:28 +12:00
2025-12-08 14:37:45 -05:00
2026-04-09 11:28:48 +12:00
2025-07-17 22:40:28 +12:00
S
Description
ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems.
Readme Multiple Licenses
594 MiB
Languages
C++ 55.8%
Python 43.6%
C 0.3%
JavaScript 0.2%