[grundfosalpha] Initial contribution (#15907)

* [Bluez] Disable automatic filtering of duplicate data
* Added Grundfos Alpha binding

Signed-off-by: Markus Heberling <markus@heberling.net>
This commit is contained in:
Markus Heberling
2023-12-04 11:10:10 +01:00
committed by GitHub
parent c22de9bcd3
commit f5065ad6e4
15 changed files with 540 additions and 0 deletions

View File

@@ -12,13 +12,20 @@
*/
package org.openhab.binding.bluetooth.bluez.internal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Future;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import org.bluez.exceptions.BluezFailedException;
import org.bluez.exceptions.BluezInvalidArgumentsException;
import org.bluez.exceptions.BluezNotReadyException;
import org.bluez.exceptions.BluezNotSupportedException;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.freedesktop.dbus.types.Variant;
import org.openhab.binding.bluetooth.AbstractBluetoothBridgeHandler;
import org.openhab.binding.bluetooth.BluetoothAddress;
import org.openhab.binding.bluetooth.bluez.internal.events.AdapterDiscoveringChangedEvent;
@@ -139,6 +146,15 @@ public class BlueZBridgeHandler extends AbstractBluetoothBridgeHandler<BlueZBlue
return null;
}
Map<String, Variant<?>> filter = new HashMap<>();
filter.put("DuplicateData", new Variant<>(true));
try {
adapter.setDiscoveryFilter(filter);
} catch (BluezInvalidArgumentsException | BluezFailedException | BluezNotSupportedException
| BluezNotReadyException e) {
throw new RuntimeException(e);
}
// now lets make sure that discovery is turned on
if (!localAdapter.startDiscovery()) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE, "Trying to start discovery");