homebridge-econet-rheem
Version:
Homebridge plugin for control of Rheem and Ruud thermostats and water heaters
54 lines (53 loc) • 3.59 kB
TypeScript
import { Characteristic, CharacteristicSetHandler, CharacteristicValue, PlatformAccessory, PrimitiveTypes, Service } from 'homebridge';
import { AccessoryType, CharacteristicKey, HKCharacteristicKey, MQTTKeys } from '../../model/enums.js';
import { HistoryEntry, HistoryType } from '../../model/history.js';
import { MQTTListener } from '../../model/mqtt.js';
import { CharacteristicType, AccessoryDependency, EquipmentData } from '../../model/types.js';
import { Log, LogType } from '../../tools/log.js';
export type OnUpdateHandler = (value: PrimitiveTypes) => (Promise<void>);
type ValueOrObject<T> = T | {
value: T;
};
export type NumberCallback = (value: number) => void;
export declare abstract class BaseAccessory implements MQTTListener {
private readonly dependency;
private readonly data;
readonly name: string;
private readonly mqttClient;
private readonly accessoryService;
private readonly updateHandlers;
constructor(dependency: AccessoryDependency, data: EquipmentData);
get Characteristic(): CharacteristicType;
get platformAccessory(): PlatformAccessory;
get log(): Log;
protected abstract getAccessoryType(): AccessoryType;
get service(): Service;
get identifier(): string;
protected get isDeviceAuth(): boolean;
private getMQTTKey;
mqttMessageReceived(message: Record<string, ValueOrObject<PrimitiveTypes>>): void;
private publish;
protected publishPayload(payload: Record<string, PrimitiveTypes>): void;
teardown(): void;
protected setCharacteristicValue(key: HKCharacteristicKey, value: CharacteristicValue): Characteristic;
getProperty(key: CharacteristicKey): CharacteristicValue | undefined;
setProperty(key: CharacteristicKey, value: CharacteristicValue): void;
protected getValue<T>(input: ValueOrObject<T>): T;
protected setUpdateHandler(mqttKeys: MQTTKeys, onUpdateHandler: OnUpdateHandler): void;
protected setup(characteristicKey: CharacteristicKey, startingValue: CharacteristicValue, mqttKeys: MQTTKeys, onUpdateHandler: OnUpdateHandler, onSetHandler?: CharacteristicSetHandler): Characteristic | undefined;
private setupGet;
private setupSet;
protected bindOnUpdateNumericBoolean(charKey: CharacteristicKey, logTrue: string, logFalse: string): OnUpdateHandler;
protected bindOnUpdateNumeric(charKey: CharacteristicKey, logTemplate: string, callback?: NumberCallback): OnUpdateHandler;
protected bindOnSetNumericBoolean(charKey: CharacteristicKey, mqttKeys: MQTTKeys, logTrue: string, logFalse: string, debounce?: boolean): CharacteristicSetHandler;
protected bindOnSetNumeric(charKey: CharacteristicKey, mqttKeys: MQTTKeys, logTemplate: string, debounce?: boolean): CharacteristicSetHandler;
protected onUpdate(key: CharacteristicKey, value: CharacteristicValue, logString?: string | undefined): boolean;
protected onSet(charKey: CharacteristicKey, mqttKeys: MQTTKeys, value: CharacteristicValue, publish: PrimitiveTypes, logString: string | undefined): void;
protected onSetNumeric(charKey: CharacteristicKey, mqttKeys: MQTTKeys, value: CharacteristicValue, publish: number, logTemplate: string, doDebounce: boolean): void;
protected characteristicFromKey(key: CharacteristicKey): any;
private isOptionalCharacteristic;
protected recordHistory(type: HistoryType, entry: HistoryEntry, updateLastActivation?: boolean): void;
protected logIfDesired(message: string, ...parameters: string[]): void;
protected logIfDesired(level: LogType, message: string, ...parameters: string[]): void;
}
export {};