UNPKG

homebridge-homeconnect

Version:

A Homebridge plugin that connects Home Connect appliances to Apple HomeKit

102 lines 5.88 kB
import { CharacteristicSetHandler, Logger, PlatformAccessory, Service } from 'homebridge'; import { PersistCache } from './persist-cache.js'; import { ApplianceConfig } from './config-types.js'; import { HomeConnectDevice } from './homeconnect-device.js'; import { SerialisedOperation, SerialisedValue } from './serialised.js'; import { HomeConnectPlatform } from './platform.js'; import { ConfigSchemaData, SchemaOptionalFeature } from './homebridge-ui/schema-data.js'; import { ServiceNames } from './service-name.js'; type ServiceConstructor = typeof Service & { new (displayName?: string, subtype?: string): Service; UUID: string; }; export type OnSetHandler<Type> = (value: Type) => unknown; export declare class ApplianceBase { readonly log: Logger; readonly platform: HomeConnectPlatform; readonly device: HomeConnectDevice; readonly accessory: PlatformAccessory; readonly Service: typeof Service; readonly Characteristic: typeof import("homebridge").Characteristic; readonly config: ApplianceConfig; readonly schema: ConfigSchemaData; readonly optionalFeatures: SchemaOptionalFeature[]; readonly cache: PersistCache; readonly cachedOperation: Record<string, string>; readonly cachedPromise: Map<string, Promise<unknown>>; readonly asyncInitTasks: { name: string; promise: Promise<void>; }[]; serviceNames: ServiceNames; readonly accessoryInformationService: Service; readonly obsoleteServices: Service[]; constructor(log: Logger, platform: HomeConnectPlatform, device: HomeConnectDevice, accessory: PlatformAccessory); asyncInitialise(name: string, promise: Promise<void>): void; waitAsyncInitialisation(): Promise<void>; makeService(serviceConstructor: ServiceConstructor, suffix?: string, subtype?: string): Service; cleanupServices(): void; cleanupOldVersions(): void; unregister(): void; identify(): Promise<void>; hasOptionalFeature(service: string, name: string, group?: string, enableByDefault?: boolean): boolean; setOptionalFeatures(): void; getCached<Type>(key: string, operation: () => Promise<Type>): Promise<Type>; doCachedOperation<Type>(key: string, operation: () => Promise<Type>): Promise<Type>; makeSerialised<Value extends SerialisedValue, Returns = void>(operation: SerialisedOperation<Value, Returns>, defaultValue?: Value): (value?: Value) => Promise<Returns>; makeSerialisedObject<Value extends object, Returns = void>(operation: SerialisedOperation<Value, Returns>): (value?: Value) => Promise<Returns>; onSet<Type>(handler: OnSetHandler<Type>, assertIsType: (value: unknown) => asserts value is Type): CharacteristicSetHandler; onSetBoolean(handler: OnSetHandler<boolean>): CharacteristicSetHandler; onSetNumber(handler: OnSetHandler<number>): CharacteristicSetHandler; onSetString(handler: OnSetHandler<string>): CharacteristicSetHandler; trap<Type>(when: string, promise: Promise<Type> | Type, canThrow?: boolean): Promise<Type | undefined>; } export type ApplianceConstructorArgs = ConstructorParameters<typeof ApplianceBase>; export declare const ApplianceGeneric: { new (...args: any[]): { readonly powerService: Service; defaultOffValue?: import("./api-value-types.js").PowerState; initHasPower(): Promise<void>; updatePowerHK(): void; hasPowerOff(offValue: import("./api-value-types.js").PowerState): void; readonly Service: typeof Service; readonly Characteristic: typeof import("homebridge").Characteristic; readonly config: ApplianceConfig; readonly schema: ConfigSchemaData; readonly optionalFeatures: SchemaOptionalFeature[]; readonly cache: PersistCache; readonly cachedOperation: Record<string, string>; readonly cachedPromise: Map<string, Promise<unknown>>; readonly asyncInitTasks: { name: string; promise: Promise<void>; }[]; serviceNames: ServiceNames; readonly accessoryInformationService: Service; readonly obsoleteServices: Service[]; readonly log: Logger; readonly platform: HomeConnectPlatform; readonly device: HomeConnectDevice; readonly accessory: PlatformAccessory; asyncInitialise(name: string, promise: Promise<void>): void; waitAsyncInitialisation(): Promise<void>; makeService(serviceConstructor: ServiceConstructor, suffix?: string, subtype?: string): Service; cleanupServices(): void; cleanupOldVersions(): void; unregister(): void; identify(): Promise<void>; hasOptionalFeature(service: string, name: string, group?: string, enableByDefault?: boolean): boolean; setOptionalFeatures(): void; getCached<Type>(key: string, operation: () => Promise<Type>): Promise<Type>; doCachedOperation<Type>(key: string, operation: () => Promise<Type>): Promise<Type>; makeSerialised<Value extends SerialisedValue, Returns = void>(operation: SerialisedOperation<Value, Returns>, defaultValue?: Value): (value?: Value) => Promise<Returns>; makeSerialisedObject<Value extends object, Returns = void>(operation: SerialisedOperation<Value, Returns>): (value?: Value) => Promise<Returns>; onSet<Type>(handler: OnSetHandler<Type>, assertIsType: (value: unknown) => asserts value is Type): CharacteristicSetHandler; onSetBoolean(handler: OnSetHandler<boolean>): CharacteristicSetHandler; onSetNumber(handler: OnSetHandler<number>): CharacteristicSetHandler; onSetString(handler: OnSetHandler<string>): CharacteristicSetHandler; trap<Type>(when: string, promise: Promise<Type> | Type, canThrow?: boolean): Promise<Type | undefined>; }; } & typeof ApplianceBase; export {}; //# sourceMappingURL=appliance-generic.d.ts.map