homebridge-unifi-protect
Version:
Homebridge UniFi Protect plugin providing complete HomeKit integration for the entire UniFi Protect ecosystem with full support for most features including HomeKit Secure Video, multiple controllers, blazing fast performance, and much more.
85 lines • 3.48 kB
TypeScript
import type { HomebridgePluginLogging, Nullable } from "homebridge-plugin-utils";
import type { Camera, DeepPartial, ProtectCameraLcdMessageConfig } from "unifi-protect";
import type { HAP, Service } from "homebridge";
import type { ProtectAccessory } from "../../types.ts";
import { ProtectBase } from "../device-base.ts";
import type { ProtectCamera } from "./camera.ts";
import type { ProtectCameraPackage } from "./camera-package.ts";
import type { ProtectNvr } from "../../nvr/nvr.ts";
interface MessageInterface {
duration: number;
text: string;
type: string;
}
export interface MessageSwitchInterface extends MessageInterface {
service: Service;
state: boolean;
}
/**
* The effective LCD message for a doorbell, given the raw slice and the current time: an empty object once the message's resetAt deadline has passed, otherwise the
* slice unchanged. The controller signals a message's expiry by patching lcdMessage rather than clearing it, and an empty-object patch is a no-op the store cannot
* observe, so both the switch sync and the MQTT get consult this one predicate to treat a past resetAt as a clear. An absent resetAt (a non-expiring message), a
* still-future resetAt, and an already-empty slice all pass through unchanged. Exported so its truth-table rows exercise it directly.
*
* @param options - The raw `lcdMessage` slice and the current time in milliseconds as `nowMs`.
*
* @returns The effective message slice, blanked to `{}` when expired.
*/
export declare function effectiveLcdMessage(options: {
lcdMessage: DeepPartial<ProtectCameraLcdMessageConfig>;
nowMs: number;
}): DeepPartial<ProtectCameraLcdMessageConfig>;
export declare class DoorbellCapability extends ProtectBase {
#private;
readonly camera: ProtectCamera;
private messageSwitches;
packageCamera: Nullable<ProtectCameraPackage>;
constructor(nvr: ProtectNvr, init: {
camera: ProtectCamera;
device: Camera;
signal: AbortSignal;
});
private get ufp();
private get accessory();
private get accessoryName();
private hasFeature;
private getFeatureNumber;
private isReservedName;
private acquireService;
private validService;
get name(): string;
protected get observeSignal(): AbortSignal;
protected get mqttId(): string;
protected get recordPresent(): boolean;
protected onObserverWake(key: string): void;
private get chimeDigitalDuration();
private get defaultMessageDuration();
private get isMessagesEnabled();
private get isMessagesFromControllerEnabled();
private get chimeDuration();
configure(): void;
cleanup(): void;
updateDevice(): void;
private spawnObservers;
private configureDoorbellLcdSwitch;
private configurePackageCamera;
reconcilePackageCamera(): void;
private detachPackageCamera;
private configurePhysicalChimes;
private configureProtectChimeLightbulb;
private configureAuthSensor;
private configureMqtt;
private updatePhysicalChimes;
private getPhysicalChimeDuration;
private getMessages;
private validateMessageSwitches;
private syncLcdMessageState;
private updateLcdSwitch;
private setMessage;
private get chimeVolume();
private setChimeVolume;
private updateChimeVolume;
static removeServices(accessory: ProtectAccessory, hap: HAP, log: HomebridgePluginLogging): void;
}
export {};
//# sourceMappingURL=doorbell.d.ts.map