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 +}