Commit Graph
6 Commits
Author SHA1 Message Date
Vlad KolotovandGitHub 2a8504cac6 [bluetooth] Fix BlueZ events stopping after reconnect (no SERVICES_DISCOVERED) (#20950)
#20903 changed onServicesResolved() to call discoverServices() instead of
firing SERVICES_DISCOVERED unconditionally. discoverServices() only notified
when the openHAB-side service list *grew* (getGattServices().size() >
getServices().size()). That list (supportedServices) is only cleared on BlueZ
object removal, so on a normal reconnect BlueZ re-fires ServicesResolved=true
while the list is already fully populated, the "grew" check is false, and
SERVICES_DISCOVERED is never re-fired.

Consumers built on ConnectedBluetoothHandler re-arm their notifications and
polling off onServicesDiscovered() (e.g. grundfosalpha enables notifications
and schedules its read loop there; the generic binding rebuilds channels).
Swallowing the event leaves the Thing ONLINE but silent after every reconnect
- no events are received, matching #20947.

Fire SERVICES_DISCOVERED whenever the GATT is resolved with services present,
not only when the list just grew. Population still happens only when the list
grows, but the notification now always reaches listeners on a resolve. The
event is idempotent for all consumers (generic only adds missing channels;
ConnectedBluetoothHandler/grundfosalpha re-enabling notifications is a no-op
when already notifying).

Fixes #20947

Signed-off-by: Vlad Kolotoff <vkolotoff@pm.me>
2026-06-14 13:03:26 +02:00
Vlad KolotovandGitHub 0af60ee874 [bluetooth] Bump bluez-dbus-osgi to 0.3.5 (#20926)
Pick up the upstream bluez-dbus fix that returns a snapshot from
DeviceManager.getDevices() (hypfvieh/bluez-dbus#75), avoiding a
ConcurrentModificationException when BlueZ mutates the device list
during iteration, which could take the bridge offline and stall
updates.

Updates the bundle dependency, the BlueZ Karaf feature, and the
aggregated Bluetooth feature to 0.3.5.

Signed-off-by: Vlad Kolotoff <vkolotoff@pm.me>
2026-06-11 07:03:28 +02:00
Vlad KolotovandGitHub 6839c31fcd [bluetooth] Recover BlueZ devices after object removal (#20903)
* [bluetooth] Recover BlueZ devices after object removal

Reset cached adapter and device state when BlueZ removes their DBus objects, and populate GATT services before notifying listeners. This allows always-connected devices to reconnect after device removal or adapter unplug/replug.

Signed-off-by: Vlad Kolotoff <vkolotoff@pm.me>
2026-06-08 17:47:32 +02:00
Vlad KolotovandGitHub 321299a50c [bluetooth] Bump bluez-dbus-osgi to 0.3.4 (#20881)
* [bluetooth] Bump bluez-dbus-osgi to 0.3.3

Picks up the upstream bluez-dbus fix that evicts cached device wrappers when
BlueZ removes the underlying DBus object (hypfvieh/bluez-dbus#73), so the binding
recovers from stale device objects instead of getting stuck on a dead proxy.

* [bluetooth] Bump bluez-dbus-osgi to 0.3.4

Use the corrected release containing the verified BlueZ object-lifecycle and retryable GATT discovery fixes.

Signed-off-by: Vlad Kolotoff <vkolotoff@pm.me>
2026-06-08 10:49:24 +02:00
Vlad KolotovandGitHub 60a6ec3247 [bluetooth] Support custom GATT specifications via a configurable folder (#20880)
* [bluetooth] Support custom GATT specifications via a configurable

Signed-off-by: Vlad Kolotoff <vkolotov@gmail.com>
2026-06-07 19:14:52 +02:00
Vlad KolotovandGitHub b7906949c2 [bluetooth] Fix BlueZ GATT service discovery for slow/reconnecting devices (#20882)
Devices whose BlueZ connection completes shortly after the binding's connect
call times out, or that reconnect later, never had their GATT services
discovered, so their channels were never built or stopped updating (the Thing
kept only the rssi channel, or logged 'characteristic is missing' forever).

Signed-off-by: Vlad Kolotoff <vkolotov@gmail.com>
2026-06-05 16:29:45 +02:00