added migrated 2.x add-ons

Signed-off-by: Kai Kreuzer <kai@openhab.org>
This commit is contained in:
Kai Kreuzer
2020-09-21 01:58:32 +02:00
parent bbf1a7fd29
commit 6df6783b60
11662 changed files with 1302875 additions and 11 deletions

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.openhab.binding.bluetooth.blukii</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View File

@@ -0,0 +1,13 @@
This content is produced and maintained by the openHAB project.
* Project home: https://www.openhab.org
== Declared Project Licenses
This program and the accompanying materials are made available under the terms
of the Eclipse Public License 2.0 which is available at
https://www.eclipse.org/legal/epl-2.0/.
== Source Code
https://github.com/openhab/openhab-addons

View File

@@ -0,0 +1,53 @@
# Blukii
This extension adds support for [Blukii](https://www.blukii.com/) Sensor Beacons.
## Supported Things
Only a single thing type is added by this extension:
| Thing Type ID | Description |
|---------------|-------------------------------------------------|
| blukii_beacon | A Blukii Sensor Beacon |
## Discovery
As any other Bluetooth device, Blukii Beacons are discovered automatically by the corresponding bridge.
## Thing Configuration
There is only a single configuration parameter `address`, which corresponds to the Bluetooth address of the device (in format "XX:XX:XX:XX:XX:XX").
## Channels
A Blukii Smart Beacon has the following channels:
| Channel ID | Item Type | Description |
|---------------|------------------------|------------------------------------|
| temperature | Number:Temperature | The measured temperature |
| humidity | Number:Dimensionless | The measured humidity |
| pressure | Number:Pressure | The measured air pressure |
| luminance | Number:Illuminance | The measured brightness |
| tiltx | Number:Angle | The tilt (x-axis) |
| titly | Number:Angle | The tilt (y-axis) |
| tiltz | Number:Angle | The tilt (z-axis) |
## Example
demo.things:
```
bluetooth:blukii:hci0:beacon "Blukii Sensor Beacon" (bluetooth:bluez:hci0) [ address="12:34:56:78:9A:BC" ]
```
demo.items:
```
Number:Temperature temperature "Room Temperature [%.1f %unit%]" { channel="bluetooth:blukii:hci0:beacon:temperature" }
Number:Dimensionless humidity "Humidity [%.0f %unit%]" { channel="bluetooth:blukii:hci0:beacon:humidity" }
Number:Pressure pressure "Air Pressure [%.0f %unit%]" { channel="bluetooth:blukii:hci0:beacon:pressure" }
Number:Illuminance luminance "Luminance [%.0f %unit%]" { channel="bluetooth:blukii:hci0:beacon:luminance" }
Number:Angle tiltX "Tilt (X-Axis) [%.0f %unit%]" { channel="bluetooth:blukii:hci0:beacon:tiltx" }
Number:Angle tiltY "Tilt (Y-Axis) [%.0f %unit%]" { channel="bluetooth:blukii:hci0:beacon:tilty" }
Number:Angle tiltZ "Tilt (Z-Axis) [%.0f %unit%]" { channel="bluetooth:blukii:hci0:beacon:tiltz" }
```

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.addons.reactor.bundles</artifactId>
<version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.openhab.binding.bluetooth.blukii</artifactId>
<name>openHAB Add-ons :: Bundles :: Blukii Bluetooth Adapter</name>
<dependencies>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.bluetooth</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<features name="org.openhab.binding.bluetooth.blukii-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository>
<feature name="openhab-binding-bluetooth-bluuki" description="Bluetooth Binding Blukii" version="${project.version}">
<feature>openhab-runtime-base</feature>
<feature>openhab-transport-serial</feature>
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.bluetooth/${project.version}</bundle>
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.bluetooth.blukii/${project.version}</bundle>
</feature>
</features>

View File

@@ -0,0 +1,42 @@
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.bluetooth.blukii;
import org.openhab.binding.bluetooth.BluetoothBindingConstants;
import org.openhab.core.thing.ThingTypeUID;
/**
* The {@link BlukiiBindingConstants} class defines common constants, which are
* used across the whole binding.
*
* @author Kai Kreuzer - Initial contribution
*/
public class BlukiiBindingConstants {
// List of all Thing Type UIDs
public static final ThingTypeUID THING_TYPE_BEACON = new ThingTypeUID(BluetoothBindingConstants.BINDING_ID,
"blukii_beacon");
public static final String BLUKII_PREFIX = "blukii ";
// Channel IDs
public static final String CHANNEL_ID_BATTERY = "battery";
public static final String CHANNEL_ID_TEMPERATURE = "temperature";
public static final String CHANNEL_ID_HUMIDITY = "humidity";
public static final String CHANNEL_ID_PRESSURE = "pressure";
public static final String CHANNEL_ID_LUMINANCE = "luminance";
public static final String CHANNEL_ID_TILTX = "tiltx";
public static final String CHANNEL_ID_TILTY = "tilty";
public static final String CHANNEL_ID_TILTZ = "tiltz";
}

View File

@@ -0,0 +1,79 @@
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.bluetooth.blukii.handler;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.binding.bluetooth.BeaconBluetoothHandler;
import org.openhab.binding.bluetooth.BluetoothDeviceListener;
import org.openhab.binding.bluetooth.blukii.BlukiiBindingConstants;
import org.openhab.binding.bluetooth.blukii.internal.data.BlukiiData;
import org.openhab.binding.bluetooth.blukii.internal.data.BlukiiDataDecoder;
import org.openhab.binding.bluetooth.notification.BluetoothScanNotification;
import org.openhab.core.library.types.DecimalType;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.unit.MetricPrefix;
import org.openhab.core.library.unit.SIUnits;
import org.openhab.core.library.unit.SmartHomeUnits;
import org.openhab.core.thing.Thing;
/**
* The {@link BlukiiHandler} is responsible for handling commands, which are
* sent to one of the channels.
*
* @author Kai Kreuzer - Initial contribution and API
* @author Markus Rathgeb - Split data (decoding and types) and handler
*/
@NonNullByDefault
public class BlukiiHandler extends BeaconBluetoothHandler implements BluetoothDeviceListener {
private final BlukiiDataDecoder decoder = new BlukiiDataDecoder();
public BlukiiHandler(Thing thing) {
super(thing);
}
@Override
public void onScanRecordReceived(BluetoothScanNotification scanNotification) {
final byte[] manufacturerData = scanNotification.getManufacturerData();
if (manufacturerData != null) {
final BlukiiData blukiiData = decoder.decode(manufacturerData);
if (blukiiData != null) {
updateState(BlukiiBindingConstants.CHANNEL_ID_BATTERY, new DecimalType(blukiiData.battery));
blukiiData.environment.ifPresent(environment -> {
updateState(BlukiiBindingConstants.CHANNEL_ID_TEMPERATURE,
new QuantityType<>(environment.temperature, SIUnits.CELSIUS));
updateState(BlukiiBindingConstants.CHANNEL_ID_HUMIDITY,
new QuantityType<>(environment.humidity, SmartHomeUnits.PERCENT));
updateState(BlukiiBindingConstants.CHANNEL_ID_PRESSURE,
new QuantityType<>(environment.pressure, MetricPrefix.HECTO(SIUnits.PASCAL)));
updateState(BlukiiBindingConstants.CHANNEL_ID_LUMINANCE,
new QuantityType<>(environment.luminance, SmartHomeUnits.LUX));
});
blukiiData.accelerometer.ifPresent(accelerometer -> {
updateState(BlukiiBindingConstants.CHANNEL_ID_TILTX,
new QuantityType<>(accelerometer.tiltX, SmartHomeUnits.DEGREE_ANGLE));
updateState(BlukiiBindingConstants.CHANNEL_ID_TILTY,
new QuantityType<>(accelerometer.tiltY, SmartHomeUnits.DEGREE_ANGLE));
updateState(BlukiiBindingConstants.CHANNEL_ID_TILTZ,
new QuantityType<>(accelerometer.tiltZ, SmartHomeUnits.DEGREE_ANGLE));
});
blukiiData.magnetometer.ifPresent(magnetometer -> {
// It isn't easy to get a heading from these values without any calibration, so we ignore those
// right
// now.
});
}
}
super.onScanRecordReceived(scanNotification);
}
}

View File

@@ -0,0 +1,83 @@
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.bluetooth.blukii.internal;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.bluetooth.BluetoothBindingConstants;
import org.openhab.binding.bluetooth.blukii.BlukiiBindingConstants;
import org.openhab.binding.bluetooth.discovery.BluetoothDiscoveryDevice;
import org.openhab.binding.bluetooth.discovery.BluetoothDiscoveryParticipant;
import org.openhab.core.config.discovery.DiscoveryResult;
import org.openhab.core.config.discovery.DiscoveryResultBuilder;
import org.openhab.core.thing.Thing;
import org.openhab.core.thing.ThingTypeUID;
import org.openhab.core.thing.ThingUID;
import org.osgi.service.component.annotations.Component;
/**
* This discovery participant is able to recognize blukii devices and create discovery results for them.
*
* @author Kai Kreuzer - Initial contribution and API
*
*/
@NonNullByDefault
@Component(immediate = true)
public class BlukiiDiscoveryParticipant implements BluetoothDiscoveryParticipant {
@Override
public Set<ThingTypeUID> getSupportedThingTypeUIDs() {
return Collections.singleton(BlukiiBindingConstants.THING_TYPE_BEACON);
}
@Override
public @Nullable ThingUID getThingUID(BluetoothDiscoveryDevice device) {
String name = device.getName();
if (name != null && name.startsWith(BlukiiBindingConstants.BLUKII_PREFIX)) {
if (name.charAt(BlukiiBindingConstants.BLUKII_PREFIX.length()) == 'B') {
return new ThingUID(BlukiiBindingConstants.THING_TYPE_BEACON, device.getAdapter().getUID(),
device.getAddress().toString().toLowerCase().replace(":", ""));
}
}
return null;
}
@Override
public @Nullable DiscoveryResult createResult(BluetoothDiscoveryDevice device) {
ThingUID thingUID = getThingUID(device);
if (thingUID != null) {
String label = "Blukii SmartBeacon";
Map<String, Object> properties = new HashMap<>();
properties.put(BluetoothBindingConstants.CONFIGURATION_ADDRESS, device.getAddress().toString());
properties.put(Thing.PROPERTY_VENDOR, "Schneider Schreibgeräte GmbH");
Integer txPower = device.getTxPower();
if (txPower != null) {
properties.put(BluetoothBindingConstants.PROPERTY_TXPOWER, Integer.toString(txPower));
}
// Create the discovery result and add to the inbox
return DiscoveryResultBuilder.create(thingUID).withProperties(properties)
.withRepresentationProperty(BluetoothBindingConstants.CONFIGURATION_ADDRESS)
.withBridge(device.getAdapter().getUID()).withLabel(label).build();
} else {
return null;
}
}
}

View File

@@ -0,0 +1,53 @@
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.bluetooth.blukii.internal;
import java.util.Collections;
import java.util.Set;
import org.openhab.binding.bluetooth.blukii.BlukiiBindingConstants;
import org.openhab.binding.bluetooth.blukii.handler.BlukiiHandler;
import org.openhab.core.thing.Thing;
import org.openhab.core.thing.ThingTypeUID;
import org.openhab.core.thing.binding.BaseThingHandlerFactory;
import org.openhab.core.thing.binding.ThingHandler;
import org.openhab.core.thing.binding.ThingHandlerFactory;
import org.osgi.service.component.annotations.Component;
/**
* The {@link BlukiiHandlerFactory} is responsible for creating things and thing handlers.
*
* @author Kai Kreuzer - Initial contribution
*/
@Component(service = ThingHandlerFactory.class, configurationPid = "binding.blukii")
public class BlukiiHandlerFactory extends BaseThingHandlerFactory {
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections
.singleton(BlukiiBindingConstants.THING_TYPE_BEACON);
@Override
public boolean supportsThingType(ThingTypeUID thingTypeUID) {
return SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID);
}
@Override
protected ThingHandler createHandler(Thing thing) {
ThingTypeUID thingTypeUID = thing.getThingTypeUID();
if (thingTypeUID.equals(BlukiiBindingConstants.THING_TYPE_BEACON)) {
return new BlukiiHandler(thing);
}
return null;
}
}

