diff --git a/addons/binding/org.openhab.binding.rfxcom/ESH-INF/thing/wind.xml b/addons/binding/org.openhab.binding.rfxcom/ESH-INF/thing/wind.xml
index 18f7edc1ce112..5062d73ca0c8a 100644
--- a/addons/binding/org.openhab.binding.rfxcom/ESH-INF/thing/wind.xml
+++ b/addons/binding/org.openhab.binding.rfxcom/ESH-INF/thing/wind.xml
@@ -15,8 +15,20 @@
A Wind device.
-
+
+
+ Average wind speed in meters per second
+
+
+
+ Wind gust in meters per second
+
+
+
+
+ Chill temperature in degree Celsius
+
diff --git a/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/RFXComBindingConstants.java b/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/RFXComBindingConstants.java
index dfe2664742e68..b3de44fde727c 100644
--- a/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/RFXComBindingConstants.java
+++ b/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/RFXComBindingConstants.java
@@ -62,6 +62,7 @@ public class RFXComBindingConstants {
public static final String CHANNEL_SIGNAL_LEVEL = "signalLevel";
public static final String CHANNEL_DIMMING_LEVEL = "dimmingLevel";
public static final String CHANNEL_TEMPERATURE = "temperature";
+ public static final String CHANNEL_CHILL_TEMPERATURE = "chillTemperature";
public static final String CHANNEL_HUMIDITY = "humidity";
public static final String CHANNEL_HUMIDITY_STATUS = "humidityStatus";
public static final String CHANNEL_BATTERY_LEVEL = "batteryLevel";
@@ -72,8 +73,7 @@ public class RFXComBindingConstants {
public static final String CHANNEL_RAIN_TOTAL = "rainTotal";
public static final String CHANNEL_WIND_DIRECTION = "windDirection";
public static final String CHANNEL_WIND_SPEED = "windSpeed";
- public static final String CHANNEL_GUST = "gust";
- public static final String CHANNEL_CHILL_FACTOR = "chillFactor";
+ public static final String CHANNEL_AVG_WIND_SPEED = "avgWindSpeed";
public static final String CHANNEL_INSTANT_POWER = "instantPower";
public static final String CHANNEL_TOTAL_USAGE = "totalUsage";
public static final String CHANNEL_INSTANT_AMPS = "instantAmp";
diff --git a/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/RFXComValueSelector.java b/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/RFXComValueSelector.java
index 9defe6b723f9c..3b9ea0fcf757d 100644
--- a/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/RFXComValueSelector.java
+++ b/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/RFXComValueSelector.java
@@ -42,9 +42,9 @@ public enum RFXComValueSelector {
RAIN_RATE(RFXComBindingConstants.CHANNEL_RAIN_RATE, NumberItem.class),
RAIN_TOTAL(RFXComBindingConstants.CHANNEL_RAIN_TOTAL, NumberItem.class),
WIND_DIRECTION(RFXComBindingConstants.CHANNEL_WIND_DIRECTION, NumberItem.class),
+ AVG_WIND_SPEED(RFXComBindingConstants.CHANNEL_AVG_WIND_SPEED, NumberItem.class),
WIND_SPEED(RFXComBindingConstants.CHANNEL_WIND_SPEED, NumberItem.class),
- GUST(RFXComBindingConstants.CHANNEL_GUST, NumberItem.class),
- CHILL_FACTOR(RFXComBindingConstants.CHANNEL_CHILL_FACTOR, NumberItem.class),
+ CHILL_TEMPERATURE(RFXComBindingConstants.CHANNEL_CHILL_TEMPERATURE, NumberItem.class),
INSTANT_POWER(RFXComBindingConstants.CHANNEL_INSTANT_POWER, NumberItem.class),
TOTAL_USAGE(RFXComBindingConstants.CHANNEL_TOTAL_USAGE, NumberItem.class),
INSTANT_AMPS(RFXComBindingConstants.CHANNEL_INSTANT_AMPS, NumberItem.class),
diff --git a/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/handler/RFXComHandler.java b/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/handler/RFXComHandler.java
index e3fdfa0ac410c..aa24a22810775 100644
--- a/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/handler/RFXComHandler.java
+++ b/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/handler/RFXComHandler.java
@@ -169,9 +169,6 @@ public void onDeviceMessageReceived(ThingUID bridge, RFXComMessage message) {
updateState(CHANNEL_BATTERY_LEVEL, convertBatteryLevelToSystemWideLevel(
message.convertToState(valueSelector)));
break;
- case CHILL_FACTOR:
- updateState(CHANNEL_CHILL_FACTOR, message.convertToState(valueSelector));
- break;
case CHIME_SOUND:
updateState(CHANNEL_CHIME_SOUND, message.convertToState(valueSelector));
break;
@@ -190,9 +187,6 @@ public void onDeviceMessageReceived(ThingUID bridge, RFXComMessage message) {
case FORECAST:
updateState(CHANNEL_FORECAST, message.convertToState(valueSelector));
break;
- case GUST:
- updateState(CHANNEL_GUST, message.convertToState(valueSelector));
- break;
case HUMIDITY:
updateState(CHANNEL_HUMIDITY, message.convertToState(valueSelector));
break;
@@ -247,6 +241,9 @@ public void onDeviceMessageReceived(ThingUID bridge, RFXComMessage message) {
case TEMPERATURE:
updateState(CHANNEL_TEMPERATURE, message.convertToState(valueSelector));
break;
+ case CHILL_TEMPERATURE:
+ updateState(CHANNEL_TEMPERATURE, message.convertToState(valueSelector));
+ break;
case TOTAL_AMP_HOUR:
updateState(CHANNEL_TOTAL_AMP_HOUR, message.convertToState(valueSelector));
break;
@@ -259,6 +256,9 @@ public void onDeviceMessageReceived(ThingUID bridge, RFXComMessage message) {
case WIND_DIRECTION:
updateState(CHANNEL_WIND_DIRECTION, message.convertToState(valueSelector));
break;
+ case AVG_WIND_SPEED:
+ updateState(CHANNEL_AVG_WIND_SPEED, message.convertToState(valueSelector));
+ break;
case WIND_SPEED:
updateState(CHANNEL_WIND_SPEED, message.convertToState(valueSelector));
break;
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 c67cf5a5144d1..ddc5704269539 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
@@ -25,6 +25,7 @@
*
* @author Marc SAUVEUR - Initial contribution
* @author Pauli Anttila
+ * @author Mike Jagdis - Support all available data from sensors
*/
public class RFXComWindMessage extends RFXComBaseMessage {
@@ -60,7 +61,7 @@ public static SubType fromByte(int input) throws RFXComUnsupportedValueException
private static final List SUPPORTED_INPUT_VALUE_SELECTORS = Arrays.asList(
RFXComValueSelector.SIGNAL_LEVEL, RFXComValueSelector.BATTERY_LEVEL, RFXComValueSelector.WIND_DIRECTION,
- RFXComValueSelector.WIND_SPEED);
+ RFXComValueSelector.AVG_WIND_SPEED, RFXComValueSelector.WIND_SPEED);
private static final List SUPPORTED_OUTPUT_VALUE_SELECTORS = Collections.emptyList();
@@ -68,6 +69,9 @@ public static SubType fromByte(int input) throws RFXComUnsupportedValueException
public int sensorId;
public double windDirection;
public double windSpeed;
+ public double avgWindSpeed;
+ public double temperature;
+ public double chillTemperature;
public byte signalLevel;
public byte batteryLevel;
@@ -81,17 +85,16 @@ public RFXComWindMessage(byte[] data) throws RFXComException {
@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;
+ return super.toString()
+ + ", Sub type = " + subType
+ + ", Device Id = " + getDeviceId()
+ + ", Wind direction = " + windDirection
+ + ", Wind gust = " + windSpeed
+ + ", Average wind speed = " + avgWindSpeed
+ + ", Temperature = " + temperature
+ + ", Chill temperature = " + chillTemperature
+ + ", Signal level = " + signalLevel
+ + ", Battery level = " + batteryLevel;
}
@Override
@@ -103,7 +106,25 @@ public void encodeMessage(byte[] data) throws RFXComException {
sensorId = (data[4] & 0xFF) << 8 | (data[5] & 0xFF);
windDirection = (short) ((data[6] & 0xFF) << 8 | (data[7] & 0xFF));
+
+ if (subType != SubType.WIND5) {
+ avgWindSpeed = (short) ((data[8] & 0xFF) << 8 | (data[9] & 0xFF)) * 0.1;
+ }
+
windSpeed = (short) ((data[10] & 0xFF) << 8 | (data[11] & 0xFF)) * 0.1;
+
+ if (subType == SubType.WIND4) {
+ temperature = (short) ((data[12] & 0x7F) << 8 | (data[13] & 0xFF)) * 0.1;
+ if ((data[12] & 0x80) != 0) {
+ temperature = -temperature;
+ }
+
+ chillTemperature = (short) ((data[14] & 0x7F) << 8 | (data[15] & 0xFF)) * 0.1;
+ if ((data[14] & 0x80) != 0) {
+ chillTemperature = -chillTemperature;
+ }
+ }
+
signalLevel = (byte) ((data[16] & 0xF0) >> 4);
batteryLevel = (byte) (data[16] & 0x0F);
}
@@ -123,10 +144,32 @@ public byte[] decodeMessage() {
data[6] = (byte) ((absWindDirection >> 8) & 0xFF);
data[7] = (byte) (absWindDirection & 0xFF);
+ if (subType != SubType.WIND5) {
+ int absAvgWindSpeedTimesTen = (short) Math.abs(avgWindSpeed) * 10;
+ data[8] = (byte) ((absAvgWindSpeedTimesTen >> 8) & 0xFF);
+ data[9] = (byte) (absAvgWindSpeedTimesTen & 0xFF);
+ }
+
int absWindSpeedTimesTen = (short) Math.abs(windSpeed) * 10;
data[10] = (byte) ((absWindSpeedTimesTen >> 8) & 0xFF);
data[11] = (byte) (absWindSpeedTimesTen & 0xFF);
+ if (subType == SubType.WIND4) {
+ int temp = (short) Math.abs(temperature) * 10;
+ data[12] = (byte) ((temp >> 8) & 0x7F);
+ data[13] = (byte) (temp & 0xFF);
+ if (temperature < 0) {
+ data[12] |= 0x80;
+ }
+
+ int chill = (short) Math.abs(chillTemperature) * 10;
+ data[14] = (byte) ((chill >> 8) & 0x7F);
+ data[15] = (byte) (chill & 0xFF);
+ if (chillTemperature < 0) {
+ data[14] |= 0x80;
+ }
+ }
+
data[16] = (byte) (((signalLevel & 0x0F) << 4) | (batteryLevel & 0x0F));
return data;
@@ -155,10 +198,23 @@ public State convertToState(RFXComValueSelector valueSelector) throws RFXComExce
} else if (valueSelector == RFXComValueSelector.WIND_DIRECTION) {
state = new DecimalType(windDirection);
+
+ } else if (valueSelector == RFXComValueSelector.AVG_WIND_SPEED) {
+
+ state = new DecimalType(avgWindSpeed);
+
} else if (valueSelector == RFXComValueSelector.WIND_SPEED) {
state = new DecimalType(windSpeed);
+ } else if (valueSelector == RFXComValueSelector.TEMPERATURE) {
+
+ state = new DecimalType(temperature);
+
+ } else if (valueSelector == RFXComValueSelector.CHILL_TEMPERATURE) {
+
+ state = new DecimalType(chillTemperature);
+
} else {
throw new RFXComException("Can't convert " + valueSelector + " to NumberItem");
}