From cf620b5e85da61ca2a3b5559581c7dc001f9fdaf Mon Sep 17 00:00:00 2001 From: Luke Rhodes Date: Fri, 23 Mar 2018 10:43:30 +1100 Subject: [PATCH] Added `ignoreTemperatureWhenOff` option to the air-conditioner. --- accessories/aircon.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/accessories/aircon.js b/accessories/aircon.js index 552bba12..4d5c6705 100644 --- a/accessories/aircon.js +++ b/accessories/aircon.js @@ -224,7 +224,7 @@ class AirConAccessory extends BroadlinkRMAccessory { // Thermostat async sendTemperature (temperature, previousTemperature) { const { HeatingCoolingStates, config, data, host, log, name, state, debug } = this; - const { preventResendHex, defaultCoolTemperature, heatTemperature, sendTemperatureOnlyWhenOff } = config; + const { preventResendHex, defaultCoolTemperature, heatTemperature, ignoreTemperatureWhenOff, sendTemperatureOnlyWhenOff } = config; log(`${name} Potential sendTemperature (${temperature})`); @@ -246,13 +246,16 @@ class AirConAccessory extends BroadlinkRMAccessory { } } + if (!state.currentHeatingCoolingState && ignoreTemperatureWhenOff) { + return; + } + state.firstTemperatureUpdate = false; // Send the temperature hex this.log(`${name} sendTemperature (${state.targetTemperature}`); await this.performSend(hexData.data); - if (!state.currentHeatingCoolingState && sendTemperatureOnlyWhenOff) { return; }