View File

@@ -0,0 +1,38 @@
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.bluetooth.blukii.internal.data;
import org.eclipse.jdt.annotation.NonNullByDefault;
/**
* Blukii accelerometer data.
*
* @author Markus Rathgeb - Initial contribution (migrated from handler)
*/
@NonNullByDefault
public class Accelerometer {
public final double tiltX;
public final double tiltY;
public final double tiltZ;
public Accelerometer(final double tiltX, final double tiltY, final double tiltZ) {
this.tiltX = tiltX;
this.tiltY = tiltY;
this.tiltZ = tiltZ;
}
@Override
public String toString() {
return "Accelerometer [tiltX=" + tiltX + ", tiltY=" + tiltY + ", tiltZ=" + tiltZ + "]";
}
}

View File

@@ -0,0 +1,45 @@
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.bluetooth.blukii.internal.data;
import java.util.Optional;
import org.eclipse.jdt.annotation.NonNullByDefault;
/**
* Blukii data.
*
* @author Markus Rathgeb - Initial contribution (migrate from handler)
*/
@NonNullByDefault
public class BlukiiData {
public final int battery;
public final Optional<Magnetometer> magnetometer;
public final Optional<Environment> environment;
public final Optional<Accelerometer> accelerometer;
public BlukiiData(final int battery, final Optional<Magnetometer> magnetometer,
final Optional<Environment> environment, final Optional<Accelerometer> accelerometer) {
this.battery = battery;
this.magnetometer = magnetometer;
this.environment = environment;
this.accelerometer = accelerometer;
}
@Override
public String toString() {
return "BlukiiData [battery=" + battery + ", magnetometer=" + magnetometer + ", environment=" + environment
+ ", accelerometer=" + accelerometer + "]";
}
}

