homebridge-levoit-humidifiers
Version:
Homebridge plugin for Levoit Humidifiers
33 lines • 1.31 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const VeSyncFan_1 = require("../api/VeSyncFan");
const deviceTypes_1 = require("../api/deviceTypes");
const characteristic = {
get: async function () {
await this.device.updateInfo();
// If device is off, set the mode to null so the switch displays Off
if (!this.device.isOn) {
return false;
}
return this.device.mode === VeSyncFan_1.Mode.Sleep;
},
set: async function (value) {
switch (value) {
case true:
await this.device.changeMode(VeSyncFan_1.Mode.Sleep);
break;
case false:
// LEH_S601S_WUS has an auto and humidity mode, we want to revert to humidity for that model since Auto has its own switch
if ([deviceTypes_1.DeviceName.LEH_S601S_WUS, deviceTypes_1.DeviceName.LEH_S601S_WUSR].includes(this.device.model)) {
await this.device.changeMode(VeSyncFan_1.Mode.Humidity);
break;
}
else {
await this.device.changeMode(VeSyncFan_1.Mode.Auto);
break;
}
}
},
};
exports.default = characteristic;
//# sourceMappingURL=SleepState.js.map