Skip to content

Commit 35add30

Browse files
authored
[enocean] fix temperature values for D2_50 eep (openhab#16975)
Fixes openhab#16974 Signed-off-by: Zhivka Dimova <[email protected]>
1 parent a5a02a1 commit 35add30

File tree

1 file changed

+7
-6
lines changed
  • bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/D2_50

1 file changed

+7
-6
lines changed

bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/D2_50/D2_50.java

+7-6
Original file line numberDiff line numberDiff line change
@@ -144,19 +144,20 @@ protected State convertToStateImpl(String channelId, String channelTypeId,
144144
case CHANNEL_AIRQUALITYVALUE2:
145145
return new QuantityType<>((bytes[4] & 0x7f), Units.PERCENT);
146146
case CHANNEL_OUTDOORAIRTEMPERATURE:
147-
return new QuantityType<>(-63 + (bytes[5] >>> 1), SIUnits.CELSIUS);
147+
return new QuantityType<>(-63 + ((bytes[5] & 0xff) >>> 1), SIUnits.CELSIUS);
148148
case CHANNEL_SUPPLYAIRTEMPERATURE:
149-
return new QuantityType<>(-63 + (bytes[6] >>> 2) + ((bytes[5] & 1) << 6), SIUnits.CELSIUS);
149+
return new QuantityType<>(-63 + ((bytes[6] & 0xff) >>> 2) + ((bytes[5] & 1) << 6), SIUnits.CELSIUS);
150150
case CHANNEL_INDOORAIRTEMPERATURE:
151-
return new QuantityType<>(-63 + (bytes[7] >>> 3) + ((bytes[6] & 0b11) << 5), SIUnits.CELSIUS);
151+
return new QuantityType<>(-63 + ((bytes[7] & 0xff) >>> 3) + ((bytes[6] & 0b11) << 5), SIUnits.CELSIUS);
152152
case CHANNEL_EXHAUSTAIRTEMPERATURE:
153-
return new QuantityType<>(-63 + (bytes[8] >>> 4) + ((bytes[7] & 0b111) << 4), SIUnits.CELSIUS);
153+
return new QuantityType<>(-63 + ((bytes[8] & 0xff) >>> 4) + ((bytes[7] & 0b111) << 4), SIUnits.CELSIUS);
154154
case CHANNEL_SUPPLYAIRFANAIRFLOWRATE:
155-
return new QuantityType<>((bytes[9] >>> 2) + ((bytes[8] & 0b1111) << 6), Units.CUBICMETRE_PER_MINUTE);
155+
return new QuantityType<>(((bytes[9] & 0xff) >>> 2) + ((bytes[8] & 0b1111) << 6),
156+
Units.CUBICMETRE_PER_MINUTE);
156157
case CHANNEL_EXHAUSTAIRFANAIRFLOWRATE:
157158
return new QuantityType<>((bytes[10] & 0xff) + ((bytes[9] & 0b11) << 8), Units.CUBICMETRE_PER_MINUTE);
158159
case CHANNEL_SUPPLYFANSPEED:
159-
return new DecimalType((bytes[12] >>> 4) + (bytes[11] << 4));
160+
return new DecimalType(((bytes[12] & 0xff) >>> 4) + (bytes[11] << 4));
160161
case CHANNEL_EXHAUSTFANSPEED:
161162
return new DecimalType((bytes[13] & 0xff) + ((bytes[12] & 0b1111) << 8));
162163
}

0 commit comments

Comments
 (0)