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.
52 lines • 3.29 kB
TypeScript
import type { TypedEvent } from "unifi-protect";
import diagnosticsChannel from "node:diagnostics_channel";
/**
* The plugin's forward-only observability surface, expressed as `node:diagnostics_channel` publishers - the very primitive the unifi-protect library uses for its own
* channels, so there is one observability idiom across the plugin and the library it consumes. A subscriber attaches to a channel to watch an internal lifecycle
* event without the plugin having to grow bespoke logging hooks or per-event callback parameters; every publisher gates on `hasSubscribers` before building a
* payload, so there is exactly zero cost when nobody is listening.
*
* Channel names follow a stable `hbup:<subsystem>:<event>` taxonomy and are declared exactly once here; call sites import the publisher they need rather than
* re-deriving the channel-name string, so a rename is a single edit and a typo is impossible at the call site. This is the mirror of the library's diagnostics
* module, kept deliberately small: the channels declared here - firehose dispatch, controller lifecycle, the per-accessory observer-wake, and the
* reachability fan-out - cover the plugin's internal lifecycle and per-device reaction points.
*/
export declare const channels: {
readonly firehoseDispatch: diagnosticsChannel.Channel<any, any>;
readonly nvrLifecycle: diagnosticsChannel.Channel<any, any>;
readonly observerWake: diagnosticsChannel.Channel<any, any>;
readonly reachabilityFanout: diagnosticsChannel.Channel<any, any>;
};
/**
* Payload published on {@link channels.firehoseDispatch}. `kind` is the dispatched event's discriminated kind (e.g. `smartDetect`, `tamperDetected`, `doorbellRing`,
* `accessEvent`, `authDetected`, `buttonPressed`); `cameraId` is the addressed camera/device id, present whenever the router resolved a target accessory.
*/
export interface FirehoseDispatchPayload {
cameraId?: string;
kind: TypedEvent["kind"];
}
/**
* Payload published on {@link channels.nvrLifecycle}. `event` names the lifecycle milestone: `connected` after a successful connect, `shuttingDown` at the terminal
* abort chokepoint, and `controllerLost` / `controllerRebooted` / `controllerRecovered` as forwarded from the connection monitor's events.
*/
export interface NvrLifecyclePayload {
event: "connected" | "controllerLost" | "controllerRebooted" | "controllerRecovered" | "shuttingDown";
}
/**
* Payload published on {@link channels.reachabilityFanout}. `accessoryId` is the HomeKit accessory UUID; `was` and `now` are the StatusActive value before and
* after the fan-out, so a subscriber sees the actual reachability flip rather than every idempotent rewrite.
*/
export interface ReachabilityFanoutPayload {
accessoryId: string;
now: boolean;
was: boolean;
}
/**
* Payload published on {@link channels.observerWake}. `accessoryId` is the HomeKit accessory UUID whose observer woke; `key` is the stable, dotted tag naming the watched
* slice (e.g. `"camera.videoCodec"`, `"camera.ledSettings"`, `"sensor.tamperingDetectedAt"`), so a subscriber can attribute each wake to the exact reaction it drives.
*/
export interface ObserverWakePayload {
accessoryId: string;
key: string;
}
//# sourceMappingURL=diagnostics.d.ts.map