From f1a61a13cfaf14fd9aee10b75086f3b211789708 Mon Sep 17 00:00:00 2001 From: Nicolas Glassey <1530837+Webbeh@users.noreply.github.com> Date: Wed, 20 Nov 2024 21:15:58 +0100 Subject: [PATCH] MClimate HT - Fix temperature decoding issue (#849) --- vendor/mclimate/ht-sensor.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/mclimate/ht-sensor.js b/vendor/mclimate/ht-sensor.js index b3a462699b..bb5c3820fd 100644 --- a/vendor/mclimate/ht-sensor.js +++ b/vendor/mclimate/ht-sensor.js @@ -12,7 +12,7 @@ function decodeUplink(input) { } function handleKeepalive(bytes, data){ - var tempHex = '0' + bytes[1].toString(16) + bytes[2].toString(16); + var tempHex = ("0" + bytes[1].toString(16)).substr(-2) + ("0" + bytes[2].toString(16)).substr(-2); var tempDec = parseInt(tempHex, 16); var temperatureValue = calculateTemperature(tempDec); var humidityValue = calculateHumidity(bytes[3]); @@ -105,4 +105,4 @@ function decodeUplink(input) { } catch (e) { throw new Error(e); } -} \ No newline at end of file +}