homebridge-levoit-humidifiers
Version:
Homebridge plugin for Levoit Humidifiers
25 lines • 878 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const calculateWarmMistLevel = (device) => {
const currentMistLevel = device.warmLevel;
return device.isOn ? currentMistLevel : 0;
};
const characteristic = {
get: async function () {
await this.device.updateInfo();
return calculateWarmMistLevel(this.device);
},
set: async function (value) {
if (!this.device.warmEnabled && value > 0) {
// if from Off state and level is greater than 0, return immediately.
return;
}
if (this.device.warmEnabled && value == 0) {
// if from On state and level is less than 0, return immediately
return;
}
await this.device.changeWarmMistLevel(Number(value));
},
};
exports.default = characteristic;
//# sourceMappingURL=WarmMistLevel.js.map