UNPKG

homebridge-blaq

Version:

Control and view your garage door(s) remotely with real-time updates using Konnected's BlaQ hardware

52 lines (51 loc) 2.49 kB
import { CharacteristicValue, Logger, PlatformAccessory, Service, WithUUID } from 'homebridge'; import { LogMessageEvent, PingMessageEvent, StateUpdateMessageEvent } from '../utils/eventsource'; import { BlaQHomebridgePluginPlatform } from '../platform'; import type { RequestInfo, RequestInit } from 'node-fetch'; export interface BaseBlaQAccessoryInterface { setAPIBaseURL: (apiBaseURL: string) => void; handleStateEvent: (stateEvent: StateUpdateMessageEvent) => void; handleLogEvent?: (logEvent: LogMessageEvent) => void; handlePingEvent?: (pingEvent: PingMessageEvent) => void; resetSyncState: () => void; } export type BaseBlaQAccessoryConstructorParams = { accessory: PlatformAccessory; apiBaseURL: string; apiUser?: string; apiPass?: string; friendlyName: string; platform: BlaQHomebridgePluginPlatform; serialNumber: string; }; export declare const correctAPIBaseURL: (inputURL: string) => string; export declare class BaseBlaQAccessory implements BaseBlaQAccessoryInterface { protected apiBaseURL: string; protected user?: string; protected pass?: string; protected firmwareVersion?: string; protected synced?: boolean; protected queuedEvents: { type: 'state' | 'log' | 'ping'; event: StateUpdateMessageEvent | LogMessageEvent | PingMessageEvent; }[]; protected readonly accessory: PlatformAccessory; protected readonly accessoryInformationService: Service; protected readonly logger: Logger; protected readonly friendlyName: string; protected readonly platform: BlaQHomebridgePluginPlatform; protected readonly serialNumber: string; constructor({ accessory, apiBaseURL, apiUser, apiPass, friendlyName, platform, serialNumber, }: BaseBlaQAccessoryConstructorParams); protected getSelfClassName(): string; protected getOrAddService(service: WithUUID<typeof Service> | Service): Service; protected removeService(service: WithUUID<typeof Service> | Service): void; processQueuedEvents(): void; resetSyncState(): void; handlePingEvent(pingEvent: PingMessageEvent): void; handleLogEvent(logEvent: LogMessageEvent): void; handleStateEvent(stateEvent: StateUpdateMessageEvent): void; getFirmwareVersion(): CharacteristicValue; protected setFirmwareVersion(version: string): void; setAPIBaseURL(url: string): void; protected authFetch(url: URL | RequestInfo, init?: RequestInit): Promise<import("node-fetch").Response>; }