UNPKG

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.

25 lines 2.18 kB
/** * Resolve what a camera should do to reconcile its doorbell capability against the controller's live state. Cameras and doorbells share Protect's "camera" modelKey - the * sole differentiator is featureFlags.isDoorbell, which can arrive (or be withdrawn) after a camera is first adopted (the controller provisions the doorbell capability * late). The per-camera reclassification observer watches that flag and routes its change through one reconcile chokepoint driven by this exhaustive 2x2 over * (hasCapability, isDoorbell) - a pure device-classification decision, homed in this dedicated camera-family policy leaf alongside motion-policy.ts and testable without * standing up an accessory (the camera leaf is not directly importable in a unit test due to its transitive streaming-stack dependencies). * * The reconcile actions (attach composes the capability onto the live camera in place; demotion is observability-only): * * - "attach": the controller now reports a doorbell and no capability is attached yet - compose the capability onto the live camera in place (no teardown). * - "report-withdrawn": the controller no longer reports a doorbell but a capability is attached - log a warning only; the capability and its accessories remain (a full * detach is a one-arm addition later if field observation shows demotion happens in the wild). * - "sweep-stale": the controller does not report a doorbell and no capability is attached - remove any doorbell-only services a demoted-while-down doorbell left behind * (idempotent; a no-op on a steady plain camera). * - "none": steady state - a doorbell with its capability (the steady plain camera resolves to the no-op "sweep-stale" instead). * * @param inputs - hasCapability is whether this camera already has a doorbell capability attached; isDoorbell is the camera's current featureFlags.isDoorbell. * * @returns the reconcile action the camera's chokepoint should run. */ export declare function doorbellReconcileAction(inputs: { hasCapability: boolean; isDoorbell: boolean; }): "attach" | "none" | "report-withdrawn" | "sweep-stale"; //# sourceMappingURL=doorbell-reconcile-policy.d.ts.map