diff --git a/vendor/mclimate/vicki-codec.yaml b/vendor/mclimate/vicki-codec.yaml index ead089ff88..f2667d7ccc 100644 --- a/vendor/mclimate/vicki-codec.yaml +++ b/vendor/mclimate/vicki-codec.yaml @@ -23,8 +23,8 @@ uplinkDecoder: calibrationFailed: false perceiveAsOnline: false antiFreezeProtection: false - motorOpenness: 17 - targetTemperatureFloat: '29.00' + valveOpenness: 17 + targetTemperatureFloat: 29 normalizedOutput: data: - air: diff --git a/vendor/mclimate/vicki.js b/vendor/mclimate/vicki.js index 03730aa621..a0480ca691 100644 --- a/vendor/mclimate/vicki.js +++ b/vendor/mclimate/vicki.js @@ -24,14 +24,14 @@ function decodeUplink(input) { batteryTmp = ("0" + bytes[7].toString(16)).substr(-2)[0]; batteryVoltageCalculated = 2 + parseInt("0x" + batteryTmp, 16) * 0.1; - decbin = function(number) { + let decbin = (number) => { if (number < 0) { number = 0xFFFFFFFF + number + 1 } number = number.toString(2); return "00000000".substr(number.length) + number; } - byte7Bin = decbin(bytes[8]); + byte7Bin = decbin(bytes[7]); openWindow = byte7Bin[4]; highMotorConsumption = byte7Bin[5]; lowMotorConsumption = byte7Bin[6]; @@ -67,9 +67,9 @@ function decodeUplink(input) { data.attachedBackplate = toBool(attachedBackplate); data.perceiveAsOnline = toBool(perceiveAsOnline); data.antiFreezeProtection = toBool(antiFreezeProtection); - data.motorOpenness = Math.round((1-(motorPosition/motorRange))*100); + data.valveOpenness = motorRange != 0 ? Math.round((1-(motorPosition/motorRange))*100) : 0; if(!data.hasOwnProperty('targetTemperatureFloat')){ - data.targetTemperatureFloat = bytes[1].toFixed(2); + data.targetTemperatureFloat = parseFloat(bytes[1]) } return data; } @@ -169,8 +169,7 @@ function decodeUplink(input) { { // get default keepalive if it is not available in data command_len = 2; - var deviceKeepAlive = 5; - var wdpC = commands[i + 1] == '00' ? false : commands[i + 1] * deviceKeepAlive + 7; + var wdpC = commands[i + 1] == '00' ? false : parseInt(commands[i + 1], 16); var wdpUc = commands[i + 2] == '00' ? false : parseInt(commands[i + 2], 16); var dataJ = { watchDogParams: { wdpC: wdpC, wdpUc: wdpUc } }; resultToPass = merge_obj(resultToPass, dataJ); @@ -311,14 +310,14 @@ function decodeUplink(input) { case '4d': { command_len = 2; - var data = { maxAllowedIntegralValue : (parseInt(`${commands[i + 1]}${commands[i + 2]}`, 16))/10 }; + var data = { piMaxIntegratedError : (parseInt(`${commands[i + 1]}${commands[i + 2]}`, 16))/10 }; resultToPass = merge_obj(resultToPass, data); } break; case '50': { command_len = 2; - var data = { valveOpennessRangeInPercentage: { min: parseInt(commands[i + 1], 16), max: parseInt(commands[i + 2], 16) } }; + var data = { effectiveMotorRange: { minValveOpenness: 100 - parseInt(commands[i + 2], 16), maxValveOpenness: 100 - parseInt(commands[i + 1], 16) } }; resultToPass = merge_obj(resultToPass, data); } break;