From 0d13ae1c73a18f64b31e8ca3e5421762ee530c18 Mon Sep 17 00:00:00 2001 From: Markus Rathgeb <maggu2810@gmail.com> Date: Wed, 21 Nov 2018 09:26:19 +0100 Subject: [PATCH] blukii: fix temperature decoding Fixes: https://github.com/eclipse/smarthome/issues/6532 Signed-off-by: Markus Rathgeb <maggu2810@gmail.com> --- .../bluetooth/blukii/internal/data/BlukiiDataDecoder.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extensions/binding/org.eclipse.smarthome.binding.bluetooth.blukii/src/main/java/org/eclipse/smarthome/binding/bluetooth/blukii/internal/data/BlukiiDataDecoder.java b/extensions/binding/org.eclipse.smarthome.binding.bluetooth.blukii/src/main/java/org/eclipse/smarthome/binding/bluetooth/blukii/internal/data/BlukiiDataDecoder.java index 1fea2c59210..3e08b343d45 100644 --- a/extensions/binding/org.eclipse.smarthome.binding.bluetooth.blukii/src/main/java/org/eclipse/smarthome/binding/bluetooth/blukii/internal/data/BlukiiDataDecoder.java +++ b/extensions/binding/org.eclipse.smarthome.binding.bluetooth.blukii/src/main/java/org/eclipse/smarthome/binding/bluetooth/blukii/internal/data/BlukiiDataDecoder.java @@ -24,6 +24,7 @@ * Blukii data decoding. * * @author Markus Rathgeb - Initial contribution (migrate from handler) + * @author Markus Rathgeb - Fixed temperature decoding */ @NonNullByDefault public class BlukiiDataDecoder { @@ -69,7 +70,7 @@ private static Environment processEnvironmentData(byte[] data) { double pressure = doubleByteToInt(data[15], data[16]) / 10; int luminance = doubleByteToInt(data[17], data[18]); int humidity = data[19] & 0xFF; - double temperature = (data[20] & 0xFF) + (data[21] & 0xFF) / 100000000; + double temperature = (data[20] << 8 | data[21] & 0xFF) / 256d; return new Environment(pressure, luminance, humidity, temperature); }