fix ewt temperatures (#8608)

Signed-off-by: Hans Böhm <h.boehm@gmx.at>
This commit is contained in:
boehan 2020-10-03 00:07:40 +02:00 committed by GitHub
parent 67edb76fc6
commit 7d1c6ee371
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,7 +49,11 @@ public class DataTypeTemperature implements ComfoAirDataType {
} else { } else {
int[] readReplyDataPos = commandType.getReadReplyDataPos(); int[] readReplyDataPos = commandType.getReadReplyDataPos();
if (readReplyDataPos != null && readReplyDataPos[0] < data.length) { 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 { } else {
return UnDefType.NULL; return UnDefType.NULL;
} }
@ -62,7 +66,11 @@ public class DataTypeTemperature implements ComfoAirDataType {
QuantityType<?> celsius = ((QuantityType<?>) value).toUnit(SIUnits.CELSIUS); QuantityType<?> celsius = ((QuantityType<?>) value).toUnit(SIUnits.CELSIUS);
if (celsius != null) { 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; return template;
} else { } else {
logger.trace("\"DataTypeTemperature\" class \"convertFromState\" undefined state"); logger.trace("\"DataTypeTemperature\" class \"convertFromState\" undefined state");