mirror of
https://github.com/esphome/esphome.git
synced 2026-09-14 08:38:39 +00:00
8c0b0b1302c418f121b39724d96c87bd71c6ed9f
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.
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%
