import * as net from 'net'; import { Service, PlatformAccessory, CharacteristicValue } from 'homebridge'; import type { BigAssFansAccessoryContext, BigAssFansPlatformContext, LightDetectionOverride } from './types'; import { type Capabilities } from './protocol'; interface lightStates { On: boolean; Brightness: number; ColorTemperature: number; homeShieldUp: boolean; } interface colorLightStates { On: boolean; Brightness: number; ColorTemperature: number; Hue: number; Saturation: number; } type BAF = BigAssFans_i6PlatformAccessory; declare function normalizeLightDetectionOverride(value: LightDetectionOverride | undefined): boolean | undefined; /** * Accessory handler for a single Big Ass Fans i6/es6/Haiku ceiling fan. * * Manages the TCP connection to the fan, registers HomeKit services and characteristics * (Fanv2, Lightbulb, sensors, switches), and translates between HomeKit state and the * fan's proprietary protobuf-over-SLIP protocol on port 31415. */ export declare class BigAssFans_i6PlatformAccessory { readonly platform: BigAssFansPlatformContext; readonly accessory: PlatformAccessory; capabilitiesEstablished: boolean; capabilities: Capabilities; fanService: Service; downlightBulbService: Service; uplightBulbService: Service; humiditySensorService: Service; temperatureSensorService: Service; whooshSwitchService: Service; dimToWarmSwitchService: Service; fanAutoSwitchService: Service; lightAutoSwitchService: Service; ecoModeSwitchService: Service; UVCSwitchService: Service; fanOccupancySensorService: Service; lightOccupancySensorService: Service; standbyLEDEnabledSwitchService: Service; standbyLEDBulbService: Service; downlightDarkenService: Service; downlightLightenService: Service; fanSlowerService: Service; fanFasterService: Service; downlightStates: lightStates; uplightStates: lightStates; standbyLEDStates: colorLightStates; fanStates: { Active: number; CurrentFanState: number; TargetFanState: number; RotationDirection: number; RotationSpeed: number; homeShieldUp: boolean; }; fanOccupancyDetected: boolean; lightOccupancyDetected: boolean; showWhooshSwitch: boolean; whooshSwitchOn: boolean; showDimToWarmSwitch: boolean; dimToWarmSwitchOn: boolean; showFanAutoSwitch: boolean; fanAutoSwitchOn: boolean; showLightAutoSwitch: boolean; lightAutoSwitchOn: boolean; showEcoModeSwitch: boolean; ecoModeSwitchOn: boolean; UVCSwitchOn: boolean; disableDirectionControl: boolean; noLights: boolean; showFanOccupancySensor: boolean; showLightOccupancySensor: boolean; showStandbyLED: boolean; standbyLEDEnabledSwitchOn: boolean; downlightEquipped: boolean | undefined; uplightEquipped: boolean | undefined; enableIncrementalButtons: boolean; incrementalButtonsDelay: number; enableDebugPort: boolean; simulated: boolean; showHumidity: boolean; showTemperature: boolean; IP: string; MAC: string; Name: string; ProbeFrequency: number; probeTimeout: ReturnType | undefined; modelUnknown: boolean; firmwareUnknown: boolean; Model: string; SSID: string; Firmware: string; uptimeMinutes: number; rebootCount: number; rebootReason: number; debugLevel: number; debugLevels: Record; CurrentTemperature: number; CurrentRelativeHumidity: number; bulbCount: number; targetBulb: number; client: net.Socket | undefined; oneByteHeaders: number[]; chunkFragment: Buffer; funQueue: funCall[]; lastDebugMessage: string; lastDebugMessageTag: string; messagesLogged: Set; lastRotationSpeedRequestAt: number; lastRotationSpeedRequestPercent: number | undefined; lastRotationSpeedRequestDeviceSpeed: number | undefined; lastFanActiveRequestAt: number; lastFanActiveRequestValue: number | undefined; lastFanActiveWriteAt: number; lastFanActiveWriteValue: number | undefined; pendingRotationSpeedWrite: Buffer | undefined; pendingRotationSpeedWriteTimeout: ReturnType | undefined; pendingRotationSpeedRequestPercent: number | undefined; pendingRotationSpeedRequestDeviceSpeed: number | undefined; expectedRotationSpeed: number | undefined; ignoreUnexpectedRotationSpeedUntil: number; debugLastFanOccupancyValue: number; debugLastLightOccupancyValue: number; uptimeLogged: boolean; lastRebootCount: number; showRebootReason: boolean; /** Sets up config, debug levels, network connection, and HomeKit services for the fan. */ constructor(platform: BigAssFansPlatformContext, accessory: PlatformAccessory); setDownLightOnState(value: CharacteristicValue): Promise; getDownLightOnState(): Promise; setDownBrightness(value: CharacteristicValue): Promise; getDownBrightness(): Promise; setUpLightOnState(value: CharacteristicValue): Promise; getUpLightOnState(): Promise; setUpBrightness(value: CharacteristicValue): Promise; getUpBrightness(): Promise; getCurrentTemperature(): Promise; getCurrentRelativeHumidity(): Promise; setFanActive(value: CharacteristicValue): Promise; getFanActive(): Promise; getCurrentFanState(): Promise; setTargetFanState(value: CharacteristicValue): Promise; getTargetFanState(): Promise; setRotationSpeed(value: CharacteristicValue): Promise; getRotationSpeed(): Promise; setRotationDirection(value: CharacteristicValue): Promise; getRotationDirection(): Promise; setDownColorTemperature(value: CharacteristicValue): Promise; getDownColorTemperature(): Promise; setSwingMode(value: CharacteristicValue): Promise; getSwingMode(): Promise; setWhooshSwitchOnState(value: CharacteristicValue): Promise; getWhooshSwitchOnState(): Promise; setDimToWarmSwitchOnState(value: CharacteristicValue): Promise; getDimToWarmSwitchOnState(): Promise; setFanAutoSwitchOnState(value: CharacteristicValue): Promise; getFanAutoSwitchOnState(): Promise; setLightAutoSwitchOnState(value: CharacteristicValue): Promise; getLightAutoSwitchOnState(): Promise; setEcoModeSwitchOnState(value: CharacteristicValue): Promise; getEcoModeSwitchOnState(): Promise; handleFanOccupancyDetectedGet(): Promise; handleLightOccupancyDetectedGet(): Promise; setUVCSwitchOnState(value: CharacteristicValue): Promise; getUVCSwitchOnState(): Promise; setStandbyLEDEnabledSwitchOnState(value: CharacteristicValue): Promise; getStandbyLEDEnabledSwitchOnState(): Promise; setStandbyLEDOnState(value: CharacteristicValue): Promise; getStandbyLEDOnState(): Promise; setStandbyLEDBrightness(value: CharacteristicValue): Promise; getStandbyLEDBrightness(): Promise; setStandbyLEDHue(value: CharacteristicValue): Promise; getStandbyLEDHue(): Promise; setStandbyLEDSaturation(value: CharacteristicValue): Promise; getStandbyLEDSaturation(): Promise; setDownlightDarkenServiceOnState(value: CharacteristicValue): Promise; setDownlightLightenServiceOnState(value: CharacteristicValue): Promise; setFanSlowerServiceOnState(value: CharacteristicValue): Promise; setFanFasterServiceOnState(value: CharacteristicValue): Promise; } /** * Registers all HomeKit services and characteristics for this fan accessory. * * Creates the Fanv2 service (with Active, CurrentFanState, TargetFanState, SwingMode, * RotationSpeed, RotationDirection), light services, sensor services, and optional * switches based on the user's config and the fan's detected capabilities. * Removes any stale legacy services (Fan v1, whoosh switch) from cached accessories. */ declare function makeServices(pA: BAF): void; /** * connect to the fan, send capability query and initialization message, * establish the error and data callbacks and start a keep-alive interval timer. */ declare function networkSetup(pA: BAF): void; /** * Handles incoming TCP data from the fan. * * Splits the raw byte stream on SLIP 0xC0 delimiters into individual frames, * unstuffs escaped bytes, reassembles fragmented chunks, and passes each * complete protobuf message to buildFunStack() for decoding and dispatch. */ declare function onData(pA: BAF, data: Buffer): void; declare function fanOnState(s: string, pA: BAF): void; declare function fanRotationSpeed(s: string, pA: BAF): void; /** Reverses SLIP byte stuffing: 0xDB 0xDC -> 0xC0, 0xDB 0xDD -> 0xDB. */ declare function unstuff(data: Buffer): Buffer; /** Encodes a number as a protobuf varint (variable-length integer). */ declare function varint_encode(n: number): number[]; /** Builds a standby LED color message with proper varint encoding for RGB values >= 128. */ declare function buildStandbyLEDColorMessage(red: number, green: number, blue: number): number[]; declare function rotationSpeedPercent(speed: number): number; declare function percentToRotationSpeed(percent: number): number; /** Decodes a protobuf varint from the start of the buffer. Returns [remaining buffer, decoded value]. */ declare function getVarint(b: Buffer): [Buffer, number]; type funCall = [((s: string, pA: BigAssFans_i6PlatformAccessory) => void), string]; declare class ProtobufParseError extends Error { constructor(message: string); } declare function reconcileCapabilities(pA: BAF, previousCapabilities: Capabilities): boolean; declare function flushFunQueue(pA: BAF, pending?: funCall[]): void; export declare const __test__: { ProtobufParseError: typeof ProtobufParseError; buildStandbyLEDColorMessage: typeof buildStandbyLEDColorMessage; fanOnState: typeof fanOnState; fanRotationSpeed: typeof fanRotationSpeed; flushFunQueue: typeof flushFunQueue; getVarint: typeof getVarint; invokeSetFanActive(pA: Partial, value: CharacteristicValue): Promise; invokeSetRotationSpeed(pA: Partial, value: CharacteristicValue): Promise; networkSetup: typeof networkSetup; normalizeLightDetectionOverride: typeof normalizeLightDetectionOverride; makeServices: typeof makeServices; onData: typeof onData; percentToRotationSpeed: typeof percentToRotationSpeed; reconcileCapabilities: typeof reconcileCapabilities; rotationSpeedPercent: typeof rotationSpeedPercent; unstuff: typeof unstuff; varint_encode: typeof varint_encode; setConnectSocketForTest(connect: typeof net.connect): void; resetConnectSocketForTest(): void; }; export {}; //# sourceMappingURL=platformAccessory.d.ts.map