homebridge-levoit-humidifiers
Version:
Homebridge plugin for Levoit Humidifiers
37 lines • 1.33 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const VeSyncFan_1 = require("../api/VeSyncFan");
/**
* CurrentState characteristic handler for the Humidifier service.
* Indicates whether the humidifier is currently humidifying or idle.
*
* Returns:
* - IDLE: Device is off, target reached, or in Manual mode
* - HUMIDIFYING: Device is on and actively humidifying (in Auto/Humidity/Sleep mode)
*
* Note: Uses cached device state from background polling to avoid slow read warnings.
*/
const characteristic = {
/**
* Gets the current humidifier state (IDLE or HUMIDIFYING).
* Uses cached state to ensure fast response times.
*/
get: async function () {
// Use cached state - background polling keeps this fresh
const { HUMIDIFYING, IDLE } = this.platform.Characteristic.CurrentHumidifierDehumidifierState;
// Device is idle if:
// - Target humidity has been reached
// - Device is off
// - Device is in Manual mode
if (this.device.targetReached ||
!this.device.isOn ||
this.device.mode == VeSyncFan_1.Mode.Manual) {
return IDLE;
}
else {
return HUMIDIFYING;
}
},
};
exports.default = characteristic;
//# sourceMappingURL=CurrentState.js.map