diff --git a/addons/binding/org.openhab.binding.rfxcom/ESH-INF/thing/channels.xml b/addons/binding/org.openhab.binding.rfxcom/ESH-INF/thing/channels.xml
index 78f8c52b3e674..d9f953a970b4e 100644
--- a/addons/binding/org.openhab.binding.rfxcom/ESH-INF/thing/channels.xml
+++ b/addons/binding/org.openhab.binding.rfxcom/ESH-INF/thing/channels.xml
@@ -90,14 +90,14 @@
Number
Instant current in Amperes
-
+
-
+
Number
Used "energy" in ampere-hours
-
+
diff --git a/addons/binding/org.openhab.binding.rfxcom/ESH-INF/thing/energy.xml b/addons/binding/org.openhab.binding.rfxcom/ESH-INF/thing/energy.xml
index 497e4bc5998d7..c0b57c16eeabb 100644
--- a/addons/binding/org.openhab.binding.rfxcom/ESH-INF/thing/energy.xml
+++ b/addons/binding/org.openhab.binding.rfxcom/ESH-INF/thing/energy.xml
@@ -15,11 +15,10 @@
A Energy device.
-
-
+
-
+
diff --git a/addons/binding/org.openhab.binding.rfxcom/README.md b/addons/binding/org.openhab.binding.rfxcom/README.md
index 56847095ff9f8..59b481915cd8c 100644
--- a/addons/binding/org.openhab.binding.rfxcom/README.md
+++ b/addons/binding/org.openhab.binding.rfxcom/README.md
@@ -100,6 +100,6 @@ This binding currently supports following channels:
| signallevel | Number | Received signal strength level. |
| temperature | Number | Current temperature in degree Celsius. |
| totalusage | Number | Used energy in Watt hours. |
-| totalamphours | Number | Used "energy" in ampere-hours. |
+| totalamphour | Number | Used "energy" in ampere-hours. |
| winddirection | Number | Wind direction in degrees. |
| windspeed | Number | Average wind speed in meters per second. |
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 d61509e962165..30018d5797b46 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
@@ -84,8 +84,8 @@ public class RFXComBindingConstants {
public final static String CHANNEL_CHILL_FACTOR = "chillFactor";
public final static String CHANNEL_INSTANT_POWER = "instantPower";
public final static String CHANNEL_TOTAL_USAGE = "totalUsage";
- public final static String CHANNEL_INSTANT_AMPS = "instantAmps";
- public final static String CHANNEL_TOTAL_AMP_HOURS = "totalAmpHours";
+ public final static String CHANNEL_INSTANT_AMPS = "instantAmp";
+ public final static String CHANNEL_TOTAL_AMP_HOUR = "totalAmpHour";
public final static String CHANNEL_STATUS = "status";
public final static String CHANNEL_MOTION = "motion";
public final static String CHANNEL_CONTACT = "contact";
@@ -123,7 +123,7 @@ public class RFXComBindingConstants {
public final static ThingTypeUID THING_TYPE_UV = new ThingTypeUID(BINDING_ID, "uv");
public final static ThingTypeUID THING_TYPE_DATE_TIME = new ThingTypeUID(BINDING_ID, "datetime");
public final static ThingTypeUID THING_TYPE_CURRENT = new ThingTypeUID(BINDING_ID, "current");
- public final static ThingTypeUID THING_TYPE_ENERGY_USAGE = new ThingTypeUID(BINDING_ID, "energyusage");
+ public final static ThingTypeUID THING_TYPE_ENERGY = new ThingTypeUID(BINDING_ID, "energy");
public final static ThingTypeUID THING_TYPE_CURRENT_ENERGY = new ThingTypeUID(BINDING_ID, "currentenergy");
public final static ThingTypeUID THING_TYPE_POWER = new ThingTypeUID(BINDING_ID, "power");
public final static ThingTypeUID THING_TYPE_WEIGHTING_SCALE = new ThingTypeUID(BINDING_ID, "weightingscale");
@@ -144,9 +144,9 @@ public class RFXComBindingConstants {
THING_TYPE_THERMOSTAT2, THING_TYPE_THERMOSTAT3, THING_TYPE_BBQ_TEMPERATURE, THING_TYPE_TEMPERATURE_RAIN,
THING_TYPE_TEMPERATURE, THING_TYPE_HUMIDITY, THING_TYPE_TEMPERATURE_HUMIDITY, THING_TYPE_BAROMETRIC,
THING_TYPE_TEMPERATURE_HUMIDITY_BAROMETRIC, THING_TYPE_RAIN, THING_TYPE_WIND, THING_TYPE_UV,
- THING_TYPE_DATE_TIME, THING_TYPE_CURRENT, THING_TYPE_ENERGY_USAGE, THING_TYPE_CURRENT_ENERGY,
- THING_TYPE_POWER, THING_TYPE_WEIGHTING_SCALE, THING_TYPE_GAS_USAGE, THING_TYPE_WATER_USAGE,
- THING_TYPE_RFX_SENSOR, THING_TYPE_RFX_METER, THING_TYPE_FS20, THING_TYPE_RFY);
+ THING_TYPE_DATE_TIME, THING_TYPE_CURRENT, THING_TYPE_ENERGY, THING_TYPE_CURRENT_ENERGY, THING_TYPE_POWER,
+ THING_TYPE_WEIGHTING_SCALE, THING_TYPE_GAS_USAGE, THING_TYPE_WATER_USAGE, THING_TYPE_RFX_SENSOR,
+ THING_TYPE_RFX_METER, THING_TYPE_FS20, THING_TYPE_RFY);
/**
* Map RFXCOM packet types to RFXCOM Thing types and vice versa.
@@ -162,7 +162,7 @@ public class RFXComBindingConstants {
.put(PacketType.CURRENT_ENERGY, RFXComBindingConstants.THING_TYPE_CURRENT_ENERGY)
.put(PacketType.CURTAIN1, RFXComBindingConstants.THING_TYPE_CURTAIN1)
.put(PacketType.DATE_TIME, RFXComBindingConstants.THING_TYPE_DATE_TIME)
- .put(PacketType.ENERGY, RFXComBindingConstants.THING_TYPE_ENERGY_USAGE)
+ .put(PacketType.ENERGY, RFXComBindingConstants.THING_TYPE_ENERGY)
.put(PacketType.FAN, RFXComBindingConstants.THING_TYPE_FAN)
.put(PacketType.FS20, RFXComBindingConstants.THING_TYPE_FS20)
.put(PacketType.GAS, RFXComBindingConstants.THING_TYPE_GAS_USAGE)
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 fd98be384ed66..5eb33e28a564d 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
@@ -46,7 +46,7 @@ public enum RFXComValueSelector {
INSTANT_POWER(RFXComBindingConstants.CHANNEL_INSTANT_POWER, NumberItem.class),
TOTAL_USAGE(RFXComBindingConstants.CHANNEL_TOTAL_USAGE, NumberItem.class),
INSTANT_AMPS(RFXComBindingConstants.CHANNEL_INSTANT_AMPS, NumberItem.class),
- TOTAL_AMP_HOURS(RFXComBindingConstants.CHANNEL_TOTAL_AMP_HOURS, NumberItem.class),
+ TOTAL_AMP_HOUR(RFXComBindingConstants.CHANNEL_TOTAL_AMP_HOUR, NumberItem.class),
STATUS(RFXComBindingConstants.CHANNEL_STATUS, StringItem.class),
MOTION(RFXComBindingConstants.CHANNEL_MOTION, SwitchItem.class),
CONTACT(RFXComBindingConstants.CHANNEL_CONTACT, ContactItem.class),
@@ -73,7 +73,7 @@ public Class extends Item> getItemClass() {
/**
* Procedure to validate selector string.
- *
+ *
* @param valueSelector
* selector string e.g. Command, Temperature
* @return true if item is valid.
@@ -102,7 +102,7 @@ public static boolean validateBinding(String valueSelector, Class extends Item
/**
* Procedure to convert selector string to value selector class.
- *
+ *
* @param valueSelectorText
* selector string e.g. RawData, Command, Temperature
* @return corresponding selector value.
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 4a64fd458c511..564771b6245fa 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
@@ -232,8 +232,8 @@ public void onDeviceMessageReceived(ThingUID bridge, RFXComMessage message) {
case TEMPERATURE:
updateState(CHANNEL_TEMPERATURE, message.convertToState(valueSelector));
break;
- case TOTAL_AMP_HOURS:
- updateState(CHANNEL_TOTAL_AMP_HOURS, message.convertToState(valueSelector));
+ case TOTAL_AMP_HOUR:
+ updateState(CHANNEL_TOTAL_AMP_HOUR, message.convertToState(valueSelector));
break;
case TOTAL_USAGE:
updateState(CHANNEL_TOTAL_USAGE, message.convertToState(valueSelector));
diff --git a/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/internal/messages/RFXComEnergyMessage.java b/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/internal/messages/RFXComEnergyMessage.java
index 4b431e792ab12..c7bf5e9ff7bbb 100644
--- a/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/internal/messages/RFXComEnergyMessage.java
+++ b/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/internal/messages/RFXComEnergyMessage.java
@@ -53,17 +53,16 @@ public byte toByte() {
}
private final static List supportedInputValueSelectors = Arrays.asList(
- RFXComValueSelector.SIGNAL_LEVEL, RFXComValueSelector.BATTERY_LEVEL, RFXComValueSelector.COMMAND,
- RFXComValueSelector.INSTANT_POWER, RFXComValueSelector.TOTAL_USAGE, RFXComValueSelector.INSTANT_AMPS,
- RFXComValueSelector.TOTAL_AMP_HOURS);
+ RFXComValueSelector.SIGNAL_LEVEL, RFXComValueSelector.BATTERY_LEVEL, RFXComValueSelector.INSTANT_POWER,
+ RFXComValueSelector.TOTAL_USAGE, RFXComValueSelector.INSTANT_AMPS, RFXComValueSelector.TOTAL_AMP_HOUR);
private final static List supportedOutputValueSelectors = Arrays.asList();
public SubType subType = SubType.ELEC1;
public int sensorId = 0;
public byte count = 0;
- public double instantAmps = 0;
- public double totalAmpHours = 0;
+ public double instantAmp = 0;
+ public double totalAmpHour = 0;
public double instantPower = 0;
public double totalUsage = 0;
public byte signalLevel = 0;
@@ -85,10 +84,12 @@ public String toString() {
str += ", Sub type = " + subType;
str += ", Device Id = " + getDeviceId();
str += ", Count = " + count;
- str += ", Instant Amps = " + instantAmps;
- str += ", Total Amp Hours = " + totalAmpHours;
+ str += ", Instant Amps = " + instantAmp;
+ str += ", Total Amp Hours = " + totalAmpHour;
str += ", Signal level = " + signalLevel;
str += ", Battery level = " + batteryLevel;
+ str += ", Instant Power = " + instantPower;
+ str += ", Total Usage = " + totalUsage;
return str;
}
@@ -108,14 +109,15 @@ public void encodeMessage(byte[] data) {
count = data[6];
// all usage is reported in Watts based on 230V
- instantPower = ((data[7] & 0xFF) << 24 | (data[8] & 0xFF) << 16 | (data[9] & 0xFF) << 8 | (data[10] & 0xFF))
- / TOTAL_USAGE_CONVERSION_FACTOR;
+ instantPower = ((data[7] & 0xFF) << 24 | (data[8] & 0xFF) << 16 | (data[9] & 0xFF) << 8 | (data[10] & 0xFF));
+
totalUsage = ((data[11] & 0xFF) << 40 | (data[12] & 0xFF) << 32 | (data[13] & 0xFF) << 24
- | (data[14] & 0xFF) << 16 | (data[15] & 0xFF) << 8 | (data[16] & 0xFF));
+ | (data[14] & 0xFF) << 16 | (data[15] & 0xFF) << 8 | (data[16] & 0xFF)) / TOTAL_USAGE_CONVERSION_FACTOR;
+ ;
// convert to amps so external code can determine the watts based on local voltage
- instantAmps = instantPower / WATTS_TO_AMPS_CONVERSION_FACTOR;
- totalAmpHours = totalUsage / WATTS_TO_AMPS_CONVERSION_FACTOR;
+ instantAmp = instantPower / WATTS_TO_AMPS_CONVERSION_FACTOR;
+ totalAmpHour = totalUsage / WATTS_TO_AMPS_CONVERSION_FACTOR;
signalLevel = (byte) ((data[17] & 0xF0) >> 4);
batteryLevel = (byte) (data[17] & 0x0F);
@@ -184,11 +186,11 @@ public State convertToState(RFXComValueSelector valueSelector) throws RFXComExce
} else if (valueSelector == RFXComValueSelector.INSTANT_AMPS) {
- state = new DecimalType(instantAmps);
+ state = new DecimalType(instantAmp);
- } else if (valueSelector == RFXComValueSelector.TOTAL_AMP_HOURS) {
+ } else if (valueSelector == RFXComValueSelector.TOTAL_AMP_HOUR) {
- state = new DecimalType(totalAmpHours);
+ state = new DecimalType(totalAmpHour);
} else {