homebridge-levoit-humidifiers
Version:
Homebridge plugin for Levoit Humidifiers
53 lines • 1.85 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const VeSyncFan_1 = require("../api/VeSyncFan");
/**
* AutoProState characteristic handler for the AutoPro Mode service.
* Controls whether the device is in AutoPro Mode or Manual Mode.
*
* AutoPro Mode is available on certain models (e.g., Superior 6000S) and provides
* advanced automatic humidity control.
*
* Behavior:
* - On: Switches to AutoPro Mode
* - Off: Switches to Manual Mode
* - Returns false if device is off (so switch displays Off)
*
* Note: Uses cached device state from background polling to avoid slow read warnings.
*/
const characteristic = {
/**
* Gets whether the device is in AutoPro Mode.
* Returns false if device is off (so switch displays Off).
* Uses cached state to ensure fast response times.
*/
get: async function () {
// Use cached state - background polling keeps this fresh
// If device is off, return false so the switch displays Off
if (!this.device.isOn) {
return false;
}
return this.device.mode === VeSyncFan_1.Mode.AutoPro;
},
/**
* Sets AutoPro Mode state.
* - On: Switches to AutoPro Mode
* - Off: Switches to Manual Mode
*/
set: async function (value) {
switch (value) {
case true:
// Turn on AutoPro Mode
await this.device.changeMode(VeSyncFan_1.Mode.AutoPro);
this.updateAllCharacteristics();
break;
case false:
// Turn off AutoPro Mode - switch to Manual
await this.device.changeMode(VeSyncFan_1.Mode.Manual);
this.updateAllCharacteristics();
break;
}
},
};
exports.default = characteristic;
//# sourceMappingURL=AutoProState.js.map