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.
33 lines • 2.44 kB
TypeScript
import type { Nullable } from "homebridge-plugin-utils";
import type { ProtectEventMetadataDetectedThumbnail } from "unifi-protect";
/**
* A single detected smart-object occurrence, as the event router assembles it from the classified firehose. It carries the object type plus the optional rich-detection
* fields the controller attaches: a license-plate string in `name`, a `confidence` score, and the structured thumbnail `payload` whose `attributes` hold per-type
* telemetry such as a vehicle's color and body type.
*/
export interface SmartDetectEventItem {
confidence?: number;
name?: string;
payload?: ProtectEventMetadataDetectedThumbnail;
type: string;
}
/**
* A per-type renderer for the rich metadata a smart detection carries.
*
* The {@link SMART_DETECT_ENRICHERS} registry maps a smart-detection object type to its enricher and is the single source of truth for how that type's telemetry is
* surfaced - both as the human-readable attribute fragments appended to the log line and as the structured payload mirrored to MQTT. Supporting a new type as UniFi
* Protect ships richer metadata for it is one new registry entry; the delivery and log-dedup policy in the event router are generic over this interface and need no
* change.
*/
export interface SmartDetectEnricher {
/** The human-readable attribute fragments for this detection, e.g. `[ "color: black [68% confidence]", "vehicleType: suv [96% confidence]" ]`. Returns an empty array
* when the controller has not yet attached any rich metadata, which the router treats as a plain detection and coalesces onto the shared log line. The router re-logs a
* detection only when this list grows IN LENGTH, so progressively-enriched telemetry is captured at its fullest without re-logging the in-window noise; a later
* same-length re-read that only changes existing values does not re-log. An enricher should therefore surface each new piece of telemetry as an additional fragment.
*/
readonly attributes: (item: SmartDetectEventItem) => string[];
/** The structured payload mirrored to the type's `motion/smart/<type>/metadata` MQTT topic, or `null` when there is no metadata to publish. */
readonly mqtt: (item: SmartDetectEventItem) => Nullable<Record<string, unknown>>;
}
export declare const SMART_DETECT_ENRICHERS: ReadonlyMap<string, SmartDetectEnricher>;
//# sourceMappingURL=smart-detect-metadata.d.ts.map