thermostat: handle mode auto

This commit is contained in:
Koushik Dutta
2022-01-20 13:59:16 -08:00
parent 414cff0cc7
commit 112bbd2214
3 changed files with 6 additions and 7 deletions

View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/thermostat",
"version": "0.0.27",
"version": "0.0.29",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/thermostat",
"version": "0.0.27",
"version": "0.0.29",
"license": "Apache",
"devDependencies": {
"@scrypted/sdk": "file:../../sdk"

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/thermostat",
"version": "0.0.27",
"version": "0.0.29",
"description": "Create a virtual thermostat from a temperature sensor and smart plug connected to heater or AC unit.",
"author": "Scrypted",
"license": "Apache",
@@ -26,8 +26,7 @@
"Settings",
"Thermometer",
"TemperatureSetting",
"HumiditySensor",
"HumiditySetting"
"HumiditySensor"
],
"type": "Thermostat"
},

View File

@@ -295,10 +295,10 @@ class ThermostatDevice extends ScryptedDeviceBase implements TemperatureSetting,
}
async setThermostatMode(mode) {
log.i('thermostat mode set to ' + mode);
if (mode == 'On') {
if (mode === ThermostatMode.On || mode == ThermostatMode.Auto) {
mode = this.storage.getItem("lastThermostatMode");
}
else if (mode != 'Off') {
else if (mode != ThermostatMode.Off) {
this.storage.setItem("lastThermostatMode", mode);
}
this.thermostatMode = mode;