diff --git a/README.md b/README.md
index c243136bf3cdb..e266a9875567e 100644
--- a/README.md
+++ b/README.md
@@ -1,18 +1,174 @@
-## openHAB 2 Add-ons
+# Zoneminder Binding
-This repository contains add-ons that are implemenented using the new [Eclipse SmartHome APIs](https://www.eclipse.org/smarthome/documentation/development/bindings/how-to.html) of openHAB 2.
+This binding offers integration to a ZoneMinder Server. It currently only offers to integrate to monitors (eg. cameras in ZoneMinder). It also only offers access to a limited set of values, as well as a even more limited option to update values in ZoneMinder. It requires at least ZoneMinder 1.29 with API enabled (option 'OPT_USE_API' in ZoneMinder must be enabled). The option 'OPT_TRIGGERS' must be anabled to allow openHAB to trip the ForceAlarm in ZoneMinder.
-Note that all information about openHAB itself, the IDE setup and the contribution processes can be found in the [openhab-distro](https://github.com/openhab/openhab-distro) project, so please go there for any further details!
+## Supported Things
-## Add-ons in other repositories
-Some add-ons (e.g. specific bindings such as [Z-Wave](https://github.com/openhab/org.openhab.binding.zwave)) are maintained in separate repositories in order to improve their management. In order to contribute to these bindings, you should follow the following steps -:
+This binding supports the following thing types
-1. Fork the repository on Github
-2. Clone your repository to your local computer as described in the [Github tutorial](https://help.github.com/articles/cloning-a-repository/)
-3. Open the openHAB Eclipse IDE
-4. Select the *File | Import* menu option
-5. Select *General | Existing Projects into Workspace* and click Next
-6. Select the root directory where you made the local clone of the repository
-7. Select the project and click *Next*
-8. The project will now be imported and available in the Package Explorer
-9. You may want to add the project to the *OH2 Add-ons* Working Set
+
+
Thing
Thing Type
Discovery
Description
+
ZoneMinder Server
Bridge
Manual
A ZoneMinder Server. Required version is minimum 1.29
+
ZoneMinder Monitor
Thing
Automatic
Monitor as defined in ZoneMinder Server
+
+
+## Getting started / Discovery
+
+The binding consists of a Bridge (the ZoneMinder Server it self), and a number of Things, which relates to the induvidual monitors in ZoneMinder. ZoneMinder things can be configured either through the online configuration utility via discovery, or manually through the 'zoneminder.things' configuration file. The Bridge will not be autodiscovered, this behaviour is by design. That is because the ZoneMinder API can be configured to communicate on custom ports, you can even change the url from the default /zm/ to something userdefined. That makes it meaningless to scan for a ZoneMinder Server. The Bridge must therefore be added manually, this can be done from PaperUI. After adding the Bridge it will go ONLINE, and after a short while and the discovery process for monitors will start. When a new monitor is discovered it will appear in the Inbox.
+
+
+### Bridge ###
+
+Channel | Type | Description
+-------------- | --------- | ----------------------------------
+online | Switch | Parameter indicating if the server is online
+CPU load | Text | Current CPU Load of server
+Disk Usage | text | Current Disk Usage on server
+
+### Thing ###
+
+ Channel | Type | Description
+-------------- | --------- | ----------------------------------
+online | Switch | Parameter indicating if the monitor is online
+enabled | Switch | Parameter indicating if the monitor is enabled
+force-alarm | Switch | Parameter indicating if Force Alarm for the the monitor is active
+alarm | Switch | true if monitor has an active alarm
+recording | Text | true if monitor is recording
+detailed-status| Text | Detailed status of monitor (Idle, Pre-alarm, Alarm, Alert, Recording)
+event-cause | Text | Empty when there is no active event, else it contains the text with the cause of the event
+function | Text | Text corresponding the value in ZoneMinder: None, Monitor, Modect, Record, Mocord, Nodect
+capture-daemon | Switch | Run state of ZMC Daemon
+analysis-daemon| Switch | Run state of ZMA Daemon
+frame-daemon | Switch | Run state of ZMF Daemon
+
+##Manual configuration##
+
+###Things configuration###
+
+```
+Bridge zoneminder:server:ZoneMinderSample [ hostname="192.168.1.55", user="", password="", telnet_port=6802, refresh_interval_disk_usage=1 ]
+{
+ Thing monitor monitor_1 [ monitorId=1, monitorTriggerTimeout=120, monitorEventText="Trigger activated from OpenHAB" ]
+}
+
+```
+###Items configuration###
+
+```
+/* *****************************************
+ * SERVER
+ * *****************************************/
+Switch zmServer_Online "Zoneminder Online [%s]" {channel="zoneminder:server:ZoneMinderSample:online"}
+Number zmServer_CpuLoad "ZoneMinder Server Load [%s]" {channel="zoneminder:server:ZoneMinderSample:cpu-load"}
+
+Number zmServer_DiskUsage "ZoneMinder Disk Usage [%s]" {channel="zoneminder:server:ZoneMinderSample:disk-usage"}
+
+/* *****************************************
+ * MONITOR 1
+ * *****************************************/
+Switch zmMonitor1_Online "Online [%s]" {channel="zoneminder:monitor:ZoneMinderSample:monitor-1:online"}
+Switch zmMonitor1_Enabled "Enabled [%s]" {channel="zoneminder:monitor:ZoneMinderSample:monitor-1:enabled"}
+Switch zmMonitor1_ForceAlarm "Force Alarm [%s]" {channel="zoneminder:monitor:ZoneMinderSample:monitor-1:force-alarm"}
+Switch zmMonitor1_EventState "Alarm [%s]" {channel="zoneminder:monitor:ZoneMinderSample:monitor-1:alarm"}
+Switch zmMonitor1_Recording "Recording [%s]" {channel="zoneminder:monitor:ZoneMinderSample:monitor-1:recording"}
+String zmMonitor1_DetailedStatus "Detailed Status [%s]" {channel="zoneminder:monitor:ZoneMinderSample:monitor-1:detailed-status"}
+String zmMonitor1_EventCause "Event Cause [%s]" {channel="zoneminder:monitor:ZoneMinderSample:monitor-1:event-cause"}
+String zmMonitor1_Function "Function [%s]" {channel="zoneminder:monitor:ZoneMinderSample:monitor-1:function"}
+Switch zmMonitor1_CaptureState "Capture Daemon [%s]" {channel="zoneminder:monitor:ZoneMinderSample:monitor-1:capture-daemon"}
+Switch zmMonitor1_AnalysisState "Analysis Daemon [%s]" {channel="zoneminder:monitor:ZoneMinderSample:monitor-1:analysis-daemon"}
+Switch zmMonitor1_FrameState "Frame Daemon [%s]" {channel="zoneminder:monitor:ZoneMinderSample:monitor-1:frame-daemon"}
+
+
+// Helpers
+Switch zmMonitor1_Mode "Monitor active [%s]"
+```
+
+###Sample Rule###
+
+```
+rule "Monitor1 Alarm State"
+when
+ Item zmMonitor1_EventState changed
+then
+ if (zmMonitor1_EventState.state == ON) {
+ logInfo("zoneminder.rules", "ZoneMinder Alarm started")
+ }
+ else if (zmMonitor1_EventState.state == OFF) {
+ logInfo("zoneminder.rules", "ZoneMinder Alarm stopped")
+ }
+end
+
+rule "Monitor1 Recording State"
+when
+ Item zmMonitor1_Recording changed
+then
+ if (zmMonitor1_Recording.state == ON) {
+ logInfo("zoneminder.rules", "ZoneMinder recording started")
+ }
+ else if (zmMonitor1_Recording.state == OFF) {
+ logInfo("zoneminder.rules", "ZoneMinder recording stopped")
+ }
+end
+
+
+rule "Change Monitor1 Mode"
+when
+ Item zmMonitor1_Mode changed
+then
+ if (zmMonitor1_Mode.state==ON) {
+ sendCommand(zmMonitor1_Function, "Modect")
+ sendCommand(zmMonitor1_Enabled, ON)
+ }
+ else {
+ sendCommand(zmMonitor1_Function, "Monitor")
+ sendCommand(zmMonitor1_Enabled, OFF)
+ }
+end
+```
+
+
+###Sitemap configuration###
+
+```
+sitemap zoneminder label="Zoneminder"
+{
+ Frame {
+ Text item=zmServer_Online label="ZoneMinder Server [%s]" {
+ Frame {
+ Text item=zmServer_Online
+ Text item=zmServer_CpuLoad
+ Text item=zmServer_DiskUsage
+ }
+ }
+
+ Text item=zmMonitor1_Function label="(Monitor-1) [%s]" {
+ Frame {
+ Switch item=zmMonitor1_Enabled
+ Switch item=zmMonitor1_ForceAlarm
+ Text item=zmMonitor1_Online
+ Selection item=zmMonitor1_Function mappings=["None"=None, "Modect"=Modect, "Monitor"=Monitor, "Record"=Record, "Mocord"=Mocord, "Nodect"=Nodect]
+ Text item=zmMonitor1_EventState
+ Text item=zmMonitor1_Recording
+ Text item=zmMonitor1_DetailedStatus
+ Text item=zmMonitor1_EventCause
+ Text item=zmMonitor1_CaptureState
+ Text item=zmMonitor1_AnalysisState
+ Text item=zmMonitor1_FrameState
+ }
+ }
+ Frame label="Monitor Helpers" {
+ Switch item=zmMonitor1_Mode
+ }
+ }
+}
+```
+##Troubleshooting##
+
+
+
Problem
Solution
+
Cannot connect to ZoneMinder Bridge
Check if you can logon to ZoneMinder from your openHAB server (with http).
+
Check that it is possible to establish a Telnet connection from openHAB server to Zoneminder Server
+
ZoneMinder Bridge is not comming ONLINE. It says: 'OFFLINE - COMMUNICATION_ERROR Cannot access ZoneMinder Server. Check provided usercredentials'
Check that the hostname is valid, if using a DNS name, make sure name is correct resolved. Also check that the given host can be accessed from a browser. Finally make sure to change the additional path from '/zm', if not using standard setup.
+
Cannot connect to ZoneMinder Bridge via HTTPS, using Letsencrypt certificate
Verify your Java version, if Java is below build 101, letsencrypt certificate isn't known by Java. Either use HTTP or upgrade Java to newest build. Please be aware that https support is provided as an experimental feature.
+
I have tried all of the above, it still doesn't work
Try to execute this from a commandline (on your openHAB server): curl -d "=XXXX&=YYYY&action=login&view=console" -c cookies.txt http:///zm/index.php. Change , and to the actual values. This will check if your server is accessible from the openHAB server.
+
diff --git a/addons/archetype-catalog.xml b/addons/binding/archetype-catalog.xml
similarity index 100%
rename from addons/archetype-catalog.xml
rename to addons/binding/archetype-catalog.xml
diff --git a/addons/binding/create_openhab_binding_skeleton.cmd b/addons/binding/create_openhab_binding_skeleton.cmd
index e881130d243bc..a6f7cbc9058bd 100644
--- a/addons/binding/create_openhab_binding_skeleton.cmd
+++ b/addons/binding/create_openhab_binding_skeleton.cmd
@@ -1,16 +1,16 @@
-@echo off
-
-
-SETLOCAL
-SET ARGC=0
-
-FOR %%x IN (%*) DO SET /A ARGC+=1
-
-IF %ARGC% NEQ 2 (
- echo Usage: %0 BindingIdInCamelCase BindingIdInLowerCase
- exit /B 1
-)
-
-mvn archetype:generate -N -DarchetypeGroupId=org.eclipse.smarthome.archetype -DarchetypeArtifactId=org.eclipse.smarthome.archetype.binding -DarchetypeVersion=0.9.0-SNAPSHOT -DgroupId=org.openhab.binding -DartifactId=org.openhab.binding.%2 -Dpackage=org.openhab.binding.%2 -DarchetypeCatalog='file://../archetype-catalog.xml' -Dversion=2.0.0-SNAPSHOT -DbindingId=%2 -DbindingIdCamelCase=%1 -DvendorName=openHAB -Dnamespace=org.openhab
-
+@echo off
+
+
+SETLOCAL
+SET ARGC=0
+
+FOR %%x IN (%*) DO SET /A ARGC+=1
+
+IF %ARGC% NEQ 2 (
+ echo Usage: %0 BindingIdInCamelCase BindingIdInLowerCase
+ exit /B 1
+)
+
+mvn archetype:generate -N -DarchetypeGroupId=org.eclipse.smarthome.archetype -DarchetypeArtifactId=org.eclipse.smarthome.archetype.binding -DarchetypeVersion=0.9.0-SNAPSHOT -DgroupId=org.openhab.binding -DartifactId=org.openhab.binding.%2 -Dpackage=org.openhab.binding.%2 -DarchetypeCatalog='file://../archetype-catalog.xml' -Dversion=2.0.0-SNAPSHOT -DbindingId=%2 -DbindingIdCamelCase=%1 -DvendorName=openHAB -Dnamespace=org.openhab
+
ENDLOCAL
\ No newline at end of file
diff --git a/addons/binding/create_openhab_binding_skeleton.sh b/addons/binding/create_openhab_binding_skeleton.sh
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/hardware/FritzahaContentExchange.java b/addons/binding/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/hardware/FritzahaContentExchange.java
index d7c4eec55a6b4..22d92a52f9c0b 100644
--- a/addons/binding/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/hardware/FritzahaContentExchange.java
+++ b/addons/binding/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/hardware/FritzahaContentExchange.java
@@ -1,73 +1,73 @@
-/**
- * Copyright (c) 2014-2016 by the respective copyright holders.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- */
-package org.openhab.binding.avmfritz.internal.hardware;
-
-import org.eclipse.jetty.client.api.Response;
-import org.eclipse.jetty.client.api.Response.CompleteListener;
-import org.eclipse.jetty.client.api.Response.ContentListener;
-import org.eclipse.jetty.client.api.Response.FailureListener;
-import org.eclipse.jetty.client.api.Response.SuccessListener;
-import org.eclipse.jetty.client.api.Result;
-import org.eclipse.jetty.client.util.BufferingResponseListener;
-import org.openhab.binding.avmfritz.internal.hardware.callbacks.FritzAhaCallback;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Implementation of Jetty ContextExchange to handle callbacks
- *
- * @author Robert Bausdorf
- *
- */
-public class FritzahaContentExchange extends BufferingResponseListener
- implements SuccessListener, FailureListener, ContentListener, CompleteListener {
- /**
- * logger
- */
- private final Logger logger = LoggerFactory.getLogger(this.getClass());
-
- /**
- * Callback to execute on complete response
- */
- private FritzAhaCallback callback;
-
- /**
- * Constructor
- *
- * @param callback Callback which execute method has to be called.
- */
- public FritzahaContentExchange(FritzAhaCallback callback) {
- this.callback = callback;
- }
-
- /**
- * Log request success
- */
- @Override
- public void onSuccess(Response response) {
- logger.debug("HTTP response {}", response.getStatus());
- }
-
- /**
- * Log request failure
- */
- @Override
- public void onFailure(Response response, Throwable failure) {
- logger.debug(failure.getLocalizedMessage());
- }
-
- /**
- * Call the callbacks execute method on request completion.
- */
- @Override
- public void onComplete(Result result) {
- logger.debug("response complete: " + this.getContentAsString());
- this.callback.execute(result.getResponse().getStatus(), this.getContentAsString());
- }
-}
+/**
+ * Copyright (c) 2014-2016 by the respective copyright holders.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.openhab.binding.avmfritz.internal.hardware;
+
+import org.eclipse.jetty.client.api.Response;
+import org.eclipse.jetty.client.api.Response.CompleteListener;
+import org.eclipse.jetty.client.api.Response.ContentListener;
+import org.eclipse.jetty.client.api.Response.FailureListener;
+import org.eclipse.jetty.client.api.Response.SuccessListener;
+import org.eclipse.jetty.client.api.Result;
+import org.eclipse.jetty.client.util.BufferingResponseListener;
+import org.openhab.binding.avmfritz.internal.hardware.callbacks.FritzAhaCallback;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Implementation of Jetty ContextExchange to handle callbacks
+ *
+ * @author Robert Bausdorf
+ *
+ */
+public class FritzahaContentExchange extends BufferingResponseListener
+ implements SuccessListener, FailureListener, ContentListener, CompleteListener {
+ /**
+ * logger
+ */
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
+ /**
+ * Callback to execute on complete response
+ */
+ private FritzAhaCallback callback;
+
+ /**
+ * Constructor
+ *
+ * @param callback Callback which execute method has to be called.
+ */
+ public FritzahaContentExchange(FritzAhaCallback callback) {
+ this.callback = callback;
+ }
+
+ /**
+ * Log request success
+ */
+ @Override
+ public void onSuccess(Response response) {
+ logger.debug("HTTP response {}", response.getStatus());
+ }
+
+ /**
+ * Log request failure
+ */
+ @Override
+ public void onFailure(Response response, Throwable failure) {
+ logger.debug(failure.getLocalizedMessage());
+ }
+
+ /**
+ * Call the callbacks execute method on request completion.
+ */
+ @Override
+ public void onComplete(Result result) {
+ logger.debug("response complete: " + this.getContentAsString());
+ this.callback.execute(result.getResponse().getStatus(), this.getContentAsString());
+ }
+}
diff --git a/addons/binding/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/hardware/callbacks/FritzAhaCallback.java b/addons/binding/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/hardware/callbacks/FritzAhaCallback.java
index 461ce44bdb635..9cb3a0b1d1b0e 100644
--- a/addons/binding/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/hardware/callbacks/FritzAhaCallback.java
+++ b/addons/binding/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/hardware/callbacks/FritzAhaCallback.java
@@ -1,34 +1,34 @@
-/**
- * Copyright (c) 2014-2016 by the respective copyright holders.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- */
-package org.openhab.binding.avmfritz.internal.hardware.callbacks;
-
-/**
- * Interface for callbacks in asynchronous requests.
- *
- * @author Robert Bausdorf
- *
- */
-public interface FritzAhaCallback {
- /**
- * Runs callback code after response completion.
- */
- void execute(int status, String response);
-
- /**
- * Get the URI path
- * @return URI path as String
- */
- public String getPath();
-
- /**
- * Get the query String
- * @return Query string as String
- */
- public String getArgs();
-}
+/**
+ * Copyright (c) 2014-2016 by the respective copyright holders.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.openhab.binding.avmfritz.internal.hardware.callbacks;
+
+/**
+ * Interface for callbacks in asynchronous requests.
+ *
+ * @author Robert Bausdorf
+ *
+ */
+public interface FritzAhaCallback {
+ /**
+ * Runs callback code after response completion.
+ */
+ void execute(int status, String response);
+
+ /**
+ * Get the URI path
+ * @return URI path as String
+ */
+ public String getPath();
+
+ /**
+ * Get the query String
+ * @return Query string as String
+ */
+ public String getArgs();
+}
diff --git a/addons/binding/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/hardware/callbacks/FritzAhaReauthCallback.java b/addons/binding/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/hardware/callbacks/FritzAhaReauthCallback.java
index dd95b6df9deb8..f4718b074ac62 100644
--- a/addons/binding/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/hardware/callbacks/FritzAhaReauthCallback.java
+++ b/addons/binding/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/hardware/callbacks/FritzAhaReauthCallback.java
@@ -1,144 +1,144 @@
-/**
- * Copyright (c) 2014-2016 by the respective copyright holders.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- */
-package org.openhab.binding.avmfritz.internal.hardware.callbacks;
-
-import org.openhab.binding.avmfritz.internal.hardware.FritzahaWebInterface;
-
-/**
- * Callback implementation for reauthorization and retry
- *
- * @author Robert Bausdorf, Christian Brauers
- *
- */
-public class FritzAhaReauthCallback implements FritzAhaCallback {
-
- public static final String WEBSERVICE_PATH = "webservices/homeautoswitch.lua";
- /**
- * Path to HTTP interface
- */
- private String path;
- /**
- * Arguments to use
- */
- private String args;
- /**
- * Web interface to use
- */
- private FritzahaWebInterface webIface;
-
- /**
- * HTTP Method for callback retries
- */
- public enum Method {
- POST, GET
- };
-
- /**
- * Method used
- */
- private Method httpMethod;
- /**
- * Number of remaining retries
- */
- private int retries;
- /**
- * Whether the request returned a valid response
- */
- private boolean validRequest;
- /**
- * Callback to execute on next retry
- */
- private FritzAhaCallback retryCallback;
-
- /**
- * Returns whether the request returned a valid response
- *
- * @return Validity of response
- */
- public boolean isValidRequest() {
- return validRequest;
- }
-
- /**
- * Returns whether there will be another retry on an invalid response
- *
- * @return true if there will be no more retries, false otherwise
- */
- public boolean isFinalAttempt() {
- return retries <= 0;
- }
-
- /**
- * Sets different Callback to use on retry (initial value: same callback
- * after decremented retry counter)
- *
- * @param newRetryCallback
- * Callback to retry with
- */
- public void setRetryCallback(FritzAhaCallback newRetryCallback) {
- retryCallback = newRetryCallback;
- }
-
-
- public String getPath() {
- return path;
- }
-
- public String getArgs() {
- return args;
- }
-
-
- public FritzahaWebInterface getWebIface() {
- return webIface;
- }
-
- /**
- * {@inheritDoc}
- */
- public void execute(int status, String response) {
- if (status != 200 || "".equals(response) || ".".equals(response)) {
- validRequest = false;
- if (retries >= 1) {
- webIface.authenticate();
- retries--;
- if (httpMethod == Method.GET) {
- webIface.asyncGet(path, args, retryCallback);
- } else if (httpMethod == Method.POST) {
- webIface.asyncPost(path, args, retryCallback);
- }
- }
- } else
- validRequest = true;
- }
-
- /**
- * Constructor for retriable authentication
- *
- * @param path
- * Path to HTTP interface
- * @param args
- * Arguments to use
- * @param webIface
- * Web interface to use
- * @param httpMethod
- * Method used
- * @param retries
- * Number of retries
- */
- public FritzAhaReauthCallback(String path, String args, FritzahaWebInterface webIface, Method httpMethod,
- int retries) {
- this.path = path;
- this.args = args;
- this.webIface = webIface;
- this.httpMethod = httpMethod;
- this.retries = retries;
- retryCallback = this;
- }
-}
+/**
+ * Copyright (c) 2014-2016 by the respective copyright holders.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.openhab.binding.avmfritz.internal.hardware.callbacks;
+
+import org.openhab.binding.avmfritz.internal.hardware.FritzahaWebInterface;
+
+/**
+ * Callback implementation for reauthorization and retry
+ *
+ * @author Robert Bausdorf, Christian Brauers
+ *
+ */
+public class FritzAhaReauthCallback implements FritzAhaCallback {
+
+ public static final String WEBSERVICE_PATH = "webservices/homeautoswitch.lua";
+ /**
+ * Path to HTTP interface
+ */
+ private String path;
+ /**
+ * Arguments to use
+ */
+ private String args;
+ /**
+ * Web interface to use
+ */
+ private FritzahaWebInterface webIface;
+
+ /**
+ * HTTP Method for callback retries
+ */
+ public enum Method {
+ POST, GET
+ };
+
+ /**
+ * Method used
+ */
+ private Method httpMethod;
+ /**
+ * Number of remaining retries
+ */
+ private int retries;
+ /**
+ * Whether the request returned a valid response
+ */
+ private boolean validRequest;
+ /**
+ * Callback to execute on next retry
+ */
+ private FritzAhaCallback retryCallback;
+
+ /**
+ * Returns whether the request returned a valid response
+ *
+ * @return Validity of response
+ */
+ public boolean isValidRequest() {
+ return validRequest;
+ }
+
+ /**
+ * Returns whether there will be another retry on an invalid response
+ *
+ * @return true if there will be no more retries, false otherwise
+ */
+ public boolean isFinalAttempt() {
+ return retries <= 0;
+ }
+
+ /**
+ * Sets different Callback to use on retry (initial value: same callback
+ * after decremented retry counter)
+ *
+ * @param newRetryCallback
+ * Callback to retry with
+ */
+ public void setRetryCallback(FritzAhaCallback newRetryCallback) {
+ retryCallback = newRetryCallback;
+ }
+
+
+ public String getPath() {
+ return path;
+ }
+
+ public String getArgs() {
+ return args;
+ }
+
+
+ public FritzahaWebInterface getWebIface() {
+ return webIface;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void execute(int status, String response) {
+ if (status != 200 || "".equals(response) || ".".equals(response)) {
+ validRequest = false;
+ if (retries >= 1) {
+ webIface.authenticate();
+ retries--;
+ if (httpMethod == Method.GET) {
+ webIface.asyncGet(path, args, retryCallback);
+ } else if (httpMethod == Method.POST) {
+ webIface.asyncPost(path, args, retryCallback);
+ }
+ }
+ } else
+ validRequest = true;
+ }
+
+ /**
+ * Constructor for retriable authentication
+ *
+ * @param path
+ * Path to HTTP interface
+ * @param args
+ * Arguments to use
+ * @param webIface
+ * Web interface to use
+ * @param httpMethod
+ * Method used
+ * @param retries
+ * Number of retries
+ */
+ public FritzAhaReauthCallback(String path, String args, FritzahaWebInterface webIface, Method httpMethod,
+ int retries) {
+ this.path = path;
+ this.args = args;
+ this.webIface = webIface;
+ this.httpMethod = httpMethod;
+ this.retries = retries;
+ retryCallback = this;
+ }
+}
diff --git a/addons/binding/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/hardware/callbacks/FritzAhaSetSwitchCallback.java b/addons/binding/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/hardware/callbacks/FritzAhaSetSwitchCallback.java
index f62fa6f29bd1f..be3c72b23a67d 100644
--- a/addons/binding/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/hardware/callbacks/FritzAhaSetSwitchCallback.java
+++ b/addons/binding/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/hardware/callbacks/FritzAhaSetSwitchCallback.java
@@ -1,50 +1,50 @@
-/**
- * Copyright (c) 2014-2016 by the respective copyright holders.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- */
-package org.openhab.binding.avmfritz.internal.hardware.callbacks;
-
-import org.openhab.binding.avmfritz.internal.hardware.FritzahaWebInterface;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Callback implementation for updating switch states Supports reauthorization
- *
- * @author Robert Bausdorf
- *
- */
-public class FritzAhaSetSwitchCallback extends FritzAhaReauthCallback {
- private final Logger logger = LoggerFactory.getLogger(this.getClass());
- /**
- * Item to update
- */
- private String itemName;
-
- /**
- * Constructor
- * @param webIface Interface to FRITZ!Box
- * @param ain AIN of the device that should be switched
- * @param switchOn true - switch on, false - switch off
- */
- public FritzAhaSetSwitchCallback(FritzahaWebInterface webIface, String ain, boolean switchOn) {
- super(WEBSERVICE_PATH,
- "ain=" + ain + "&switchcmd=" + (switchOn ? "setswitchon" : "setswitchoff"),
- webIface, Method.GET, 1);
- this.itemName = ain;
- }
-
- /**
- * {@inheritDoc}
- */
- public void execute(int status, String response) {
- super.execute(status, response);
- if (this.isValidRequest()) {
- logger.debug("Received State response " + response + " for item " + itemName);
- }
- }
-}
+/**
+ * Copyright (c) 2014-2016 by the respective copyright holders.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.openhab.binding.avmfritz.internal.hardware.callbacks;
+
+import org.openhab.binding.avmfritz.internal.hardware.FritzahaWebInterface;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Callback implementation for updating switch states Supports reauthorization
+ *
+ * @author Robert Bausdorf
+ *
+ */
+public class FritzAhaSetSwitchCallback extends FritzAhaReauthCallback {
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
+ /**
+ * Item to update
+ */
+ private String itemName;
+
+ /**
+ * Constructor
+ * @param webIface Interface to FRITZ!Box
+ * @param ain AIN of the device that should be switched
+ * @param switchOn true - switch on, false - switch off
+ */
+ public FritzAhaSetSwitchCallback(FritzahaWebInterface webIface, String ain, boolean switchOn) {
+ super(WEBSERVICE_PATH,
+ "ain=" + ain + "&switchcmd=" + (switchOn ? "setswitchon" : "setswitchoff"),
+ webIface, Method.GET, 1);
+ this.itemName = ain;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void execute(int status, String response) {
+ super.execute(status, response);
+ if (this.isValidRequest()) {
+ logger.debug("Received State response " + response + " for item " + itemName);
+ }
+ }
+}
diff --git a/addons/binding/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/hardware/callbacks/FritzAhaUpdateXmlCallback.java b/addons/binding/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/hardware/callbacks/FritzAhaUpdateXmlCallback.java
index bc085e3377e63..c851b9bcc0731 100644
--- a/addons/binding/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/hardware/callbacks/FritzAhaUpdateXmlCallback.java
+++ b/addons/binding/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/hardware/callbacks/FritzAhaUpdateXmlCallback.java
@@ -1,84 +1,84 @@
-/**
- * Copyright (c) 2014-2016 by the respective copyright holders.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- */
-package org.openhab.binding.avmfritz.internal.hardware.callbacks;
-
-import java.io.StringReader;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
-
-import org.eclipse.smarthome.core.thing.ThingStatus;
-import org.eclipse.smarthome.core.thing.ThingStatusDetail;
-import org.openhab.binding.avmfritz.handler.IFritzHandler;
-import org.openhab.binding.avmfritz.internal.ahamodel.DeviceModel;
-import org.openhab.binding.avmfritz.internal.ahamodel.DevicelistModel;
-import org.openhab.binding.avmfritz.internal.hardware.FritzahaWebInterface;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Callback implementation for updating multiple numbers decoded from a xml
- * response. Supports reauthorization.
- *
- * @author Robert Bausdorf
- *
- */
-public class FritzAhaUpdateXmlCallback extends FritzAhaReauthCallback {
- /**
- * logger
- */
- private final Logger logger = LoggerFactory.getLogger(this.getClass());
-
- /**
- * Handler to update
- */
- private IFritzHandler handler;
-
- /**
- * Constructor
- * @param webIface Webinterface to FRITZ!Box
- * @param handler Bridge handler taht will update things.
- */
- public FritzAhaUpdateXmlCallback(FritzahaWebInterface webIface, IFritzHandler handler) {
- super(WEBSERVICE_PATH, "switchcmd=getdevicelistinfos", webIface, Method.GET, 1);
- this.handler = handler;
- }
-
- /**
- * {@inheritDoc}
- */
- public void execute(int status, String response) {
- super.execute(status, response);
- if (this.isValidRequest()) {
- logger.trace("Received State response " + response);
- try {
- JAXBContext jaxbContext = JAXBContext
- .newInstance(DevicelistModel.class);
- Unmarshaller jaxbUM = jaxbContext.createUnmarshaller();
-
- DevicelistModel model = (DevicelistModel) jaxbUM
- .unmarshal(new StringReader(response));
- if( model != null ) {
- for( DeviceModel device : model.getDevicelist() ) {
- handler.addDeviceList(device);
- }
- handler.setStatusInfo(ThingStatus.ONLINE,
- ThingStatusDetail.NONE, "FritzBox online");
- } else {
- logger.warn("no model in response");
- }
- } catch (JAXBException e) {
- logger.error(e.getLocalizedMessage(), e);
- }
- } else {
- logger.info("request is invalid: " + status);
- }
- }
-}
+/**
+ * Copyright (c) 2014-2016 by the respective copyright holders.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.openhab.binding.avmfritz.internal.hardware.callbacks;
+
+import java.io.StringReader;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+
+import org.eclipse.smarthome.core.thing.ThingStatus;
+import org.eclipse.smarthome.core.thing.ThingStatusDetail;
+import org.openhab.binding.avmfritz.handler.IFritzHandler;
+import org.openhab.binding.avmfritz.internal.ahamodel.DeviceModel;
+import org.openhab.binding.avmfritz.internal.ahamodel.DevicelistModel;
+import org.openhab.binding.avmfritz.internal.hardware.FritzahaWebInterface;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Callback implementation for updating multiple numbers decoded from a xml
+ * response. Supports reauthorization.
+ *
+ * @author Robert Bausdorf
+ *
+ */
+public class FritzAhaUpdateXmlCallback extends FritzAhaReauthCallback {
+ /**
+ * logger
+ */
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
+ /**
+ * Handler to update
+ */
+ private IFritzHandler handler;
+
+ /**
+ * Constructor
+ * @param webIface Webinterface to FRITZ!Box
+ * @param handler Bridge handler taht will update things.
+ */
+ public FritzAhaUpdateXmlCallback(FritzahaWebInterface webIface, IFritzHandler handler) {
+ super(WEBSERVICE_PATH, "switchcmd=getdevicelistinfos", webIface, Method.GET, 1);
+ this.handler = handler;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void execute(int status, String response) {
+ super.execute(status, response);
+ if (this.isValidRequest()) {
+ logger.trace("Received State response " + response);
+ try {
+ JAXBContext jaxbContext = JAXBContext
+ .newInstance(DevicelistModel.class);
+ Unmarshaller jaxbUM = jaxbContext.createUnmarshaller();
+
+ DevicelistModel model = (DevicelistModel) jaxbUM
+ .unmarshal(new StringReader(response));
+ if( model != null ) {
+ for( DeviceModel device : model.getDevicelist() ) {
+ handler.addDeviceList(device);
+ }
+ handler.setStatusInfo(ThingStatus.ONLINE,
+ ThingStatusDetail.NONE, "FritzBox online");
+ } else {
+ logger.warn("no model in response");
+ }
+ } catch (JAXBException e) {
+ logger.error(e.getLocalizedMessage(), e);
+ }
+ } else {
+ logger.info("request is invalid: " + status);
+ }
+ }
+}
diff --git a/addons/binding/org.openhab.binding.max.test/.classpath b/addons/binding/org.openhab.binding.max.test/.classpath
index 0b00a0280ed45..bc938b62884fd 100644
--- a/addons/binding/org.openhab.binding.max.test/.classpath
+++ b/addons/binding/org.openhab.binding.max.test/.classpath
@@ -1,9 +1,9 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/addons/binding/org.openhab.binding.max.test/.groovy/suggestions.xdsl b/addons/binding/org.openhab.binding.max.test/.groovy/suggestions.xdsl
index 1ce9852b140c0..f5bf460b7522c 100644
--- a/addons/binding/org.openhab.binding.max.test/.groovy/suggestions.xdsl
+++ b/addons/binding/org.openhab.binding.max.test/.groovy/suggestions.xdsl
@@ -1,2 +1,2 @@
-
-
+
+
diff --git a/addons/binding/org.openhab.binding.max.test/.settings/org.eclipse.jdt.groovy.core.prefs b/addons/binding/org.openhab.binding.max.test/.settings/org.eclipse.jdt.groovy.core.prefs
index a68b5bf397081..65c6dc88b43da 100644
--- a/addons/binding/org.openhab.binding.max.test/.settings/org.eclipse.jdt.groovy.core.prefs
+++ b/addons/binding/org.openhab.binding.max.test/.settings/org.eclipse.jdt.groovy.core.prefs
@@ -1,2 +1,2 @@
-eclipse.preferences.version=1
-groovy.compiler.level=-1
+eclipse.preferences.version=1
+groovy.compiler.level=-1
diff --git a/addons/binding/org.openhab.binding.max.test/.settings/org.eclipse.pde.core.prefs b/addons/binding/org.openhab.binding.max.test/.settings/org.eclipse.pde.core.prefs
index e313d3c3b6b38..923c37fb8d55b 100644
--- a/addons/binding/org.openhab.binding.max.test/.settings/org.eclipse.pde.core.prefs
+++ b/addons/binding/org.openhab.binding.max.test/.settings/org.eclipse.pde.core.prefs
@@ -1,2 +1,2 @@
-eclipse.preferences.version=1
-resolve.requirebundle=false
+eclipse.preferences.version=1
+resolve.requirebundle=false
diff --git a/addons/binding/org.openhab.binding.max.test/META-INF/MANIFEST.MF b/addons/binding/org.openhab.binding.max.test/META-INF/MANIFEST.MF
index d975b3d4243a0..0dedc8c13c0cd 100644
--- a/addons/binding/org.openhab.binding.max.test/META-INF/MANIFEST.MF
+++ b/addons/binding/org.openhab.binding.max.test/META-INF/MANIFEST.MF
@@ -1,26 +1,26 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Openhab Max! Binding Tests
-Bundle-SymbolicName: org.openhab.binding.max.test;singleton:=true
-Bundle-Version: 2.1.0.qualifier
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
-Bundle-Vendor: Openhab
-Fragment-Host: org.openhab.binding.max
-Import-Package: groovy.json,
- groovy.lang,
- org.codehaus.groovy.reflection,
- org.codehaus.groovy.runtime,
- org.codehaus.groovy.runtime.callsite,
- org.codehaus.groovy.runtime.typehandling,
- org.eclipse.smarthome.core.events,
- org.eclipse.smarthome.core.thing.util,
- org.eclipse.smarthome.test,
- org.eclipse.smarthome.test.storage,
- org.hamcrest;core=split,
- org.openhab.binding.max,
- org.osgi.service.device,
- org.slf4j
-Require-Bundle: org.junit;bundle-version="4.11.0"
-Export-Package: org.openhab.binding.max.internal.message;x-internal:=true,
- org.openhab.binding.max.test;uses:="org.eclipse.smarthome.test"
-
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Openhab Max! Binding Tests
+Bundle-SymbolicName: org.openhab.binding.max.test;singleton:=true
+Bundle-Version: 2.1.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-Vendor: Openhab
+Fragment-Host: org.openhab.binding.max
+Import-Package: groovy.json,
+ groovy.lang,
+ org.codehaus.groovy.reflection,
+ org.codehaus.groovy.runtime,
+ org.codehaus.groovy.runtime.callsite,
+ org.codehaus.groovy.runtime.typehandling,
+ org.eclipse.smarthome.core.events,
+ org.eclipse.smarthome.core.thing.util,
+ org.eclipse.smarthome.test,
+ org.eclipse.smarthome.test.storage,
+ org.hamcrest;core=split,
+ org.openhab.binding.max,
+ org.osgi.service.device,
+ org.slf4j
+Require-Bundle: org.junit;bundle-version="4.11.0"
+Export-Package: org.openhab.binding.max.internal.message;x-internal:=true,
+ org.openhab.binding.max.test;uses:="org.eclipse.smarthome.test"
+
diff --git a/addons/binding/org.openhab.binding.max.test/MaxBindingTests.launch b/addons/binding/org.openhab.binding.max.test/MaxBindingTests.launch
index 542fab481d331..935c5473c823c 100644
--- a/addons/binding/org.openhab.binding.max.test/MaxBindingTests.launch
+++ b/addons/binding/org.openhab.binding.max.test/MaxBindingTests.launch
@@ -1,45 +1,45 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/binding/org.openhab.binding.max.test/sample/sampleMessage.txt b/addons/binding/org.openhab.binding.max.test/sample/sampleMessage.txt
index dfe346ac57615..0cb2df31149e8 100644
--- a/addons/binding/org.openhab.binding.max.test/sample/sampleMessage.txt
+++ b/addons/binding/org.openhab.binding.max.test/sample/sampleMessage.txt
@@ -1,12 +1,12 @@
-H:KEQ0565026,0b5951,0113,00000000,4eed6795,01,32,0f0113,0f34,03,0000
-M:00,01,VgIFAQhiYWRrYW1lcgsNowIMU3R1ZGVlcmthbWVyB7bnAwlXb29ua2FtZXIL6aIEDFN6b25qYSBLYW1lcgjDSQUGWm9sZGVyCMHWCAILDaNLRVEwNTQ0MjQyEUJhZGthbWVyIFJhZGlhdG9yAQEHtudLRVEwMTQ1MTcyFVJhZGlhdG9yIFN0dWRlZXJrYW1lcgIDDhXMTEVRMDAxNTM0MBlXYWxsIFRoZXJtb3N0YXQgV29vbmthbWVyAwEL6aJLRVE5MDE1NDMyG1BsdWcgQWRhcHRlciBNdXVydmVyd2FybWluZwMFBDNvSkVRMDM4MDg3OBdFY28gU3dpdGNoIFN0dWRlZXJrYW1lcgAEDnX2S0VRMTEwNDM4MBpXaW5kb3cgU2Vuc29yIFN0dWRlZXJrYW1lcgIBCMNJS0VRMDY0ODk0ORJUaGVybW9zdGFhdCBTem9uamEEAQjB1ktFUTA2NDkzMTIRU3R1ZGVlcmthbWVyIElybWEFAQ==
-C:0b5951,7QtZUQATAf9LRVEwNTY1MDI2AQsABEAAAAAAAAAAQQAAAAAAAAAAAAAAAAAAAAAAAAAAAAsABEAAAAAAAAAAQgAAAAAAAAAAAAAAAAAAAAAAAAAAAGh0dHA6Ly9tYXguZXEtMy5kZTo4MC9jdWJlADAvbG9va3VwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAENFVAAACgADAAAOEENFU1QAAwACAAAcIA==
-C:0b0da3,0gsNowIBEABLRVEwNTQ0MjQyLCQ9CQcYAzAM/wBIYViRSP1ZFE0gTSBNIEUgRSBFIEUgRSBFIEhhWJFQ/VkVUSBRIFEgRSBFIEUgRSBFIEUgSFBYWkj+WRRNIE0gTSBFIEUgRSBFIEUgRSBIUFhaSP5ZFE0gTSBNIEUgRSBFIEUgRSBFIEhQWFpI/lkUTSBNIE0gRSBFIEUgRSBFIEUgSFBYWkj+WRRNIE0gTSBFIEUgRSBFIEUgRSBIUFhaSP5ZFE0gTSBNIEUgRSBFIEUgRSBFIA==
-C:08c1d6,0gjB1gEFGP9LRVEwNjQ5MzEyKyE9CQcYAzAM/wBEeFUgVSBVIFUgVSBVIEUgRSBFIEUgRSBFIER4VRZFIEUgRSBFIEUgRSBFIEUgRSBFIEUgRFFEYkTkTQ9FIEUgRSBFIEUgRSBFIEUgRSBEUURiRORND0UgRSBFIEUgRSBFIEUgRSBFIERRRGJE5E0PRSBFIEUgRSBFIEUgRSBFIEUgRFFEYkTkTQ9FIEUgRSBFIEUgRSBFIEUgRSBEUURiRORRGEUgRSBFIEUgRSBFIEUgRSBFIA==
-C:0e75f6,EQ519gQCEABLRVExMTA0Mzgw
-C:04336f,EQQzbwUAEg9KRVEwMzgwODc4
-C:0be9a2,0gvpogEDEapLRVE5MDE1NDMyKyE9CQcYAzAM/wBEbFkgWSBZIFkgWSBZIEUgRSBFIEUgRSBFIERgWSBZIFkgWSBZIFkgRSBFIEUgRSBFIEUgRFFUYUTYWSBZIFkgWSBFIEUgRSBFIEUgRSBEUVRhRNhZIFkgWSBZIEUgRSBFIEUgRSBFIERRVGFE2FkgWSBZIFkgRSBFIEUgRSBFIEUgRFFUYUTYWSBZIFkgWSBFIEUgRSBFIEUgRSBEUVRhRNhZIFkgWSBZIEUgRSBFIEUgRSBFIA==
-C:0e15cc,zg4VzAMDEP9MRVEwMDE1MzQwKyE9CURsWSBZIFkgWSBZIFkgRSBFIEUgRSBFIEUgRGBZIFkgWSBZIFkgWSBFIEUgRSBFIEUgRSBEUVRhRNhZIFkgWSBZIEUgRSBFIEUgRSBFIERRVGFE2FkgWSBZIFkgRSBFIEUgRSBFIEUgRFFUYUTYWSBZIFkgWSBFIEUgRSBFIEUgRSBEUVRhRNhZIFkgWSBZIEUgRSBFIEUgRSBFIERRVGFE2FkgWSBZIFkgRSBFIEUgRSBFIEUgBxgw
-C:08c349,0gjDSQEEGP9LRVEwNjQ4OTQ5KiA9CQcYAzAM/wBEbFUKRSBFIEUgRSBFIEUgRSBFIEUgRSBFIERgVQlFIEUgRSBFIEUgRSBFIEUgRSBFIEUgRFFUYUS0VQNFIEUgRSBFIEUgRSBFIEUgRSBEUVRhRLRVA0UgRSBFIEUgRSBFIEUgRSBFIERRVGFEtFUDRSBFIEUgRSBFIEUgRSBFIEUgRFFUYUS0VQNFIEUgRSBFIEUgRSBFIEUgRSBEUVRhRLRVCkUgRSBFIEUgRSBFIEUgRSBFIA==
-C:07b6e7,0ge25wECGP9LRVEwMTQ1MTcyKyE9CQcYAzAM/wBEflUaRSBFIEUgRSBFIEUgRSBFIEUgRSBFIER+VRpFIEUgRSBFIEUgRSBFIEUgRSBFIEUgRFRUcEjSVRJJIEkgSSBFIEUgRSBFIEUgRSBEVFRwSNJVEkkgSSBJIEUgRSBFIEUgRSBFIERUVG9U01URSSBJIEkgRSBFIEUgRSBFIEUgRFRUcEjSVRJJIEkgSSBFIEUgRSBFIEUgRSBEVFRwSNJVEkkgSSBJIEUgRSBFIEUgRSBFIA==
-L:CwsNowkSGE0kALAACwjB1gkSGGAiAAAABg519gkSEAYEM28JAAALC+miCRIYACIAAAAMDhXMCRIYBCIAAACtCwjDSQkSGGQqAGMACwe25wkSGGQkAAAA
+H:KEQ0565026,0b5951,0113,00000000,4eed6795,01,32,0f0113,0f34,03,0000
+M:00,01,VgIFAQhiYWRrYW1lcgsNowIMU3R1ZGVlcmthbWVyB7bnAwlXb29ua2FtZXIL6aIEDFN6b25qYSBLYW1lcgjDSQUGWm9sZGVyCMHWCAILDaNLRVEwNTQ0MjQyEUJhZGthbWVyIFJhZGlhdG9yAQEHtudLRVEwMTQ1MTcyFVJhZGlhdG9yIFN0dWRlZXJrYW1lcgIDDhXMTEVRMDAxNTM0MBlXYWxsIFRoZXJtb3N0YXQgV29vbmthbWVyAwEL6aJLRVE5MDE1NDMyG1BsdWcgQWRhcHRlciBNdXVydmVyd2FybWluZwMFBDNvSkVRMDM4MDg3OBdFY28gU3dpdGNoIFN0dWRlZXJrYW1lcgAEDnX2S0VRMTEwNDM4MBpXaW5kb3cgU2Vuc29yIFN0dWRlZXJrYW1lcgIBCMNJS0VRMDY0ODk0ORJUaGVybW9zdGFhdCBTem9uamEEAQjB1ktFUTA2NDkzMTIRU3R1ZGVlcmthbWVyIElybWEFAQ==
+C:0b5951,7QtZUQATAf9LRVEwNTY1MDI2AQsABEAAAAAAAAAAQQAAAAAAAAAAAAAAAAAAAAAAAAAAAAsABEAAAAAAAAAAQgAAAAAAAAAAAAAAAAAAAAAAAAAAAGh0dHA6Ly9tYXguZXEtMy5kZTo4MC9jdWJlADAvbG9va3VwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAENFVAAACgADAAAOEENFU1QAAwACAAAcIA==
+C:0b0da3,0gsNowIBEABLRVEwNTQ0MjQyLCQ9CQcYAzAM/wBIYViRSP1ZFE0gTSBNIEUgRSBFIEUgRSBFIEhhWJFQ/VkVUSBRIFEgRSBFIEUgRSBFIEUgSFBYWkj+WRRNIE0gTSBFIEUgRSBFIEUgRSBIUFhaSP5ZFE0gTSBNIEUgRSBFIEUgRSBFIEhQWFpI/lkUTSBNIE0gRSBFIEUgRSBFIEUgSFBYWkj+WRRNIE0gTSBFIEUgRSBFIEUgRSBIUFhaSP5ZFE0gTSBNIEUgRSBFIEUgRSBFIA==
+C:08c1d6,0gjB1gEFGP9LRVEwNjQ5MzEyKyE9CQcYAzAM/wBEeFUgVSBVIFUgVSBVIEUgRSBFIEUgRSBFIER4VRZFIEUgRSBFIEUgRSBFIEUgRSBFIEUgRFFEYkTkTQ9FIEUgRSBFIEUgRSBFIEUgRSBEUURiRORND0UgRSBFIEUgRSBFIEUgRSBFIERRRGJE5E0PRSBFIEUgRSBFIEUgRSBFIEUgRFFEYkTkTQ9FIEUgRSBFIEUgRSBFIEUgRSBEUURiRORRGEUgRSBFIEUgRSBFIEUgRSBFIA==
+C:0e75f6,EQ519gQCEABLRVExMTA0Mzgw
+C:04336f,EQQzbwUAEg9KRVEwMzgwODc4
+C:0be9a2,0gvpogEDEapLRVE5MDE1NDMyKyE9CQcYAzAM/wBEbFkgWSBZIFkgWSBZIEUgRSBFIEUgRSBFIERgWSBZIFkgWSBZIFkgRSBFIEUgRSBFIEUgRFFUYUTYWSBZIFkgWSBFIEUgRSBFIEUgRSBEUVRhRNhZIFkgWSBZIEUgRSBFIEUgRSBFIERRVGFE2FkgWSBZIFkgRSBFIEUgRSBFIEUgRFFUYUTYWSBZIFkgWSBFIEUgRSBFIEUgRSBEUVRhRNhZIFkgWSBZIEUgRSBFIEUgRSBFIA==
+C:0e15cc,zg4VzAMDEP9MRVEwMDE1MzQwKyE9CURsWSBZIFkgWSBZIFkgRSBFIEUgRSBFIEUgRGBZIFkgWSBZIFkgWSBFIEUgRSBFIEUgRSBEUVRhRNhZIFkgWSBZIEUgRSBFIEUgRSBFIERRVGFE2FkgWSBZIFkgRSBFIEUgRSBFIEUgRFFUYUTYWSBZIFkgWSBFIEUgRSBFIEUgRSBEUVRhRNhZIFkgWSBZIEUgRSBFIEUgRSBFIERRVGFE2FkgWSBZIFkgRSBFIEUgRSBFIEUgBxgw
+C:08c349,0gjDSQEEGP9LRVEwNjQ4OTQ5KiA9CQcYAzAM/wBEbFUKRSBFIEUgRSBFIEUgRSBFIEUgRSBFIERgVQlFIEUgRSBFIEUgRSBFIEUgRSBFIEUgRFFUYUS0VQNFIEUgRSBFIEUgRSBFIEUgRSBEUVRhRLRVA0UgRSBFIEUgRSBFIEUgRSBFIERRVGFEtFUDRSBFIEUgRSBFIEUgRSBFIEUgRFFUYUS0VQNFIEUgRSBFIEUgRSBFIEUgRSBEUVRhRLRVCkUgRSBFIEUgRSBFIEUgRSBFIA==
+C:07b6e7,0ge25wECGP9LRVEwMTQ1MTcyKyE9CQcYAzAM/wBEflUaRSBFIEUgRSBFIEUgRSBFIEUgRSBFIER+VRpFIEUgRSBFIEUgRSBFIEUgRSBFIEUgRFRUcEjSVRJJIEkgSSBFIEUgRSBFIEUgRSBEVFRwSNJVEkkgSSBJIEUgRSBFIEUgRSBFIERUVG9U01URSSBJIEkgRSBFIEUgRSBFIEUgRFRUcEjSVRJJIEkgSSBFIEUgRSBFIEUgRSBEVFRwSNJVEkkgSSBJIEUgRSBFIEUgRSBFIA==
+L:CwsNowkSGE0kALAACwjB1gkSGGAiAAAABg519gkSEAYEM28JAAALC+miCRIYACIAAAAMDhXMCRIYBCIAAACtCwjDSQkSGGQqAGMACwe25wkSGGQkAAAA
diff --git a/addons/binding/org.openhab.binding.miele/OSGI-INF/MieleMDNSDiscoveryParticipant.xml b/addons/binding/org.openhab.binding.miele/OSGI-INF/MieleMDNSDiscoveryParticipant.xml
index fc94056247ef0..8e4ed752e3e94 100644
--- a/addons/binding/org.openhab.binding.miele/OSGI-INF/MieleMDNSDiscoveryParticipant.xml
+++ b/addons/binding/org.openhab.binding.miele/OSGI-INF/MieleMDNSDiscoveryParticipant.xml
@@ -1,21 +1,21 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
diff --git a/addons/binding/org.openhab.binding.netatmo/README.md b/addons/binding/org.openhab.binding.netatmo/README.md
index 6d9b6ef7d1730..43bf5c00bf487 100644
--- a/addons/binding/org.openhab.binding.netatmo/README.md
+++ b/addons/binding/org.openhab.binding.netatmo/README.md
@@ -1,274 +1,274 @@
----
-layout: documentation
----
-
-{% include base.html %}
-
-# Netatmo Binding
-
-The Netatmo binding integrates the following Netatmo products :
-- *Personal Weather Station*. Reports temperature, humidity, air pressure, carbon dioxide concentration in the air, as well as the ambient noise level.
-- *Thermostat*. Reports ambient temperature, allow to check target temperature, consult and change furnace heating status.
-
-See http://www.netatmo.com/ for details on their product.
-
-## Binding Configuration
-
-The binding has no configuration options itself, all configuration is done at 'Things' level but before, you'll have to grant openHab to access Netatmo API. Here is the procedure :
-
-### 1. Application creation
-Create an application at https://dev.netatmo.com/dev/createapp
-
-The variables you'll need to get to setup the binding are:
-* `` Your client ID taken from your App at https://dev.netatmo.com/dev/listapps
-* `` A token provided along with the ``.
-* `` The username you use to connect to the Netatmo API (usually your mail address).
-* `` The password attached to the above username.
-
-## 2.Bridge and Things Configuration
-
-Once you'll get needed informations from the Netatmo API, you'll be able to configure bridge and things.
-
-E.g.
-```
-Bridge netatmo:netatmoapi:home [ clientId="", clientSecret="", username = "", password = "", readStation=true|false, readThermostat=true|false] {
- Thing NAMain inside [ equipmentId="aa:aa:aa:aa:aa:aa", [refreshInterval=60000] ]
- Thing NAModule1 outside [ equipmentId="yy:yy:yy:yy:yy:yy", parentId="aa:aa:aa:aa:aa:aa" ]
- Thing NAPlug plugtherm [ equipmentId="bb:bb:bb:bb:bb:bb", [refreshInterval=60000] ]
- Thing NATherm1 thermostat [ equipmentId="xx:xx:xx:xx:xx:xx", parentId="bb:bb:bb:bb:bb:bb" ]
- ...
-}
-```
-
-### Configure Things
-
-The IDs for the modules can be extracted from the developer documentation on the netatmo site.
-First login with your user. Then some examples of the documentation contain the **real results** of your weather station. Get the IDs of your devices (indoor, outdoor, rain gauge) here:
-
-```
-https://dev.netatmo.com/doc/methods/devicelist
-```
-
-main_device is the ID of the "main device", the indoor sensor. This is equal to the MAC address of the Netatmo.
-
-The other modules you can recognize by "module_name" and then note the "_id" which you need later.
-
-**Another way to get the IDs is to calculate them:**
-
-You have to calculate the ID for the outside module as follows: (it cannot be read from the app)
-if the first serial character is "h": start with "02",
-if the first serial character is "i": start with "03",
-
-append ":00:00:",
-
-split the rest into three parts of two characters and append with a colon as delimeter.
-
-For example your serial number "h00bcdc" should end up as "02:00:00:00:bc:dc".
-
-## Discovery
-
-If you don't manually create things in the *.things file, the Netatmo Binding is able to discover automatically all depending modules and devices from Netatmo website.
-
-## Channels
-
-### Weather Station Main Indoor Device
-Example item for the **indoor module**:
-```
-Number Netatmo_Indoor_CO2 "CO2" { channel = "netatmo:NAMain:home:inside:Co2" }
-```
-
-**Supported types for the indoor module:**
-* Temperature
-* Humidity
-* Co2
-* Pressure
-* AbsolutePressure
-* Noise
-* WifiStatus
-* Location
-* TimeStamp
-* HeatIndex
-* Humidex
-* Dewpoint
-* DewpointDepression
-* WifiStatus
-* LastStatusStore
-
-### Weather Station Outdoor module
-Example item for the **outdoor module**
-```
-Number Netatmo_Outdoor_Temperature "Temperature" { channel = "netatmo:NAModule1:home:outside:Temperature" }
-```
-
-**Supported types for the outdoor module:**
-* Temperature
-* Humidity
-* RfStatus
-* BatteryVP
-* TimeStamp
-* Humidex
-* HeatIndex
-* Dewpoint
-* DewpointDepression
-* LastMessage
-* LowBattery
-
-### Weather Station Additional Indoor module
-Example item for the **indoor module**
-```
-Number Netatmo_Indoor2_Temperature "Temperature" { channel = "netatmo:NAModule4:home:insidesupp:Temperature" }
-```
-
-**Supported types for the additional indoor module:**
-* Co2
-* Temperature
-* Humidity
-* RfStatus
-* BatteryVP
-* TimeStamp
-* Humidex
-* HeatIndex
-* Dewpoint
-* DewpointDepression
-* LastMessage
-* LowBattery
-
-### Rain
-Example item for the **rain gauge**
-```
-Number Netatmo_Rain_Current "Rain [%.1f mm]" { channel = "netatmo:NAModule3:home:rain:Rain" }
-```
-
-**Supported types for the rain guage:**
-* Rain
-* RfStatus
-* BatteryVP
-* LastMessage
-* LowBattery
-
-### Weather Station Wind module
-Example item for the **wind module** :
-```
-Number Netatmo_Wind_Strength "Wind Strength [%.0f KPH]" { channel = "netatmo:NAModule2:home:wind:WindStrength" }
-```
-
-**Supported types for the wind module:**
-* WindStrength
-* WindAngle
-* GustStrength
-* GustAngle
-* LastMessage
-* LowBattery
-* RfStatus
-* BatteryVP
-
-### Thermostat Relay Device
-
-
-**Supported types for the thermostat relay device:**
-* LastStatusStore
-* WifiStatus
-* Location
-
-### Thermostat Module
-
-**Supported types for the thermostat module:**
-* Temperature
-* SetpointTemperature
-* SetpointMode
-* BoilerOn
-* BoilerOff
-* TimeStamp
-
-# Common problems
-
-## Missing Certificate Authority
-
-This version of the binding has been modified to avoid the need to impoort StartCom certificate in the local JDK certificate store.
-
-
-```
-javax.net.ssl.SSLHandshakeException:
-sun.security.validator.ValidatorException:
-PKIX path building failed:
-sun.security.provider.certpath.SunCertPathBuilderException:
-unable to find valid certification path to requested target
-```
-
-can be solved by installing the StartCom CA Certificate into the local JDK like this:
-
-* Download the certificate from https://www.startssl.com/certs/ca.pem or use wget https://www.startssl.com/certs/ca.pem
-
-* Then import it into the keystore (the password is "changeit")
-```
-$JAVA_HOME/bin/keytool -import -keystore $JAVA_HOME/jre/lib/security/cacerts -alias StartCom-Root-CA -file ca.pem
-```
-If $JAVA_HOME is not set then run the command:
-update-alternatives --list java
-
-This should output something similar to:
-/usr/lib/jvm/java-8-oracle/jre/bin/java
-
-Use everything before /jre/... to set the JAVA_HOME environment variable:
-export JAVA_HOME=/usr/lib/jvm/java-8-oracle
-
-After you set the environment variable, try:
-
-ls -l $JAVA_HOME/jre/lib/security/cacerts
-
-If it's set correctly then you should see something similar to:
--rw-r--r-- 1 root root 101992 Nov 4 10:54 /usr/lib/jvm/java-8-oracle/jre/lib/security/cacerts
-
-Now try and rerun the keytool command. If you didn't get errors, you should be good to go.
-
-source: http://jinahya.wordpress.com/2013/04/28/installing-the-startcom-ca-certifcate-into-the-local-jdk/
-
-alternative approach if above solution does not work:
-
-```
-sudo keytool -delete -alias StartCom-Root-CA -keystore $JAVA_HOME/jre/lib/security/cacerts -storepass changeit
-```
-
-download the certificate from https://api.netatmo.net to $JAVA_HOME/jre/lib/security/ and save it as api.netatmo.net.crt (X.509 / PEM)
-
-
-```
-sudo $JAVA_HOME/bin/keytool -import -keystore $JAVA_HOME/jre/lib/security/cacerts -alias StartCom-Root-CA -file api.netatmo.net.crt
-```
-The password is "changeit".
-
-# Sample data
-
-If you want to evaluate this binding but have not got a Netatmo station yourself
-yet, you can add the Netatmo office in Paris to your account:
-
-http://www.netatmo.com/en-US/addguest/index/TIQ3797dtfOmgpqUcct3/70:ee:50:00:02:20
-
-# Icons
-The following icons are used by original Netatmo web app:
-
-## Modules
-http://my.netatmo.com/img/my/app/module_int.png
-http://my.netatmo.com/img/my/app/module_ext.png
-http://my.netatmo.com/img/my/app/module_rain.png
-
-## Battery status
-http://my.netatmo.com/img/my/app/battery_verylow.png
-http://my.netatmo.com/img/my/app/battery_low.png
-http://my.netatmo.com/img/my/app/battery_medium.png
-http://my.netatmo.com/img/my/app/battery_high.png
-http://my.netatmo.com/img/my/app/battery_full.png
-
-## Signal status
-http://my.netatmo.com/img/my/app/signal_verylow.png
-http://my.netatmo.com/img/my/app/signal_low.png
-http://my.netatmo.com/img/my/app/signal_medium.png
-http://my.netatmo.com/img/my/app/signal_high.png
-http://my.netatmo.com/img/my/app/signal_full.png
-
-## Wifi status
-http://my.netatmo.com/img/my/app/wifi_low.png
-http://my.netatmo.com/img/my/app/wifi_medium.png
-http://my.netatmo.com/img/my/app/wifi_high.png
-http://my.netatmo.com/img/my/app/wifi_full.png
+---
+layout: documentation
+---
+
+{% include base.html %}
+
+# Netatmo Binding
+
+The Netatmo binding integrates the following Netatmo products :
+- *Personal Weather Station*. Reports temperature, humidity, air pressure, carbon dioxide concentration in the air, as well as the ambient noise level.
+- *Thermostat*. Reports ambient temperature, allow to check target temperature, consult and change furnace heating status.
+
+See http://www.netatmo.com/ for details on their product.
+
+## Binding Configuration
+
+The binding has no configuration options itself, all configuration is done at 'Things' level but before, you'll have to grant openHab to access Netatmo API. Here is the procedure :
+
+### 1. Application creation
+Create an application at https://dev.netatmo.com/dev/createapp
+
+The variables you'll need to get to setup the binding are:
+* `` Your client ID taken from your App at https://dev.netatmo.com/dev/listapps
+* `` A token provided along with the ``.
+* `` The username you use to connect to the Netatmo API (usually your mail address).
+* `` The password attached to the above username.
+
+## 2.Bridge and Things Configuration
+
+Once you'll get needed informations from the Netatmo API, you'll be able to configure bridge and things.
+
+E.g.
+```
+Bridge netatmo:netatmoapi:home [ clientId="", clientSecret="", username = "", password = "", readStation=true|false, readThermostat=true|false] {
+ Thing NAMain inside [ equipmentId="aa:aa:aa:aa:aa:aa", [refreshInterval=60000] ]
+ Thing NAModule1 outside [ equipmentId="yy:yy:yy:yy:yy:yy", parentId="aa:aa:aa:aa:aa:aa" ]
+ Thing NAPlug plugtherm [ equipmentId="bb:bb:bb:bb:bb:bb", [refreshInterval=60000] ]
+ Thing NATherm1 thermostat [ equipmentId="xx:xx:xx:xx:xx:xx", parentId="bb:bb:bb:bb:bb:bb" ]
+ ...
+}
+```
+
+### Configure Things
+
+The IDs for the modules can be extracted from the developer documentation on the netatmo site.
+First login with your user. Then some examples of the documentation contain the **real results** of your weather station. Get the IDs of your devices (indoor, outdoor, rain gauge) here:
+
+```
+https://dev.netatmo.com/doc/methods/devicelist
+```
+
+main_device is the ID of the "main device", the indoor sensor. This is equal to the MAC address of the Netatmo.
+
+The other modules you can recognize by "module_name" and then note the "_id" which you need later.
+
+**Another way to get the IDs is to calculate them:**
+
+You have to calculate the ID for the outside module as follows: (it cannot be read from the app)
+if the first serial character is "h": start with "02",
+if the first serial character is "i": start with "03",
+
+append ":00:00:",
+
+split the rest into three parts of two characters and append with a colon as delimeter.
+
+For example your serial number "h00bcdc" should end up as "02:00:00:00:bc:dc".
+
+## Discovery
+
+If you don't manually create things in the *.things file, the Netatmo Binding is able to discover automatically all depending modules and devices from Netatmo website.
+
+## Channels
+
+### Weather Station Main Indoor Device
+Example item for the **indoor module**:
+```
+Number Netatmo_Indoor_CO2 "CO2" { channel = "netatmo:NAMain:home:inside:Co2" }
+```
+
+**Supported types for the indoor module:**
+* Temperature
+* Humidity
+* Co2
+* Pressure
+* AbsolutePressure
+* Noise
+* WifiStatus
+* Location
+* TimeStamp
+* HeatIndex
+* Humidex
+* Dewpoint
+* DewpointDepression
+* WifiStatus
+* LastStatusStore
+
+### Weather Station Outdoor module
+Example item for the **outdoor module**
+```
+Number Netatmo_Outdoor_Temperature "Temperature" { channel = "netatmo:NAModule1:home:outside:Temperature" }
+```
+
+**Supported types for the outdoor module:**
+* Temperature
+* Humidity
+* RfStatus
+* BatteryVP
+* TimeStamp
+* Humidex
+* HeatIndex
+* Dewpoint
+* DewpointDepression
+* LastMessage
+* LowBattery
+
+### Weather Station Additional Indoor module
+Example item for the **indoor module**
+```
+Number Netatmo_Indoor2_Temperature "Temperature" { channel = "netatmo:NAModule4:home:insidesupp:Temperature" }
+```
+
+**Supported types for the additional indoor module:**
+* Co2
+* Temperature
+* Humidity
+* RfStatus
+* BatteryVP
+* TimeStamp
+* Humidex
+* HeatIndex
+* Dewpoint
+* DewpointDepression
+* LastMessage
+* LowBattery
+
+### Rain
+Example item for the **rain gauge**
+```
+Number Netatmo_Rain_Current "Rain [%.1f mm]" { channel = "netatmo:NAModule3:home:rain:Rain" }
+```
+
+**Supported types for the rain guage:**
+* Rain
+* RfStatus
+* BatteryVP
+* LastMessage
+* LowBattery
+
+### Weather Station Wind module
+Example item for the **wind module** :
+```
+Number Netatmo_Wind_Strength "Wind Strength [%.0f KPH]" { channel = "netatmo:NAModule2:home:wind:WindStrength" }
+```
+
+**Supported types for the wind module:**
+* WindStrength
+* WindAngle
+* GustStrength
+* GustAngle
+* LastMessage
+* LowBattery
+* RfStatus
+* BatteryVP
+
+### Thermostat Relay Device
+
+
+**Supported types for the thermostat relay device:**
+* LastStatusStore
+* WifiStatus
+* Location
+
+### Thermostat Module
+
+**Supported types for the thermostat module:**
+* Temperature
+* SetpointTemperature
+* SetpointMode
+* BoilerOn
+* BoilerOff
+* TimeStamp
+
+# Common problems
+
+## Missing Certificate Authority
+
+This version of the binding has been modified to avoid the need to impoort StartCom certificate in the local JDK certificate store.
+
+
+```
+javax.net.ssl.SSLHandshakeException:
+sun.security.validator.ValidatorException:
+PKIX path building failed:
+sun.security.provider.certpath.SunCertPathBuilderException:
+unable to find valid certification path to requested target
+```
+
+can be solved by installing the StartCom CA Certificate into the local JDK like this:
+
+* Download the certificate from https://www.startssl.com/certs/ca.pem or use wget https://www.startssl.com/certs/ca.pem
+
+* Then import it into the keystore (the password is "changeit")
+```
+$JAVA_HOME/bin/keytool -import -keystore $JAVA_HOME/jre/lib/security/cacerts -alias StartCom-Root-CA -file ca.pem
+```
+If $JAVA_HOME is not set then run the command:
+update-alternatives --list java
+
+This should output something similar to:
+/usr/lib/jvm/java-8-oracle/jre/bin/java
+
+Use everything before /jre/... to set the JAVA_HOME environment variable:
+export JAVA_HOME=/usr/lib/jvm/java-8-oracle
+
+After you set the environment variable, try:
+
+ls -l $JAVA_HOME/jre/lib/security/cacerts
+
+If it's set correctly then you should see something similar to:
+-rw-r--r-- 1 root root 101992 Nov 4 10:54 /usr/lib/jvm/java-8-oracle/jre/lib/security/cacerts
+
+Now try and rerun the keytool command. If you didn't get errors, you should be good to go.
+
+source: http://jinahya.wordpress.com/2013/04/28/installing-the-startcom-ca-certifcate-into-the-local-jdk/
+
+alternative approach if above solution does not work:
+
+```
+sudo keytool -delete -alias StartCom-Root-CA -keystore $JAVA_HOME/jre/lib/security/cacerts -storepass changeit
+```
+
+download the certificate from https://api.netatmo.net to $JAVA_HOME/jre/lib/security/ and save it as api.netatmo.net.crt (X.509 / PEM)
+
+
+```
+sudo $JAVA_HOME/bin/keytool -import -keystore $JAVA_HOME/jre/lib/security/cacerts -alias StartCom-Root-CA -file api.netatmo.net.crt
+```
+The password is "changeit".
+
+# Sample data
+
+If you want to evaluate this binding but have not got a Netatmo station yourself
+yet, you can add the Netatmo office in Paris to your account:
+
+http://www.netatmo.com/en-US/addguest/index/TIQ3797dtfOmgpqUcct3/70:ee:50:00:02:20
+
+# Icons
+The following icons are used by original Netatmo web app:
+
+## Modules
+http://my.netatmo.com/img/my/app/module_int.png
+http://my.netatmo.com/img/my/app/module_ext.png
+http://my.netatmo.com/img/my/app/module_rain.png
+
+## Battery status
+http://my.netatmo.com/img/my/app/battery_verylow.png
+http://my.netatmo.com/img/my/app/battery_low.png
+http://my.netatmo.com/img/my/app/battery_medium.png
+http://my.netatmo.com/img/my/app/battery_high.png
+http://my.netatmo.com/img/my/app/battery_full.png
+
+## Signal status
+http://my.netatmo.com/img/my/app/signal_verylow.png
+http://my.netatmo.com/img/my/app/signal_low.png
+http://my.netatmo.com/img/my/app/signal_medium.png
+http://my.netatmo.com/img/my/app/signal_high.png
+http://my.netatmo.com/img/my/app/signal_full.png
+
+## Wifi status
+http://my.netatmo.com/img/my/app/wifi_low.png
+http://my.netatmo.com/img/my/app/wifi_medium.png
+http://my.netatmo.com/img/my/app/wifi_high.png
+http://my.netatmo.com/img/my/app/wifi_full.png
\ No newline at end of file
diff --git a/addons/binding/org.openhab.binding.network/src/main/java/org/openhab/binding/network/discovery/NetworkDiscoveryService.java b/addons/binding/org.openhab.binding.network/src/main/java/org/openhab/binding/network/discovery/NetworkDiscoveryService.java
index ffd66a3e49cfd..a26fd92ecb2d8 100644
--- a/addons/binding/org.openhab.binding.network/src/main/java/org/openhab/binding/network/discovery/NetworkDiscoveryService.java
+++ b/addons/binding/org.openhab.binding.network/src/main/java/org/openhab/binding/network/discovery/NetworkDiscoveryService.java
@@ -1,104 +1,104 @@
-/**
- * Copyright (c) 2014-2016 by the respective copyright holders.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- */
-package org.openhab.binding.network.discovery;
-
-import static org.openhab.binding.network.NetworkBindingConstants.*;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-
-import org.eclipse.smarthome.config.discovery.AbstractDiscoveryService;
-import org.eclipse.smarthome.config.discovery.DiscoveryResult;
-import org.eclipse.smarthome.config.discovery.DiscoveryResultBuilder;
-import org.eclipse.smarthome.core.thing.ThingUID;
-import org.openhab.binding.network.service.DiscoveryCallback;
-import org.openhab.binding.network.service.NetworkUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * The {@link NetworkDiscoveryService} is responsible for discovering devices on
- * the current Network. It uses every Network Interface which is connected to a network.
- *
- * @author Marc Mettke - Initial contribution
- */
-public class NetworkDiscoveryService extends AbstractDiscoveryService implements DiscoveryCallback {
- private final Logger logger = LoggerFactory.getLogger(NetworkDiscoveryService.class);
- private ExecutorService executorService = null;
- final static int PING_TIMEOUT_IN_MS = 500;
- private int scanningNetworkSize = 0;
-
- public NetworkDiscoveryService() {
- super(SUPPORTED_THING_TYPES_UIDS, 900, false);
- }
-
- /**
- * Starts the DiscoveryThread for each IP on each interface on the network
- *
- */
- @Override
- protected void startScan() {
- if (executorService != null) {
- stopScan();
- }
-
- logger.debug("Starting Discovery");
- LinkedHashSet networkIPs = NetworkUtils.getNetworkIPs(NetworkUtils.getInterfaceIPs());
- scanningNetworkSize = networkIPs.size();
- executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 10);
-
- for (Iterator it = networkIPs.iterator(); it.hasNext();) {
- final String ip = it.next();
- executorService.execute(new PingRunnable(ip, this));
- }
- stopScan();
- }
-
- @Override
- protected synchronized void stopScan() {
- super.stopScan();
- if (executorService == null) {
- return;
- }
-
- try {
- executorService.awaitTermination(PING_TIMEOUT_IN_MS * scanningNetworkSize, TimeUnit.MILLISECONDS);
- } catch (InterruptedException e) {
- }
- executorService.shutdown();
- executorService = null;
-
- }
-
- /**
- * Submit newly discovered devices. This method is called by the spawned threads in {@link startScan}.
- *
- * @param ip The device IP, received by the
- */
- @Override
- public void newDevice(String ip) {
- logger.info("Found " + ip);
-
- // uid must not contains dots
- ThingUID uid = new ThingUID(THING_TYPE_DEVICE, ip.replace('.', '_'));
-
- if (uid != null) {
- Map properties = new HashMap<>(1);
- properties.put(PARAMETER_HOSTNAME, ip);
- DiscoveryResult result = DiscoveryResultBuilder.create(uid).withProperties(properties)
- .withLabel("Network Device (" + ip + ")").build();
- thingDiscovered(result);
- }
- }
-}
+/**
+ * Copyright (c) 2014-2016 by the respective copyright holders.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.openhab.binding.network.discovery;
+
+import static org.openhab.binding.network.NetworkBindingConstants.*;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+import org.eclipse.smarthome.config.discovery.AbstractDiscoveryService;
+import org.eclipse.smarthome.config.discovery.DiscoveryResult;
+import org.eclipse.smarthome.config.discovery.DiscoveryResultBuilder;
+import org.eclipse.smarthome.core.thing.ThingUID;
+import org.openhab.binding.network.service.DiscoveryCallback;
+import org.openhab.binding.network.service.NetworkUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The {@link NetworkDiscoveryService} is responsible for discovering devices on
+ * the current Network. It uses every Network Interface which is connected to a network.
+ *
+ * @author Marc Mettke - Initial contribution
+ */
+public class NetworkDiscoveryService extends AbstractDiscoveryService implements DiscoveryCallback {
+ private final Logger logger = LoggerFactory.getLogger(NetworkDiscoveryService.class);
+ private ExecutorService executorService = null;
+ final static int PING_TIMEOUT_IN_MS = 500;
+ private int scanningNetworkSize = 0;
+
+ public NetworkDiscoveryService() {
+ super(SUPPORTED_THING_TYPES_UIDS, 900, false);
+ }
+
+ /**
+ * Starts the DiscoveryThread for each IP on each interface on the network
+ *
+ */
+ @Override
+ protected void startScan() {
+ if (executorService != null) {
+ stopScan();
+ }
+
+ logger.debug("Starting Discovery");
+ LinkedHashSet networkIPs = NetworkUtils.getNetworkIPs(NetworkUtils.getInterfaceIPs());
+ scanningNetworkSize = networkIPs.size();
+ executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 10);
+
+ for (Iterator it = networkIPs.iterator(); it.hasNext();) {
+ final String ip = it.next();
+ executorService.execute(new PingRunnable(ip, this));
+ }
+ stopScan();
+ }
+
+ @Override
+ protected synchronized void stopScan() {
+ super.stopScan();
+ if (executorService == null) {
+ return;
+ }
+
+ try {
+ executorService.awaitTermination(PING_TIMEOUT_IN_MS * scanningNetworkSize, TimeUnit.MILLISECONDS);
+ } catch (InterruptedException e) {
+ }
+ executorService.shutdown();
+ executorService = null;
+
+ }
+
+ /**
+ * Submit newly discovered devices. This method is called by the spawned threads in {@link startScan}.
+ *
+ * @param ip The device IP, received by the
+ */
+ @Override
+ public void newDevice(String ip) {
+ logger.info("Found " + ip);
+
+ // uid must not contains dots
+ ThingUID uid = new ThingUID(THING_TYPE_DEVICE, ip.replace('.', '_'));
+
+ if (uid != null) {
+ Map properties = new HashMap<>(1);
+ properties.put(PARAMETER_HOSTNAME, ip);
+ DiscoveryResult result = DiscoveryResultBuilder.create(uid).withProperties(properties)
+ .withLabel("Network Device (" + ip + ")").build();
+ thingDiscovered(result);
+ }
+ }
+}
diff --git a/addons/binding/org.openhab.binding.opensprinkler/.classpath b/addons/binding/org.openhab.binding.opensprinkler/.classpath
index f4091170bca81..c383bda0dd310 100644
--- a/addons/binding/org.openhab.binding.opensprinkler/.classpath
+++ b/addons/binding/org.openhab.binding.opensprinkler/.classpath
@@ -1,8 +1,8 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/addons/binding/org.openhab.binding.opensprinkler/.project b/addons/binding/org.openhab.binding.opensprinkler/.project
index 7020a66fb3a26..359cb92cd22f8 100644
--- a/addons/binding/org.openhab.binding.opensprinkler/.project
+++ b/addons/binding/org.openhab.binding.opensprinkler/.project
@@ -1,33 +1,33 @@
-
-
- org.openhab.binding.opensprinkler
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.pde.ManifestBuilder
-
-
-
-
- org.eclipse.pde.SchemaBuilder
-
-
-
-
- org.eclipse.pde.ds.core.builder
-
-
-
-
-
- org.eclipse.pde.PluginNature
- org.eclipse.jdt.core.javanature
-
-
+
+
+ org.openhab.binding.opensprinkler
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+ org.eclipse.pde.ds.core.builder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/addons/binding/org.openhab.binding.opensprinkler/ESH-INF/binding/binding.xml b/addons/binding/org.openhab.binding.opensprinkler/ESH-INF/binding/binding.xml
index 66c6e5104477e..97ccb13a3797b 100644
--- a/addons/binding/org.openhab.binding.opensprinkler/ESH-INF/binding/binding.xml
+++ b/addons/binding/org.openhab.binding.opensprinkler/ESH-INF/binding/binding.xml
@@ -1,11 +1,11 @@
-
-
-
- OpenSprinkler Binding
- This is the binding for OpenSprinkler.
- Chris Graham
-
-
+
+
+
+ OpenSprinkler Binding
+ This is the binding for OpenSprinkler.
+ Chris Graham
+
+
diff --git a/addons/binding/org.openhab.binding.opensprinkler/ESH-INF/thing/thing-types.xml b/addons/binding/org.openhab.binding.opensprinkler/ESH-INF/thing/thing-types.xml
index bf9bcf67071b1..ef16600231d81 100644
--- a/addons/binding/org.openhab.binding.opensprinkler/ESH-INF/thing/thing-types.xml
+++ b/addons/binding/org.openhab.binding.opensprinkler/ESH-INF/thing/thing-types.xml
@@ -1,467 +1,467 @@
-
-
-
-
-
-
- This is the stand alone OpenSprinkler device that allows sprinkler control.
-
-
-
-
-
- Controls station 01 on the OpenSprinkler device.
-
-
-
- Controls station 02 on the OpenSprinkler device.
-
-
-
- Controls station 03 on the OpenSprinkler device.
-
-
-
- Controls station 04 on the OpenSprinkler device.
-
-
-
- Controls station 05 on the OpenSprinkler device.
-
-
-
- Controls station 06 on the OpenSprinkler device.
-
-
-
- Controls station 07 on the OpenSprinkler device.
-
-
-
- Controls station 08 on the OpenSprinkler device.
-
-
-
- Controls station 09 on the OpenSprinkler device.
-
-
-
- Controls station 10 on the OpenSprinkler device.
-
-
-
- Controls station 11 on the OpenSprinkler device.
-
-
-
- Controls station 12 on the OpenSprinkler device.
-
-
-
- Controls station 13 on the OpenSprinkler device.
-
-
-
- Controls station 14 on the OpenSprinkler device.
-
-
-
- Controls station 15 on the OpenSprinkler device.
-
-
-
- Controls station 16 on the OpenSprinkler device.
-
-
-
- Controls station 17 on the OpenSprinkler device.
-
-
-
- Controls station 18 on the OpenSprinkler device.
-
-
-
- Controls station 19 on the OpenSprinkler device.
-
-
-
- Controls station 20 on the OpenSprinkler device.
-
-
-
- Controls station 21 on the OpenSprinkler device.
-
-
-
- Controls station 22 on the OpenSprinkler device.
-
-
-
- Controls station 23 on the OpenSprinkler device.
-
-
-
- Controls station 24 on the OpenSprinkler device.
-
-
-
- Controls station 25 on the OpenSprinkler device.
-
-
-
- Controls station 26 on the OpenSprinkler device.
-
-
-
- Controls station 27 on the OpenSprinkler device.
-
-
-
- Controls station 28 on the OpenSprinkler device.
-
-
-
- Controls station 29 on the OpenSprinkler device.
-
-
-
- Controls station 30 on the OpenSprinkler device.
-
-
-
- Controls station 31 on the OpenSprinkler device.
-
-
-
- Controls station 32 on the OpenSprinkler device.
-
-
-
- Controls station 33 on the OpenSprinkler device.
-
-
-
- Controls station 34 on the OpenSprinkler device.
-
-
-
- Controls station 35 on the OpenSprinkler device.
-
-
-
- Controls station 36 on the OpenSprinkler device.
-
-
-
- Controls station 37 on the OpenSprinkler device.
-
-
-
- Controls station 38 on the OpenSprinkler device.
-
-
-
- Controls station 39 on the OpenSprinkler device.
-
-
-
- Controls station 40 on the OpenSprinkler device.
-
-
-
- Controls station 41 on the OpenSprinkler device.
-
-
-
- Controls station 42 on the OpenSprinkler device.
-
-
-
- Controls station 43 on the OpenSprinkler device.
-
-
-
- Controls station 44 on the OpenSprinkler device.
-
-
-
- Controls station 45 on the OpenSprinkler device.
-
-
-
- Controls station 46 on the OpenSprinkler device.
-
-
-
- Controls station 47 on the OpenSprinkler device.
-
-
-
- Controls station 48 on the OpenSprinkler device.
-
-
-
-
-
-
- The host name or IP address of the OpenSprinkler Web API interface.
- localhost
-
-
-
- Port of the OpenSprinkler Web API interface.
- 80
-
-
-
- The admin password used to access the Web API interface.
- opendoor
-
-
-
- Specifies the refresh interval in seconds.
- 60
-
-
-
-
-
-
-
- This is the Raspberry Pi OpenSprinkler device that allows sprinkler control.
-
-
-
-
- Controls station 01 on the OpenSprinkler device.
-
-
-
- Controls station 02 on the OpenSprinkler device.
-
-
-
- Controls station 03 on the OpenSprinkler device.
-
-
-
- Controls station 04 on the OpenSprinkler device.
-
-
-
- Controls station 05 on the OpenSprinkler device.
-
-
-
- Controls station 06 on the OpenSprinkler device.
-
-
-
- Controls station 07 on the OpenSprinkler device.
-
-
-
- Controls station 08 on the OpenSprinkler device.
-
-
-
- Controls station 09 on the OpenSprinkler device.
-
-
-
- Controls station 10 on the OpenSprinkler device.
-
-
-
- Controls station 11 on the OpenSprinkler device.
-
-
-
- Controls station 12 on the OpenSprinkler device.
-
-
-
- Controls station 13 on the OpenSprinkler device.
-
-
-
- Controls station 14 on the OpenSprinkler device.
-
-
-
- Controls station 15 on the OpenSprinkler device.
-
-
-
- Controls station 16 on the OpenSprinkler device.
-
-
-
- Controls station 17 on the OpenSprinkler device.
-
-
-
- Controls station 18 on the OpenSprinkler device.
-
-
-
- Controls station 19 on the OpenSprinkler device.
-
-
-
- Controls station 20 on the OpenSprinkler device.
-
-
-
- Controls station 21 on the OpenSprinkler device.
-
-
-
- Controls station 22 on the OpenSprinkler device.
-
-
-
- Controls station 23 on the OpenSprinkler device.
-
-
-
- Controls station 24 on the OpenSprinkler device.
-
-
-
- Controls station 25 on the OpenSprinkler device.
-
-
-
- Controls station 26 on the OpenSprinkler device.
-
-
-
- Controls station 27 on the OpenSprinkler device.
-
-
-
- Controls station 28 on the OpenSprinkler device.
-
-
-
- Controls station 29 on the OpenSprinkler device.
-
-
-
- Controls station 30 on the OpenSprinkler device.
-
-
-
- Controls station 31 on the OpenSprinkler device.
-
-
-
- Controls station 32 on the OpenSprinkler device.
-
-
-
- Controls station 33 on the OpenSprinkler device.
-
-
-
- Controls station 34 on the OpenSprinkler device.
-
-
-
- Controls station 35 on the OpenSprinkler device.
-
-
-
- Controls station 36 on the OpenSprinkler device.
-
-
-
- Controls station 37 on the OpenSprinkler device.
-
-
-
- Controls station 38 on the OpenSprinkler device.
-
-
-
- Controls station 39 on the OpenSprinkler device.
-
-
-
- Controls station 40 on the OpenSprinkler device.
-
-
-
- Controls station 41 on the OpenSprinkler device.
-
-
-
- Controls station 42 on the OpenSprinkler device.
-
-
-
- Controls station 43 on the OpenSprinkler device.
-
-
-
- Controls station 44 on the OpenSprinkler device.
-
-
-
- Controls station 45 on the OpenSprinkler device.
-
-
-
- Controls station 46 on the OpenSprinkler device.
-
-
-
- Controls station 47 on the OpenSprinkler device.
-
-
-
- Controls station 48 on the OpenSprinkler device.
-
-
-
-
-
-
- The number of stations to control.
- 8
-
-
-
- Specifies the refresh interval in seconds.
- 60
-
-
-
-
-
- Switch
-
- Provides feedback on whether the OpenSprinkler device has detected rain or not.
- Sensor
-
-
-
-
- Switch
-
- Controls a station on the OpenSprinkler device.
- Switch
-
-
-
- Switch
-
- Controls a station on the OpenSprinkler device.
- Switch
-
-
+
+
+
+
+
+
+ This is the stand alone OpenSprinkler device that allows sprinkler control.
+
+
+
+
+
+ Controls station 01 on the OpenSprinkler device.
+
+
+
+ Controls station 02 on the OpenSprinkler device.
+
+
+
+ Controls station 03 on the OpenSprinkler device.
+
+
+
+ Controls station 04 on the OpenSprinkler device.
+
+
+
+ Controls station 05 on the OpenSprinkler device.
+
+
+
+ Controls station 06 on the OpenSprinkler device.
+
+
+
+ Controls station 07 on the OpenSprinkler device.
+
+
+
+ Controls station 08 on the OpenSprinkler device.
+
+
+
+ Controls station 09 on the OpenSprinkler device.
+
+
+
+ Controls station 10 on the OpenSprinkler device.
+
+
+
+ Controls station 11 on the OpenSprinkler device.
+
+
+
+ Controls station 12 on the OpenSprinkler device.
+
+
+
+ Controls station 13 on the OpenSprinkler device.
+
+
+
+ Controls station 14 on the OpenSprinkler device.
+
+
+
+ Controls station 15 on the OpenSprinkler device.
+
+
+
+ Controls station 16 on the OpenSprinkler device.
+
+
+
+ Controls station 17 on the OpenSprinkler device.
+
+
+
+ Controls station 18 on the OpenSprinkler device.
+
+
+
+ Controls station 19 on the OpenSprinkler device.
+
+
+
+ Controls station 20 on the OpenSprinkler device.
+
+
+
+ Controls station 21 on the OpenSprinkler device.
+
+
+
+ Controls station 22 on the OpenSprinkler device.
+
+
+
+ Controls station 23 on the OpenSprinkler device.
+
+
+
+ Controls station 24 on the OpenSprinkler device.
+
+
+
+ Controls station 25 on the OpenSprinkler device.
+
+
+
+ Controls station 26 on the OpenSprinkler device.
+
+
+
+ Controls station 27 on the OpenSprinkler device.
+
+
+
+ Controls station 28 on the OpenSprinkler device.
+
+
+
+ Controls station 29 on the OpenSprinkler device.
+
+
+
+ Controls station 30 on the OpenSprinkler device.
+
+
+
+ Controls station 31 on the OpenSprinkler device.
+
+
+
+ Controls station 32 on the OpenSprinkler device.
+
+
+
+ Controls station 33 on the OpenSprinkler device.
+
+
+
+ Controls station 34 on the OpenSprinkler device.
+
+
+
+ Controls station 35 on the OpenSprinkler device.
+
+
+
+ Controls station 36 on the OpenSprinkler device.
+
+
+
+ Controls station 37 on the OpenSprinkler device.
+
+
+
+ Controls station 38 on the OpenSprinkler device.
+
+
+
+ Controls station 39 on the OpenSprinkler device.
+
+
+
+ Controls station 40 on the OpenSprinkler device.
+
+
+
+ Controls station 41 on the OpenSprinkler device.
+
+
+
+ Controls station 42 on the OpenSprinkler device.
+
+
+
+ Controls station 43 on the OpenSprinkler device.
+
+
+
+ Controls station 44 on the OpenSprinkler device.
+
+
+
+ Controls station 45 on the OpenSprinkler device.
+
+
+
+ Controls station 46 on the OpenSprinkler device.
+
+
+
+ Controls station 47 on the OpenSprinkler device.
+
+
+
+ Controls station 48 on the OpenSprinkler device.
+
+
+
+
+
+
+ The host name or IP address of the OpenSprinkler Web API interface.
+ localhost
+
+
+
+ Port of the OpenSprinkler Web API interface.
+ 80
+
+
+
+ The admin password used to access the Web API interface.
+ opendoor
+
+
+
+ Specifies the refresh interval in seconds.
+ 60
+
+
+
+
+
+
+
+ This is the Raspberry Pi OpenSprinkler device that allows sprinkler control.
+
+
+
+
+ Controls station 01 on the OpenSprinkler device.
+
+
+
+ Controls station 02 on the OpenSprinkler device.
+
+
+
+ Controls station 03 on the OpenSprinkler device.
+
+
+
+ Controls station 04 on the OpenSprinkler device.
+
+
+
+ Controls station 05 on the OpenSprinkler device.
+
+
+
+ Controls station 06 on the OpenSprinkler device.
+
+
+
+ Controls station 07 on the OpenSprinkler device.
+
+
+
+ Controls station 08 on the OpenSprinkler device.
+
+
+
+ Controls station 09 on the OpenSprinkler device.
+
+
+
+ Controls station 10 on the OpenSprinkler device.
+
+
+
+ Controls station 11 on the OpenSprinkler device.
+
+
+
+ Controls station 12 on the OpenSprinkler device.
+
+
+
+ Controls station 13 on the OpenSprinkler device.
+
+
+
+ Controls station 14 on the OpenSprinkler device.
+
+
+
+ Controls station 15 on the OpenSprinkler device.
+
+
+
+ Controls station 16 on the OpenSprinkler device.
+
+
+
+ Controls station 17 on the OpenSprinkler device.
+
+
+
+ Controls station 18 on the OpenSprinkler device.
+
+
+
+ Controls station 19 on the OpenSprinkler device.
+
+
+
+ Controls station 20 on the OpenSprinkler device.
+
+
+
+ Controls station 21 on the OpenSprinkler device.
+
+
+
+ Controls station 22 on the OpenSprinkler device.
+
+
+
+ Controls station 23 on the OpenSprinkler device.
+
+
+
+ Controls station 24 on the OpenSprinkler device.
+
+
+
+ Controls station 25 on the OpenSprinkler device.
+
+
+
+ Controls station 26 on the OpenSprinkler device.
+
+
+
+ Controls station 27 on the OpenSprinkler device.
+
+
+
+ Controls station 28 on the OpenSprinkler device.
+
+
+
+ Controls station 29 on the OpenSprinkler device.
+
+
+
+ Controls station 30 on the OpenSprinkler device.
+
+
+
+ Controls station 31 on the OpenSprinkler device.
+
+
+
+ Controls station 32 on the OpenSprinkler device.
+
+
+
+ Controls station 33 on the OpenSprinkler device.
+
+
+
+ Controls station 34 on the OpenSprinkler device.
+
+
+
+ Controls station 35 on the OpenSprinkler device.
+
+
+
+ Controls station 36 on the OpenSprinkler device.
+
+
+
+ Controls station 37 on the OpenSprinkler device.
+
+
+
+ Controls station 38 on the OpenSprinkler device.
+
+
+
+ Controls station 39 on the OpenSprinkler device.
+
+
+
+ Controls station 40 on the OpenSprinkler device.
+
+
+
+ Controls station 41 on the OpenSprinkler device.
+
+
+
+ Controls station 42 on the OpenSprinkler device.
+
+
+
+ Controls station 43 on the OpenSprinkler device.
+
+
+
+ Controls station 44 on the OpenSprinkler device.
+
+
+
+ Controls station 45 on the OpenSprinkler device.
+
+
+
+ Controls station 46 on the OpenSprinkler device.
+
+
+
+ Controls station 47 on the OpenSprinkler device.
+
+
+
+ Controls station 48 on the OpenSprinkler device.
+
+
+
+
+
+
+ The number of stations to control.
+ 8
+
+
+
+ Specifies the refresh interval in seconds.
+ 60
+
+
+
+
+
+ Switch
+
+ Provides feedback on whether the OpenSprinkler device has detected rain or not.
+ Sensor
+
+
+
+
+ Switch
+
+ Controls a station on the OpenSprinkler device.
+ Switch
+
+
+
+ Switch
+
+ Controls a station on the OpenSprinkler device.
+ Switch
+
+
diff --git a/addons/binding/org.openhab.binding.opensprinkler/META-INF/MANIFEST.MF b/addons/binding/org.openhab.binding.opensprinkler/META-INF/MANIFEST.MF
index 9ef66cb944018..4cb62cc7be49f 100644
--- a/addons/binding/org.openhab.binding.opensprinkler/META-INF/MANIFEST.MF
+++ b/addons/binding/org.openhab.binding.opensprinkler/META-INF/MANIFEST.MF
@@ -1,24 +1,24 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: OpenSprinkler Binding
-Bundle-SymbolicName: org.openhab.binding.opensprinkler;singleton:=true
-Bundle-Vendor: openHAB
-Bundle-Version: 2.1.0.qualifier
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
-Bundle-ClassPath: .,
- lib/pi4j-core.jar
-Import-Package:
- com.google.gson,
- org.apache.commons.net.util,
- org.eclipse.smarthome.config.core,
- org.eclipse.smarthome.config.discovery,
- 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.slf4j
-Service-Component: OSGI-INF/*.xml
-Export-Package: org.openhab.binding.opensprinkler,
- org.openhab.binding.opensprinkler.handler
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: OpenSprinkler Binding
+Bundle-SymbolicName: org.openhab.binding.opensprinkler;singleton:=true
+Bundle-Vendor: openHAB
+Bundle-Version: 2.1.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-ClassPath: .,
+ lib/pi4j-core.jar
+Import-Package:
+ com.google.gson,
+ org.apache.commons.net.util,
+ org.eclipse.smarthome.config.core,
+ org.eclipse.smarthome.config.discovery,
+ 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.slf4j
+Service-Component: OSGI-INF/*.xml
+Export-Package: org.openhab.binding.opensprinkler,
+ org.openhab.binding.opensprinkler.handler
diff --git a/addons/binding/org.openhab.binding.opensprinkler/OSGI-INF/OpenSprinklerHandlerFactory.xml b/addons/binding/org.openhab.binding.opensprinkler/OSGI-INF/OpenSprinklerHandlerFactory.xml
index 878ef8840705d..6b20a10eef75c 100644
--- a/addons/binding/org.openhab.binding.opensprinkler/OSGI-INF/OpenSprinklerHandlerFactory.xml
+++ b/addons/binding/org.openhab.binding.opensprinkler/OSGI-INF/OpenSprinklerHandlerFactory.xml
@@ -1,20 +1,20 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/binding/org.openhab.binding.opensprinkler/build.properties b/addons/binding/org.openhab.binding.opensprinkler/build.properties
index 8c38637d80645..74698c0216904 100644
--- a/addons/binding/org.openhab.binding.opensprinkler/build.properties
+++ b/addons/binding/org.openhab.binding.opensprinkler/build.properties
@@ -1,7 +1,7 @@
-source.. = src/main/java/
-output.. = target/classes
-bin.includes = META-INF/,\
- .,\
- OSGI-INF/,\
- ESH-INF/,\
- lib/pi4j-core.jar
+source.. = src/main/java/
+output.. = target/classes
+bin.includes = META-INF/,\
+ .,\
+ OSGI-INF/,\
+ ESH-INF/,\
+ lib/pi4j-core.jar
diff --git a/addons/binding/org.openhab.binding.opensprinkler/pom.xml b/addons/binding/org.openhab.binding.opensprinkler/pom.xml
index 769fa22baa6d1..5134021bf072d 100644
--- a/addons/binding/org.openhab.binding.opensprinkler/pom.xml
+++ b/addons/binding/org.openhab.binding.opensprinkler/pom.xml
@@ -1,19 +1,19 @@
-
-
-
- 4.0.0
-
-
- org.openhab.binding
- pom
- 2.1.0-SNAPSHOT
-
-
- org.openhab.binding
- org.openhab.binding.opensprinkler
- 2.1.0-SNAPSHOT
-
- OpenSprinkler Binding
- eclipse-plugin
-
-
+
+
+
+ 4.0.0
+
+
+ org.openhab.binding
+ pom
+ 2.1.0-SNAPSHOT
+
+
+ org.openhab.binding
+ org.openhab.binding.opensprinkler
+ 2.1.0-SNAPSHOT
+
+ OpenSprinkler Binding
+ eclipse-plugin
+
+
diff --git a/addons/binding/org.openhab.binding.opensprinkler/src/main/java/org/openhab/binding/opensprinkler/OpenSprinklerBindingConstants.java b/addons/binding/org.openhab.binding.opensprinkler/src/main/java/org/openhab/binding/opensprinkler/OpenSprinklerBindingConstants.java
index 62061fc8874d8..165b435918844 100644
--- a/addons/binding/org.openhab.binding.opensprinkler/src/main/java/org/openhab/binding/opensprinkler/OpenSprinklerBindingConstants.java
+++ b/addons/binding/org.openhab.binding.opensprinkler/src/main/java/org/openhab/binding/opensprinkler/OpenSprinklerBindingConstants.java
@@ -1,187 +1,187 @@
-/**
- * Copyright (c) 2014-2016 by the respective copyright holders.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- */
-package org.openhab.binding.opensprinkler;
-
-import org.eclipse.smarthome.core.thing.ThingTypeUID;
-
-/**
- * The {@link OpenSprinklerBinding} class defines common constants, which are
- * used across the whole binding.
- *
- * @author Chris Graham - Initial contribution
- */
-public class OpenSprinklerBindingConstants {
- public static final String BINDING_ID = "opensprinkler";
-
- // List of all Thing ids
- public final static String OPENSPRINKLER = "http";
- public final static String OPENSPRINKLERPI = "pi";
-
- // List of all Thing Type UIDs
- public final static ThingTypeUID OPENSPRINKLER_THING = new ThingTypeUID(BINDING_ID, OPENSPRINKLER);
- public final static ThingTypeUID OPENSPRINKLERPI_THING = new ThingTypeUID(BINDING_ID, OPENSPRINKLERPI);
-
- public final static int DEFAULT_WAIT_BEFORE_INITIAL_REFRESH = 30;
- public final static int DEFAULT_REFRESH_RATE = 60;
- public final static short DISCOVERY_SUBNET_MASK = 24;
- public final static int DISCOVERY_THREAD_POOL_SIZE = 15;
- public final static int DISCOVERY_THREAD_POOL_SHUTDOWN_WAIT_TIME_SECONDS = 300;
- public final static boolean DISCOVERY_DEFAULT_AUTO_DISCOVER = false;
- public final static int DISCOVERY_DEFAULT_TIMEOUT_RATE = 500;
- public final static int DISCOVERY_DEFAULT_IP_TIMEOUT_RATE = 750;
-
- // List of all Channel ids
- public final static String SENSOR_RAIN = "rainsensor";
-
- public final static String STATION_01 = "station01";
- public final static String STATION_02 = "station02";
- public final static String STATION_03 = "station03";
- public final static String STATION_04 = "station04";
- public final static String STATION_05 = "station05";
- public final static String STATION_06 = "station06";
- public final static String STATION_07 = "station07";
- public final static String STATION_08 = "station08";
- public final static String STATION_09 = "station09";
- public final static String STATION_10 = "station10";
- public final static String STATION_11 = "station11";
- public final static String STATION_12 = "station12";
- public final static String STATION_13 = "station13";
- public final static String STATION_14 = "station14";
- public final static String STATION_15 = "station15";
- public final static String STATION_16 = "station16";
- public final static String STATION_17 = "station17";
- public final static String STATION_18 = "station18";
- public final static String STATION_19 = "station19";
- public final static String STATION_20 = "station20";
- public final static String STATION_21 = "station21";
- public final static String STATION_22 = "station22";
- public final static String STATION_23 = "station23";
- public final static String STATION_24 = "station24";
- public final static String STATION_25 = "station25";
- public final static String STATION_26 = "station26";
- public final static String STATION_27 = "station27";
- public final static String STATION_28 = "station28";
- public final static String STATION_29 = "station29";
- public final static String STATION_30 = "station30";
- public final static String STATION_31 = "station31";
- public final static String STATION_32 = "station32";
- public final static String STATION_33 = "station33";
- public final static String STATION_34 = "station34";
- public final static String STATION_35 = "station35";
- public final static String STATION_36 = "station36";
- public final static String STATION_37 = "station37";
- public final static String STATION_38 = "station38";
- public final static String STATION_39 = "station39";
- public final static String STATION_40 = "station40";
- public final static String STATION_41 = "station41";
- public final static String STATION_42 = "station42";
- public final static String STATION_43 = "station43";
- public final static String STATION_44 = "station44";
- public final static String STATION_45 = "station45";
- public final static String STATION_46 = "station46";
- public final static String STATION_47 = "station47";
- public final static String STATION_48 = "station48";
-
- /**
- * Enumeration of station constants for mapping station channel names to ints and back.
- *
- * @author CrackerStealth
- */
- public enum Station {
- STATION01(0, STATION_01),
- STATION02(1, STATION_02),
- STATION03(2, STATION_03),
- STATION04(3, STATION_04),
- STATION05(4, STATION_05),
- STATION06(5, STATION_06),
- STATION07(6, STATION_07),
- STATION08(7, STATION_08),
- STATION09(8, STATION_09),
- STATION10(9, STATION_10),
- STATION11(10, STATION_11),
- STATION12(11, STATION_12),
- STATION13(12, STATION_13),
- STATION14(13, STATION_14),
- STATION15(14, STATION_15),
- STATION16(15, STATION_16),
- STATION17(16, STATION_17),
- STATION18(17, STATION_18),
- STATION19(18, STATION_19),
- STATION20(19, STATION_20),
- STATION21(20, STATION_21),
- STATION22(21, STATION_22),
- STATION23(22, STATION_23),
- STATION24(23, STATION_24),
- STATION25(24, STATION_25),
- STATION26(25, STATION_26),
- STATION27(26, STATION_27),
- STATION28(27, STATION_28),
- STATION29(28, STATION_29),
- STATION30(29, STATION_30),
- STATION31(30, STATION_31),
- STATION32(31, STATION_32),
- STATION33(32, STATION_33),
- STATION34(33, STATION_34),
- STATION35(34, STATION_35),
- STATION36(35, STATION_36),
- STATION37(36, STATION_37),
- STATION38(37, STATION_38),
- STATION39(38, STATION_39),
- STATION40(39, STATION_40),
- STATION41(40, STATION_41),
- STATION42(41, STATION_42),
- STATION43(42, STATION_43),
- STATION44(43, STATION_44),
- STATION45(44, STATION_45),
- STATION46(45, STATION_46),
- STATION47(46, STATION_47),
- STATION48(47, STATION_48);
-
- private final int number;
- private final String id;
-
- private Station(final int number, final String id) {
- this.number = number;
- this.id = id;
- }
-
- @Override
- public String toString() {
- return String.valueOf(number);
- }
-
- public int toNumber() {
- return number;
- }
-
- public static Station get(int valueSelectorNumber) throws IllegalArgumentException {
- for (Station c : Station.values()) {
- if (c.number == valueSelectorNumber) {
- return c;
- }
- }
-
- throw new IllegalArgumentException("Not a valid value selector.");
- }
-
- public static Station get(String valueSelectorText) throws IllegalArgumentException {
- for (Station c : Station.values()) {
- if (c.id.equals(valueSelectorText)) {
- return c;
- }
- }
-
- throw new IllegalArgumentException("Not a valid value selector.");
- }
-
- public String channelID() {
- return this.id;
- }
- }
-}
+/**
+ * Copyright (c) 2014-2016 by the respective copyright holders.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.openhab.binding.opensprinkler;
+
+import org.eclipse.smarthome.core.thing.ThingTypeUID;
+
+/**
+ * The {@link OpenSprinklerBinding} class defines common constants, which are
+ * used across the whole binding.
+ *
+ * @author Chris Graham - Initial contribution
+ */
+public class OpenSprinklerBindingConstants {
+ public static final String BINDING_ID = "opensprinkler";
+
+ // List of all Thing ids
+ public final static String OPENSPRINKLER = "http";
+ public final static String OPENSPRINKLERPI = "pi";
+
+ // List of all Thing Type UIDs
+ public final static ThingTypeUID OPENSPRINKLER_THING = new ThingTypeUID(BINDING_ID, OPENSPRINKLER);
+ public final static ThingTypeUID OPENSPRINKLERPI_THING = new ThingTypeUID(BINDING_ID, OPENSPRINKLERPI);
+
+ public final static int DEFAULT_WAIT_BEFORE_INITIAL_REFRESH = 30;
+ public final static int DEFAULT_REFRESH_RATE = 60;
+ public final static short DISCOVERY_SUBNET_MASK = 24;
+ public final static int DISCOVERY_THREAD_POOL_SIZE = 15;
+ public final static int DISCOVERY_THREAD_POOL_SHUTDOWN_WAIT_TIME_SECONDS = 300;
+ public final static boolean DISCOVERY_DEFAULT_AUTO_DISCOVER = false;
+ public final static int DISCOVERY_DEFAULT_TIMEOUT_RATE = 500;
+ public final static int DISCOVERY_DEFAULT_IP_TIMEOUT_RATE = 750;
+
+ // List of all Channel ids
+ public final static String SENSOR_RAIN = "rainsensor";
+
+ public final static String STATION_01 = "station01";
+ public final static String STATION_02 = "station02";
+ public final static String STATION_03 = "station03";
+ public final static String STATION_04 = "station04";
+ public final static String STATION_05 = "station05";
+ public final static String STATION_06 = "station06";
+ public final static String STATION_07 = "station07";
+ public final static String STATION_08 = "station08";
+ public final static String STATION_09 = "station09";
+ public final static String STATION_10 = "station10";
+ public final static String STATION_11 = "station11";
+ public final static String STATION_12 = "station12";
+ public final static String STATION_13 = "station13";
+ public final static String STATION_14 = "station14";
+ public final static String STATION_15 = "station15";
+ public final static String STATION_16 = "station16";
+ public final static String STATION_17 = "station17";
+ public final static String STATION_18 = "station18";
+ public final static String STATION_19 = "station19";
+ public final static String STATION_20 = "station20";
+ public final static String STATION_21 = "station21";
+ public final static String STATION_22 = "station22";
+ public final static String STATION_23 = "station23";
+ public final static String STATION_24 = "station24";
+ public final static String STATION_25 = "station25";
+ public final static String STATION_26 = "station26";
+ public final static String STATION_27 = "station27";
+ public final static String STATION_28 = "station28";
+ public final static String STATION_29 = "station29";
+ public final static String STATION_30 = "station30";
+ public final static String STATION_31 = "station31";
+ public final static String STATION_32 = "station32";
+ public final static String STATION_33 = "station33";
+ public final static String STATION_34 = "station34";
+ public final static String STATION_35 = "station35";
+ public final static String STATION_36 = "station36";
+ public final static String STATION_37 = "station37";
+ public final static String STATION_38 = "station38";
+ public final static String STATION_39 = "station39";
+ public final static String STATION_40 = "station40";
+ public final static String STATION_41 = "station41";
+ public final static String STATION_42 = "station42";
+ public final static String STATION_43 = "station43";
+ public final static String STATION_44 = "station44";
+ public final static String STATION_45 = "station45";
+ public final static String STATION_46 = "station46";
+ public final static String STATION_47 = "station47";
+ public final static String STATION_48 = "station48";
+
+ /**
+ * Enumeration of station constants for mapping station channel names to ints and back.
+ *
+ * @author CrackerStealth
+ */
+ public enum Station {
+ STATION01(0, STATION_01),
+ STATION02(1, STATION_02),
+ STATION03(2, STATION_03),
+ STATION04(3, STATION_04),
+ STATION05(4, STATION_05),
+ STATION06(5, STATION_06),
+ STATION07(6, STATION_07),
+ STATION08(7, STATION_08),
+ STATION09(8, STATION_09),
+ STATION10(9, STATION_10),
+ STATION11(10, STATION_11),
+ STATION12(11, STATION_12),
+ STATION13(12, STATION_13),
+ STATION14(13, STATION_14),
+ STATION15(14, STATION_15),
+ STATION16(15, STATION_16),
+ STATION17(16, STATION_17),
+ STATION18(17, STATION_18),
+ STATION19(18, STATION_19),
+ STATION20(19, STATION_20),
+ STATION21(20, STATION_21),
+ STATION22(21, STATION_22),
+ STATION23(22, STATION_23),
+ STATION24(23, STATION_24),
+ STATION25(24, STATION_25),
+ STATION26(25, STATION_26),
+ STATION27(26, STATION_27),
+ STATION28(27, STATION_28),
+ STATION29(28, STATION_29),
+ STATION30(29, STATION_30),
+ STATION31(30, STATION_31),
+ STATION32(31, STATION_32),
+ STATION33(32, STATION_33),
+ STATION34(33, STATION_34),
+ STATION35(34, STATION_35),
+ STATION36(35, STATION_36),
+ STATION37(36, STATION_37),
+ STATION38(37, STATION_38),
+ STATION39(38, STATION_39),
+ STATION40(39, STATION_40),
+ STATION41(40, STATION_41),
+ STATION42(41, STATION_42),
+ STATION43(42, STATION_43),
+ STATION44(43, STATION_44),
+ STATION45(44, STATION_45),
+ STATION46(45, STATION_46),
+ STATION47(46, STATION_47),
+ STATION48(47, STATION_48);
+
+ private final int number;
+ private final String id;
+
+ private Station(final int number, final String id) {
+ this.number = number;
+ this.id = id;
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(number);
+ }
+
+ public int toNumber() {
+ return number;
+ }
+
+ public static Station get(int valueSelectorNumber) throws IllegalArgumentException {
+ for (Station c : Station.values()) {
+ if (c.number == valueSelectorNumber) {
+ return c;
+ }
+ }
+
+ throw new IllegalArgumentException("Not a valid value selector.");
+ }
+
+ public static Station get(String valueSelectorText) throws IllegalArgumentException {
+ for (Station c : Station.values()) {
+ if (c.id.equals(valueSelectorText)) {
+ return c;
+ }
+ }
+
+ throw new IllegalArgumentException("Not a valid value selector.");
+ }
+
+ public String channelID() {
+ return this.id;
+ }
+ }
+}
diff --git a/addons/binding/org.openhab.binding.opensprinkler/src/main/java/org/openhab/binding/opensprinkler/handler/OpenSprinklerHTTPHandler.java b/addons/binding/org.openhab.binding.opensprinkler/src/main/java/org/openhab/binding/opensprinkler/handler/OpenSprinklerHTTPHandler.java
index fe282c73c5e3c..4d4cf498cb6b7 100644
--- a/addons/binding/org.openhab.binding.opensprinkler/src/main/java/org/openhab/binding/opensprinkler/handler/OpenSprinklerHTTPHandler.java
+++ b/addons/binding/org.openhab.binding.opensprinkler/src/main/java/org/openhab/binding/opensprinkler/handler/OpenSprinklerHTTPHandler.java
@@ -1,145 +1,145 @@
-/**
- * Copyright (c) 2014-2016 by the respective copyright holders.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- */
-package org.openhab.binding.opensprinkler.handler;
-
-import static org.openhab.binding.opensprinkler.OpenSprinklerBindingConstants.*;
-
-import java.util.concurrent.TimeUnit;
-
-import org.eclipse.smarthome.core.library.types.OnOffType;
-import org.eclipse.smarthome.core.thing.ChannelUID;
-import org.eclipse.smarthome.core.thing.Thing;
-import org.eclipse.smarthome.core.thing.ThingStatus;
-import org.eclipse.smarthome.core.thing.ThingStatusDetail;
-import org.eclipse.smarthome.core.types.State;
-import org.openhab.binding.opensprinkler.OpenSprinklerBindingConstants.Station;
-import org.openhab.binding.opensprinkler.config.OpenSprinklerConfig;
-import org.openhab.binding.opensprinkler.internal.api.OpenSprinklerApiFactory;
-
-/**
- * The {@link OpenSprinklerHTTPHandler} is responsible for handling commands, which are
- * sent to one of the channels.
- *
- * @author Chris Graham - Initial contribution
- */
-public class OpenSprinklerHTTPHandler extends OpenSprinklerHandler {
- private OpenSprinklerConfig openSprinklerConfig = null;
-
- public OpenSprinklerHTTPHandler(Thing thing) {
- super(thing);
- }
-
- @Override
- public void initialize() {
- openSprinklerConfig = getConfig().as(OpenSprinklerConfig.class);
-
- logger.debug("Initializing OpenSprinkler with config (Hostname: {}, Port: {}, Password: {}, Refresh: {}).",
- openSprinklerConfig.hostname, openSprinklerConfig.port, openSprinklerConfig.password,
- openSprinklerConfig.refresh);
-
- if (openSprinklerConfig == null) {
- updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.CONFIGURATION_ERROR,
- "Could not parse the config for the OpenSprinkler.");
-
- return;
- }
-
- try {
- openSprinklerDevice = OpenSprinklerApiFactory.getHttpApi(openSprinklerConfig.hostname,
- openSprinklerConfig.port, openSprinklerConfig.password);
- } catch (Exception exp) {
- updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR,
- "Could not create a connection to the OpenSprinkler.");
- logger.debug("Could not create API connection to the OpenSprinkler device. Exception received: {}",
- exp.toString());
-
- return;
- }
-
- logger.debug("Successfully created API connection to the OpenSprinkler device.");
-
- try {
- openSprinklerDevice.openConnection();
- } catch (Exception exp) {
- updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR,
- "Could not open the connection to the OpenSprinkler.");
- logger.debug("Could not open API connection to the OpenSprinkler device. Exception received: {}",
- exp.toString());
- }
-
- if (openSprinklerDevice.isConnected()) {
- updateStatus(ThingStatus.ONLINE);
- logger.debug("OpenSprinkler connected.");
- } else {
- updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR,
- "Could not initialize the connection to the OpenSprinkler.");
-
- return;
- }
-
- onUpdate();
- }
-
- /**
- * Creates a new polling job to sync state with the OpenSprinkler device.
- */
- private synchronized void onUpdate() {
- if (pollingJob == null || pollingJob.isCancelled()) {
- int refresh;
-
- try {
- refresh = getConfig().as(OpenSprinklerConfig.class).refresh;
- } catch (Exception exp) {
- refresh = this.refreshInterval;
- }
-
- pollingJob = scheduler.scheduleWithFixedDelay(refreshService, DEFAULT_WAIT_BEFORE_INITIAL_REFRESH, refresh,
- TimeUnit.SECONDS);
- }
- }
-
- /**
- * Threaded scheduled job that periodically syncs the state of the OpenSprinkler device.
- */
- private Runnable refreshService = new Runnable() {
- @Override
- public void run() {
- if (openSprinklerDevice != null) {
- if (openSprinklerDevice.isConnected()) {
- logger.debug("Refreshing state with the OpenSprinkler device.");
-
- try {
- if (openSprinklerDevice.isRainDetected()) {
- updateState(new ChannelUID(getThing().getUID(), SENSOR_RAIN), OnOffType.ON);
- } else {
- updateState(new ChannelUID(getThing().getUID(), SENSOR_RAIN), OnOffType.OFF);
- }
-
- for (int i = 0; i < openSprinklerDevice.getNumberOfStations(); i++) {
- ChannelUID channel = new ChannelUID(getThing().getUID(), Station.get(i).channelID());
- State command = getStationState(i);
- updateState(channel, command);
- }
-
- updateStatus(ThingStatus.ONLINE);
- } catch (Exception exp) {
- updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR,
- "Could not refresh current state from the OpenSprinkler.");
- logger.debug(
- "Could not refresh current state of the OpenSprinkler device. Exception received: {}",
- exp.toString());
- }
- } else {
- updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR,
- "Could not sync status with the OpenSprinkler.");
- }
- }
- }
- };
-}
+/**
+ * Copyright (c) 2014-2016 by the respective copyright holders.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.openhab.binding.opensprinkler.handler;
+
+import static org.openhab.binding.opensprinkler.OpenSprinklerBindingConstants.*;
+
+import java.util.concurrent.TimeUnit;
+
+import org.eclipse.smarthome.core.library.types.OnOffType;
+import org.eclipse.smarthome.core.thing.ChannelUID;
+import org.eclipse.smarthome.core.thing.Thing;
+import org.eclipse.smarthome.core.thing.ThingStatus;
+import org.eclipse.smarthome.core.thing.ThingStatusDetail;
+import org.eclipse.smarthome.core.types.State;
+import org.openhab.binding.opensprinkler.OpenSprinklerBindingConstants.Station;
+import org.openhab.binding.opensprinkler.config.OpenSprinklerConfig;
+import org.openhab.binding.opensprinkler.internal.api.OpenSprinklerApiFactory;
+
+/**
+ * The {@link OpenSprinklerHTTPHandler} is responsible for handling commands, which are
+ * sent to one of the channels.
+ *
+ * @author Chris Graham - Initial contribution
+ */
+public class OpenSprinklerHTTPHandler extends OpenSprinklerHandler {
+ private OpenSprinklerConfig openSprinklerConfig = null;
+
+ public OpenSprinklerHTTPHandler(Thing thing) {
+ super(thing);
+ }
+
+ @Override
+ public void initialize() {
+ openSprinklerConfig = getConfig().as(OpenSprinklerConfig.class);
+
+ logger.debug("Initializing OpenSprinkler with config (Hostname: {}, Port: {}, Password: {}, Refresh: {}).",
+ openSprinklerConfig.hostname, openSprinklerConfig.port, openSprinklerConfig.password,
+ openSprinklerConfig.refresh);
+
+ if (openSprinklerConfig == null) {
+ updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.CONFIGURATION_ERROR,
+ "Could not parse the config for the OpenSprinkler.");
+
+ return;
+ }
+
+ try {
+ openSprinklerDevice = OpenSprinklerApiFactory.getHttpApi(openSprinklerConfig.hostname,
+ openSprinklerConfig.port, openSprinklerConfig.password);
+ } catch (Exception exp) {
+ updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR,
+ "Could not create a connection to the OpenSprinkler.");
+ logger.debug("Could not create API connection to the OpenSprinkler device. Exception received: {}",
+ exp.toString());
+
+ return;
+ }
+
+ logger.debug("Successfully created API connection to the OpenSprinkler device.");
+
+ try {
+ openSprinklerDevice.openConnection();
+ } catch (Exception exp) {
+ updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR,
+ "Could not open the connection to the OpenSprinkler.");
+ logger.debug("Could not open API connection to the OpenSprinkler device. Exception received: {}",
+ exp.toString());
+ }
+
+ if (openSprinklerDevice.isConnected()) {
+ updateStatus(ThingStatus.ONLINE);
+ logger.debug("OpenSprinkler connected.");
+ } else {
+ updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR,
+ "Could not initialize the connection to the OpenSprinkler.");
+
+ return;
+ }
+
+ onUpdate();
+ }
+
+ /**
+ * Creates a new polling job to sync state with the OpenSprinkler device.
+ */
+ private synchronized void onUpdate() {
+ if (pollingJob == null || pollingJob.isCancelled()) {
+ int refresh;
+
+ try {
+ refresh = getConfig().as(OpenSprinklerConfig.class).refresh;
+ } catch (Exception exp) {
+ refresh = this.refreshInterval;
+ }
+
+ pollingJob = scheduler.scheduleWithFixedDelay(refreshService, DEFAULT_WAIT_BEFORE_INITIAL_REFRESH, refresh,
+ TimeUnit.SECONDS);
+ }
+ }
+
+ /**
+ * Threaded scheduled job that periodically syncs the state of the OpenSprinkler device.
+ */
+ private Runnable refreshService = new Runnable() {
+ @Override
+ public void run() {
+ if (openSprinklerDevice != null) {
+ if (openSprinklerDevice.isConnected()) {
+ logger.debug("Refreshing state with the OpenSprinkler device.");
+
+ try {
+ if (openSprinklerDevice.isRainDetected()) {
+ updateState(new ChannelUID(getThing().getUID(), SENSOR_RAIN), OnOffType.ON);
+ } else {
+ updateState(new ChannelUID(getThing().getUID(), SENSOR_RAIN), OnOffType.OFF);
+ }
+
+ for (int i = 0; i < openSprinklerDevice.getNumberOfStations(); i++) {
+ ChannelUID channel = new ChannelUID(getThing().getUID(), Station.get(i).channelID());
+ State command = getStationState(i);
+ updateState(channel, command);
+ }
+
+ updateStatus(ThingStatus.ONLINE);
+ } catch (Exception exp) {
+ updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR,
+ "Could not refresh current state from the OpenSprinkler.");
+ logger.debug(
+ "Could not refresh current state of the OpenSprinkler device. Exception received: {}",
+ exp.toString());
+ }
+ } else {
+ updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR,
+ "Could not sync status with the OpenSprinkler.");
+ }
+ }
+ }
+ };
+}
diff --git a/addons/binding/org.openhab.binding.opensprinkler/src/main/java/org/openhab/binding/opensprinkler/internal/OpenSprinklerHandlerFactory.java b/addons/binding/org.openhab.binding.opensprinkler/src/main/java/org/openhab/binding/opensprinkler/internal/OpenSprinklerHandlerFactory.java
index a694d788b111f..e88b722d53e03 100644
--- a/addons/binding/org.openhab.binding.opensprinkler/src/main/java/org/openhab/binding/opensprinkler/internal/OpenSprinklerHandlerFactory.java
+++ b/addons/binding/org.openhab.binding.opensprinkler/src/main/java/org/openhab/binding/opensprinkler/internal/OpenSprinklerHandlerFactory.java
@@ -1,51 +1,51 @@
-/**
- * Copyright (c) 2014-2016 by the respective copyright holders.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- */
-package org.openhab.binding.opensprinkler.internal;
-
-import static org.openhab.binding.opensprinkler.OpenSprinklerBindingConstants.*;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.smarthome.core.thing.Thing;
-import org.eclipse.smarthome.core.thing.ThingTypeUID;
-import org.eclipse.smarthome.core.thing.binding.BaseThingHandlerFactory;
-import org.eclipse.smarthome.core.thing.binding.ThingHandler;
-import org.openhab.binding.opensprinkler.handler.OpenSprinklerHTTPHandler;
-import org.openhab.binding.opensprinkler.handler.OpenSprinklerPiHandler;
-
-/**
- * The {@link OpenSprinklerHandlerFactory} is responsible for creating things and thing
- * handlers.
- *
- * @author Chris Graham - Initial contribution
- */
-public class OpenSprinklerHandlerFactory extends BaseThingHandlerFactory {
- private final static Set SUPPORTED_THING_TYPES_UIDS = new HashSet(
- Arrays.asList(OPENSPRINKLER_THING, OPENSPRINKLERPI_THING));
-
- @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(OPENSPRINKLER_THING)) {
- return new OpenSprinklerHTTPHandler(thing);
- } else if (thingTypeUID.equals(OPENSPRINKLERPI_THING)) {
- return new OpenSprinklerPiHandler(thing);
- }
-
- return null;
- }
-}
+/**
+ * Copyright (c) 2014-2016 by the respective copyright holders.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.openhab.binding.opensprinkler.internal;
+
+import static org.openhab.binding.opensprinkler.OpenSprinklerBindingConstants.*;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.smarthome.core.thing.Thing;
+import org.eclipse.smarthome.core.thing.ThingTypeUID;
+import org.eclipse.smarthome.core.thing.binding.BaseThingHandlerFactory;
+import org.eclipse.smarthome.core.thing.binding.ThingHandler;
+import org.openhab.binding.opensprinkler.handler.OpenSprinklerHTTPHandler;
+import org.openhab.binding.opensprinkler.handler.OpenSprinklerPiHandler;
+
+/**
+ * The {@link OpenSprinklerHandlerFactory} is responsible for creating things and thing
+ * handlers.
+ *
+ * @author Chris Graham - Initial contribution
+ */
+public class OpenSprinklerHandlerFactory extends BaseThingHandlerFactory {
+ private final static Set SUPPORTED_THING_TYPES_UIDS = new HashSet(
+ Arrays.asList(OPENSPRINKLER_THING, OPENSPRINKLERPI_THING));
+
+ @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(OPENSPRINKLER_THING)) {
+ return new OpenSprinklerHTTPHandler(thing);
+ } else if (thingTypeUID.equals(OPENSPRINKLERPI_THING)) {
+ return new OpenSprinklerPiHandler(thing);
+ }
+
+ return null;
+ }
+}
diff --git a/addons/binding/org.openhab.binding.pioneeravr/.classpath b/addons/binding/org.openhab.binding.pioneeravr/.classpath
index 642bfb34f723f..a95e0906ca013 100644
--- a/addons/binding/org.openhab.binding.pioneeravr/.classpath
+++ b/addons/binding/org.openhab.binding.pioneeravr/.classpath
@@ -1,7 +1,7 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/addons/binding/org.openhab.binding.pioneeravr/.project b/addons/binding/org.openhab.binding.pioneeravr/.project
index 3664a60fe003b..039829a40e6d9 100644
--- a/addons/binding/org.openhab.binding.pioneeravr/.project
+++ b/addons/binding/org.openhab.binding.pioneeravr/.project
@@ -1,33 +1,33 @@
-
-
- org.openhab.binding.pioneeravr
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.pde.ManifestBuilder
-
-
-
-
- org.eclipse.pde.SchemaBuilder
-
-
-
-
- org.eclipse.pde.ds.core.builder
-
-
-
-
-
- org.eclipse.pde.PluginNature
- org.eclipse.jdt.core.javanature
-
-
+
+
+ org.openhab.binding.pioneeravr
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+ org.eclipse.pde.ds.core.builder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/internal/discovery/RFXComDeviceDiscoveryService.java b/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/internal/discovery/RFXComDeviceDiscoveryService.java
index cdb2e4e24253e..0142b06b24995 100644
--- a/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/internal/discovery/RFXComDeviceDiscoveryService.java
+++ b/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/internal/discovery/RFXComDeviceDiscoveryService.java
@@ -1,84 +1,84 @@
-/**
- * Copyright (c) 2014-2016 by the respective copyright holders.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- */
-package org.openhab.binding.rfxcom.internal.discovery;
-
-import java.util.Set;
-
-import org.eclipse.smarthome.config.discovery.AbstractDiscoveryService;
-import org.eclipse.smarthome.config.discovery.DiscoveryResult;
-import org.eclipse.smarthome.config.discovery.DiscoveryResultBuilder;
-import org.eclipse.smarthome.core.thing.ThingTypeUID;
-import org.eclipse.smarthome.core.thing.ThingUID;
-import org.openhab.binding.rfxcom.RFXComBindingConstants;
-import org.openhab.binding.rfxcom.handler.RFXComBridgeHandler;
-import org.openhab.binding.rfxcom.internal.DeviceMessageListener;
-import org.openhab.binding.rfxcom.internal.messages.RFXComBaseMessage;
-import org.openhab.binding.rfxcom.internal.messages.RFXComMessage;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * The {@link RFXComDeviceDiscoveryService} class is used to discover RFXCOM
- * devices that send messages to RFXCOM bridge.
- *
- * @author Pauli Anttila - Initial contribution
- */
-public class RFXComDeviceDiscoveryService extends AbstractDiscoveryService implements DeviceMessageListener {
-
- private final static Logger logger = LoggerFactory.getLogger(RFXComDeviceDiscoveryService.class);
-
- private RFXComBridgeHandler bridgeHandler;
-
- public RFXComDeviceDiscoveryService(RFXComBridgeHandler rfxcomBridgeHandler) {
- super(null, 1, false);
- this.bridgeHandler = rfxcomBridgeHandler;
- }
-
- public void activate() {
- bridgeHandler.registerDeviceStatusListener(this);
- }
-
- @Override
- public void deactivate() {
- bridgeHandler.unregisterDeviceStatusListener(this);
- }
-
- @Override
- public Set getSupportedThingTypes() {
- return RFXComBindingConstants.SUPPORTED_DEVICE_THING_TYPES_UIDS;
- }
-
- @Override
- protected void startScan() {
- // this can be ignored here as we discover devices from received messages
- }
-
- @Override
- public void onDeviceMessageReceived(ThingUID bridge, RFXComMessage message) {
- logger.trace("Received: bridge: {} message: {}", bridge, message);
-
- try {
- RFXComBaseMessage msg = (RFXComBaseMessage) message;
- String id = message.getDeviceId();
- ThingTypeUID uid = RFXComBindingConstants.packetTypeThingMap.get(msg.packetType);
- ThingUID thingUID = new ThingUID(uid, bridge, id.replace(RFXComBaseMessage.ID_DELIMITER, "_"));
- if (thingUID != null) {
- logger.trace("Adding new RFXCOM {} with id '{}' to smarthome inbox", thingUID, id);
- String subType = msg.convertSubType(String.valueOf(msg.subType)).toString();
- String label = msg.packetType + "-" + id;
- DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(thingUID).withLabel(label)
- .withProperty(RFXComBindingConstants.DEVICE_ID, id)
- .withProperty(RFXComBindingConstants.SUB_TYPE, subType).withBridge(bridge).build();
- thingDiscovered(discoveryResult);
- }
- } catch (Exception e) {
- logger.debug("Error occurred during device discovery", e);
- }
- }
-}
+/**
+ * Copyright (c) 2014-2016 by the respective copyright holders.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.openhab.binding.rfxcom.internal.discovery;
+
+import java.util.Set;
+
+import org.eclipse.smarthome.config.discovery.AbstractDiscoveryService;
+import org.eclipse.smarthome.config.discovery.DiscoveryResult;
+import org.eclipse.smarthome.config.discovery.DiscoveryResultBuilder;
+import org.eclipse.smarthome.core.thing.ThingTypeUID;
+import org.eclipse.smarthome.core.thing.ThingUID;
+import org.openhab.binding.rfxcom.RFXComBindingConstants;
+import org.openhab.binding.rfxcom.handler.RFXComBridgeHandler;
+import org.openhab.binding.rfxcom.internal.DeviceMessageListener;
+import org.openhab.binding.rfxcom.internal.messages.RFXComBaseMessage;
+import org.openhab.binding.rfxcom.internal.messages.RFXComMessage;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The {@link RFXComDeviceDiscoveryService} class is used to discover RFXCOM
+ * devices that send messages to RFXCOM bridge.
+ *
+ * @author Pauli Anttila - Initial contribution
+ */
+public class RFXComDeviceDiscoveryService extends AbstractDiscoveryService implements DeviceMessageListener {
+
+ private final static Logger logger = LoggerFactory.getLogger(RFXComDeviceDiscoveryService.class);
+
+ private RFXComBridgeHandler bridgeHandler;
+
+ public RFXComDeviceDiscoveryService(RFXComBridgeHandler rfxcomBridgeHandler) {
+ super(null, 1, false);
+ this.bridgeHandler = rfxcomBridgeHandler;
+ }
+
+ public void activate() {
+ bridgeHandler.registerDeviceStatusListener(this);
+ }
+
+ @Override
+ public void deactivate() {
+ bridgeHandler.unregisterDeviceStatusListener(this);
+ }
+
+ @Override
+ public Set getSupportedThingTypes() {
+ return RFXComBindingConstants.SUPPORTED_DEVICE_THING_TYPES_UIDS;
+ }
+
+ @Override
+ protected void startScan() {
+ // this can be ignored here as we discover devices from received messages
+ }
+
+ @Override
+ public void onDeviceMessageReceived(ThingUID bridge, RFXComMessage message) {
+ logger.trace("Received: bridge: {} message: {}", bridge, message);
+
+ try {
+ RFXComBaseMessage msg = (RFXComBaseMessage) message;
+ String id = message.getDeviceId();
+ ThingTypeUID uid = RFXComBindingConstants.packetTypeThingMap.get(msg.packetType);
+ ThingUID thingUID = new ThingUID(uid, bridge, id.replace(RFXComBaseMessage.ID_DELIMITER, "_"));
+ if (thingUID != null) {
+ logger.trace("Adding new RFXCOM {} with id '{}' to smarthome inbox", thingUID, id);
+ String subType = msg.convertSubType(String.valueOf(msg.subType)).toString();
+ String label = msg.packetType + "-" + id;
+ DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(thingUID).withLabel(label)
+ .withProperty(RFXComBindingConstants.DEVICE_ID, id)
+ .withProperty(RFXComBindingConstants.SUB_TYPE, subType).withBridge(bridge).build();
+ thingDiscovered(discoveryResult);
+ }
+ } catch (Exception e) {
+ logger.debug("Error occurred during device discovery", e);
+ }
+ }
+}
diff --git a/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/internal/messages/RFXComRainMessage.java b/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/internal/messages/RFXComRainMessage.java
index a581676aa94ec..bf5d89dc3dffb 100644
--- a/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/internal/messages/RFXComRainMessage.java
+++ b/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/internal/messages/RFXComRainMessage.java
@@ -1,231 +1,231 @@
-/**
- * Copyright (c) 2014-2016 by the respective copyright holders.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- */
-package org.openhab.binding.rfxcom.internal.messages;
-
-import org.eclipse.smarthome.core.library.items.NumberItem;
-import org.eclipse.smarthome.core.library.types.DecimalType;
-import org.eclipse.smarthome.core.types.State;
-import org.eclipse.smarthome.core.types.Type;
-import org.eclipse.smarthome.core.types.UnDefType;
-import org.openhab.binding.rfxcom.RFXComValueSelector;
-import org.openhab.binding.rfxcom.internal.exceptions.RFXComException;
-
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * RFXCOM data class for temperature and humidity message.
- *
- * @author Marc SAUVEUR - Initial contribution
- * @author Pauli Anttila
- */
-public class RFXComRainMessage extends RFXComBaseMessage {
-
- public enum SubType {
- RAIN1(1),
- RAIN2(2),
- RAIN3(3),
- RAIN4(4),
- RAIN5(5),
- RAIN6(6),
-
- UNKNOWN(255);
-
- private final int subType;
-
- SubType(int subType) {
- this.subType = subType;
- }
-
- SubType(byte subType) {
- this.subType = subType;
- }
-
- public byte toByte() {
- return (byte) subType;
- }
-
- public static SubType fromByte(int input) {
- for (SubType c : SubType.values()) {
- if (c.subType == input) {
- return c;
- }
- }
-
- return SubType.UNKNOWN;
- }
- }
-
- private final static List supportedInputValueSelectors = Arrays.asList(
- RFXComValueSelector.SIGNAL_LEVEL, RFXComValueSelector.BATTERY_LEVEL, RFXComValueSelector.RAIN_RATE,
- RFXComValueSelector.RAIN_TOTAL);
-
- private final static List supportedOutputValueSelectors = Arrays.asList();
-
- public SubType subType = SubType.UNKNOWN;
- public int sensorId = 0;
- public double rainRate = 0;
- public double rainTotal = 0;
- public byte signalLevel = 0;
- public byte batteryLevel = 0;
-
- public RFXComRainMessage() {
- packetType = PacketType.RAIN;
- }
-
- public RFXComRainMessage(byte[] data) {
- encodeMessage(data);
- }
-
- @Override
- public String toString() {
- String str = "";
-
- str += super.toString();
- str += ", Sub type = " + subType;
- str += ", Device Id = " + getDeviceId();
- str += ", Rain rate = " + rainRate;
- str += ", Rain total = " + rainTotal;
- str += ", Signal level = " + signalLevel;
- str += ", Battery level = " + batteryLevel;
-
- return str;
- }
-
- @Override
- public void encodeMessage(byte[] data) {
- super.encodeMessage(data);
-
- subType = SubType.fromByte(super.subType);
- sensorId = (data[4] & 0xFF) << 8 | (data[5] & 0xFF);
-
- rainRate = (short) ((data[6] & 0xFF) << 8 | (data[7] & 0xFF));
- if (subType == SubType.RAIN2) {
- rainRate *= 0.01;
- }
-
- if (subType == SubType.RAIN6) {
- rainTotal = (short) ((data[10] & 0xFF)) * 0.266;
- } else {
- rainTotal = (short) ((data[8] & 0xFF) << 8 | (data[9] & 0xFF) << 8 | (data[10] & 0xFF)) * 0.1;
- }
-
- signalLevel = (byte) ((data[11] & 0xF0) >> 4);
- batteryLevel = (byte) (data[11] & 0x0F);
- }
-
- @Override
- public byte[] decodeMessage() {
- byte[] data = new byte[12];
-
- data[0] = 0x0B;
- data[1] = RFXComBaseMessage.PacketType.RAIN.toByte();
- data[2] = subType.toByte();
- data[3] = seqNbr;
- data[4] = (byte) ((sensorId & 0xFF00) >> 8);
- data[5] = (byte) (sensorId & 0x00FF);
-
- short rainR = (short) Math.abs(rainRate * 100);
- data[6] = (byte) ((rainR >> 8) & 0xFF);
- data[7] = (byte) (rainR & 0xFF);
-
- short rainT = (short) Math.abs(rainTotal * 10);
- data[8] = (byte) ((rainT >> 16) & 0xFF);
- data[9] = (byte) ((rainT >> 8) & 0xFF);
- data[10] = (byte) (rainT & 0xFF);
-
- data[11] = (byte) (((signalLevel & 0x0F) << 4) | (batteryLevel & 0x0F));
-
- return data;
- }
-
- @Override
- public String getDeviceId() {
- return String.valueOf(sensorId);
- }
-
- @Override
- public State convertToState(RFXComValueSelector valueSelector) throws RFXComException {
-
- State state = UnDefType.UNDEF;
-
- if (valueSelector.getItemClass() == NumberItem.class) {
-
- if (valueSelector == RFXComValueSelector.SIGNAL_LEVEL) {
-
- state = new DecimalType(signalLevel);
-
- } else if (valueSelector == RFXComValueSelector.BATTERY_LEVEL) {
-
- state = new DecimalType(batteryLevel);
-
- } else if (valueSelector == RFXComValueSelector.RAIN_RATE) {
-
- state = new DecimalType(rainRate);
- } else if (valueSelector == RFXComValueSelector.RAIN_TOTAL) {
-
- state = new DecimalType(rainTotal);
-
- } else {
- throw new RFXComException("Can't convert " + valueSelector + " to NumberItem");
- }
-
- } else {
-
- throw new RFXComException("Can't convert " + valueSelector + " to " + valueSelector.getItemClass());
-
- }
-
- return state;
- }
-
- @Override
- public void setSubType(Object subType) throws RFXComException {
- throw new RFXComException("Not supported");
- }
-
- @Override
- public void setDeviceId(String deviceId) throws RFXComException {
- throw new RFXComException("Not supported");
- }
-
- @Override
- public void convertFromState(RFXComValueSelector valueSelector, Type type) throws RFXComException {
-
- throw new RFXComException("Not supported");
- }
-
- @Override
- public Object convertSubType(String subType) throws RFXComException {
-
- for (SubType s : SubType.values()) {
- if (s.toString().equals(subType)) {
- return s;
- }
- }
-
- // try to find sub type by number
- try {
- return SubType.values()[Integer.parseInt(subType)];
- } catch (Exception e) {
- throw new RFXComException("Unknown sub type " + subType);
- }
- }
-
- @Override
- public List getSupportedInputValueSelectors() throws RFXComException {
- return supportedInputValueSelectors;
- }
-
- @Override
- public List getSupportedOutputValueSelectors() throws RFXComException {
- return supportedOutputValueSelectors;
- }
-
-}
+/**
+ * Copyright (c) 2014-2016 by the respective copyright holders.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.openhab.binding.rfxcom.internal.messages;
+
+import org.eclipse.smarthome.core.library.items.NumberItem;
+import org.eclipse.smarthome.core.library.types.DecimalType;
+import org.eclipse.smarthome.core.types.State;
+import org.eclipse.smarthome.core.types.Type;
+import org.eclipse.smarthome.core.types.UnDefType;
+import org.openhab.binding.rfxcom.RFXComValueSelector;
+import org.openhab.binding.rfxcom.internal.exceptions.RFXComException;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * RFXCOM data class for temperature and humidity message.
+ *
+ * @author Marc SAUVEUR - Initial contribution
+ * @author Pauli Anttila
+ */
+public class RFXComRainMessage extends RFXComBaseMessage {
+
+ public enum SubType {
+ RAIN1(1),
+ RAIN2(2),
+ RAIN3(3),
+ RAIN4(4),
+ RAIN5(5),
+ RAIN6(6),
+
+ UNKNOWN(255);
+
+ private final int subType;
+
+ SubType(int subType) {
+ this.subType = subType;
+ }
+
+ SubType(byte subType) {
+ this.subType = subType;
+ }
+
+ public byte toByte() {
+ return (byte) subType;
+ }
+
+ public static SubType fromByte(int input) {
+ for (SubType c : SubType.values()) {
+ if (c.subType == input) {
+ return c;
+ }
+ }
+
+ return SubType.UNKNOWN;
+ }
+ }
+
+ private final static List supportedInputValueSelectors = Arrays.asList(
+ RFXComValueSelector.SIGNAL_LEVEL, RFXComValueSelector.BATTERY_LEVEL, RFXComValueSelector.RAIN_RATE,
+ RFXComValueSelector.RAIN_TOTAL);
+
+ private final static List supportedOutputValueSelectors = Arrays.asList();
+
+ public SubType subType = SubType.UNKNOWN;
+ public int sensorId = 0;
+ public double rainRate = 0;
+ public double rainTotal = 0;
+ public byte signalLevel = 0;
+ public byte batteryLevel = 0;
+
+ public RFXComRainMessage() {
+ packetType = PacketType.RAIN;
+ }
+
+ public RFXComRainMessage(byte[] data) {
+ encodeMessage(data);
+ }
+
+ @Override
+ public String toString() {
+ String str = "";
+
+ str += super.toString();
+ str += ", Sub type = " + subType;
+ str += ", Device Id = " + getDeviceId();
+ str += ", Rain rate = " + rainRate;
+ str += ", Rain total = " + rainTotal;
+ str += ", Signal level = " + signalLevel;
+ str += ", Battery level = " + batteryLevel;
+
+ return str;
+ }
+
+ @Override
+ public void encodeMessage(byte[] data) {
+ super.encodeMessage(data);
+
+ subType = SubType.fromByte(super.subType);
+ sensorId = (data[4] & 0xFF) << 8 | (data[5] & 0xFF);
+
+ rainRate = (short) ((data[6] & 0xFF) << 8 | (data[7] & 0xFF));
+ if (subType == SubType.RAIN2) {
+ rainRate *= 0.01;
+ }
+
+ if (subType == SubType.RAIN6) {
+ rainTotal = (short) ((data[10] & 0xFF)) * 0.266;
+ } else {
+ rainTotal = (short) ((data[8] & 0xFF) << 8 | (data[9] & 0xFF) << 8 | (data[10] & 0xFF)) * 0.1;
+ }
+
+ signalLevel = (byte) ((data[11] & 0xF0) >> 4);
+ batteryLevel = (byte) (data[11] & 0x0F);
+ }
+
+ @Override
+ public byte[] decodeMessage() {
+ byte[] data = new byte[12];
+
+ data[0] = 0x0B;
+ data[1] = RFXComBaseMessage.PacketType.RAIN.toByte();
+ data[2] = subType.toByte();
+ data[3] = seqNbr;
+ data[4] = (byte) ((sensorId & 0xFF00) >> 8);
+ data[5] = (byte) (sensorId & 0x00FF);
+
+ short rainR = (short) Math.abs(rainRate * 100);
+ data[6] = (byte) ((rainR >> 8) & 0xFF);
+ data[7] = (byte) (rainR & 0xFF);
+
+ short rainT = (short) Math.abs(rainTotal * 10);
+ data[8] = (byte) ((rainT >> 16) & 0xFF);
+ data[9] = (byte) ((rainT >> 8) & 0xFF);
+ data[10] = (byte) (rainT & 0xFF);
+
+ data[11] = (byte) (((signalLevel & 0x0F) << 4) | (batteryLevel & 0x0F));
+
+ return data;
+ }
+
+ @Override
+ public String getDeviceId() {
+ return String.valueOf(sensorId);
+ }
+
+ @Override
+ public State convertToState(RFXComValueSelector valueSelector) throws RFXComException {
+
+ State state = UnDefType.UNDEF;
+
+ if (valueSelector.getItemClass() == NumberItem.class) {
+
+ if (valueSelector == RFXComValueSelector.SIGNAL_LEVEL) {
+
+ state = new DecimalType(signalLevel);
+
+ } else if (valueSelector == RFXComValueSelector.BATTERY_LEVEL) {
+
+ state = new DecimalType(batteryLevel);
+
+ } else if (valueSelector == RFXComValueSelector.RAIN_RATE) {
+
+ state = new DecimalType(rainRate);
+ } else if (valueSelector == RFXComValueSelector.RAIN_TOTAL) {
+
+ state = new DecimalType(rainTotal);
+
+ } else {
+ throw new RFXComException("Can't convert " + valueSelector + " to NumberItem");
+ }
+
+ } else {
+
+ throw new RFXComException("Can't convert " + valueSelector + " to " + valueSelector.getItemClass());
+
+ }
+
+ return state;
+ }
+
+ @Override
+ public void setSubType(Object subType) throws RFXComException {
+ throw new RFXComException("Not supported");
+ }
+
+ @Override
+ public void setDeviceId(String deviceId) throws RFXComException {
+ throw new RFXComException("Not supported");
+ }
+
+ @Override
+ public void convertFromState(RFXComValueSelector valueSelector, Type type) throws RFXComException {
+
+ throw new RFXComException("Not supported");
+ }
+
+ @Override
+ public Object convertSubType(String subType) throws RFXComException {
+
+ for (SubType s : SubType.values()) {
+ if (s.toString().equals(subType)) {
+ return s;
+ }
+ }
+
+ // try to find sub type by number
+ try {
+ return SubType.values()[Integer.parseInt(subType)];
+ } catch (Exception e) {
+ throw new RFXComException("Unknown sub type " + subType);
+ }
+ }
+
+ @Override
+ public List getSupportedInputValueSelectors() throws RFXComException {
+ return supportedInputValueSelectors;
+ }
+
+ @Override
+ public List getSupportedOutputValueSelectors() throws RFXComException {
+ return supportedOutputValueSelectors;
+ }
+
+}
diff --git a/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/internal/messages/RFXComSecurity1Message.java b/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/internal/messages/RFXComSecurity1Message.java
index 80bf0964076dc..58f180f1dc0ad 100644
--- a/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/internal/messages/RFXComSecurity1Message.java
+++ b/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/internal/messages/RFXComSecurity1Message.java
@@ -1,424 +1,424 @@
-/**
- * Copyright (c) 2014-2016 by the respective copyright holders.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- */
-package org.openhab.binding.rfxcom.internal.messages;
-
-import org.eclipse.smarthome.core.library.items.*;
-import org.eclipse.smarthome.core.library.types.*;
-import org.eclipse.smarthome.core.types.State;
-import org.eclipse.smarthome.core.types.Type;
-import org.eclipse.smarthome.core.types.UnDefType;
-import org.openhab.binding.rfxcom.RFXComValueSelector;
-import org.openhab.binding.rfxcom.internal.exceptions.RFXComException;
-
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * RFXCOM data class for Security1 message.
- * (i.e. X10 Security, Visonic PowerCode, Meiantech, etc.)
- *
- * @author David Kalff - Initial contribution
- * @author Pauli Anttila
- */
-public class RFXComSecurity1Message extends RFXComBaseMessage {
-
- public enum SubType {
- X10_SECURITY(0),
- X10_SECURITY_MOTION(1),
- X10_SECURITY_REMOTE(2),
- KD101(3),
- VISONIC_POWERCODE_SENSOR_PRIMARY_CONTACT(4),
- VISONIC_POWERCODE_MOTION(5),
- VISONIC_CODESECURE(6),
- VISONIC_POWERCODE_SENSOR_AUX_CONTACT(7),
- MEIANTECH(8),
- SA30(9),
-
- UNKNOWN(255);
-
- private final int subType;
-
- SubType(int subType) {
- this.subType = subType;
- }
-
- SubType(byte subType) {
- this.subType = subType;
- }
-
- public byte toByte() {
- return (byte) subType;
- }
-
- public static SubType fromByte(int input) {
- for (SubType c : SubType.values()) {
- if (c.subType == input) {
- return c;
- }
- }
-
- return SubType.UNKNOWN;
- }
- }
-
- public enum Status {
- NORMAL(0),
- NORMAL_DELAYED(1),
- ALARM(2),
- ALARM_DELAYED(3),
- MOTION(4),
- NO_MOTION(5),
- PANIC(6),
- END_PANIC(7),
- IR(8),
- ARM_AWAY(9),
- ARM_AWAY_DELAYED(10),
- ARM_HOME(11),
- ARM_HOME_DELAYED(12),
- DISARM(13),
- LIGHT_1_OFF(16),
- LIGHT_1_ON(17),
- LIGHT_2_OFF(18),
- LIGHT_2_ON(19),
- DARK_DETECTED(20),
- LIGHT_DETECTED(21),
- BATLOW(22),
- PAIR_KD101(23),
- NORMAL_TAMPER(128),
- NORMAL_DELAYED_TAMPER(129),
- ALARM_TAMPER(130),
- ALARM_DELAYED_TAMPER(131),
- MOTION_TAMPER(132),
- NO_MOTION_TAMPER(133),
-
- UNKNOWN(255);
-
- private final int status;
-
- Status(int status) {
- this.status = status;
- }
-
- Status(byte status) {
- this.status = status;
- }
-
- public byte toByte() {
- return (byte) status;
- }
-
- public static Status fromByte(int input) {
- for (Status status : Status.values()) {
- if (status.status == input) {
- return status;
- }
- }
-
- return Status.UNKNOWN;
- }
- }
-
- /* Added item for ContactTypes */
- public enum Contact {
- NORMAL(0),
- NORMAL_DELAYED(1),
- ALARM(2),
- ALARM_DELAYED(3),
- NORMAL_TAMPER(128),
- NORMAL_DELAYED_TAMPER(129),
- ALARM_TAMPER(130),
- ALARM_DELAYED_TAMPER(131),
-
- UNKNOWN(255);
-
- private final int contact;
-
- Contact(int contact) {
- this.contact = contact;
- }
-
- Contact(byte contact) {
- this.contact = contact;
- }
-
- public byte toByte() {
- return (byte) contact;
- }
-
- public static Contact fromByte(int input) {
- for (Contact status : Contact.values()) {
- if (status.contact == input) {
- return status;
- }
- }
-
- return Contact.UNKNOWN;
- }
- }
-
- /* Added item for MotionTypes */
- public enum Motion {
- MOTION(4),
- NO_MOTION(5),
- MOTION_TAMPER(132),
- NO_MOTION_TAMPER(133),
-
- UNKNOWN(255);
-
- private final int motion;
-
- Motion(int motion) {
- this.motion = motion;
- }
-
- Motion(byte motion) {
- this.motion = motion;
- }
-
- public byte toByte() {
- return (byte) motion;
- }
-
- public static Motion fromByte(int input) {
- for (Motion motion : Motion.values()) {
- if (motion.motion == input) {
- return motion;
- }
- }
-
- return Motion.UNKNOWN;
- }
- }
-
- private final static List supportedInputValueSelectors = Arrays.asList(
- RFXComValueSelector.SIGNAL_LEVEL, RFXComValueSelector.BATTERY_LEVEL, RFXComValueSelector.STATUS,
- RFXComValueSelector.CONTACT, RFXComValueSelector.MOTION);
-
- private final static List supportedOutputValueSelectors = Arrays
- .asList(RFXComValueSelector.STATUS, RFXComValueSelector.CONTACT);
-
- public SubType subType = SubType.UNKNOWN;
- public int sensorId = 0;
- public Status status = Status.UNKNOWN;
- public byte batteryLevel = 0;
- public byte signalLevel = 0;
- public Contact contact = Contact.UNKNOWN;
- public Motion motion = Motion.UNKNOWN;
-
- public RFXComSecurity1Message() {
- packetType = PacketType.SECURITY1;
- }
-
- public RFXComSecurity1Message(byte[] data) {
- encodeMessage(data);
- }
-
- @Override
- public String toString() {
- String str = "";
-
- str += super.toString();
- str += ", Sub type = " + subType;
- str += ", Device Id = " + getDeviceId();
- str += ", Status = " + status;
- str += ", Battery level = " + batteryLevel;
- str += ", Signal level = " + signalLevel;
-
- return str;
- }
-
- @Override
- public void encodeMessage(byte[] data) {
-
- super.encodeMessage(data);
-
- subType = SubType.fromByte(super.subType);
- sensorId = (data[4] & 0xFF) << 16 | (data[5] & 0xFF) << 8 | (data[6] & 0xFF);
-
- status = Status.fromByte(data[7]);
- batteryLevel = (byte) ((data[8] & 0xF0) >> 4);
- signalLevel = (byte) (data[8] & 0x0F);
-
- contact = Contact.fromByte(data[7]);
- motion = Motion.fromByte(data[7]);
- }
-
- @Override
- public byte[] decodeMessage() {
-
- byte[] data = new byte[9];
-
- data[0] = 0x08;
- data[1] = RFXComBaseMessage.PacketType.SECURITY1.toByte();
- data[2] = subType.toByte();
- data[3] = seqNbr;
- data[4] = (byte) ((sensorId >> 16) & 0xFF);
- data[5] = (byte) ((sensorId >> 8) & 0xFF);
- data[6] = (byte) (sensorId & 0xFF);
- data[7] = status.toByte();
- data[8] = (byte) (((batteryLevel & 0x0F) << 4) | (signalLevel & 0x0F));
-
- return data;
- }
-
- @Override
- public String getDeviceId() {
- return String.valueOf(sensorId);
- }
-
- @Override
- public State convertToState(RFXComValueSelector valueSelector) throws RFXComException {
-
- State state = UnDefType.UNDEF;
-
- if (valueSelector.getItemClass() == SwitchItem.class) {
-
- if (valueSelector == RFXComValueSelector.MOTION) {
-
- switch (status) {
- case MOTION:
- state = OnOffType.ON;
- break;
- case NO_MOTION:
- state = OnOffType.OFF;
- break;
- default:
- break;
- }
-
- } else {
- throw new RFXComException("Can't convert " + valueSelector + " to SwitchItem");
- }
-
- } else if (valueSelector.getItemClass() == ContactItem.class) {
-
- if (valueSelector == RFXComValueSelector.CONTACT) {
-
- switch (status) {
-
- case NORMAL:
- state = OpenClosedType.CLOSED;
- break;
- case NORMAL_DELAYED:
- state = OpenClosedType.CLOSED;
- break;
- case ALARM:
- state = OpenClosedType.OPEN;
- break;
- case ALARM_DELAYED:
- state = OpenClosedType.OPEN;
- break;
- default:
- break;
-
- }
-
- } else {
- throw new RFXComException("Can't convert " + valueSelector + " to ContactItem");
- }
-
- } else if (valueSelector.getItemClass() == StringItem.class) {
-
- if (valueSelector == RFXComValueSelector.STATUS) {
-
- state = new StringType(status.toString());
-
- } else {
- throw new RFXComException("Can't convert " + valueSelector + " to StringItem");
- }
-
- } else if (valueSelector.getItemClass() == NumberItem.class) {
-
- if (valueSelector == RFXComValueSelector.SIGNAL_LEVEL) {
-
- state = new DecimalType(signalLevel);
-
- } else if (valueSelector == RFXComValueSelector.BATTERY_LEVEL) {
-
- state = new DecimalType(batteryLevel);
-
- } else {
- throw new RFXComException("Can't convert " + valueSelector + " to StringItem");
- }
-
- } else if (valueSelector.getItemClass() == DateTimeItem.class) {
-
- state = new DateTimeType();
-
- } else {
-
- throw new RFXComException("Can't convert " + valueSelector + " to " + valueSelector.getItemClass());
- }
-
- return state;
-
- }
-
- @Override
- public void setSubType(Object subType) throws RFXComException {
- this.subType = ((SubType) subType);
- }
-
- @Override
- public void setDeviceId(String deviceId) throws RFXComException {
- sensorId = Integer.parseInt(deviceId);
- }
-
- @Override
- public void convertFromState(RFXComValueSelector valueSelector, Type type) throws RFXComException {
-
- switch (valueSelector) {
- case COMMAND:
- if ((type instanceof OnOffType) && (subType == SubType.X10_SECURITY_REMOTE)) {
- status = (type == OnOffType.ON ? Status.ARM_AWAY_DELAYED : Status.DISARM);
- } else {
- throw new RFXComException("Can't convert " + type + " to Command");
- }
- break;
-
- case STATUS:
- if (type instanceof StringType) {
- status = Status.valueOf(type.toString());
- } else {
- throw new RFXComException("Can't convert " + type + " to Status");
- }
- break;
-
- default:
- throw new RFXComException("Can't convert " + type + " to " + valueSelector);
- }
- }
-
- @Override
- public Object convertSubType(String subType) throws RFXComException {
-
- for (SubType s : SubType.values()) {
- if (s.toString().equals(subType)) {
- return s;
- }
- }
-
- // try to find sub type by number
- try {
- return SubType.values()[Integer.parseInt(subType)];
- } catch (Exception e) {
- throw new RFXComException("Unknown sub type " + subType);
- }
- }
-
- @Override
- public List getSupportedInputValueSelectors() throws RFXComException {
- return supportedInputValueSelectors;
- }
-
- @Override
- public List getSupportedOutputValueSelectors() throws RFXComException {
- return supportedOutputValueSelectors;
- }
-}
+/**
+ * Copyright (c) 2014-2016 by the respective copyright holders.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.openhab.binding.rfxcom.internal.messages;
+
+import org.eclipse.smarthome.core.library.items.*;
+import org.eclipse.smarthome.core.library.types.*;
+import org.eclipse.smarthome.core.types.State;
+import org.eclipse.smarthome.core.types.Type;
+import org.eclipse.smarthome.core.types.UnDefType;
+import org.openhab.binding.rfxcom.RFXComValueSelector;
+import org.openhab.binding.rfxcom.internal.exceptions.RFXComException;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * RFXCOM data class for Security1 message.
+ * (i.e. X10 Security, Visonic PowerCode, Meiantech, etc.)
+ *
+ * @author David Kalff - Initial contribution
+ * @author Pauli Anttila
+ */
+public class RFXComSecurity1Message extends RFXComBaseMessage {
+
+ public enum SubType {
+ X10_SECURITY(0),
+ X10_SECURITY_MOTION(1),
+ X10_SECURITY_REMOTE(2),
+ KD101(3),
+ VISONIC_POWERCODE_SENSOR_PRIMARY_CONTACT(4),
+ VISONIC_POWERCODE_MOTION(5),
+ VISONIC_CODESECURE(6),
+ VISONIC_POWERCODE_SENSOR_AUX_CONTACT(7),
+ MEIANTECH(8),
+ SA30(9),
+
+ UNKNOWN(255);
+
+ private final int subType;
+
+ SubType(int subType) {
+ this.subType = subType;
+ }
+
+ SubType(byte subType) {
+ this.subType = subType;
+ }
+
+ public byte toByte() {
+ return (byte) subType;
+ }
+
+ public static SubType fromByte(int input) {
+ for (SubType c : SubType.values()) {
+ if (c.subType == input) {
+ return c;
+ }
+ }
+
+ return SubType.UNKNOWN;
+ }
+ }
+
+ public enum Status {
+ NORMAL(0),
+ NORMAL_DELAYED(1),
+ ALARM(2),
+ ALARM_DELAYED(3),
+ MOTION(4),
+ NO_MOTION(5),
+ PANIC(6),
+ END_PANIC(7),
+ IR(8),
+ ARM_AWAY(9),
+ ARM_AWAY_DELAYED(10),
+ ARM_HOME(11),
+ ARM_HOME_DELAYED(12),
+ DISARM(13),
+ LIGHT_1_OFF(16),
+ LIGHT_1_ON(17),
+ LIGHT_2_OFF(18),
+ LIGHT_2_ON(19),
+ DARK_DETECTED(20),
+ LIGHT_DETECTED(21),
+ BATLOW(22),
+ PAIR_KD101(23),
+ NORMAL_TAMPER(128),
+ NORMAL_DELAYED_TAMPER(129),
+ ALARM_TAMPER(130),
+ ALARM_DELAYED_TAMPER(131),
+ MOTION_TAMPER(132),
+ NO_MOTION_TAMPER(133),
+
+ UNKNOWN(255);
+
+ private final int status;
+
+ Status(int status) {
+ this.status = status;
+ }
+
+ Status(byte status) {
+ this.status = status;
+ }
+
+ public byte toByte() {
+ return (byte) status;
+ }
+
+ public static Status fromByte(int input) {
+ for (Status status : Status.values()) {
+ if (status.status == input) {
+ return status;
+ }
+ }
+
+ return Status.UNKNOWN;
+ }
+ }
+
+ /* Added item for ContactTypes */
+ public enum Contact {
+ NORMAL(0),
+ NORMAL_DELAYED(1),
+ ALARM(2),
+ ALARM_DELAYED(3),
+ NORMAL_TAMPER(128),
+ NORMAL_DELAYED_TAMPER(129),
+ ALARM_TAMPER(130),
+ ALARM_DELAYED_TAMPER(131),
+
+ UNKNOWN(255);
+
+ private final int contact;
+
+ Contact(int contact) {
+ this.contact = contact;
+ }
+
+ Contact(byte contact) {
+ this.contact = contact;
+ }
+
+ public byte toByte() {
+ return (byte) contact;
+ }
+
+ public static Contact fromByte(int input) {
+ for (Contact status : Contact.values()) {
+ if (status.contact == input) {
+ return status;
+ }
+ }
+
+ return Contact.UNKNOWN;
+ }
+ }
+
+ /* Added item for MotionTypes */
+ public enum Motion {
+ MOTION(4),
+ NO_MOTION(5),
+ MOTION_TAMPER(132),
+ NO_MOTION_TAMPER(133),
+
+ UNKNOWN(255);
+
+ private final int motion;
+
+ Motion(int motion) {
+ this.motion = motion;
+ }
+
+ Motion(byte motion) {
+ this.motion = motion;
+ }
+
+ public byte toByte() {
+ return (byte) motion;
+ }
+
+ public static Motion fromByte(int input) {
+ for (Motion motion : Motion.values()) {
+ if (motion.motion == input) {
+ return motion;
+ }
+ }
+
+ return Motion.UNKNOWN;
+ }
+ }
+
+ private final static List supportedInputValueSelectors = Arrays.asList(
+ RFXComValueSelector.SIGNAL_LEVEL, RFXComValueSelector.BATTERY_LEVEL, RFXComValueSelector.STATUS,
+ RFXComValueSelector.CONTACT, RFXComValueSelector.MOTION);
+
+ private final static List supportedOutputValueSelectors = Arrays
+ .asList(RFXComValueSelector.STATUS, RFXComValueSelector.CONTACT);
+
+ public SubType subType = SubType.UNKNOWN;
+ public int sensorId = 0;
+ public Status status = Status.UNKNOWN;
+ public byte batteryLevel = 0;
+ public byte signalLevel = 0;
+ public Contact contact = Contact.UNKNOWN;
+ public Motion motion = Motion.UNKNOWN;
+
+ public RFXComSecurity1Message() {
+ packetType = PacketType.SECURITY1;
+ }
+
+ public RFXComSecurity1Message(byte[] data) {
+ encodeMessage(data);
+ }
+
+ @Override
+ public String toString() {
+ String str = "";
+
+ str += super.toString();
+ str += ", Sub type = " + subType;
+ str += ", Device Id = " + getDeviceId();
+ str += ", Status = " + status;
+ str += ", Battery level = " + batteryLevel;
+ str += ", Signal level = " + signalLevel;
+
+ return str;
+ }
+
+ @Override
+ public void encodeMessage(byte[] data) {
+
+ super.encodeMessage(data);
+
+ subType = SubType.fromByte(super.subType);
+ sensorId = (data[4] & 0xFF) << 16 | (data[5] & 0xFF) << 8 | (data[6] & 0xFF);
+
+ status = Status.fromByte(data[7]);
+ batteryLevel = (byte) ((data[8] & 0xF0) >> 4);
+ signalLevel = (byte) (data[8] & 0x0F);
+
+ contact = Contact.fromByte(data[7]);
+ motion = Motion.fromByte(data[7]);
+ }
+
+ @Override
+ public byte[] decodeMessage() {
+
+ byte[] data = new byte[9];
+
+ data[0] = 0x08;
+ data[1] = RFXComBaseMessage.PacketType.SECURITY1.toByte();
+ data[2] = subType.toByte();
+ data[3] = seqNbr;
+ data[4] = (byte) ((sensorId >> 16) & 0xFF);
+ data[5] = (byte) ((sensorId >> 8) & 0xFF);
+ data[6] = (byte) (sensorId & 0xFF);
+ data[7] = status.toByte();
+ data[8] = (byte) (((batteryLevel & 0x0F) << 4) | (signalLevel & 0x0F));
+
+ return data;
+ }
+
+ @Override
+ public String getDeviceId() {
+ return String.valueOf(sensorId);
+ }
+
+ @Override
+ public State convertToState(RFXComValueSelector valueSelector) throws RFXComException {
+
+ State state = UnDefType.UNDEF;
+
+ if (valueSelector.getItemClass() == SwitchItem.class) {
+
+ if (valueSelector == RFXComValueSelector.MOTION) {
+
+ switch (status) {
+ case MOTION:
+ state = OnOffType.ON;
+ break;
+ case NO_MOTION:
+ state = OnOffType.OFF;
+ break;
+ default:
+ break;
+ }
+
+ } else {
+ throw new RFXComException("Can't convert " + valueSelector + " to SwitchItem");
+ }
+
+ } else if (valueSelector.getItemClass() == ContactItem.class) {
+
+ if (valueSelector == RFXComValueSelector.CONTACT) {
+
+ switch (status) {
+
+ case NORMAL:
+ state = OpenClosedType.CLOSED;
+ break;
+ case NORMAL_DELAYED:
+ state = OpenClosedType.CLOSED;
+ break;
+ case ALARM:
+ state = OpenClosedType.OPEN;
+ break;
+ case ALARM_DELAYED:
+ state = OpenClosedType.OPEN;
+ break;
+ default:
+ break;
+
+ }
+
+ } else {
+ throw new RFXComException("Can't convert " + valueSelector + " to ContactItem");
+ }
+
+ } else if (valueSelector.getItemClass() == StringItem.class) {
+
+ if (valueSelector == RFXComValueSelector.STATUS) {
+
+ state = new StringType(status.toString());
+
+ } else {
+ throw new RFXComException("Can't convert " + valueSelector + " to StringItem");
+ }
+
+ } else if (valueSelector.getItemClass() == NumberItem.class) {
+
+ if (valueSelector == RFXComValueSelector.SIGNAL_LEVEL) {
+
+ state = new DecimalType(signalLevel);
+
+ } else if (valueSelector == RFXComValueSelector.BATTERY_LEVEL) {
+
+ state = new DecimalType(batteryLevel);
+
+ } else {
+ throw new RFXComException("Can't convert " + valueSelector + " to StringItem");
+ }
+
+ } else if (valueSelector.getItemClass() == DateTimeItem.class) {
+
+ state = new DateTimeType();
+
+ } else {
+
+ throw new RFXComException("Can't convert " + valueSelector + " to " + valueSelector.getItemClass());
+ }
+
+ return state;
+
+ }
+
+ @Override
+ public void setSubType(Object subType) throws RFXComException {
+ this.subType = ((SubType) subType);
+ }
+
+ @Override
+ public void setDeviceId(String deviceId) throws RFXComException {
+ sensorId = Integer.parseInt(deviceId);
+ }
+
+ @Override
+ public void convertFromState(RFXComValueSelector valueSelector, Type type) throws RFXComException {
+
+ switch (valueSelector) {
+ case COMMAND:
+ if ((type instanceof OnOffType) && (subType == SubType.X10_SECURITY_REMOTE)) {
+ status = (type == OnOffType.ON ? Status.ARM_AWAY_DELAYED : Status.DISARM);
+ } else {
+ throw new RFXComException("Can't convert " + type + " to Command");
+ }
+ break;
+
+ case STATUS:
+ if (type instanceof StringType) {
+ status = Status.valueOf(type.toString());
+ } else {
+ throw new RFXComException("Can't convert " + type + " to Status");
+ }
+ break;
+
+ default:
+ throw new RFXComException("Can't convert " + type + " to " + valueSelector);
+ }
+ }
+
+ @Override
+ public Object convertSubType(String subType) throws RFXComException {
+
+ for (SubType s : SubType.values()) {
+ if (s.toString().equals(subType)) {
+ return s;
+ }
+ }
+
+ // try to find sub type by number
+ try {
+ return SubType.values()[Integer.parseInt(subType)];
+ } catch (Exception e) {
+ throw new RFXComException("Unknown sub type " + subType);
+ }
+ }
+
+ @Override
+ public List getSupportedInputValueSelectors() throws RFXComException {
+ return supportedInputValueSelectors;
+ }
+
+ @Override
+ public List getSupportedOutputValueSelectors() throws RFXComException {
+ return supportedOutputValueSelectors;
+ }
+}
diff --git a/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/internal/messages/RFXComWindMessage.java b/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/internal/messages/RFXComWindMessage.java
index e44314e29d25b..97dde5f9c375a 100644
--- a/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/internal/messages/RFXComWindMessage.java
+++ b/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/internal/messages/RFXComWindMessage.java
@@ -1,222 +1,222 @@
-/**
- * Copyright (c) 2014-2016 by the respective copyright holders.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- */
-package org.openhab.binding.rfxcom.internal.messages;
-
-import org.eclipse.smarthome.core.library.items.NumberItem;
-import org.eclipse.smarthome.core.library.types.DecimalType;
-import org.eclipse.smarthome.core.types.State;
-import org.eclipse.smarthome.core.types.Type;
-import org.openhab.binding.rfxcom.RFXComValueSelector;
-import org.openhab.binding.rfxcom.internal.exceptions.RFXComException;
-
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * RFXCOM data class for temperature and humidity message.
- *
- * @author Marc SAUVEUR - Initial contribution
- * @author Pauli Anttila
- */
-public class RFXComWindMessage extends RFXComBaseMessage {
-
- public enum SubType {
- WIND1(1),
- WIND2(2),
- WIND3(3),
- WIND4(4),
- WIND5(5),
- WIND6(6),
- WIND7(7),
-
- UNKNOWN(255);
-
- private final int subType;
-
- SubType(int subType) {
- this.subType = subType;
- }
-
- SubType(byte subType) {
- this.subType = subType;
- }
-
- public byte toByte() {
- return (byte) subType;
- }
-
- public static SubType fromByte(int input) {
- for (SubType c : SubType.values()) {
- if (c.subType == input) {
- return c;
- }
- }
-
- return SubType.UNKNOWN;
- }
- }
-
- private final static List supportedInputValueSelectors = Arrays.asList(
- RFXComValueSelector.SIGNAL_LEVEL, RFXComValueSelector.BATTERY_LEVEL, RFXComValueSelector.WIND_DIRECTION,
- RFXComValueSelector.WIND_SPEED);
-
- private final static List supportedOutputValueSelectors = Arrays.asList();
-
- public SubType subType = SubType.UNKNOWN;
- public int sensorId = 0;
- public double windDirection = 0;
- public double windSpeed = 0;
- public byte signalLevel = 0;
- public byte batteryLevel = 0;
-
- public RFXComWindMessage() {
- packetType = PacketType.WIND;
- }
-
- public RFXComWindMessage(byte[] data) {
- encodeMessage(data);
- }
-
- @Override
- public String toString() {
- String str = "";
-
- str += super.toString();
- str += ", Sub type = " + subType;
- str += ", Device Id = " + getDeviceId();
- str += ", Wind direction = " + windDirection;
- str += ", Wind speed = " + windSpeed;
- str += ", Signal level = " + signalLevel;
- str += ", Battery level = " + batteryLevel;
-
- return str;
- }
-
- @Override
- public void encodeMessage(byte[] data) {
-
- super.encodeMessage(data);
-
- subType = SubType.fromByte(super.subType);
- sensorId = (data[4] & 0xFF) << 8 | (data[5] & 0xFF);
-
- windDirection = (short) ((data[6] & 0xFF) << 8 | (data[7] & 0xFF));
- windSpeed = (short) ((data[10] & 0xFF) << 8 | (data[11] & 0xFF)) * 0.1;
- signalLevel = (byte) ((data[16] & 0xF0) >> 4);
- batteryLevel = (byte) (data[16] & 0x0F);
- }
-
- @Override
- public byte[] decodeMessage() {
- byte[] data = new byte[17];
-
- data[0] = 0x10;
- data[1] = PacketType.WIND.toByte();
- data[2] = subType.toByte();
- data[3] = seqNbr;
- data[4] = (byte) ((sensorId & 0xFF00) >> 8);
- data[5] = (byte) (sensorId & 0x00FF);
-
- short WindD = (short) Math.abs(windDirection);
- data[6] = (byte) ((WindD >> 8) & 0xFF);
- data[7] = (byte) (WindD & 0xFF);
-
- int WindS = (short) Math.abs(windSpeed) * 10;
- data[10] = (byte) ((WindS >> 8) & 0xFF);
- data[11] = (byte) (WindS & 0xFF);
-
- data[16] = (byte) (((signalLevel & 0x0F) << 4) | (batteryLevel & 0x0F));
-
- return data;
- }
-
- @Override
- public String getDeviceId() {
- return String.valueOf(sensorId);
- }
-
- @Override
- public State convertToState(RFXComValueSelector valueSelector) throws RFXComException {
-
- State state;
-
- if (valueSelector.getItemClass() == NumberItem.class) {
-
- if (valueSelector == RFXComValueSelector.SIGNAL_LEVEL) {
-
- state = new DecimalType(signalLevel);
-
- } else if (valueSelector == RFXComValueSelector.BATTERY_LEVEL) {
-
- state = new DecimalType(batteryLevel);
-
- } else if (valueSelector == RFXComValueSelector.WIND_DIRECTION) {
-
- state = new DecimalType(windDirection);
- } else if (valueSelector == RFXComValueSelector.WIND_SPEED) {
-
- state = new DecimalType(windSpeed);
-
- } else {
- throw new RFXComException("Can't convert " + valueSelector + " to NumberItem");
- }
-
- } else {
-
- throw new RFXComException("Can't convert " + valueSelector + " to " + valueSelector.getItemClass());
-
- }
-
- return state;
- }
-
- @Override
- public void setSubType(Object subType) throws RFXComException {
- throw new RFXComException("Not supported");
- }
-
- @Override
- public void setDeviceId(String deviceId) throws RFXComException {
- throw new RFXComException("Not supported");
- }
-
- @Override
- public void convertFromState(RFXComValueSelector valueSelector, Type type) throws RFXComException {
-
- throw new RFXComException("Not supported");
- }
-
- @Override
- public Object convertSubType(String subType) throws RFXComException {
-
- for (SubType s : SubType.values()) {
- if (s.toString().equals(subType)) {
- return s;
- }
- }
-
- // try to find sub type by number
- try {
- return SubType.values()[Integer.parseInt(subType)];
- } catch (Exception e) {
- throw new RFXComException("Unknown sub type " + subType);
- }
- }
-
- @Override
- public List getSupportedInputValueSelectors() throws RFXComException {
- return supportedInputValueSelectors;
- }
-
- @Override
- public List getSupportedOutputValueSelectors() throws RFXComException {
- return supportedOutputValueSelectors;
- }
-
-}
+/**
+ * Copyright (c) 2014-2016 by the respective copyright holders.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.openhab.binding.rfxcom.internal.messages;
+
+import org.eclipse.smarthome.core.library.items.NumberItem;
+import org.eclipse.smarthome.core.library.types.DecimalType;
+import org.eclipse.smarthome.core.types.State;
+import org.eclipse.smarthome.core.types.Type;
+import org.openhab.binding.rfxcom.RFXComValueSelector;
+import org.openhab.binding.rfxcom.internal.exceptions.RFXComException;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * RFXCOM data class for temperature and humidity message.
+ *
+ * @author Marc SAUVEUR - Initial contribution
+ * @author Pauli Anttila
+ */
+public class RFXComWindMessage extends RFXComBaseMessage {
+
+ public enum SubType {
+ WIND1(1),
+ WIND2(2),
+ WIND3(3),
+ WIND4(4),
+ WIND5(5),
+ WIND6(6),
+ WIND7(7),
+
+ UNKNOWN(255);
+
+ private final int subType;
+
+ SubType(int subType) {
+ this.subType = subType;
+ }
+
+ SubType(byte subType) {
+ this.subType = subType;
+ }
+
+ public byte toByte() {
+ return (byte) subType;
+ }
+
+ public static SubType fromByte(int input) {
+ for (SubType c : SubType.values()) {
+ if (c.subType == input) {
+ return c;
+ }
+ }
+
+ return SubType.UNKNOWN;
+ }
+ }
+
+ private final static List supportedInputValueSelectors = Arrays.asList(
+ RFXComValueSelector.SIGNAL_LEVEL, RFXComValueSelector.BATTERY_LEVEL, RFXComValueSelector.WIND_DIRECTION,
+ RFXComValueSelector.WIND_SPEED);
+
+ private final static List supportedOutputValueSelectors = Arrays.asList();
+
+ public SubType subType = SubType.UNKNOWN;
+ public int sensorId = 0;
+ public double windDirection = 0;
+ public double windSpeed = 0;
+ public byte signalLevel = 0;
+ public byte batteryLevel = 0;
+
+ public RFXComWindMessage() {
+ packetType = PacketType.WIND;
+ }
+
+ public RFXComWindMessage(byte[] data) {
+ encodeMessage(data);
+ }
+
+ @Override
+ public String toString() {
+ String str = "";
+
+ str += super.toString();
+ str += ", Sub type = " + subType;
+ str += ", Device Id = " + getDeviceId();
+ str += ", Wind direction = " + windDirection;
+ str += ", Wind speed = " + windSpeed;
+ str += ", Signal level = " + signalLevel;
+ str += ", Battery level = " + batteryLevel;
+
+ return str;
+ }
+
+ @Override
+ public void encodeMessage(byte[] data) {
+
+ super.encodeMessage(data);
+
+ subType = SubType.fromByte(super.subType);
+ sensorId = (data[4] & 0xFF) << 8 | (data[5] & 0xFF);
+
+ windDirection = (short) ((data[6] & 0xFF) << 8 | (data[7] & 0xFF));
+ windSpeed = (short) ((data[10] & 0xFF) << 8 | (data[11] & 0xFF)) * 0.1;
+ signalLevel = (byte) ((data[16] & 0xF0) >> 4);
+ batteryLevel = (byte) (data[16] & 0x0F);
+ }
+
+ @Override
+ public byte[] decodeMessage() {
+ byte[] data = new byte[17];
+
+ data[0] = 0x10;
+ data[1] = PacketType.WIND.toByte();
+ data[2] = subType.toByte();
+ data[3] = seqNbr;
+ data[4] = (byte) ((sensorId & 0xFF00) >> 8);
+ data[5] = (byte) (sensorId & 0x00FF);
+
+ short WindD = (short) Math.abs(windDirection);
+ data[6] = (byte) ((WindD >> 8) & 0xFF);
+ data[7] = (byte) (WindD & 0xFF);
+
+ int WindS = (short) Math.abs(windSpeed) * 10;
+ data[10] = (byte) ((WindS >> 8) & 0xFF);
+ data[11] = (byte) (WindS & 0xFF);
+
+ data[16] = (byte) (((signalLevel & 0x0F) << 4) | (batteryLevel & 0x0F));
+
+ return data;
+ }
+
+ @Override
+ public String getDeviceId() {
+ return String.valueOf(sensorId);
+ }
+
+ @Override
+ public State convertToState(RFXComValueSelector valueSelector) throws RFXComException {
+
+ State state;
+
+ if (valueSelector.getItemClass() == NumberItem.class) {
+
+ if (valueSelector == RFXComValueSelector.SIGNAL_LEVEL) {
+
+ state = new DecimalType(signalLevel);
+
+ } else if (valueSelector == RFXComValueSelector.BATTERY_LEVEL) {
+
+ state = new DecimalType(batteryLevel);
+
+ } else if (valueSelector == RFXComValueSelector.WIND_DIRECTION) {
+
+ state = new DecimalType(windDirection);
+ } else if (valueSelector == RFXComValueSelector.WIND_SPEED) {
+
+ state = new DecimalType(windSpeed);
+
+ } else {
+ throw new RFXComException("Can't convert " + valueSelector + " to NumberItem");
+ }
+
+ } else {
+
+ throw new RFXComException("Can't convert " + valueSelector + " to " + valueSelector.getItemClass());
+
+ }
+
+ return state;
+ }
+
+ @Override
+ public void setSubType(Object subType) throws RFXComException {
+ throw new RFXComException("Not supported");
+ }
+
+ @Override
+ public void setDeviceId(String deviceId) throws RFXComException {
+ throw new RFXComException("Not supported");
+ }
+
+ @Override
+ public void convertFromState(RFXComValueSelector valueSelector, Type type) throws RFXComException {
+
+ throw new RFXComException("Not supported");
+ }
+
+ @Override
+ public Object convertSubType(String subType) throws RFXComException {
+
+ for (SubType s : SubType.values()) {
+ if (s.toString().equals(subType)) {
+ return s;
+ }
+ }
+
+ // try to find sub type by number
+ try {
+ return SubType.values()[Integer.parseInt(subType)];
+ } catch (Exception e) {
+ throw new RFXComException("Unknown sub type " + subType);
+ }
+ }
+
+ @Override
+ public List getSupportedInputValueSelectors() throws RFXComException {
+ return supportedInputValueSelectors;
+ }
+
+ @Override
+ public List getSupportedOutputValueSelectors() throws RFXComException {
+ return supportedOutputValueSelectors;
+ }
+
+}
diff --git a/addons/binding/org.openhab.binding.samsungtv/src/main/java/org/openhab/binding/samsungtv/internal/protocol/KeyCode.java b/addons/binding/org.openhab.binding.samsungtv/src/main/java/org/openhab/binding/samsungtv/internal/protocol/KeyCode.java
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.samsungtv/src/main/java/org/openhab/binding/samsungtv/internal/protocol/RemoteControllerException.java b/addons/binding/org.openhab.binding.samsungtv/src/main/java/org/openhab/binding/samsungtv/internal/protocol/RemoteControllerException.java
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/.classpath b/addons/binding/org.openhab.binding.tellstick/.classpath
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/.project b/addons/binding/org.openhab.binding.tellstick/.project
old mode 100755
new mode 100644
index 96216975833e4..a851245278840
--- a/addons/binding/org.openhab.binding.tellstick/.project
+++ b/addons/binding/org.openhab.binding.tellstick/.project
@@ -1,33 +1,33 @@
-
-
- org.openhab.binding.tellstick
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.pde.ManifestBuilder
-
-
-
-
- org.eclipse.pde.SchemaBuilder
-
-
-
-
- org.eclipse.pde.ds.core.builder
-
-
-
-
-
- org.eclipse.pde.PluginNature
- org.eclipse.jdt.core.javanature
-
-
+
+
+ org.openhab.binding.tellstick
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+ org.eclipse.pde.ds.core.builder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/addons/binding/org.openhab.binding.tellstick/.settings/org.eclipse.jdt.core.prefs b/addons/binding/org.openhab.binding.tellstick/.settings/org.eclipse.jdt.core.prefs
old mode 100755
new mode 100644
index 980b98c1d5ff1..d17b6724d17fd
--- a/addons/binding/org.openhab.binding.tellstick/.settings/org.eclipse.jdt.core.prefs
+++ b/addons/binding/org.openhab.binding.tellstick/.settings/org.eclipse.jdt.core.prefs
@@ -1,12 +1,12 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.7
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.7
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/addons/binding/org.openhab.binding.tellstick/ESH-INF/binding/binding.xml b/addons/binding/org.openhab.binding.tellstick/ESH-INF/binding/binding.xml
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/ESH-INF/config/config.xml b/addons/binding/org.openhab.binding.tellstick/ESH-INF/config/config.xml
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/ESH-INF/thing/bridge.xml b/addons/binding/org.openhab.binding.tellstick/ESH-INF/thing/bridge.xml
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/ESH-INF/thing/devices.xml b/addons/binding/org.openhab.binding.tellstick/ESH-INF/thing/devices.xml
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/ESH-INF/thing/sensor.xml b/addons/binding/org.openhab.binding.tellstick/ESH-INF/thing/sensor.xml
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/META-INF/MANIFEST.MF b/addons/binding/org.openhab.binding.tellstick/META-INF/MANIFEST.MF
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/OSGI-INF/TellstickHandlerFactory.xml b/addons/binding/org.openhab.binding.tellstick/OSGI-INF/TellstickHandlerFactory.xml
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/build.properties b/addons/binding/org.openhab.binding.tellstick/build.properties
old mode 100755
new mode 100644
index 4aa3323db78dd..31505b18dd7b8
--- a/addons/binding/org.openhab.binding.tellstick/build.properties
+++ b/addons/binding/org.openhab.binding.tellstick/build.properties
@@ -1,17 +1,17 @@
-source.. = src/main/java/
-output.. = target/classes
-bin.includes = META-INF/,\
- .,\
- OSGI-INF/,\
- ESH-INF/,\
- lib/jna-4.0.0.jar,\
- plugin.xml,\
- lib/javatellstick-1.0.jar,\
- lib/async-http-client-2.0.19.jar,\
- lib/async-http-client-netty-utils-2.0.19.jar,\
- lib/netty-reactive-streams-1.0.8.jar,\
- lib/reactive-streams-1.0.0.jar,\
- lib/netty-all-4.0.42.Final.jar,\
- lib/netty-resolver-2.0.19.jar,\
- lib/netty-resolver-dns-2.0.19.jar
-
+source.. = src/main/java/
+output.. = target/classes
+bin.includes = META-INF/,\
+ .,\
+ OSGI-INF/,\
+ ESH-INF/,\
+ lib/jna-4.0.0.jar,\
+ plugin.xml,\
+ lib/javatellstick-1.0.jar,\
+ lib/async-http-client-2.0.19.jar,\
+ lib/async-http-client-netty-utils-2.0.19.jar,\
+ lib/netty-reactive-streams-1.0.8.jar,\
+ lib/reactive-streams-1.0.0.jar,\
+ lib/netty-all-4.0.42.Final.jar,\
+ lib/netty-resolver-2.0.19.jar,\
+ lib/netty-resolver-dns-2.0.19.jar
+
diff --git a/addons/binding/org.openhab.binding.tellstick/lib/javatellstick-1.0.jar b/addons/binding/org.openhab.binding.tellstick/lib/javatellstick-1.0.jar
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/lib/jna-4.0.0.jar b/addons/binding/org.openhab.binding.tellstick/lib/jna-4.0.0.jar
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/plugin.xml b/addons/binding/org.openhab.binding.tellstick/plugin.xml
old mode 100755
new mode 100644
index b60f62ae57e47..5535690d3778e
--- a/addons/binding/org.openhab.binding.tellstick/plugin.xml
+++ b/addons/binding/org.openhab.binding.tellstick/plugin.xml
@@ -1,5 +1,5 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/addons/binding/org.openhab.binding.tellstick/pom.xml b/addons/binding/org.openhab.binding.tellstick/pom.xml
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/TellstickBindingConstants.java b/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/TellstickBindingConstants.java
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/conf/TelldusLiveConfiguration.java b/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/conf/TelldusLiveConfiguration.java
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/conf/TellstickBridgeConfiguration.java b/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/conf/TellstickBridgeConfiguration.java
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/DeviceStatusListener.java b/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/DeviceStatusListener.java
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/TelldusBridgeHandler.java b/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/TelldusBridgeHandler.java
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/TelldusDeviceController.java b/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/TelldusDeviceController.java
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/TelldusDevicesHandler.java b/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/TelldusDevicesHandler.java
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/core/TelldusCoreBridgeHandler.java b/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/core/TelldusCoreBridgeHandler.java
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/core/TelldusCoreDeviceController.java b/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/core/TelldusCoreDeviceController.java
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/live/TelldusLiveBridgeHandler.java b/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/live/TelldusLiveBridgeHandler.java
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/live/TelldusLiveDeviceController.java b/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/live/TelldusLiveDeviceController.java
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/live/xml/DataTypeValue.java b/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/live/xml/DataTypeValue.java
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/live/xml/MethodToMethodType.java b/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/live/xml/MethodToMethodType.java
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/live/xml/NameToDataType.java b/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/live/xml/NameToDataType.java
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/live/xml/NumberToBooleanMapper.java b/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/live/xml/NumberToBooleanMapper.java
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/live/xml/TelldusLiveResponse.java b/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/live/xml/TelldusLiveResponse.java
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/live/xml/TellstickNetDevice.java b/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/live/xml/TellstickNetDevice.java
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/live/xml/TellstickNetDevices.java b/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/live/xml/TellstickNetDevices.java
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/live/xml/TellstickNetSensor.java b/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/live/xml/TellstickNetSensor.java
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/live/xml/TellstickNetSensors.java b/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/handler/live/xml/TellstickNetSensors.java
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/TellstickHandlerFactory.java b/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/TellstickHandlerFactory.java
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/discovery/TellstickBridgeDiscovery.java b/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/discovery/TellstickBridgeDiscovery.java
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/discovery/TellstickDiscoveryService.java b/addons/binding/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/discovery/TellstickDiscoveryService.java
old mode 100755
new mode 100644
diff --git a/addons/binding/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/throttler/AbstractChannelThrottler.java b/addons/binding/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/throttler/AbstractChannelThrottler.java
index 47652c7b5499b..1b1f8209bc406 100644
--- a/addons/binding/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/throttler/AbstractChannelThrottler.java
+++ b/addons/binding/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/throttler/AbstractChannelThrottler.java
@@ -1,53 +1,53 @@
-/**
- * Copyright (c) 2014-2016 by the respective copyright holders.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- */
-package org.openhab.binding.tesla.internal.throttler;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.ScheduledExecutorService;
-
-/**
- * The {@link AbstractChannelThrottler} is abstract class implementing a
- * throttler with one global execution rate, or rate limiter
- *
- * @author Karel Goderis - Initial contribution
- */
-abstract class AbstractChannelThrottler implements ChannelThrottler {
-
- protected final Rate totalRate;
- protected final TimeProvider timeProvider;
- protected final ScheduledExecutorService scheduler;
- protected final Map