/** * Fan Service Handler (Air Purifier) * * Implements the HomeKit AirPurifier service for Dyson devices. * Handles Active, CurrentAirPurifierState, TargetAirPurifierState, * RotationSpeed, and SwingMode characteristics. */ import type { API, Logging, PlatformAccessory, Service } from 'homebridge'; import type { DysonLinkDevice } from '../../devices/dysonLinkDevice.js'; /** * Configuration for FanService */ export interface FanServiceConfig { accessory: PlatformAccessory; device: DysonLinkDevice; api: API; log: Logging; /** Device name to display in HomeKit */ deviceName: string; /** * Whether the device supports auto mode. When false (e.g. plain fans with * no air-quality sensor), the required TargetAirPurifierState characteristic * is pinned to MANUAL so HomeKit does not offer a non-functional Auto toggle. */ supportsAutoMode?: boolean; } /** * FanService handles the AirPurifier HomeKit service * * Maps HomeKit characteristics to Dyson device state: * - Active (0/1) ↔ isOn (boolean) * - CurrentAirPurifierState (0=INACTIVE, 1=IDLE, 2=PURIFYING) ↔ isOn + fanSpeed * - TargetAirPurifierState (0=MANUAL, 1=AUTO) ↔ autoMode (boolean) * - RotationSpeed (0-100%) ↔ fanSpeed (1-10) * - SwingMode (0/1) ↔ oscillation (boolean) */ export declare class FanService { private readonly service; private readonly device; private readonly log; private readonly api; private readonly boundHandleStateChange; /** Timer for debouncing speed changes */ private speedDebounceTimer?; /** Pending speed value to be set after debounce */ private pendingSpeed?; /** Whether this service has been destroyed */ private destroyed; constructor(config: FanServiceConfig); /** * Get the underlying HomeKit service */ getService(): Service; /** * Clean up event listeners and timers */ destroy(): void; /** * Handle Active GET request * Returns 1 (ACTIVE) or 0 (INACTIVE) */ private handleActiveGet; /** * Handle Active SET request * @param value - 1 (ACTIVE) or 0 (INACTIVE) */ private handleActiveSet; /** * Handle CurrentAirPurifierState GET request * Returns 0 (INACTIVE), 1 (IDLE), or 2 (PURIFYING_AIR) */ private handleCurrentStateGet; /** * Handle TargetAirPurifierState GET request * Returns 1 (AUTO) or 0 (MANUAL) */ private handleTargetStateGet; /** * Handle TargetAirPurifierState SET request * @param value - 1 (AUTO) or 0 (MANUAL) */ private handleTargetStateSet; /** * Handle RotationSpeed GET request * Returns 0-100 percentage */ private handleSpeedGet; /** * Handle RotationSpeed SET request * Uses debouncing to prevent flooding the device when dragging the slider * @param value - 0-100 percentage */ private handleSpeedSet; /** * Apply the pending speed value after debounce delay */ private applyPendingSpeed; /** * Handle SwingMode GET request * Returns 1 (SWING_ENABLED) or 0 (SWING_DISABLED) */ private handleSwingModeGet; /** * Handle SwingMode SET request * @param value - 1 (SWING_ENABLED) or 0 (SWING_DISABLED) */ private handleSwingModeSet; /** * Handle device state changes * Updates HomeKit characteristics to reflect current device state */ private handleStateChange; /** * Update characteristics from current device state * Call this after connecting to sync HomeKit with device */ updateFromState(): void; } //# sourceMappingURL=fanService.d.ts.map