View File

@@ -0,0 +1,109 @@
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.bluetooth.blukii.internal.data;
import java.util.Optional;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.util.HexUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Blukii data decoding.
*
* @author Markus Rathgeb - Initial contribution (migrate from handler)
* @author Markus Rathgeb - Fixed temperature decoding
*/
@NonNullByDefault
public class BlukiiDataDecoder {
private final Logger logger = LoggerFactory.getLogger(BlukiiDataDecoder.class);
public @Nullable BlukiiData decode(final byte[] data) {
if (data.length < 22) {
logger.debug("Blukii data length to short (skip decoding): {}", HexUtils.bytesToHex(data, " "));
return null;
}
if (data[0] != 0x4F) {
return null;
}
if (logger.isDebugEnabled()) {
logger.debug("Decode Blukii data: {}", HexUtils.bytesToHex(data, " "));
}
final int battery = data[12] & 0x7F;
final Optional<Magnetometer> magnetometer;
final Optional<Environment> environment;
final Optional<Accelerometer> accelerometer;
if ((data[14] & 0x30) == 0x30) {
magnetometer = Optional.of(processMagnetometerData(data));
environment = Optional.empty();
accelerometer = Optional.empty();
} else if ((data[14] & 0x10) == 0x10) {
magnetometer = Optional.empty();
environment = Optional.of(processEnvironmentData(data));
accelerometer = Optional.empty();
} else if ((data[14] & 0x20) == 0x20) {
magnetometer = Optional.empty();
environment = Optional.empty();
accelerometer = Optional.of(processAccelerometerData(data));
} else {
magnetometer = Optional.empty();
environment = Optional.empty();
accelerometer = Optional.empty();
}
return new BlukiiData(battery, magnetometer, environment, accelerometer);
}
private static Environment processEnvironmentData(byte[] data) {
double pressure = doubleByteToInt(data[15], data[16]) / 10;
int luminance = doubleByteToInt(data[17], data[18]);
int humidity = data[19] & 0xFF;
double temperature = (data[20] << 8 | data[21] & 0xFF) / 256d;
return new Environment(pressure, luminance, humidity, temperature);
}
private static Accelerometer processAccelerometerData(byte[] data) {
int range = data[15] & 0xFF;
int x = (short) doubleByteToInt(data[16], data[17]) * (range / 2);
int y = (short) doubleByteToInt(data[18], data[19]) * (range / 2);
int z = (short) doubleByteToInt(data[20], data[21]) * (range / 2);
double tiltX = 180 * Math.acos(x / Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2))) / Math.PI;
double tiltY = 180 * Math.acos(y / Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2))) / Math.PI;
double tiltZ = 180 * Math.acos(z / Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2))) / Math.PI;
return new Accelerometer(tiltX, tiltY, tiltZ);
}
private static Magnetometer processMagnetometerData(byte[] data) {
int x = (short) doubleByteToInt(data[16], data[17]);
int y = (short) doubleByteToInt(data[18], data[19]);
int z = (short) doubleByteToInt(data[20], data[21]);
return new Magnetometer(x, y, z);
}
private static int doubleByteToInt(byte b1, byte b2) {
int i1 = b1 & 0xFF;
int i2 = b2 & 0xFF;
return (i1 * 0x100) + i2;
}
}

