From af92d7a3bba3e993a31df044172cb83683a374ce Mon Sep 17 00:00:00 2001 From: Luke Rhodes Date: Thu, 22 Mar 2018 22:42:59 +1100 Subject: [PATCH] Added logs for when temperature is reported too high or too low --- accessories/aircon.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/accessories/aircon.js b/accessories/aircon.js index 805f1be0..11c7576d 100644 --- a/accessories/aircon.js +++ b/accessories/aircon.js @@ -363,8 +363,17 @@ class AirConAccessory extends BroadlinkRMAccessory { log(`${name} onTemperature (${temperature})`); - if (temperature > config.maxTemperature) temperature = config.maxTemperature - if (temperature < config.minTemperature) temperature = config.minTemperature + if (temperature > config.maxTemperature) { + temperature = config.maxTemperature + + log(`\x1b[36m[INFO] Reported temperature (${temperature}) is too high, setting to \x1b[33mmaxTemperature\x1b[0m`) + } + + if (temperature < config.minTemperature) { + temperature = config.minTemperature + + log(`\x1b[36m[INFO] Reported temperature (${temperature}) is too low, setting to \x1b[33mminTemperature\x1b[0m`) + } assert.isBelow(temperature, config.maxTemperature + 1, `\x1b[31m[CONFIG ERROR] \x1b[33mmaxTemperature\x1b[0m (${config.maxTemperature}) must be more than the reported temperature (${temperature})`) assert.isAbove(temperature, config.minTemperature - 1, `\x1b[31m[CONFIG ERROR] \x1b[33mminTemperature\x1b[0m (${config.maxTemperature}) must be less than the reported temperature (${temperature})`)