v0.5.1
Fix: BLE reconnect reliability
Fixes an issue where the integration would fail to reconnect after a BLE disconnect and never recover — hammering the adapter with rapid connect attempts until BlueZ crashed.
Changes
- Exponential backoff now works: previously the backoff timer reset before every connect attempt (as long as the device was advertising), so it never actually grew. Now it only resets after a successful connect. Backoff: 5s → 10s → 20s → 40s → 80s → 160s → 300s max.
- Connection slot leak fixed: if
establish_connectionsucceeded but a later step (MTU negotiation, notifications, bind) failed, the BLE connection was dropped without callingdisconnect()— leaking a BlueZ connection slot. Now properly cleaned up. - Robust disconnect: always attempts
disconnect()even whenis_connectedreports False, since BlueZ may still hold the connection slot. - Disconnect timeout: added 5s timeout to disconnect in the connect error handler (was hanging up to 10s on unreachable devices).
- Backoff visibility: reconnect warnings now log the wait duration (
waiting 20s before reconnect) for easier debugging.