View File

@@ -0,0 +1,41 @@
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.bluetooth.blukii.internal.data;
import org.eclipse.jdt.annotation.NonNullByDefault;
/**
* Blukii environment data.
*
* @author Markus Rathgeb - Initial contribution (migrated from handler)
*/
@NonNullByDefault
public class Environment {
public final double pressure;
public final int luminance;
public final int humidity;
public final double temperature;
public Environment(final double pressure, final int luminance, final int humidity, final double temperature) {
this.pressure = pressure;
this.luminance = luminance;
this.humidity = humidity;
this.temperature = temperature;
}
@Override
public String toString() {
return "Environment [pressure=" + pressure + ", luminance=" + luminance + ", humidity=" + humidity
+ ", temperature=" + temperature + "]";
}
}

View File

@@ -0,0 +1,38 @@
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.bluetooth.blukii.internal.data;
import org.eclipse.jdt.annotation.NonNullByDefault;
/**
* Blukii megnometer data.
*
* @author Markus Rathgeb - Initial contribution (migrated from handler)
*/
@NonNullByDefault
public class Magnetometer {
public final int x;
public final int y;
public final int z;
public Magnetometer(final int x, final int y, final int z) {
this.x = x;
this.y = y;
this.z = z;
}
@Override
public String toString() {
return "Magnetometer [x=" + x + ", y=" + y + ", z=" + z + "]";
}
}

