Repository navigation
Fix BLE connection leaks and pair during setup - #24
Conversation
- Pair when connecting in the config flow and the random MAC scan, BlueZ fails service discovery without a bond (#2) - Skip random MAC candidates that raise a BleakError instead of aborting the scan - Filter scan and discovery callbacks by the advertised service UUID instead of the characteristic UUID - Close the BLE connection when pairing fails after connecting - Ignore disconnect callbacks of a previous client so they don't drop the current session - Disconnect after a failed request so the next call reconnects Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@Vurgus kannst du debug logging anschalten und die logs hier hinzufügen? |
|
@Nailik klar kein Problem. Bin neu im HA. Daher hoffe ich, dass ich das richtig gemacht habe. nach dem Verbindungsversuch ist unter Einstellungen -> System -> Protokolle folgendes aufgetaucht: Ansonsten sag mir, was ich machen kann oder ob du mehr brauchst. |
|
@Nailik habe noch das hier gefunden: |
|
@Vurgus please test https://github.com/Nailik/blanco_unit/releases/tag/0.0.14 and https://github.com/Nailik/blanco_unit/releases/tag/0.0.15-mtu-sized-packages Before testing please try to remove the old integration and reboot HomeAssistant (maybe also the OS HomeAssistant is running on), potentially also reboot the blanco unit just to make sure. |
|
@Nailik I tested https://github.com/Nailik/blanco_unit/releases/tag/0.0.14 Let me test the pre-release 0.0.14 for the next days an I will give you an update. |
## [2.0.2](v2.0.1...v2.0.2) (2026-11-09) ### Bug Fixes * harden the BLE connection against leaks and stuck GATT operations ([ef3c1fa](ef3c1fa)), closes [Nailik#24](https://github.com/alexhaller/blanco_unit/issues/24) [Nailik#25](https://github.com/alexhaller/blanco_unit/issues/25) [Nailik#27](https://github.com/alexhaller/blanco_unit/issues/27) * point the documentation and issue links at this repository ([d423f16](d423f16)), closes [hacs/default#13647](hacs/default#13647) * stop reporting the filter and CO2 capacity as a battery ([5311f42](5311f42))





Fixes connection leaks and missing BLE pairing found while looking into #2.
Pairing during setup (#2)
client.pyalready connects withpair=True(#13), but the config flow and the random MAC scan open their own connections without it. All tracebacks in #2 come fromconfig_flow.py validate_input → establish_connection, failing withfailed to discover services, device disconnected.Through an ESPHome proxy this works without a bond. ESP-IDF only runs service discovery and accepts the device's security request. BlueZ does more during discovery: it writes the Client Features and Service Changed descriptors and reads the GAP characteristics. On an "insufficient encryption/authentication" error it also raises link security by itself (
src/shared/att.cchange_security). Bonding first gives an encrypted link from the start, which matches the reports that it works afterbluetoothctl pairor withtest_cli.py. Which attribute the unit rejects is not confirmed yet; abtmoncapture would show it.Changes
BleakError(BleakConnectionErroris not anOSError) instead of aborting the scan847bba10…, as inmanifest.json) instead of the characteristic UUID, which is never advertisedTests
New tests for each change
Still needs testing with a CHOICE.All on a local adapter.
🤖 Generated with Claude Code