Skip to content

Commit

Permalink
Removed unsupported references to AutoOnOff.
Browse files Browse the repository at this point in the history
Fixes #378
  • Loading branch information
kiwi-cam committed Sep 1, 2021
1 parent 1e99d04 commit 5b08fac
Showing 1 changed file with 0 additions and 50 deletions.
50 changes: 0 additions & 50 deletions accessories/heater-cooler.js
Original file line number Diff line number Diff line change
Expand Up @@ -716,8 +716,6 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory {
})

this.temperatureCallbackQueue = {};

this.checkTemperatureForAutoOnOff(temperature);
}

updateTemperatureUI() {
Expand Down Expand Up @@ -748,54 +746,6 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory {
return callback(null, state.currentHumidity);
}

async checkTemperatureForAutoOnOff(temperature) {
const { config, host, log, logLevel, name, serviceManager, state } = this;
let { autoHeatTemperature, autoCoolTemperature, minimumAutoOnOffDuration } = config;

if (this.shouldIgnoreAutoOnOff) {
if (logLevel <= 2) {this.log(`${name} checkTemperatureForAutoOn (ignore within ${minimumAutoOnOffDuration}s of previous auto-on/off due to "minimumAutoOnOffDuration")`);}

return;
}

if (!autoHeatTemperature && !autoCoolTemperature) {return;}

if (!this.isAutoSwitchOn()) {
if (logLevel <= 2) {this.log(`${name} checkTemperatureForAutoOnOff (autoSwitch is off)`);}
return;
}

if (logLevel <= 2) {this.log(`${name} checkTemperatureForAutoOnOff`);}

if (autoHeatTemperature && temperature < autoHeatTemperature) {
this.state.isRunningAutomatically = true;

if (logLevel <= 2) {this.log(`${name} checkTemperatureForAutoOnOff (${temperature} < ${autoHeatTemperature}: auto heat)`);}
serviceManager.setCharacteristic(Characteristic.TargetHeatingCoolingState, Characteristic.TargetHeatingCoolingState.HEAT);
} else if (autoCoolTemperature && temperature > autoCoolTemperature) {
this.state.isRunningAutomatically = true;

if (logLevel <= 2) {this.log(`${name} checkTemperatureForAutoOnOff (${temperature} > ${autoCoolTemperature}: auto cool)`);}
serviceManager.setCharacteristic(Characteristic.TargetHeatingCoolingState, Characteristic.TargetHeatingCoolingState.COOL);
} else {
if (logLevel <= 1) {this.log(`${name} checkTemperatureForAutoOnOff (temperature is ok)`);}

if (this.state.isRunningAutomatically) {
this.isAutomatedOff = true;
if (logLevel <= 2) {this.log(`${name} checkTemperatureForAutoOnOff (auto off)`);}
serviceManager.setCharacteristic(Characteristic.TargetHeatingCoolingState, Characteristic.TargetHeatingCoolingState.OFF);
} else {
return;
}
}

this.shouldIgnoreAutoOnOff = true;
this.shouldIgnoreAutoOnOffPromise = delayForDuration(minimumAutoOnOffDuration);
await this.shouldIgnoreAutoOnOffPromise;

this.shouldIgnoreAutoOnOff = false;
}

getTemperatureDisplayUnits(callback) {
const { config } = this;
const temperatureDisplayUnits = (config.units.toLowerCase() === 'f') ? Characteristic.TemperatureDisplayUnits.FAHRENHEIT : Characteristic.TemperatureDisplayUnits.CELSIUS;
Expand Down

0 comments on commit 5b08fac

Please sign in to comment.