homebridge-nibe
Version:
Homebridge plugin for Nibe services
60 lines (59 loc) • 3.13 kB
TypeScript
import { Data } from './DataDomain';
import { Logger } from './PlatformDomain';
import { Locale } from './util/Locale';
export interface AccessoryInstance {
context: AccessoryContext;
getService(type: any): ServiceInstance | undefined;
addService(type: any): ServiceInstance;
removeService(service: ServiceInstance): void;
}
export interface ServiceInstance {
updateCharacteristic(type: any, value: any): void;
addOptionalCharacteristic(type: any): any;
getCharacteristic(type: any): CharacteristicInstance;
}
export interface CharacteristicInstance {
setProps(props: any): CharacteristicInstance;
value: any;
onSet(handler: (value: any) => void): CharacteristicInstance;
}
export interface ServiceResolver {
resolveService(type: ServiceType): any;
resolveCharacteristic(type: CharacteristicType): any;
}
export type ServiceType = 'AccessoryInformation' | 'TemperatureSensor' | 'Thermostat' | 'OccupancySensor' | 'Switch';
export type CharacteristicType = 'Manufacturer' | 'Model' | 'SerialNumber' | 'CurrentTemperature' | 'Name' | 'ConfiguredName' | 'Active' | 'TemperatureDisplayUnits' | 'TargetHeatingCoolingState' | 'HeatingThresholdTemperature' | 'CurrentHeatingCoolingState' | 'OccupancyDetected' | 'On' | 'TargetTemperature';
export interface AccessoryContext {
accessoryId: string;
lastUpdate: number;
version: number;
systemId: string;
systemName: string;
deviceId: string;
deviceName: string;
data: string[];
}
export declare abstract class AccessoryDefinition {
protected readonly name: string;
protected readonly version: number;
protected readonly locale: Locale;
protected readonly serviceResolver: ServiceResolver;
protected readonly log: Logger;
protected constructor(name: string, version: number, locale: Locale, serviceResolver: ServiceResolver, log: Logger);
abstract isApplicable(data: Data): boolean;
buildIdentifier(data: Data): string;
buildName(data: Data): string;
isCurrentVersion(platformAccessory: AccessoryInstance): boolean;
update(platformAccessory: AccessoryInstance, data: Data): void;
create(platformAccessory: AccessoryInstance, data: Data): void;
protected getOrCreateService(type: ServiceType, platformAccessory: AccessoryInstance): ServiceInstance;
protected removeService(type: ServiceType, platformAccessory: AccessoryInstance): void;
protected updateCharacteristic(service: ServiceInstance, name: CharacteristicType, value: any, props?: object | undefined): void;
protected getCharacteristicValue(service: ServiceInstance, name: CharacteristicType): any;
protected findParameters(parameterIds: string[], data: Data): import("./DataDomain").Parameter[];
protected findParameter(parameterId: string, data: Data): import("./DataDomain").Parameter | undefined;
protected getText(key: string): string;
protected isManageEnabled(data: Data): boolean;
protected putData(platformAccessory: AccessoryInstance, key: string, data: any): void;
protected getData(platformAccessory: AccessoryInstance, key: string): any | undefined;
}