homebridge-eufy-security
Version:
Control Eufy Security from homebridge.
56 lines • 2.93 kB
TypeScript
import { PlatformAccessory, Characteristic, CharacteristicValue, Service, WithUUID } from 'homebridge';
import { EufySecurityPlatform } from '../platform';
import { DeviceEvents, PropertyValue, StationEvents } from 'eufy-security-client';
import { EventEmitter } from 'events';
import { ILogObj, Logger } from 'tslog';
export type CharacteristicType = WithUUID<{
new (): Characteristic;
}>;
export type ServiceType = WithUUID<typeof Service> | Service;
export declare abstract class BaseAccessory extends EventEmitter {
readonly platform: EufySecurityPlatform;
readonly accessory: PlatformAccessory;
device: any;
protected servicesInUse: Service[];
readonly SN: string;
readonly name: string;
readonly log: Logger<ILogObj>;
constructor(platform: EufySecurityPlatform, accessory: PlatformAccessory, device: any);
private logPropertyKeys;
protected handleRawPropertyChange(device: any, type: number, value: string): void;
protected handlePropertyChange(device: any, name: string, value: PropertyValue): void;
/**
* Register characteristics for a given Homebridge service.
*
* This method handles the registration of Homebridge characteristics.
* It includes optional features like value debouncing and event triggers.
*
* @param {Object} params - Parameters needed for registering characteristics.
*/
protected registerCharacteristic({ characteristicType, serviceType, getValue, setValue, onValue, onSimpleValue, onMultipleValue, name, serviceSubType, setValueDebounceTime, }: {
characteristicType: CharacteristicType;
serviceType: ServiceType;
serviceSubType?: string;
name?: string;
getValue?: (data: any, characteristic?: Characteristic, service?: Service) => any;
setValue?: (value: any, characteristic?: Characteristic, service?: Service) => any;
onValue?: (service: Service, characteristic: Characteristic) => any;
onSimpleValue?: any;
onMultipleValue?: (keyof DeviceEvents | StationEvents)[];
setValueDebounceTime?: number;
}): void;
/**
* Retrieve an existing service or create a new one if it doesn't exist.
*
* @param {ServiceType} serviceType - The type of service to retrieve or create.
* @param {string} [name] - The name of the service (optional).
* @param {string} [subType] - The subtype of the service (optional).
* @returns {Service} Returns the existing or newly created service.
* @throws Will throw an error if there are overlapping services.
*/
getService(serviceType: ServiceType, name?: string, subType?: string): Service;
protected pruneUnusedServices(): void;
protected handleDummyEventGet(serviceName: string): Promise<CharacteristicValue>;
protected handleDummyEventSet(serviceName: string, value: CharacteristicValue): void;
}
//# sourceMappingURL=BaseAccessory.d.ts.map