Skip to content
Snippets Groups Projects
Commit 7a544205 authored by René Schöne's avatar René Schöne
Browse files

Adding acceleration and rotation.

parent ee249380
No related branches found
No related tags found
No related merge requests found
target/
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
</parameter> </parameter>
<parameter name="base-topic" type="text" required="true"> <parameter name="base-topic" type="text" required="true">
<label>Base-Topic</label> <label>Base-Topic</label>
<description>Base topic for publishing updates.</description> <description>Base topic for publishing updates. Do not include a trailing slash.</description>
<default>sensors/</default> <default>sensors</default>
</parameter> </parameter>
</config-description> </config-description>
......
...@@ -31,9 +31,39 @@ ...@@ -31,9 +31,39 @@
<description>Provides sensor information from a Polar M600 smart watch</description> <description>Provides sensor information from a Polar M600 smart watch</description>
<channels> <channels>
<channel typeId="polar-accelerator-type" id="polar-accelerator-x" /> <channel typeId="polar-acceleration-type" id="polar-acceleration-x">
<channel typeId="polar-accelerator-type" id="polar-accelerator-y" /> <label>Acceleration X</label>
<channel typeId="polar-accelerator-type" id="polar-accelerator-z" /> <description>Acceleration on the x-axis.</description>
</channel>
<channel typeId="polar-acceleration-type" id="polar-acceleration-y" />
<channel typeId="polar-acceleration-type" id="polar-acceleration-z" />
<channel typeId="polar-rotation-type" id="polar-rotation-x" />
<channel typeId="polar-rotation-type" id="polar-rotation-y" />
<channel typeId="polar-rotation-type" id="polar-rotation-z" />
<channel typeId="polar-activity-type" id="polar-activity" />
<channel typeId="polar-heart-rate-type" id="polar-heart-rate" />
<channel typeId="polar-steps-type" id="polar-steps" />
<channel typeId="openlicht-brightness-type" id="polar-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="polar-acceleration-type" id="polar-acceleration-x">
<label>Acceleration X</label>
<description>Acceleration on the x-axis.</description>
</channel>
<channel typeId="polar-acceleration-type" id="polar-acceleration-y" />
<channel typeId="polar-acceleration-type" id="polar-acceleration-z" />
<channel typeId="polar-rotation-type" id="polar-rotation-x" />
<channel typeId="polar-rotation-type" id="polar-rotation-y" />
<channel typeId="polar-rotation-type" id="polar-rotation-z" />
<channel typeId="polar-activity-type" id="polar-activity" /> <channel typeId="polar-activity-type" id="polar-activity" />
<channel typeId="polar-heart-rate-type" id="polar-heart-rate" /> <channel typeId="polar-heart-rate-type" id="polar-heart-rate" />
<channel typeId="polar-steps-type" id="polar-steps" /> <channel typeId="polar-steps-type" id="polar-steps" />
...@@ -44,7 +74,7 @@ ...@@ -44,7 +74,7 @@
</thing-type> </thing-type>
<!-- Accelerator Type --> <!-- Accelerator Type -->
<channel-type id="polar-accelerator-type"> <channel-type id="polar-acceleration-type">
<item-type>Number</item-type> <item-type>Number</item-type>
<label>Acceleration</label> <label>Acceleration</label>
<description>Acceleration in one direction in meters per second.</description> <description>Acceleration in one direction in meters per second.</description>
...@@ -52,6 +82,15 @@ ...@@ -52,6 +82,15 @@
<state readOnly="true" /> <state readOnly="true" />
</channel-type> </channel-type>
<!-- Rotation Type -->
<channel-type id="polar-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 --> <!-- Activity Type -->
<channel-type id="polar-activity-type"> <channel-type id="polar-activity-type">
<item-type>String</item-type> <item-type>String</item-type>
......
...@@ -21,4 +21,5 @@ Import-Package: ...@@ -21,4 +21,5 @@ Import-Package:
org.osgi.service.component, org.osgi.service.component,
org.slf4j org.slf4j
Service-Component: OSGI-INF/*.xml Service-Component: OSGI-INF/*.xml
Export-Package: org.openhab.binding.openlicht.handler Export-Package: org.openhab.binding.openlicht,
org.openhab.binding.openlicht.handler
# <bindingName> Binding # <bindingName> 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._ _Give some details about what this binding is meant for - a protocol, system, specific device._
_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._ _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 ## Supported Things
- SkyWriterHAT
- Polar M600
- Samsung S6 (or actually any smart phone)
_Please describe the different supported things / devices within this section._ _Please describe the different supported things / devices within this section._
_Which different types are supported, which models were tested etc.?_ _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 ```ESH-INF/thing``` of your binding._ _Note that it is planned to generate some part of this based on the XML files within ```ESH-INF/thing``` of your binding._
## Discovery ## Discovery
_Describe the available auto-discovery features here. Mention for what it works and what needs to be kept in mind when using it._ Not implemented yet.
## Binding Configuration ## Binding Configuration
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* *
* SPDX-License-Identifier: EPL-2.0 * SPDX-License-Identifier: EPL-2.0
*/ */
package org.openhab.binding.openlicht.internal; package org.openhab.binding.openlicht;
import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.smarthome.core.thing.ThingTypeUID; import org.eclipse.smarthome.core.thing.ThingTypeUID;
...@@ -26,6 +26,10 @@ public class BindingConstants { ...@@ -26,6 +26,10 @@ public class BindingConstants {
private static final String BINDING_ID = "openlicht"; 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";
// List of all Thing Type UIDs // 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_SKYWRITER_HAT = new ThingTypeUID(BINDING_ID, "skywriter-hat");
public static final ThingTypeUID THING_TYPE_POLAR = new ThingTypeUID(BINDING_ID, "polar-m600"); public static final ThingTypeUID THING_TYPE_POLAR = new ThingTypeUID(BINDING_ID, "polar-m600");
...@@ -33,9 +37,12 @@ public class BindingConstants { ...@@ -33,9 +37,12 @@ public class BindingConstants {
// List of all Channel ids // List of all Channel ids
public static final String CHANNEL_FLICK = "flick"; public static final String CHANNEL_FLICK = "flick";
public static final String CHANNEL_ACCELERATOR_X = "polar-accelerator-x"; public static final String CHANNEL_ACCELERATION_X = "polar-acceleration-x";
public static final String CHANNEL_ACCELERATOR_Y = "polar-accelerator-y"; public static final String CHANNEL_ACCELERATION_Y = "polar-acceleration-y";
public static final String CHANNEL_ACCELERATOR_Z = "polar-accelerator-z"; public static final String CHANNEL_ACCELERATION_Z = "polar-acceleration-z";
public static final String CHANNEL_ROTATION_X = "polar-rotation-x";
public static final String CHANNEL_ROTATION_Y = "polar-rotation-y";
public static final String CHANNEL_ROTATION_Z = "polar-rotation-z";
public static final String CHANNEL_ACTIVITY = "polar-activity"; public static final String CHANNEL_ACTIVITY = "polar-activity";
public static final String CHANNEL_HEART_RATE = "polar-heart-rate"; public static final String CHANNEL_HEART_RATE = "polar-heart-rate";
public static final String CHANNEL_STEPS = "polar-steps"; public static final String CHANNEL_STEPS = "polar-steps";
...@@ -44,7 +51,8 @@ public class BindingConstants { ...@@ -44,7 +51,8 @@ public class BindingConstants {
// List of MQTT categories // List of MQTT categories
public static final String MQTT_CATEGORY_FLICK = "flick"; public static final String MQTT_CATEGORY_FLICK = "flick";
public static final String MQTT_CATEGORY_ACCELERATOR = "accelerator"; 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_ACTIVITY = "activity";
public static final String MQTT_CATEGORY_HEART_RATE = "heart-rate"; public static final String MQTT_CATEGORY_HEART_RATE = "heart-rate";
public static final String MQTT_CATEGORY_STEPS = "steps"; public static final String MQTT_CATEGORY_STEPS = "steps";
......
package org.openhab.binding.openlicht.handler; package org.openhab.binding.openlicht.handler;
import static org.openhab.binding.openlicht.BindingConstants.*;
import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.smarthome.core.thing.Thing; import org.eclipse.smarthome.core.thing.Thing;
import org.eclipse.smarthome.core.thing.ThingStatus; import org.eclipse.smarthome.core.thing.ThingStatus;
...@@ -10,7 +12,6 @@ import org.eclipse.smarthome.io.transport.mqtt.MqttBrokersObserver; ...@@ -10,7 +12,6 @@ import org.eclipse.smarthome.io.transport.mqtt.MqttBrokersObserver;
import org.eclipse.smarthome.io.transport.mqtt.MqttException; import org.eclipse.smarthome.io.transport.mqtt.MqttException;
import org.eclipse.smarthome.io.transport.mqtt.MqttMessageSubscriber; import org.eclipse.smarthome.io.transport.mqtt.MqttMessageSubscriber;
import org.eclipse.smarthome.io.transport.mqtt.MqttService; import org.eclipse.smarthome.io.transport.mqtt.MqttService;
import org.openhab.binding.openlicht.internal.OpenLichtConfiguration;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -20,7 +21,7 @@ public abstract class AbstractMqttHandler extends BaseThingHandler ...@@ -20,7 +21,7 @@ public abstract class AbstractMqttHandler extends BaseThingHandler
@NonNull @NonNull
protected final Logger logger = LoggerFactory.getLogger(AbstractMqttHandler.class); protected final Logger logger = LoggerFactory.getLogger(AbstractMqttHandler.class);
protected OpenLichtConfiguration config; // protected OpenLichtConfiguration config;
private MqttService mqttService; private MqttService mqttService;
...@@ -28,6 +29,8 @@ public abstract class AbstractMqttHandler extends BaseThingHandler ...@@ -28,6 +29,8 @@ public abstract class AbstractMqttHandler extends BaseThingHandler
private MqttBrokerConnection currentBrokerConnection = null; private MqttBrokerConnection currentBrokerConnection = null;
private boolean warnNoBrokerConnection = true;
public AbstractMqttHandler(Thing thing, MqttService mqttService) { public AbstractMqttHandler(Thing thing, MqttService mqttService) {
super(thing); super(thing);
this.mqttService = mqttService; this.mqttService = mqttService;
...@@ -35,14 +38,19 @@ public abstract class AbstractMqttHandler extends BaseThingHandler ...@@ -35,14 +38,19 @@ public abstract class AbstractMqttHandler extends BaseThingHandler
@Override @Override
public void initialize() { public void initialize() {
config = getConfigAs(OpenLichtConfiguration.class); // config = getConfigAs(OpenLichtConfiguration.class);
String brokerName = getConfigValue(CONFIG_BROKER_NAME);
// remove this handler from mqttService (in case initialize is called because of a config update)
this.mqttService.removeBrokersListener(this);
this.mqttService.addBrokersListener(this); this.mqttService.addBrokersListener(this);
updateStatus(ThingStatus.UNKNOWN, ThingStatusDetail.CONFIGURATION_PENDING, "Searching broker"); updateStatus(ThingStatus.UNKNOWN, ThingStatusDetail.CONFIGURATION_PENDING, "Searching broker");
for (MqttBrokerConnection broker : this.mqttService.getAllBrokerConnections()) { for (MqttBrokerConnection broker : this.mqttService.getAllBrokerConnections()) {
brokerAdded(broker); brokerAdded(broker);
} }
if (currentBrokerConnection == null) { if (currentBrokerConnection == null) {
MqttBrokerConnection myBroker = this.mqttService.getBrokerConnection(config.brokerName); MqttBrokerConnection myBroker = this.mqttService.getBrokerConnection(brokerName);
if (myBroker != null) { if (myBroker != null) {
brokerAdded(myBroker); brokerAdded(myBroker);
} }
...@@ -50,11 +58,17 @@ public abstract class AbstractMqttHandler extends BaseThingHandler ...@@ -50,11 +58,17 @@ public abstract class AbstractMqttHandler extends BaseThingHandler
publish("init"); publish("init");
} }
private String getConfigValue(String key) {
return (String) getThing().getConfiguration().get(key);
}
@Override @Override
public void brokerAdded(MqttBrokerConnection broker) { public void brokerAdded(MqttBrokerConnection broker) {
if (broker.getName().equals(config.brokerName)) { String brokerName = getConfigValue(CONFIG_BROKER_NAME);
if (broker.getName().equals(brokerName)) {
// this is our broker! // this is our broker!
currentBrokerConnection = broker; currentBrokerConnection = broker;
warnNoBrokerConnection = true;
updateTopicLength(); updateTopicLength();
try { try {
if (subscribeTopic()) { if (subscribeTopic()) {
...@@ -63,9 +77,9 @@ public abstract class AbstractMqttHandler extends BaseThingHandler ...@@ -63,9 +77,9 @@ public abstract class AbstractMqttHandler extends BaseThingHandler
updateStatus(ThingStatus.ONLINE); updateStatus(ThingStatus.ONLINE);
this.logger.info("Broker found, thing is online"); this.logger.info("Broker found, thing is online");
} catch (MqttException e) { } catch (MqttException e) {
this.logger.error("Could not add subscriber to broker {}", config.brokerName); this.logger.error("Could not add subscriber to broker {}", brokerName);
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
"Could not add subscriber to broker " + config.brokerName); "Could not add subscriber to broker " + brokerName);
} }
} else { } else {
this.logger.debug("Got another broker, not interessted!"); this.logger.debug("Got another broker, not interessted!");
...@@ -80,7 +94,8 @@ public abstract class AbstractMqttHandler extends BaseThingHandler ...@@ -80,7 +94,8 @@ public abstract class AbstractMqttHandler extends BaseThingHandler
@Override @Override
public void brokerRemoved(MqttBrokerConnection broker) { public void brokerRemoved(MqttBrokerConnection broker) {
if (broker.getName().equals(config.brokerName)) { String brokerName = getConfigValue(CONFIG_BROKER_NAME);
if (broker.getName().equals(brokerName)) {
// this was our broker! // this was our broker!
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_PENDING, "Broker is offline"); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_PENDING, "Broker is offline");
currentBrokerConnection = null; currentBrokerConnection = null;
...@@ -89,7 +104,11 @@ public abstract class AbstractMqttHandler extends BaseThingHandler ...@@ -89,7 +104,11 @@ public abstract class AbstractMqttHandler extends BaseThingHandler
protected void publish(String message) { protected void publish(String message) {
if (currentBrokerConnection == null) { if (currentBrokerConnection == null) {
if (warnNoBrokerConnection) {
// just report once
logger.warn("Can't publish message, no connection"); logger.warn("Can't publish message, no connection");
warnNoBrokerConnection = false;
}
return; return;
} }
String topic = subscribeSubTopics() ? (getTopic().substring(0, usedTopicLength) + "out") String topic = subscribeSubTopics() ? (getTopic().substring(0, usedTopicLength) + "out")
...@@ -104,7 +123,8 @@ public abstract class AbstractMqttHandler extends BaseThingHandler ...@@ -104,7 +123,8 @@ public abstract class AbstractMqttHandler extends BaseThingHandler
@Override @Override
public final String getTopic() { public final String getTopic() {
return config.topic + (getSubTopic() == null ? "" : "/" + getSubTopic()) + (subscribeSubTopics() ? "/#" : ""); return getConfigValue(CONFIG_BASE_TOPIC) + (getSubTopic() == null ? "" : "/" + getSubTopic())
+ (subscribeSubTopics() ? "/#" : "");
} }
protected final int getTopicLength() { protected final int getTopicLength() {
......
...@@ -12,18 +12,17 @@ ...@@ -12,18 +12,17 @@
*/ */
package org.openhab.binding.openlicht.handler; package org.openhab.binding.openlicht.handler;
import static org.openhab.binding.openlicht.internal.BindingConstants.*; import static org.openhab.binding.openlicht.BindingConstants.*;
import java.nio.ByteBuffer;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.smarthome.core.library.types.DecimalType; import org.eclipse.smarthome.core.library.types.DecimalType;
import org.eclipse.smarthome.core.thing.ChannelUID; import org.eclipse.smarthome.core.thing.ChannelUID;
import org.eclipse.smarthome.core.thing.Thing; import org.eclipse.smarthome.core.thing.Thing;
import org.eclipse.smarthome.core.types.Command; import org.eclipse.smarthome.core.types.Command;
import org.eclipse.smarthome.io.transport.mqtt.MqttService; import org.eclipse.smarthome.io.transport.mqtt.MqttService;
import org.openhab.binding.openlicht.internal.OpenLichtConfiguration;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -37,9 +36,6 @@ public class PolarHandler extends AbstractMqttHandler { ...@@ -37,9 +36,6 @@ public class PolarHandler extends AbstractMqttHandler {
private final Logger logger = LoggerFactory.getLogger(PolarHandler.class); private final Logger logger = LoggerFactory.getLogger(PolarHandler.class);
@Nullable
private OpenLichtConfiguration config;
private Set<String> seenUnsupportedCategories; private Set<String> seenUnsupportedCategories;
public PolarHandler(Thing thing, MqttService mqttService) { public PolarHandler(Thing thing, MqttService mqttService) {
...@@ -50,7 +46,6 @@ public class PolarHandler extends AbstractMqttHandler { ...@@ -50,7 +46,6 @@ public class PolarHandler extends AbstractMqttHandler {
@Override @Override
public void handleCommand(ChannelUID channelUID, Command command) { public void handleCommand(ChannelUID channelUID, Command command) {
logger.debug("Got command for read-only thing: {} {}", channelUID.getAsString(), command.toFullString()); logger.debug("Got command for read-only thing: {} {}", channelUID.getAsString(), command.toFullString());
if (channelUID.getId().equals(CHANNEL_ACCELERATOR_X)) {
// TODO: handle command // TODO: handle command
// Note: if communication with thing fails for some reason, // Note: if communication with thing fails for some reason,
...@@ -58,22 +53,43 @@ public class PolarHandler extends AbstractMqttHandler { ...@@ -58,22 +53,43 @@ public class PolarHandler extends AbstractMqttHandler {
// updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, // updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
// "Could not control device at IP address x.x.x.x"); // "Could not control device at IP address x.x.x.x");
} }
}
@Override @Override
public void processMessage(String topic, byte[] payload) { public void processMessage(String topic, byte[] payload) {
// switch category of message (last part of topic after last slash) // switch category of message (last part of topic after last slash)
String category = topic.substring(getTopicLength()); String category = topic.substring(getTopicLength());
String state = new String(payload); // String state = new String(payload);
ByteBuffer buffer = ByteBuffer.wrap(payload);
float[] values;
switch (category) { switch (category) {
case MQTT_CATEGORY_BRIGHTNESS: case MQTT_CATEGORY_BRIGHTNESS:
updateState(CHANNEL_BRIGHTNESS_POLAR, DecimalType.valueOf(state)); updateState(CHANNEL_BRIGHTNESS_POLAR, new DecimalType(buffer.getInt()));
break; break;
case MQTT_CATEGORY_ACCELERATION:
// expected form: [0.12345678, 0.12345678, 0.12345678]
values = new float[3];
writeFloatArray(buffer, values);
updateState(CHANNEL_ACCELERATION_X, new DecimalType(values[0]));
updateState(CHANNEL_ACCELERATION_Y, new DecimalType(values[1]));
updateState(CHANNEL_ACCELERATION_Z, new DecimalType(values[2]));
case MQTT_CATEGORY_ROTATION:
// expected form: [0.12345678, 0.12345678, 0.12345678]
values = new float[3];
writeFloatArray(buffer, values);
updateState(CHANNEL_ROTATION_X, new DecimalType(values[0]));
updateState(CHANNEL_ROTATION_Y, new DecimalType(values[1]));
updateState(CHANNEL_ROTATION_Z, new DecimalType(values[2]));
default: default:
logUnsupportedCategory(category); logUnsupportedCategory(category);
} }
} }
private void writeFloatArray(ByteBuffer input, float[] output) {
for (int i = 0; i < output.length; i++) {
output[i] = input.getFloat();
}
}
private void logUnsupportedCategory(String category) { private void logUnsupportedCategory(String category) {
if (seenUnsupportedCategories.add(category)) { if (seenUnsupportedCategories.add(category)) {
logger.warn("Category not supported: {}", category); logger.warn("Category not supported: {}", category);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
*/ */
package org.openhab.binding.openlicht.handler; package org.openhab.binding.openlicht.handler;
import static org.openhab.binding.openlicht.internal.BindingConstants.CHANNEL_FLICK; import static org.openhab.binding.openlicht.BindingConstants.CHANNEL_FLICK;
import org.eclipse.smarthome.core.library.types.StringType; import org.eclipse.smarthome.core.library.types.StringType;
import org.eclipse.smarthome.core.thing.ChannelUID; import org.eclipse.smarthome.core.thing.ChannelUID;
...@@ -30,7 +30,7 @@ public class SkyWriterHATHandler extends AbstractMqttHandler { ...@@ -30,7 +30,7 @@ public class SkyWriterHATHandler extends AbstractMqttHandler {
@Override @Override
public void handleCommand(ChannelUID channelUID, Command command) { public void handleCommand(ChannelUID channelUID, Command command) {
if (channelUID.getId().equals(CHANNEL_FLICK)) { logger.debug("Got command for read-only thing: {} {}", channelUID.getAsString(), command.toFullString());
// TODO: handle command // TODO: handle command
// Note: if communication with thing fails for some reason, // Note: if communication with thing fails for some reason,
...@@ -38,7 +38,6 @@ public class SkyWriterHATHandler extends AbstractMqttHandler { ...@@ -38,7 +38,6 @@ public class SkyWriterHATHandler extends AbstractMqttHandler {
// updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, // updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
// "Could not control device at IP address x.x.x.x"); // "Could not control device at IP address x.x.x.x");
} }
}
@Override @Override
public void processMessage(String topic, byte[] payload) { public void processMessage(String topic, byte[] payload) {
......
...@@ -12,18 +12,16 @@ ...@@ -12,18 +12,16 @@
*/ */
package org.openhab.binding.openlicht.handler; package org.openhab.binding.openlicht.handler;
import static org.openhab.binding.openlicht.internal.BindingConstants.*; import static org.openhab.binding.openlicht.BindingConstants.*;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.smarthome.core.library.types.DecimalType; import org.eclipse.smarthome.core.library.types.DecimalType;
import org.eclipse.smarthome.core.thing.ChannelUID; import org.eclipse.smarthome.core.thing.ChannelUID;
import org.eclipse.smarthome.core.thing.Thing; import org.eclipse.smarthome.core.thing.Thing;
import org.eclipse.smarthome.core.types.Command; import org.eclipse.smarthome.core.types.Command;
import org.eclipse.smarthome.io.transport.mqtt.MqttService; import org.eclipse.smarthome.io.transport.mqtt.MqttService;
import org.openhab.binding.openlicht.internal.OpenLichtConfiguration;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -37,9 +35,6 @@ public class SmartphoneHandler extends AbstractMqttHandler { ...@@ -37,9 +35,6 @@ public class SmartphoneHandler extends AbstractMqttHandler {
private final Logger logger = LoggerFactory.getLogger(SmartphoneHandler.class); private final Logger logger = LoggerFactory.getLogger(SmartphoneHandler.class);
@Nullable
private OpenLichtConfiguration config;
private Set<String> seenUnsupportedCategories; private Set<String> seenUnsupportedCategories;
public SmartphoneHandler(Thing thing, MqttService mqttService) { public SmartphoneHandler(Thing thing, MqttService mqttService) {
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
*/ */
package org.openhab.binding.openlicht.internal; package org.openhab.binding.openlicht.internal;
import static org.openhab.binding.openlicht.internal.BindingConstants.*; import static org.openhab.binding.openlicht.BindingConstants.*;
import java.util.Collections; import java.util.Collections;
import java.util.Set; import java.util.Set;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment