]> git.basschouten.com Git - openhab-addons.git/commitdiff
fix ewt temperatures (#8608)
authorboehan <boehan@users.noreply.github.com>
Fri, 2 Oct 2020 22:07:40 +0000 (00:07 +0200)
committerGitHub <noreply@github.com>
Fri, 2 Oct 2020 22:07:40 +0000 (00:07 +0200)
Signed-off-by: Hans Böhm <h.boehm@gmx.at>
bundles/org.openhab.binding.comfoair/src/main/java/org/openhab/binding/comfoair/internal/datatypes/DataTypeTemperature.java

index b0afe748e70ca6586deb5e8097e005fff19760aa..cbe5ce7cc7c3725d7185b56278e6169147a1a4eb 100644 (file)
@@ -49,7 +49,11 @@ public class DataTypeTemperature implements ComfoAirDataType {
         } else {
             int[] readReplyDataPos = commandType.getReadReplyDataPos();
             if (readReplyDataPos != null && readReplyDataPos[0] < data.length) {
-                return new QuantityType<>((((double) data[readReplyDataPos[0]]) / 2) - 20, SIUnits.CELSIUS);
+                if (commandType.getReadCommand() == ComfoAirCommandType.Constants.REQUEST_GET_EWT) {
+                    return new QuantityType<>((double) data[readReplyDataPos[0]], SIUnits.CELSIUS);
+                } else {
+                    return new QuantityType<>((((double) data[readReplyDataPos[0]]) / 2) - 20, SIUnits.CELSIUS);
+                }
             } else {
                 return UnDefType.NULL;
             }
@@ -62,7 +66,11 @@ public class DataTypeTemperature implements ComfoAirDataType {
         QuantityType<?> celsius = ((QuantityType<?>) value).toUnit(SIUnits.CELSIUS);
 
         if (celsius != null) {
-            template[commandType.getChangeDataPos()] = (int) (celsius.doubleValue() + 20) * 2;
+            if (commandType.getReadCommand() == ComfoAirCommandType.Constants.REQUEST_GET_EWT) {
+                template[commandType.getChangeDataPos()] = celsius.intValue();
+            } else {
+                template[commandType.getChangeDataPos()] = (int) (celsius.doubleValue() + 20) * 2;
+            }
             return template;
         } else {
             logger.trace("\"DataTypeTemperature\" class \"convertFromState\" undefined state");