import eWelink, { Device, DeviceState, LoginInfo } from "ewelink-api"; import { Logging } from "homebridge/lib/logger"; interface ConnectionParams { readonly email: string; readonly password: string; } interface Connection { readonly _connection: any; readonly params: ConnectionParams; activateConnection(onSuccess: (auth: LoginInfo) => T): Promise; requestDevice(deviceId: string, onSuccess: (device: Device) => T): Promise; requestDeviceState(deviceId: string): Promise; requestDevices(onSuccess: (devices: Device[]) => T): Promise; openMonitoringSocket(onChange: (deviceId: string, state: string) => void): any; attemptToggleDevice(deviceId: string): Promise; } /** * Wrapper class for the ewelink connection, allows us to abstract establishing the connection and * manage promises effectively, previous version made all async calls await causing uncaught errors */ export declare class EwelinkConnection implements Connection { readonly _connection: eWelink; readonly params: ConnectionParams; readonly logger: Logging; private socket; private accessToken; private region; constructor(props: ConnectionParams, logger: Logging); activateConnection(onSuccess: (auth: any) => void): Promise; requestDevice(deviceId: string, onSuccess: (device: Device) => T): Promise; requestDeviceState(deviceId: string): Promise; requestDevices(onSuccess: (devices: Device[]) => T): Promise; attemptToggleDevice(deviceId: string): Promise; openMonitoringSocket(onChange: (deviceId: string, state: string) => void): Promise; closeMonitoringSocket(): void; private delegateWebSocketMessage; private onFailure; private connection; } export {}; //# sourceMappingURL=ewelink-connection.d.ts.map