diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/binary_sensor/protocol/parameter/SensorState.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/binary_sensor/protocol/parameter/SensorState.java index fcf36f9e8..372e4f935 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/binary_sensor/protocol/parameter/SensorState.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/binary_sensor/protocol/parameter/SensorState.java @@ -21,7 +21,7 @@ public class SensorState extends Parameter{ } public static SensorState decode(byte[] data){ - int dataInt = (data[1] << 8) | data[0]; + int dataInt = ((data[1] & 0xFF) << 8) | (data[0] & 0xFF); byte stateByte = (byte)((dataInt >> 11) & 0x01); int count = dataInt & 0b11111111111; return new SensorState(