/** * Base Accessory Class for Dyson Devices * * Abstract class that provides common functionality for all Dyson accessory types. * Handles AccessoryInformation setup and device state change subscriptions. */ import type { API, Logging, PlatformAccessory, Service } from 'homebridge'; import type { DysonDevice } from '../devices/dysonDevice.js'; import type { DeviceState } from '../devices/types.js'; /** * Configuration for DysonAccessory */ export interface DysonAccessoryConfig { accessory: PlatformAccessory; device: DysonDevice; api: API; log: Logging; } /** * Abstract base class for all Dyson accessories * * Provides: * - AccessoryInformation service setup * - Device reference management * - State change subscription * - Abstract method for service setup */ export declare abstract class DysonAccessory { protected readonly accessory: PlatformAccessory; protected readonly device: DysonDevice; protected readonly api: API; protected readonly log: Logging; /** Bound event handlers for cleanup */ private readonly boundHandleStateChange; private readonly boundHandleConnect; private readonly boundHandleDisconnect; private readonly boundHandleDebug; /** * Create a new DysonAccessory * * @param config - Accessory configuration */ constructor(config: DysonAccessoryConfig); /** * Set up device-specific services * * Must be implemented by subclasses to add the appropriate * HomeKit services for the device type. */ protected abstract setupServices(): void; /** * Handle device state changes * * Can be overridden by subclasses to update service characteristics. * * @param state - New device state */ protected handleStateChange(_state: DeviceState): void; /** * Handle device connection * * Called when the device connects. Can be overridden by subclasses. */ protected handleConnect(): void; /** * Handle device disconnection * * Called when the device disconnects. Can be overridden by subclasses * to mark the accessory as "Not Responding" in HomeKit. */ protected handleDisconnect(): void; /** * Clean up event listeners * * Call this when the accessory is being removed to prevent * EventEmitter listener leaks. */ destroy(): void; /** * Get the HomeKit accessory */ getAccessory(): PlatformAccessory; /** * Get the Dyson device */ getDevice(): DysonDevice; /** * Set up the AccessoryInformation service * * Sets manufacturer, model, serial number, and firmware version. */ private setupAccessoryInformation; /** * Get the model name for the device * * Returns a human-readable model name based on product type. */ private getModelName; /** * Remove a service from the accessory if it exists * * Useful for cleanup when reconfiguring accessories. * * @param service - The service instance to remove */ protected removeService(service: Service): void; } //# sourceMappingURL=dysonAccessory.d.ts.map