homebridge-tsvesync
Version:
Homebridge plugin for VeSync devices including Levoit air purifiers, humidifiers, and Etekcity smart outlets
101 lines • 3.18 kB
TypeScript
import { PlatformAccessory } from 'homebridge';
import { BaseAccessory } from './base.accessory';
import { TSVESyncPlatform } from '../platform';
import { DeviceCapabilities, VeSyncAirPurifier } from '../types/device.types';
export declare class AirPurifierAccessory extends BaseAccessory {
private readonly capabilities;
protected readonly device: VeSyncAirPurifier;
private isAirBypassDevice;
private isAirBaseV2Device;
private isAir131Device;
private lastSetSpeed;
private lastSetPercentage;
private skipNextUpdate;
constructor(platform: TSVESyncPlatform, accessory: PlatformAccessory, device: VeSyncAirPurifier);
/**
* Feature detection system
*/
private hasFeature;
/**
* Check if a feature is supported in the current device mode
*/
private isFeatureSupportedInCurrentMode;
/**
* Get the maximum fan speed for the device
*/
private getMaxFanSpeed;
private isCore200S;
/**
* Calculate the appropriate step size for discrete speed levels
*/
private calculateRotationSpeedStep;
/**
* Convert device speed to percentage
*/
private speedToPercentage;
/**
* Updates the rotation speed characteristic for Air131 devices immediately after turning on.
* This ensures the UI shows the restored speed instead of 0, providing better user experience.
*
* Air131 devices remember their last speed setting when turned back on, but the characteristic
* update can be delayed. This method proactively updates the HomeKit characteristic to reflect
* the actual device speed.
*
* @private
* @returns {Promise<void>} Promise that resolves when the update is complete
* @throws Will log errors through handleDeviceError but won't propagate them to avoid
* disrupting the main turn-on operation
*/
private updateAir131RotationSpeedAfterTurnOn;
/**
* Convert percentage to device speed
*/
private percentageToSpeed;
/**
* Set up the air purifier service
*/
protected setupService(): void;
/**
* Extract filter life from device data in a centralized way
*/
private extractFilterLife;
/**
* Get filter change indication
*/
private getFilterChangeIndication;
/**
* Get filter life level
*/
private getFilterLifeLevel;
/**
* Get current state (INACTIVE = 0, IDLE = 1, PURIFYING_AIR = 2)
*/
private getCurrentState;
/**
* Get device capabilities
*/
protected getDeviceCapabilities(): DeviceCapabilities;
/**
* Update device states based on the latest details
*/
protected updateDeviceSpecificStates(details: any): Promise<void>;
/**
* Get target state (MANUAL = 0, AUTO = 1)
*/
private getTargetState;
/**
* Set target state (AUTO = 0, MANUAL = 1)
*/
private setTargetState;
/**
* Get rotation speed
*/
private getRotationSpeed;
/**
* Set rotation speed
*/
private setRotationSpeed;
private getActive;
private setActive;
}
//# sourceMappingURL=air-purifier.accessory.d.ts.map