UNPKG

homebridge-levoit-humidifiers

Version:
38 lines 1.43 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * Active characteristic handler for the Humidifier service. * Controls the power state of the humidifier (On/Off). * * Note: Uses cached device state from background polling to avoid slow read warnings. * The device state is kept fresh by periodic polling in VeSyncAccessory. */ const characteristic = { /** * Gets the current power state of the humidifier. * Returns true if the device is on, false if off. * Uses cached state to ensure fast response times. */ get: async function () { // Use cached state - background polling keeps this fresh return this.device.isOn; }, /** * Sets the power state of the humidifier. * Only sends command if the state is actually changing to avoid unnecessary API calls. * Immediately updates all HomeKit characteristics to reflect the new state. */ set: async function (value) { const boolValue = value == 1; // Only update if state is changing if (boolValue !== this.device.isOn) { const success = await this.device.setPower(boolValue); if (success) { // Update all characteristics immediately to reflect new state this.updateAllCharacteristics(); } } }, }; exports.default = characteristic; //# sourceMappingURL=Active.js.map