diff --git a/ESH-INF/binding/binding.xml b/ESH-INF/binding/binding.xml deleted file mode 100644 index f94ecb6616c1403a19baa52e809ee32ae2ba465b..0000000000000000000000000000000000000000 --- a/ESH-INF/binding/binding.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<binding:binding id="openlicht" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:binding="http://eclipse.org/smarthome/schemas/binding/v1.0.0" - xsi:schemaLocation="http://eclipse.org/smarthome/schemas/binding/v1.0.0 http://eclipse.org/smarthome/schemas/binding-1.0.0.xsd"> - - <name>OpenLicht Binding</name> - <description>This is the binding for OpenLicht.</description> - <author>René Schöne</author> - -</binding:binding> diff --git a/ESH-INF/config/config.xml b/ESH-INF/config/config.xml deleted file mode 100644 index 8d0860d539ca4f485fa2afcf290029899584e4a9..0000000000000000000000000000000000000000 --- a/ESH-INF/config/config.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<config-description:config-descriptions - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:config-description="http://eclipse.org/smarthome/schemas/config-description/v1.0.0" - xsi:schemaLocation="http://eclipse.org/smarthome/schemas/config-description/v1.0.0 http://eclipse.org/smarthome/schemas/config-description-1.0.0.xsd"> - - <config-description uri="thing-type:openlicht:mqttdevice"> - <parameter name="brokerName" type="text" required="true"> - <label>Broker Name</label> - <description>Name of the broker as defined in the name of the broker thing. See the MQTT Binding for more information on how to create a MQTT broker thing.</description> - <context>service</context> - <default>embedded-mqtt-broker</default> - </parameter> - <parameter name="base-topic" type="text" required="true"> - <label>Base-Topic</label> - <description>Base topic for publishing updates. Do not include a trailing slash.</description> - <default>sensors</default> - </parameter> - <parameter name="byte-based-messages" type="boolean" required="false"> - <label>Byte-based MQTT Messages</label> - <description>Interpret MQTT messages as raw bytes. If false, interpret the messages as Strings containing numbers.</description> - <default>false</default> - </parameter> - <parameter name="unsupported-category-reset" type="integer" required="false"> - <label>MQTT Unsupported Category Reset Timeout</label> - <description>Timeout in seconds to log again unsupported MQTT categories. Set to zero to disable (default).</description> - <default>0</default> - </parameter> - </config-description> - -</config-description:config-descriptions> diff --git a/ESH-INF/i18n/openlicht_en_US.properties b/ESH-INF/i18n/openlicht_en_US.properties deleted file mode 100644 index 3cab3bbd2e6d09bfa4f7ff1de33c3e6cd8419c0b..0000000000000000000000000000000000000000 --- a/ESH-INF/i18n/openlicht_en_US.properties +++ /dev/null @@ -1,11 +0,0 @@ -# binding -binding.openlicht.name = OpenLicht Binding -binding.openlicht.description = OpenLicht Binding - -# thing types -thing-type.openlicht.skywriterhat.skywriter-hat.label = SkyWriterHAT -thing-type.openlicht.skywriterhat.skywriter-hat.description = SkyWriterHAT Gesture Recognition - -# channel types -channel-type.openlicht.skywriterhat.flick-type.label = Last Flick -channel-type.openlicht.skywriterhat.flick-type.description = Last Flick detected (and its direction) diff --git a/ESH-INF/thing/thing-types.xml b/ESH-INF/thing/thing-types.xml deleted file mode 100644 index 9ff3102aaa716b9d3f457003724966faa9361aab..0000000000000000000000000000000000000000 --- a/ESH-INF/thing/thing-types.xml +++ /dev/null @@ -1,223 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<thing:thing-descriptions bindingId="openlicht" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0" - xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd"> - - <!-- Eraser Thing Type --> - <thing-type id="eraser"> - <label>Eraser</label> - <description>Establish communication with a running eraser via MQTT</description> - - <config-description> - <parameter name="brokerName" type="text" required="true"> - <label>Broker Name</label> - <description>Name of the broker as defined in the name of the broker thing. See the MQTT Binding for more information on how to create a MQTT broker thing.</description> - <context>service</context> - <default>embedded-mqtt-broker</default> - </parameter> - <parameter name="byte-based-messages" type="boolean" required="false"> - <label>Byte-based MQTT Messages</label> - <description>Interpret MQTT messages as raw bytes. If false, interpret the messages as Strings containing numbers.</description> - <default>false</default> - </parameter> - <parameter name="base-topic" type="text" required="true"> - <label>Base-Topic</label> - <description>Base topic for publishing updates. Do not include a trailing slash.</description> - <default>oh/in</default> - </parameter> - <parameter name="outTopic" type="text" required="true"> - <label>Outgoing topic</label> - <description>MQTT topic prefix for messages leaving openHAB to eraser.</description> - <default>oh/out/</default> - </parameter> - <parameter name="publish-all" type="boolean" required="true"> - <label>Publish All</label> - <description>If enabled, changes of every item will be published. Otherwise only those of the members of group set in the parameter "Publish Group"</description> - <default>true</default> - </parameter> - <parameter name="publish-group" type="text" required="false"> - <label>Publish group</label> - <description>Group whose members will trigger an update</description> - <context>item</context> - </parameter> - </config-description> - </thing-type> - - <!-- Skywriter HAT Thing Type --> - <thing-type id="skywriter-hat"> - <label>SkyWriterHAT</label> - <description>SkyWriterHAT Gesture Recognition</description> - - <channels> - <channel typeId="flick-type" id="flick" /> - </channels> - - <config-description-ref uri="thing-type:openlicht:mqttdevice" /> - </thing-type> - - <!-- Flick Type --> - <channel-type id="flick-type"> - <item-type>String</item-type> - <label>Last Flick</label> - <description>Last Flick detected (and its direction)</description> - <category>Motion</category> - <state readOnly="true" /> - </channel-type> - - <!-- Polar M600 Thing Type --> - <thing-type id="polar-m600"> - <label>Polar M600</label> - <description>Provides sensor information from a Polar M600 smart watch</description> - - <channels> - <channel typeId="acceleration-type" id="acceleration-x"> - <label>Acceleration X</label> - </channel> - <channel typeId="acceleration-type" id="acceleration-y"> - <label>Acceleration Y</label> - </channel> - <channel typeId="acceleration-type" id="acceleration-z"> - <label>Acceleration Z</label> - </channel> - <channel typeId="rotation-type" id="rotation-x"> - <label>Rotation X</label> - </channel> - <channel typeId="rotation-type" id="rotation-y"> - <label>Rotation Y</label> - </channel> - <channel typeId="rotation-type" id="rotation-z"> - <label>Rotation Z</label> - </channel> - <channel typeId="activity-type" id="activity" /> - <channel typeId="heart-rate-type" id="heart-rate" /> - <channel typeId="steps-type" id="steps" /> - <channel typeId="brightness-type" id="brightness" /> - </channels> - - <config-description-ref uri="thing-type:openlicht:mqttdevice" /> - </thing-type> - - <!-- Polar M600 Thing Type --> - <thing-type id="moto-360"> - <label>Moto 360</label> - <description>Provides sensor information from a Moto 360 smart watch</description> - - <channels> - <channel typeId="acceleration-type" id="acceleration-x"> - <label>Acceleration X</label> - </channel> - <channel typeId="acceleration-type" id="acceleration-y"> - <label>Acceleration Y</label> - </channel> - <channel typeId="acceleration-type" id="acceleration-z"> - <label>Acceleration Z</label> - </channel> - <channel typeId="rotation-type" id="rotation-x"> - <label>Rotation X</label> - </channel> - <channel typeId="rotation-type" id="rotation-y"> - <label>Rotation Y</label> - </channel> - <channel typeId="rotation-type" id="rotation-z"> - <label>Rotation Z</label> - </channel> - <channel typeId="activity-type" id="activity" /> - <channel typeId="heart-rate-type" id="heart-rate" /> - <channel typeId="steps-type" id="steps" /> - <channel typeId="brightness-type" id="brightness" /> - </channels> - - <config-description-ref uri="thing-type:openlicht:mqttdevice" /> - </thing-type> - - <!-- Accelerator Type --> - <channel-type id="acceleration-type"> - <item-type>Number</item-type> - <label>Acceleration</label> - <description>Acceleration in one direction in meters per second.</description> - <category>Motion</category> - <state readOnly="true" /> - </channel-type> - - <!-- Rotation Type --> - <channel-type id="rotation-type"> - <item-type>Number</item-type> - <label>Rotation</label> - <description>Rotation around one axis (unitless).</description> - <category>Motion</category> - <state readOnly="true" /> - </channel-type> - - <!-- Activity Type --> - <channel-type id="activity-type"> - <item-type>String</item-type> - <label>Activity</label> - <description>Current recognized activity.</description> - <state readOnly="true" /> - <event> - <options> - <option value="Runnning">running</option> - <option value="Walking">walking</option> - <option value="Resting">resting</option> - <option value="Unknown">unknown</option> - </options> - </event> - </channel-type> - - <!-- Heart Rate Type --> - <channel-type id="heart-rate-type"> - <item-type>Number</item-type> - <label>Heart Rate</label> - <description>Heart rate in beats per minute.</description> - <state readOnly="true" /> - </channel-type> - - <!-- Steps Type --> - <channel-type id="steps-type"> - <item-type>Number</item-type> - <label>Steps</label> - <description>Steps run today.</description> - <state readOnly="true" ></state> - </channel-type> - - <!-- Samsung S6 Thing Type --> - <thing-type id="samsung-s6"> - <label>Samsung S6</label> - <description>Provides sensor information from a smart phone (a Samsung S6 in our case)</description> - - <channels> - <channel typeId="brightness-type" id="brightness" /> - <channel typeId="acceleration-type" id="acceleration-x"> - <label>Acceleration X</label> - </channel> - <channel typeId="acceleration-type" id="acceleration-y"> - <label>Acceleration Y</label> - </channel> - <channel typeId="acceleration-type" id="acceleration-z"> - <label>Acceleration Z</label> - </channel> - <channel typeId="rotation-type" id="rotation-x"> - <label>Rotation X</label> - </channel> - <channel typeId="rotation-type" id="rotation-y"> - <label>Rotation Y</label> - </channel> - <channel typeId="rotation-type" id="rotation-z"> - <label>Rotation Z</label> - </channel> - </channels> - - <config-description-ref uri="thing-type:openlicht:mqttdevice" /> - </thing-type> - - <!-- General Brightness Type --> - <channel-type id="brightness-type"> - <item-type>Number</item-type> - <label>Brightness</label> - <description>Brightness (Lux).</description> - <category>Light</category> - <state readOnly="true" ></state> - </channel-type> - -</thing:thing-descriptions> diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF deleted file mode 100644 index dcaa926f1199ab630ac5971cfe811d29a8adcd4f..0000000000000000000000000000000000000000 --- a/META-INF/MANIFEST.MF +++ /dev/null @@ -1,32 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ActivationPolicy: lazy -Bundle-ClassPath: . -Bundle-ManifestVersion: 2 -Bundle-Name: OpenLicht Binding -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Bundle-SymbolicName: org.openhab.binding.openlicht;singleton:=true -Bundle-Vendor: openHAB -Bundle-Version: 2.3.0.qualifier -Import-Package: - org.eclipse.jdt.annotation;resolution:=optional, - org.eclipse.smarthome.binding.mqtt.handler, - org.eclipse.smarthome.config.core, - org.eclipse.smarthome.core.common.registry, - org.eclipse.smarthome.core.events, - org.eclipse.smarthome.core.items, - org.eclipse.smarthome.core.items.events, - org.eclipse.smarthome.core.library.types, - org.eclipse.smarthome.core.thing, - org.eclipse.smarthome.core.thing.binding, - org.eclipse.smarthome.core.thing.binding.builder, - org.eclipse.smarthome.core.thing.type, - org.eclipse.smarthome.core.types, - org.eclipse.smarthome.io.transport.mqtt, - org.osgi.framework, - org.osgi.service.component, - org.osgi.service.component.annotations;version="[1.3.0,2.0.0)";resolution:=optional, - org.slf4j -Service-Component: OSGI-INF/*.xml -Export-Package: org.openhab.binding.openlicht, - org.openhab.binding.openlicht.handler -Automatic-Module-Name: org.openhab.binding.openlicht diff --git a/README.md b/README.md index 3d65d35b2ba8b943a09f593aec4b45a09a198d72..dbe768a1daa964ef21c483eab1c2e6fdc4db8161 100644 --- a/README.md +++ b/README.md @@ -1,72 +1,56 @@ # OpenLicht Binding -Currently, the additional package `org.eclipse.smarthome.io.transport.mqtt` is needed for this binding to work. -It can be exported as a plugin from the OpenHAB Eclipse. +_Give some details about what this binding is meant for - a protocol, system, specific device._ -This binding is used as a collection of bindings developed with the project [OpenLicht](http://openlicht.de). -All bindings use MQTT for communication between the device and openHAB. +_If possible, provide some resources like pictures, a YouTube video, etc. to give an impression of what can be done with this binding. You can place such resources into a `doc` folder next to this README.md._ ## Supported Things -Name | Description | Handler | Sub topic ------|-------------|---------|---------- -SkyWriterHAT | [Product-Page](https://shop.pimoroni.com/products/skywriter-hat) - [Documentation](http://docs.pimoroni.com/skywriter/#) | [SkyWriterHATHandler](https://git-st.inf.tu-dresden.de/OpenLicht/org.openhab.binding.openlicht/blob/master/src/main/java/org/openhab/binding/openlicht/handler/SkyWriterHATHandler.java) | `skywriter` -Polar M600 | [Product-Page](https://www.polar.com/de/produkte/sport/M600-Fitness-Smartwatch) | [PolarM600Handler](https://git-st.inf.tu-dresden.de/OpenLicht/org.openhab.binding.openlicht/blob/master/src/main/java/org/openhab/binding/openlicht/handler/PolarM600Handler.java) | `polar` -Moto 360 | from CyPhyMan, [Product-Page](https://www.motorola.com.au/products/moto-360) | [Moto360Handler](https://git-st.inf.tu-dresden.de/OpenLicht/org.openhab.binding.openlicht/blob/master/src/main/java/org/openhab/binding/openlicht/handler/Moto360Handler.java) | `moto360` -Samsung S6 | Could actually be any smart phone | [SamsungS6Handler](https://git-st.inf.tu-dresden.de/OpenLicht/org.openhab.binding.openlicht/blob/master/src/main/java/org/openhab/binding/openlicht/handler/SamsungS6Handler.java) | `samsung`¹ - -¹:warning: The topic is currently set in `AbstractSmartphoneHandler`. This is a bug. +_Please describe the different supported things / devices within this section._ +_Which different types are supported, which models were tested etc.?_ +_Note that it is planned to generate some part of this based on the XML files within ```src/main/resources/OH-INF/thing``` of your binding._ ## Discovery -Not implemented (yet). +_Describe the available auto-discovery features here. Mention for what it works and what needs to be kept in mind when using it._ ## Binding Configuration -*None* +_If your binding requires or supports general configuration settings, please create a folder ```cfg``` and place the configuration file ```<bindingId>.cfg``` inside it. In this section, you should link to this file and provide some information about the options. The file could e.g. look like:_ -## Thing Configuration +``` +# Configuration for the Philips Hue Binding +# +# Default secret key for the pairing of the Philips Hue Bridge. +# It has to be between 10-40 (alphanumeric) characters +# This may be changed by the user for security reasons. +secret=openHABSecret +``` -All bindings share the same configuration, with the following options (copied from `ESH-INF/config/config.xml`: +_Note that it is planned to generate some part of this based on the information that is available within ```src/main/resources/OH-INF/binding``` of your binding._ -Name | Label | Description | Default ------|-------|-------------|-------- -`brokerName` | Broker Name | Name of the broker as defined in the <broker>.url in services/mqtt.cfg. See the MQTT Binding for more information on how to configure MQTT broker connections. | `mosquitto`² -`base-topic` | Base-Topic | Base topic for publishing updates. Do not include a trailing slash. | `sensors` -`unsupported-category-reset` | MQTT Unsupported Category Reset Timeout (optional) | Timeout in seconds to log again unsupported MQTT categories. Set to zero to disable (default). | `0` +_If your binding does not offer any generic configurations, you can remove this section completely._ -²:warning: This must match the configured MQTT broker within openHAB, see `services/mqtt.cfg`. +## Thing Configuration -## Channel Types +_Describe what is needed to manually configure a thing, either through the (Paper) UI or via a thing-file. This should be mainly about its mandatory and optional configuration parameters. A short example entry for a thing file can help!_ -Type-Name | Kind | Label | Description | Category -----------|------|-------|-------------|--------- -`flick-type` | Text | Last Flick | Last Flick detected (and its direction) | Motion -`brightness-type` | Number | Brightness | Brightness (Lux) | Light -`acceleration-type` | Number | Acceleration | Acceleration in one direction in meters per second. | Motion -`rotation-type` | Number | Rotation | Rotation around one axis (unitless). | Motion -`activity-type` | String | Activity | Current recognized activity, one of Runnning, Walking, Resting, Unknown. | - -`heart-rate-type` | Number | Heart Rate | Heart rate in beats per minute. | - -`steps-type` | Number | Steps | Steps run today. | - +_Note that it is planned to generate some part of this based on the XML files within ```src/main/resources/OH-INF/thing``` of your binding._ ## Channels -Supported by Binding | Type-Name | Id | Label ----------------------|-----------|----|------ -SkyWriterHAT | `flick-type` | `flick` | - -Polar M600, Moto 360, Samsung S6 | `brightness-type` | `brightness` | - -Polar M600, Moto 360 | `acceleration-type` | `acceleration-x` | Acceleration X -Polar M600, Moto 360 | `acceleration-type` | `acceleration-y` | Acceleration Y -Polar M600, Moto 360 | `acceleration-type` | `acceleration-z` | Acceleration Z -Polar M600, Moto 360, Samsung S6 | `rotation-type` | `rotation-x` | Rotation X -Polar M600, Moto 360, Samsung S6 | `rotation-type` | `rotation-y` | Rotation Y -Polar M600, Moto 360, Samsung S6 | `rotation-type` | `rotation-z` | Rotation Z -Polar M600, Moto 360 | `activity-type` | `activity` | - -Polar M600, Moto 360 | `heart-rate-type` | `heart-rate` | - -Polar M600, Moto 360 | `steps-type` | `steps` | - - -## Data flow - -[AndroidSensorSharing repository](https://git-st.inf.tu-dresden.de/OpenLicht/AndroidSensorSharing) - - +_Here you should provide information about available channel types, what their meaning is and how they can be used._ + +_Note that it is planned to generate some part of this based on the XML files within ```src/main/resources/OH-INF/thing``` of your binding._ + +| channel | type | description | +|----------|--------|------------------------------| +| control | Switch | This is the control channel | + +## Full Example + +_Provide a full usage example based on textual configuration files (*.things, *.items, *.sitemap)._ + +## Any custom content here! + +_Feel free to add additional sections for whatever you think should also be mentioned about your binding!_ diff --git a/pom.xml b/pom.xml index 2cc0e6e7ecce188a56cd56f82c458c41eb379131..ec585dbee7171a48aee31939a88a3ebbcc5b1993 100644 --- a/pom.xml +++ b/pom.xml @@ -3,6 +3,7 @@ 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> + <dependencies> <dependency> <groupId>org.openhab.addons.bundles</groupId> @@ -10,13 +11,6 @@ <version>3.0.0-SNAPSHOT</version> <scope>compile</scope> </dependency> - - <dependency> - <groupId>org.openhab.core.bundles</groupId> - <artifactId>org.openhab.core.automation</artifactId> - <version>3.0.0-SNAPSHOT</version> - <scope>compile</scope> - </dependency> </dependencies> <parent> diff --git a/src/main/history/dependencies.xml b/src/main/history/dependencies.xml index 2e16a5a518925cba34917b4d51bff826a29f676b..2a648aa1fad5b88d5df1d2155d3e14ffb91b7f8d 100644 --- a/src/main/history/dependencies.xml +++ b/src/main/history/dependencies.xml @@ -5,10 +5,6 @@ <feature>wrap</feature> <bundle>mvn:org.openhab.addons.bundles/org.openhab.binding.mqtt/3.0.0-SNAPSHOT</bundle> <bundle>mvn:org.openhab.addons.bundles/org.openhab.binding.openlicht/3.0.0-SNAPSHOT</bundle> - <bundle>mvn:org.openhab.core.bundles/org.openhab.core.automation/3.0.0-SNAPSHOT</bundle> - <bundle>mvn:org.openhab.core.bundles/org.openhab.core.config.core/3.0.0-SNAPSHOT</bundle> - <bundle>mvn:org.openhab.core.bundles/org.openhab.core.ephemeris/3.0.0-SNAPSHOT</bundle> - <bundle>mvn:org.openhab.core.bundles/org.openhab.core.thing/3.0.0-SNAPSHOT</bundle> <bundle>wrap:mvn:org.lastnpe.eea/eea-all/2.2.1</bundle> </feature> </features> diff --git a/src/main/java/org/openhab/binding/openlicht/BindingConstants.java b/src/main/java/org/openhab/binding/openlicht/BindingConstants.java deleted file mode 100644 index ecec9873e156da45718261c4b436f79d30b629b3..0000000000000000000000000000000000000000 --- a/src/main/java/org/openhab/binding/openlicht/BindingConstants.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Copyright (c) 2014,2018 by the respective copyright holders. - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * 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.openlicht; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.thing.ThingTypeUID; - -/** - * The {@link BindingConstants} class defines common constants, which are - * used across the whole binding. - * - * @author René Schöne - Initial contribution - */ -@NonNullByDefault -public class BindingConstants { - - private static final String BINDING_ID = "openlicht"; - - // Configuration keys - public static final String CONFIG_BROKER_NAME = "brokerName"; - public static final String CONFIG_BASE_TOPIC = "base-topic"; - public static final String CONFIG_BYTE_BASED_MESSAGES = "byte-based-messages"; - public static final String CONFIG_TIMEOUT_MQTT_UNSUPPORTED_CATEGORIES = "unsupported-category-reset"; - public static final String CONFIG_ERASER_OUT_TOPIC = "outTopic"; - public static final String CONFIG_ERASER_PUBLISH_GROUP = "publish-group"; - public static final String CONFIG_ERASER_PUBLISH_ALL = "publish-all"; - - // List of all Thing Type UIDs - public static final ThingTypeUID THING_TYPE_SKYWRITER_HAT = new ThingTypeUID(BINDING_ID, "skywriter-hat"); - public static final ThingTypeUID THING_TYPE_POLAR_M600 = new ThingTypeUID(BINDING_ID, "polar-m600"); - public static final ThingTypeUID THING_TYPE_MOTO_360 = new ThingTypeUID(BINDING_ID, "moto-360"); - public static final ThingTypeUID THING_TYPE_SAMSUNG_S6 = new ThingTypeUID(BINDING_ID, "samsung-s6"); - public static final ThingTypeUID THING_TYPE_ERASER = new ThingTypeUID(BINDING_ID, "eraser"); - - // List of all Channel ids - public static final String CHANNEL_FLICK = "flick"; - public static final String CHANNEL_ACCELERATION_X = "acceleration-x"; - public static final String CHANNEL_ACCELERATION_Y = "acceleration-y"; - public static final String CHANNEL_ACCELERATION_Z = "acceleration-z"; - public static final String CHANNEL_ROTATION_X = "rotation-x"; - public static final String CHANNEL_ROTATION_Y = "rotation-y"; - public static final String CHANNEL_ROTATION_Z = "rotation-z"; - public static final String CHANNEL_ACTIVITY = "activity"; - public static final String CHANNEL_HEART_RATE = "heart-rate"; - public static final String CHANNEL_STEPS = "steps"; - public static final String CHANNEL_BRIGHTNESS = "brightness"; - - // List of MQTT categories - public static final String MQTT_CATEGORY_FLICK = "flick"; - public static final String MQTT_CATEGORY_ACCELERATION = "acceleration"; - public static final String MQTT_CATEGORY_ROTATION = "rotation"; - public static final String MQTT_CATEGORY_ACTIVITY = "activity"; - public static final String MQTT_CATEGORY_HEART_RATE = "heart-rate"; - public static final String MQTT_CATEGORY_STEPS = "steps"; - public static final String MQTT_CATEGORY_BRIGHTNESS = "brightness"; - - public static final String MQTT_BROKER_URL = "tcp://localhost:1883"; -} diff --git a/src/main/java/org/openhab/binding/openlicht/handler/AbstractMqttHandler.java b/src/main/java/org/openhab/binding/openlicht/handler/AbstractMqttHandler.java index 0d43245d9563d52d6ebe3cf78ca98ce2c68b9067..018d210e1b5481c9ead83e4b0406523ba12f26de 100644 --- a/src/main/java/org/openhab/binding/openlicht/handler/AbstractMqttHandler.java +++ b/src/main/java/org/openhab/binding/openlicht/handler/AbstractMqttHandler.java @@ -1,7 +1,7 @@ package org.openhab.binding.openlicht.handler; -import static org.openhab.binding.openlicht.BindingConstants.*; import static org.openhab.binding.openlicht.handler.HandlerPhase.*; +import static org.openhab.binding.openlicht.internal.OpenLichtBindingConstants.*; import java.math.BigDecimal; import java.util.concurrent.ScheduledExecutorService; @@ -11,17 +11,17 @@ import java.util.concurrent.locks.ReentrantLock; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.mqtt.handler.AbstractBrokerHandler; -import org.openhab.core.thing.ThingRegistryChangeListener; +import org.openhab.binding.openlicht.internal.ConfigurationHolder; +import org.openhab.core.io.transport.mqtt.MqttBrokerConnection; +import org.openhab.core.io.transport.mqtt.MqttMessageSubscriber; +import org.openhab.core.io.transport.mqtt.MqttServiceObserver; import org.openhab.core.thing.Thing; import org.openhab.core.thing.ThingRegistry; +import org.openhab.core.thing.ThingRegistryChangeListener; import org.openhab.core.thing.ThingStatus; import org.openhab.core.thing.ThingStatusDetail; import org.openhab.core.thing.binding.BaseThingHandler; import org.openhab.core.thing.binding.ThingHandler; -import org.openhab.core.io.transport.mqtt.MqttBrokerConnection; -import org.openhab.core.io.transport.mqtt.MqttMessageSubscriber; -import org.openhab.core.io.transport.mqtt.MqttServiceObserver; -import org.openhab.binding.openlicht.internal.ConfigurationHolder; import org.osgi.framework.Version; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -344,5 +344,4 @@ public abstract class AbstractMqttHandler extends BaseThingHandler // output[i] = input.getFloat(); // } // } - } diff --git a/src/main/java/org/openhab/binding/openlicht/handler/AbstractSmartWatchHandler.java b/src/main/java/org/openhab/binding/openlicht/handler/AbstractSmartWatchHandler.java index dabf3297d482b03edd12bc455c7f6c180189819e..d9609ccd7d7b9cff1844c5b065d6a76b8fc980be 100644 --- a/src/main/java/org/openhab/binding/openlicht/handler/AbstractSmartWatchHandler.java +++ b/src/main/java/org/openhab/binding/openlicht/handler/AbstractSmartWatchHandler.java @@ -12,7 +12,7 @@ */ package org.openhab.binding.openlicht.handler; -import static org.openhab.binding.openlicht.BindingConstants.*; +import static org.openhab.binding.openlicht.internal.OpenLichtBindingConstants.*; import java.nio.ByteBuffer; import java.nio.DoubleBuffer; @@ -20,12 +20,12 @@ import java.util.HashSet; import java.util.Set; import java.util.concurrent.TimeUnit; +import org.openhab.binding.openlicht.internal.ConfigurationHolder; import org.openhab.core.library.types.DecimalType; import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.Thing; import org.openhab.core.types.Command; import org.openhab.core.types.RefreshType; -import org.openhab.binding.openlicht.internal.ConfigurationHolder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -128,5 +128,4 @@ public abstract class AbstractSmartWatchHandler extends AbstractMqttHandler { protected boolean subscribeSubTopics() { return true; } - } diff --git a/src/main/java/org/openhab/binding/openlicht/handler/AbstractSmartphoneHandler.java b/src/main/java/org/openhab/binding/openlicht/handler/AbstractSmartphoneHandler.java index fee1fa35717c1bc1efd1f1f7f55770c5e686a53b..fca2c430191e7e7bbfbdf43506b2cb2a9c1ae3dc 100644 --- a/src/main/java/org/openhab/binding/openlicht/handler/AbstractSmartphoneHandler.java +++ b/src/main/java/org/openhab/binding/openlicht/handler/AbstractSmartphoneHandler.java @@ -12,19 +12,19 @@ */ package org.openhab.binding.openlicht.handler; -import static org.openhab.binding.openlicht.BindingConstants.*; +import static org.openhab.binding.openlicht.internal.OpenLichtBindingConstants.*; import java.nio.ByteBuffer; import java.nio.DoubleBuffer; import java.util.HashSet; import java.util.Set; +import org.openhab.binding.openlicht.internal.ConfigurationHolder; import org.openhab.core.library.types.DecimalType; import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.Thing; import org.openhab.core.types.Command; import org.openhab.core.types.RefreshType; -import org.openhab.binding.openlicht.internal.ConfigurationHolder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -105,5 +105,4 @@ public abstract class AbstractSmartphoneHandler extends AbstractMqttHandler { protected String getSubTopic() { return "phone"; } - } diff --git a/src/main/java/org/openhab/binding/openlicht/handler/EraserHandler.java b/src/main/java/org/openhab/binding/openlicht/handler/EraserHandler.java index 100d356d0f3d48269cab95573fb702c23e749465..31f80e753b2e195c206e67b325228009e396c3f0 100644 --- a/src/main/java/org/openhab/binding/openlicht/handler/EraserHandler.java +++ b/src/main/java/org/openhab/binding/openlicht/handler/EraserHandler.java @@ -7,6 +7,9 @@ import java.util.Set; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.binding.openlicht.internal.ConfigurationHolder; +import org.openhab.binding.openlicht.internal.DelegateEraserRegistryChangeListener; +import org.openhab.binding.openlicht.internal.OpenLichtBindingConstants; import org.openhab.core.events.EventPublisher; import org.openhab.core.items.GenericItem; import org.openhab.core.items.GroupItem; @@ -25,9 +28,6 @@ import org.openhab.core.thing.Thing; import org.openhab.core.types.Command; import org.openhab.core.types.State; import org.openhab.core.types.TypeParser; -import org.openhab.binding.openlicht.BindingConstants; -import org.openhab.binding.openlicht.internal.ConfigurationHolder; -import org.openhab.binding.openlicht.internal.DelegateEraserRegistryChangeListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -62,9 +62,9 @@ public class EraserHandler extends AbstractMqttHandler implements StateChangeLis @Override protected void moreInitializeBefore() { - this.outTopic = getConfigValueAsString(BindingConstants.CONFIG_ERASER_OUT_TOPIC); - this.publishGroupName = getConfigValueAsString(BindingConstants.CONFIG_ERASER_PUBLISH_GROUP); - this.publishAll = getConfigValueAsBoolean(BindingConstants.CONFIG_ERASER_PUBLISH_ALL); + this.outTopic = getConfigValueAsString(OpenLichtBindingConstants.CONFIG_ERASER_OUT_TOPIC); + this.publishGroupName = getConfigValueAsString(OpenLichtBindingConstants.CONFIG_ERASER_PUBLISH_GROUP); + this.publishAll = getConfigValueAsBoolean(OpenLichtBindingConstants.CONFIG_ERASER_PUBLISH_ALL); if (this.outTopic.charAt(this.outTopic.length() - 1) != '/') { this.outTopic += "/"; } @@ -275,5 +275,4 @@ public class EraserHandler extends AbstractMqttHandler implements StateChangeLis public void stateUpdated(Item item, State state) { // ignored, as no change } - } diff --git a/src/main/java/org/openhab/binding/openlicht/handler/Moto360Handler.java b/src/main/java/org/openhab/binding/openlicht/handler/Moto360Handler.java index 8f404818da10b6e1dbe55d2496e1e6e967ef024b..6ad6ba19494a3669fde8f51eb7624ae882dca462 100644 --- a/src/main/java/org/openhab/binding/openlicht/handler/Moto360Handler.java +++ b/src/main/java/org/openhab/binding/openlicht/handler/Moto360Handler.java @@ -1,7 +1,7 @@ package org.openhab.binding.openlicht.handler; -import org.openhab.core.thing.Thing; import org.openhab.binding.openlicht.internal.ConfigurationHolder; +import org.openhab.core.thing.Thing; public class Moto360Handler extends AbstractSmartWatchHandler { @@ -13,5 +13,4 @@ public class Moto360Handler extends AbstractSmartWatchHandler { protected String getSubTopic() { return "moto360"; } - } diff --git a/src/main/java/org/openhab/binding/openlicht/handler/MqttUtils.java b/src/main/java/org/openhab/binding/openlicht/handler/MqttUtils.java index 52075c35a5fc9744cbb3f1c8e93ae565eca9ace1..5d78787067d61d492e460868b09becc8bd8385eb 100644 --- a/src/main/java/org/openhab/binding/openlicht/handler/MqttUtils.java +++ b/src/main/java/org/openhab/binding/openlicht/handler/MqttUtils.java @@ -1,6 +1,6 @@ package org.openhab.binding.openlicht.handler; -import static org.openhab.binding.openlicht.BindingConstants.*; +import static org.openhab.binding.openlicht.internal.OpenLichtBindingConstants.*; import java.util.HashMap; import java.util.Map; @@ -68,5 +68,4 @@ public class MqttUtils { updateState.accept(channelId, entry.getValue()); } } - } diff --git a/src/main/java/org/openhab/binding/openlicht/handler/PolarM600Handler.java b/src/main/java/org/openhab/binding/openlicht/handler/PolarM600Handler.java index 3e686107a27612d0fdae8c7e4720c8801b2f7cfa..97a287fd0a02f5841357be5a8b274aab59f64106 100644 --- a/src/main/java/org/openhab/binding/openlicht/handler/PolarM600Handler.java +++ b/src/main/java/org/openhab/binding/openlicht/handler/PolarM600Handler.java @@ -1,7 +1,7 @@ package org.openhab.binding.openlicht.handler; -import org.openhab.core.thing.Thing; import org.openhab.binding.openlicht.internal.ConfigurationHolder; +import org.openhab.core.thing.Thing; public class PolarM600Handler extends AbstractSmartWatchHandler { @@ -13,5 +13,4 @@ public class PolarM600Handler extends AbstractSmartWatchHandler { protected String getSubTopic() { return "polar"; } - } diff --git a/src/main/java/org/openhab/binding/openlicht/handler/SamsungS6Handler.java b/src/main/java/org/openhab/binding/openlicht/handler/SamsungS6Handler.java index dfb6de598a4984437893e6fa9a8ca380427b5e30..0f3e58c03eb0484bfcf8aac0e8d8aeda8864c5cb 100644 --- a/src/main/java/org/openhab/binding/openlicht/handler/SamsungS6Handler.java +++ b/src/main/java/org/openhab/binding/openlicht/handler/SamsungS6Handler.java @@ -1,12 +1,11 @@ package org.openhab.binding.openlicht.handler; -import org.openhab.core.thing.Thing; import org.openhab.binding.openlicht.internal.ConfigurationHolder; +import org.openhab.core.thing.Thing; public class SamsungS6Handler extends AbstractSmartphoneHandler { public SamsungS6Handler(Thing thing, ConfigurationHolder configurationHolder) { super(thing, configurationHolder); } - } diff --git a/src/main/java/org/openhab/binding/openlicht/handler/SkyWriterHATHandler.java b/src/main/java/org/openhab/binding/openlicht/handler/SkyWriterHATHandler.java index 41c3cdf1b7c4e4d929aee9615ab0b7a75a567cea..ca26163d9590d08a4c9b039fa3175b6da19ce66a 100644 --- a/src/main/java/org/openhab/binding/openlicht/handler/SkyWriterHATHandler.java +++ b/src/main/java/org/openhab/binding/openlicht/handler/SkyWriterHATHandler.java @@ -8,14 +8,14 @@ */ package org.openhab.binding.openlicht.handler; -import static org.openhab.binding.openlicht.BindingConstants.CHANNEL_FLICK; +import static org.openhab.binding.openlicht.internal.OpenLichtBindingConstants.CHANNEL_FLICK; import org.eclipse.jdt.annotation.NonNull; +import org.openhab.binding.openlicht.internal.ConfigurationHolder; import org.openhab.core.library.types.StringType; import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.Thing; import org.openhab.core.types.Command; -import org.openhab.binding.openlicht.internal.ConfigurationHolder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -53,5 +53,4 @@ public class SkyWriterHATHandler extends AbstractMqttHandler { protected String getSubTopic() { return "skywriter"; } - } diff --git a/src/main/java/org/openhab/binding/openlicht/internal/ConfigurationHolder.java b/src/main/java/org/openhab/binding/openlicht/internal/ConfigurationHolder.java index 3ba6de1bb1bf03c7d0811ab0a412a3d0bcd74263..eb0264b1ac530153ca348661946f84e5d5069863 100644 --- a/src/main/java/org/openhab/binding/openlicht/internal/ConfigurationHolder.java +++ b/src/main/java/org/openhab/binding/openlicht/internal/ConfigurationHolder.java @@ -4,9 +4,9 @@ import java.util.concurrent.ScheduledExecutorService; import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.events.EventPublisher; +import org.openhab.core.io.transport.mqtt.MqttService; import org.openhab.core.items.ItemRegistry; import org.openhab.core.thing.ThingRegistry; -import org.openhab.core.io.transport.mqtt.MqttService; import org.osgi.framework.Version; public interface ConfigurationHolder { @@ -27,5 +27,4 @@ public interface ConfigurationHolder { EventPublisher getEventPublisher(); Version getVersion(); - } diff --git a/src/main/java/org/openhab/binding/openlicht/internal/DelegateEraserRegistryChangeListener.java b/src/main/java/org/openhab/binding/openlicht/internal/DelegateEraserRegistryChangeListener.java index a1ecfad97e58212e9270c503846873b0b9c1f245..c9554d24b93b7ca62246c257d431b064ef324c45 100644 --- a/src/main/java/org/openhab/binding/openlicht/internal/DelegateEraserRegistryChangeListener.java +++ b/src/main/java/org/openhab/binding/openlicht/internal/DelegateEraserRegistryChangeListener.java @@ -1,9 +1,10 @@ package org.openhab.binding.openlicht.internal; import java.util.Collection; -import org.openhab.core.items.ItemRegistryChangeListener; -import org.openhab.core.items.Item; + import org.openhab.binding.openlicht.handler.EraserHandler; +import org.openhab.core.items.Item; +import org.openhab.core.items.ItemRegistryChangeListener; public class DelegateEraserRegistryChangeListener implements ItemRegistryChangeListener { diff --git a/src/main/java/org/openhab/binding/openlicht/internal/OpenLichtBindingConstants.java b/src/main/java/org/openhab/binding/openlicht/internal/OpenLichtBindingConstants.java index f81653530024220faa63032964315cd5c19c5c0b..a357ab6a56cc6b8c8b200dc2cfe0a14a9c858a47 100644 --- a/src/main/java/org/openhab/binding/openlicht/internal/OpenLichtBindingConstants.java +++ b/src/main/java/org/openhab/binding/openlicht/internal/OpenLichtBindingConstants.java @@ -19,7 +19,7 @@ import org.openhab.core.thing.ThingTypeUID; * The {@link OpenLichtBindingConstants} class defines common constants, which are * used across the whole binding. * - * @author Manuel Krombholz - Initial contribution + * @author René Schöne - Initial contribution */ @NonNullByDefault public class OpenLichtBindingConstants { @@ -31,4 +31,44 @@ public class OpenLichtBindingConstants { // List of all Channel ids public static final String CHANNEL_1 = "channel1"; + + // Configuration keys + public static final String CONFIG_BROKER_NAME = "brokerName"; + public static final String CONFIG_BASE_TOPIC = "base-topic"; + public static final String CONFIG_BYTE_BASED_MESSAGES = "byte-based-messages"; + public static final String CONFIG_TIMEOUT_MQTT_UNSUPPORTED_CATEGORIES = "unsupported-category-reset"; + public static final String CONFIG_ERASER_OUT_TOPIC = "outTopic"; + public static final String CONFIG_ERASER_PUBLISH_GROUP = "publish-group"; + public static final String CONFIG_ERASER_PUBLISH_ALL = "publish-all"; + + // List of all Thing Type UIDs + public static final ThingTypeUID THING_TYPE_SKYWRITER_HAT = new ThingTypeUID(BINDING_ID, "skywriter-hat"); + public static final ThingTypeUID THING_TYPE_POLAR_M600 = new ThingTypeUID(BINDING_ID, "polar-m600"); + public static final ThingTypeUID THING_TYPE_MOTO_360 = new ThingTypeUID(BINDING_ID, "moto-360"); + public static final ThingTypeUID THING_TYPE_SAMSUNG_S6 = new ThingTypeUID(BINDING_ID, "samsung-s6"); + public static final ThingTypeUID THING_TYPE_ERASER = new ThingTypeUID(BINDING_ID, "eraser"); + + // List of all Channel ids + public static final String CHANNEL_FLICK = "flick"; + public static final String CHANNEL_ACCELERATION_X = "acceleration-x"; + public static final String CHANNEL_ACCELERATION_Y = "acceleration-y"; + public static final String CHANNEL_ACCELERATION_Z = "acceleration-z"; + public static final String CHANNEL_ROTATION_X = "rotation-x"; + public static final String CHANNEL_ROTATION_Y = "rotation-y"; + public static final String CHANNEL_ROTATION_Z = "rotation-z"; + public static final String CHANNEL_ACTIVITY = "activity"; + public static final String CHANNEL_HEART_RATE = "heart-rate"; + public static final String CHANNEL_STEPS = "steps"; + public static final String CHANNEL_BRIGHTNESS = "brightness"; + + // List of MQTT categories + public static final String MQTT_CATEGORY_FLICK = "flick"; + public static final String MQTT_CATEGORY_ACCELERATION = "acceleration"; + public static final String MQTT_CATEGORY_ROTATION = "rotation"; + public static final String MQTT_CATEGORY_ACTIVITY = "activity"; + public static final String MQTT_CATEGORY_HEART_RATE = "heart-rate"; + public static final String MQTT_CATEGORY_STEPS = "steps"; + public static final String MQTT_CATEGORY_BRIGHTNESS = "brightness"; + + public static final String MQTT_BROKER_URL = "tcp://localhost:1883"; } diff --git a/src/main/java/org/openhab/binding/openlicht/internal/OpenLichtConfiguration.java b/src/main/java/org/openhab/binding/openlicht/internal/OpenLichtConfiguration.java index b60c72ac21414c23beee002eb744847a3d36fce3..6bf02f7546c1ce730b346222e3b61e031e7f92a5 100644 --- a/src/main/java/org/openhab/binding/openlicht/internal/OpenLichtConfiguration.java +++ b/src/main/java/org/openhab/binding/openlicht/internal/OpenLichtConfiguration.java @@ -15,7 +15,7 @@ package org.openhab.binding.openlicht.internal; /** * The {@link OpenLichtConfiguration} class contains fields mapping thing configuration parameters. * - * @author René Schöne - Initial contribution + * @author René Schöne - Initial contribution * @author Manuel Krombholz - Upgrade OH Version */ public class OpenLichtConfiguration { diff --git a/src/main/java/org/openhab/binding/openlicht/internal/OpenLichtHandlerFactory.java b/src/main/java/org/openhab/binding/openlicht/internal/OpenLichtHandlerFactory.java index 6f80894d36d347df219af65eb20ca9bec7406ff5..78c808b7e507e65bbc95bfa18091e6241602d5e0 100644 --- a/src/main/java/org/openhab/binding/openlicht/internal/OpenLichtHandlerFactory.java +++ b/src/main/java/org/openhab/binding/openlicht/internal/OpenLichtHandlerFactory.java @@ -12,7 +12,7 @@ */ package org.openhab.binding.openlicht.internal; -import static org.openhab.binding.openlicht.BindingConstants.*; +import static org.openhab.binding.openlicht.internal.OpenLichtBindingConstants.*; import java.util.Collections; import java.util.Set; @@ -23,7 +23,13 @@ import java.util.stream.Stream; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.binding.openlicht.handler.EraserHandler; +import org.openhab.binding.openlicht.handler.Moto360Handler; +import org.openhab.binding.openlicht.handler.PolarM600Handler; +import org.openhab.binding.openlicht.handler.SamsungS6Handler; +import org.openhab.binding.openlicht.handler.SkyWriterHATHandler; import org.openhab.core.events.EventPublisher; +import org.openhab.core.io.transport.mqtt.MqttService; import org.openhab.core.items.ItemRegistry; import org.openhab.core.thing.Thing; import org.openhab.core.thing.ThingRegistry; @@ -31,12 +37,6 @@ 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.openhab.core.io.transport.mqtt.MqttService; -import org.openhab.binding.openlicht.handler.EraserHandler; -import org.openhab.binding.openlicht.handler.Moto360Handler; -import org.openhab.binding.openlicht.handler.PolarM600Handler; -import org.openhab.binding.openlicht.handler.SamsungS6Handler; -import org.openhab.binding.openlicht.handler.SkyWriterHATHandler; import org.osgi.framework.FrameworkUtil; import org.osgi.framework.Version; import org.osgi.service.component.ComponentContext; @@ -92,7 +92,7 @@ public class OpenLichtHandlerFactory extends BaseThingHandlerFactory implements if (THING_TYPE_ERASER.equals(thingTypeUID)) { return new EraserHandler(thing, this); } - + System.out.println("null returning"); return null; } diff --git a/src/main/resources/OH-INF/config/config.xml b/src/main/resources/OH-INF/config/config.xml new file mode 100644 index 0000000000000000000000000000000000000000..8ddda6eeeedb056a034a52ef6326a8f1b685a285 --- /dev/null +++ b/src/main/resources/OH-INF/config/config.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<config-description:config-descriptions + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:config-description="http://eclipse.org/smarthome/schemas/config-description/v1.0.0" + xsi:schemaLocation="http://eclipse.org/smarthome/schemas/config-description/v1.0.0 http://eclipse.org/smarthome/schemas/config-description-1.0.0.xsd"> + + <config-description uri="thing-type:openlicht:mqttdevice"> + <parameter name="brokerName" type="text" required="true"> + <label>Broker Name</label> + <description>Name of the broker as defined in the name of the broker thing. See the MQTT Binding for more information + on how to create a MQTT broker thing.</description> + <context>service</context> + <default>embedded-mqtt-broker</default> + </parameter> + <parameter name="base-topic" type="text" required="true"> + <label>Base-Topic</label> + <description>Base topic for publishing updates. Do not include a trailing slash.</description> + <default>sensors</default> + </parameter> + <parameter name="byte-based-messages" type="boolean" required="false"> + <label>Byte-based MQTT Messages</label> + <description>Interpret MQTT messages as raw bytes. If false, interpret the messages as Strings containing numbers.</description> + <default>false</default> + </parameter> + <parameter name="unsupported-category-reset" type="integer" required="false"> + <label>MQTT Unsupported Category Reset Timeout</label> + <description>Timeout in seconds to log again unsupported MQTT categories. Set to zero to disable (default).</description> + <default>0</default> + </parameter> + </config-description> + +</config-description:config-descriptions> diff --git a/src/main/resources/OH-INF/i18n/openlicht_xx_XX.properties b/src/main/resources/OH-INF/i18n/openlicht_xx_XX.properties index fbd6a84d0422096192f6119d92881a77d63f1416..3cab3bbd2e6d09bfa4f7ff1de33c3e6cd8419c0b 100644 --- a/src/main/resources/OH-INF/i18n/openlicht_xx_XX.properties +++ b/src/main/resources/OH-INF/i18n/openlicht_xx_XX.properties @@ -1,17 +1,11 @@ -# FIXME: please substitute the xx_XX with a proper locale, ie. de_DE -# FIXME: please do not add the file to the repo if you add or change no content # binding -binding.openlicht.name = <Your localized Binding name> -binding.openlicht.description = <Your localized Binding description> +binding.openlicht.name = OpenLicht Binding +binding.openlicht.description = OpenLicht Binding # thing types -thing-type.openlicht.sample.label = <Your localized Thing label> -thing-type.openlicht.sample.description = <Your localized Thing description> - -# thing type config description -thing-type.config.openlicht.sample.config1.label = <Your localized config parameter label> -thing-type.config.openlicht.sample.config1.description = <Your localized config parameter description> +thing-type.openlicht.skywriterhat.skywriter-hat.label = SkyWriterHAT +thing-type.openlicht.skywriterhat.skywriter-hat.description = SkyWriterHAT Gesture Recognition # channel types -channel-type.openlicht.sample-channel.label = <Your localized Channel label> -channel-type.openlicht.sample-channel.description = <Your localized Channel description> +channel-type.openlicht.skywriterhat.flick-type.label = Last Flick +channel-type.openlicht.skywriterhat.flick-type.description = Last Flick detected (and its direction) diff --git a/src/main/resources/OH-INF/thing/thing-types.xml b/src/main/resources/OH-INF/thing/thing-types.xml index c193a13e32fffb0769b56a8feaa0f4f1f78d6527..b7dbb83eb61399c1cb8814f45adf1f9c6122b045 100644 --- a/src/main/resources/OH-INF/thing/thing-types.xml +++ b/src/main/resources/OH-INF/thing/thing-types.xml @@ -1,32 +1,225 @@ <?xml version="1.0" encoding="UTF-8"?> <thing:thing-descriptions bindingId="openlicht" 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"> + xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0" + xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd"> - <!-- Sample Thing Type --> - <thing-type id="sample"> - <label>OpenLicht Binding Thing</label> - <description>Sample thing for OpenLicht Binding</description> - - <channels> - <channel id="channel1" typeId="sample-channel"/> - </channels> + <!-- Eraser Thing Type --> + <thing-type id="eraser"> + <label>Eraser</label> + <description>Establish communication with a running eraser via MQTT</description> <config-description> - <parameter name="config1" type="text" required="true"> - <label>Sample Parameter</label> - <description>This is a sample text configuration parameter</description> + <parameter name="brokerName" type="text" required="true"> + <label>Broker Name</label> + <description>Name of the broker as defined in the name of the broker thing. See the MQTT Binding for more + information on how to create a MQTT broker thing.</description> + <context>service</context> + <default>embedded-mqtt-broker</default> + </parameter> + <parameter name="byte-based-messages" type="boolean" required="false"> + <label>Byte-based MQTT Messages</label> + <description>Interpret MQTT messages as raw bytes. If false, interpret the messages as Strings containing numbers.</description> + <default>false</default> + </parameter> + <parameter name="base-topic" type="text" required="true"> + <label>Base-Topic</label> + <description>Base topic for publishing updates. Do not include a trailing slash.</description> + <default>oh/in</default> + </parameter> + <parameter name="outTopic" type="text" required="true"> + <label>Outgoing topic</label> + <description>MQTT topic prefix for messages leaving openHAB to eraser.</description> + <default>oh/out/</default> + </parameter> + <parameter name="publish-all" type="boolean" required="true"> + <label>Publish All</label> + <description>If enabled, changes of every item will be published. Otherwise only those of the members of group set + in the parameter "Publish Group"</description> + <default>true</default> + </parameter> + <parameter name="publish-group" type="text" required="false"> + <label>Publish group</label> + <description>Group whose members will trigger an update</description> + <context>item</context> </parameter> </config-description> + </thing-type> + + <!-- Skywriter HAT Thing Type --> + <thing-type id="skywriter-hat"> + <label>SkyWriterHAT</label> + <description>SkyWriterHAT Gesture Recognition</description> + + <channels> + <channel typeId="flick-type" id="flick"/> + </channels> + + <config-description-ref uri="thing-type:openlicht:mqttdevice"/> + </thing-type> + + <!-- Flick Type --> + <channel-type id="flick-type"> + <item-type>String</item-type> + <label>Last Flick</label> + <description>Last Flick detected (and its direction)</description> + <category>Motion</category> + <state readOnly="true"/> + </channel-type> + + <!-- Polar M600 Thing Type --> + <thing-type id="polar-m600"> + <label>Polar M600</label> + <description>Provides sensor information from a Polar M600 smart watch</description> + + <channels> + <channel typeId="acceleration-type" id="acceleration-x"> + <label>Acceleration X</label> + </channel> + <channel typeId="acceleration-type" id="acceleration-y"> + <label>Acceleration Y</label> + </channel> + <channel typeId="acceleration-type" id="acceleration-z"> + <label>Acceleration Z</label> + </channel> + <channel typeId="rotation-type" id="rotation-x"> + <label>Rotation X</label> + </channel> + <channel typeId="rotation-type" id="rotation-y"> + <label>Rotation Y</label> + </channel> + <channel typeId="rotation-type" id="rotation-z"> + <label>Rotation Z</label> + </channel> + <channel typeId="activity-type" id="activity"/> + <channel typeId="heart-rate-type" id="heart-rate"/> + <channel typeId="steps-type" id="steps"/> + <channel typeId="brightness-type" id="brightness"/> + </channels> + + <config-description-ref uri="thing-type:openlicht:mqttdevice"/> + </thing-type> + + <!-- Polar M600 Thing Type --> + <thing-type id="moto-360"> + <label>Moto 360</label> + <description>Provides sensor information from a Moto 360 smart watch</description> + + <channels> + <channel typeId="acceleration-type" id="acceleration-x"> + <label>Acceleration X</label> + </channel> + <channel typeId="acceleration-type" id="acceleration-y"> + <label>Acceleration Y</label> + </channel> + <channel typeId="acceleration-type" id="acceleration-z"> + <label>Acceleration Z</label> + </channel> + <channel typeId="rotation-type" id="rotation-x"> + <label>Rotation X</label> + </channel> + <channel typeId="rotation-type" id="rotation-y"> + <label>Rotation Y</label> + </channel> + <channel typeId="rotation-type" id="rotation-z"> + <label>Rotation Z</label> + </channel> + <channel typeId="activity-type" id="activity"/> + <channel typeId="heart-rate-type" id="heart-rate"/> + <channel typeId="steps-type" id="steps"/> + <channel typeId="brightness-type" id="brightness"/> + </channels> + + <config-description-ref uri="thing-type:openlicht:mqttdevice"/> + </thing-type> + + <!-- Accelerator Type --> + <channel-type id="acceleration-type"> + <item-type>Number</item-type> + <label>Acceleration</label> + <description>Acceleration in one direction in meters per second.</description> + <category>Motion</category> + <state readOnly="true"/> + </channel-type> + + <!-- Rotation Type --> + <channel-type id="rotation-type"> + <item-type>Number</item-type> + <label>Rotation</label> + <description>Rotation around one axis (unitless).</description> + <category>Motion</category> + <state readOnly="true"/> + </channel-type> + + <!-- Activity Type --> + <channel-type id="activity-type"> + <item-type>String</item-type> + <label>Activity</label> + <description>Current recognized activity.</description> + <state readOnly="true"/> + <event> + <options> + <option value="Runnning">running</option> + <option value="Walking">walking</option> + <option value="Resting">resting</option> + <option value="Unknown">unknown</option> + </options> + </event> + </channel-type> + + <!-- Heart Rate Type --> + <channel-type id="heart-rate-type"> + <item-type>Number</item-type> + <label>Heart Rate</label> + <description>Heart rate in beats per minute.</description> + <state readOnly="true"/> + </channel-type> + + <!-- Steps Type --> + <channel-type id="steps-type"> + <item-type>Number</item-type> + <label>Steps</label> + <description>Steps run today.</description> + <state readOnly="true"></state> + </channel-type> + + <!-- Samsung S6 Thing Type --> + <thing-type id="samsung-s6"> + <label>Samsung S6</label> + <description>Provides sensor information from a smart phone (a Samsung S6 in our case)</description> + + <channels> + <channel typeId="brightness-type" id="brightness"/> + <channel typeId="acceleration-type" id="acceleration-x"> + <label>Acceleration X</label> + </channel> + <channel typeId="acceleration-type" id="acceleration-y"> + <label>Acceleration Y</label> + </channel> + <channel typeId="acceleration-type" id="acceleration-z"> + <label>Acceleration Z</label> + </channel> + <channel typeId="rotation-type" id="rotation-x"> + <label>Rotation X</label> + </channel> + <channel typeId="rotation-type" id="rotation-y"> + <label>Rotation Y</label> + </channel> + <channel typeId="rotation-type" id="rotation-z"> + <label>Rotation Z</label> + </channel> + </channels> + <config-description-ref uri="thing-type:openlicht:mqttdevice"/> </thing-type> - <!-- Sample Channel Type --> - <channel-type id="sample-channel"> - <item-type>openlichtItem</item-type> - <label>OpenLicht Binding Channel</label> - <description>Sample channel for OpenLicht Binding</description> + <!-- General Brightness Type --> + <channel-type id="brightness-type"> + <item-type>Number</item-type> + <label>Brightness</label> + <description>Brightness (Lux).</description> + <category>Light</category> + <state readOnly="true"></state> </channel-type> </thing:thing-descriptions>