View File

@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="bluetooth"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<thing-type id="blukii_beacon">
<supported-bridge-type-refs>
<bridge-type-ref id="roaming"/>
<bridge-type-ref id="bluegiga"/>
<bridge-type-ref id="bluez"/>
</supported-bridge-type-refs>
<label>Blukii SmartBeacon</label>
<description>A Blukii SmartBeacon</description>
<channels>
<channel id="rssi" typeId="rssi"/>
<channel id="battery" typeId="system.battery-level"/>
<channel id="temperature" typeId="blukii_temperature"/>
<channel id="humidity" typeId="blukii_humidity"/>
<channel id="pressure" typeId="blukii_pressure"/>
<channel id="luminance" typeId="blukii_luminance"/>
<channel id="tiltx" typeId="blukii_tiltx"/>
<channel id="tilty" typeId="blukii_tilty"/>
<channel id="tiltz" typeId="blukii_tiltz"/>
</channels>
<config-description>
<parameter name="address" type="text">
<label>Address</label>
<description>Bluetooth address in XX:XX:XX:XX:XX:XX format</description>
</parameter>
</config-description>
</thing-type>
<channel-type id="blukii_temperature">
<item-type>Number:Temperature</item-type>
<label>Temperature</label>
<state readOnly="true" pattern="%.1f %unit%"/>
</channel-type>
<channel-type id="blukii_humidity">
<item-type>Number:Dimensionless</item-type>
<label>Humidity</label>
<state readOnly="true" pattern="%d %unit%"/>
</channel-type>
<channel-type id="blukii_pressure">
<item-type>Number:Pressure</item-type>
<label>Pressure</label>
<state readOnly="true" pattern="%.0f %unit%"/>
</channel-type>
<channel-type id="blukii_luminance">
<item-type>Number:Illuminance</item-type>
<label>Luminance</label>
<state readOnly="true" pattern="%d %unit%"/>
</channel-type>
<channel-type id="blukii_tiltx" advanced="true">
<item-type>Number:Angle</item-type>
<label>Tilt X</label>
<state readOnly="true" pattern="%.0f %unit%"/>
</channel-type>
<channel-type id="blukii_tilty" advanced="true">
<item-type>Number:Angle</item-type>
<label>Tilt Y</label>
<state readOnly="true" pattern="%.0f %unit%"/>
</channel-type>
<channel-type id="blukii_tiltz" advanced="true">
<item-type>Number:Angle</item-type>
<label>Tilt Z</label>
<state readOnly="true" pattern="%.0f %unit%"/>
</channel-type>
</thing:thing-descriptions>