Skip to content

Commit

Permalink
Added logs for when temperature is reported too high or too low
Browse files Browse the repository at this point in the history
  • Loading branch information
lprhodes committed Mar 22, 2018
1 parent 278711a commit af92d7a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions accessories/aircon.js
Original file line number Diff line number Diff line change
Expand Up @@ -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})`)
Expand Down

0 comments on commit af92d7a

Please sign in to comment.