Files
mc-webui/app
MarekWo 53063f199a fix(ble): connect via BlueZ D-Bus instead of bleak direct connect
bleak inside Docker cannot initiate new BLE connections — it can only
take over connections already established by BlueZ.  Replace the
force-disconnect approach with a connect-via-BlueZ approach:

1. _ble_ensure_connected() connects the device via BlueZ D-Bus
   (Device1.Connect) before bleak tries to take over
2. BleakScanner.find_device_by_address() provides the BLEDevice
   object that bleak 3.x needs (raw MAC address doesn't work)
3. MeshCore.create_ble(device=...) takes over the BlueZ connection

On reconnect after disconnect:
1. Power-cycle adapter clears stale GATT notification handles
2. BlueZ re-connects the trusted device automatically
3. bleak takes over the re-established connection

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-05 14:13:06 +02:00
..