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.

58 lines 3.06 kB
import type { ProtectAccessory, WithoutIdentity } from "../types.ts"; import type { ProtectSensorConfig, Sensor } from "unifi-protect"; import { ProtectDevice } from "./device.ts"; import type { ProtectNvr } from "../nvr/nvr.ts"; /** * Map a sensor's tampering timestamp to its HomeKit StatusTampered state: tampered when the controller has recorded a tampering time, clear when it has not. The single * source of truth is the projection's tamperingDetectedAt; this pure mapping is shared by the StatusTampered onGet, the initial write, and the reactive tamper observer, * so the read-through and the push can never disagree on what "tampered" means. * * @param tamperingDetectedAt - The sensor's tamperingDetectedAt: the epoch-ms time tampering was last detected, or null when none has been. * * @returns true when the sensor should report tampering to HomeKit. */ export declare function sensorTamperState(tamperingDetectedAt: number | null): boolean; /** * Map a sensor's alarm-trigger timestamp to its HomeKit ContactSensorState: alarm when the controller has recorded a trigger time, clear when it has not. The single * source of truth is the projection's alarmTriggeredAt, which the controller clears only on explicit user action in the Protect app (never automatically). The * alarm-family contact sensors read through this one predicate, so their read-through getter and reactive push can never disagree on what "alarm" means. Kept * deliberately distinct from sensorTamperState because it reads a different field and capability and may later honor alarmSilencedAt; it is not collapsed into a generic * latched-field predicate. * * @param alarmTriggeredAt - The sensor's alarmTriggeredAt: the epoch-ms time an alarm was last triggered, or null when none has been. * * @returns true when the sensor should report an alarm to HomeKit. */ export declare function sensorAlarmState(alarmTriggeredAt: number | null): boolean; export declare class ProtectSensor extends ProtectDevice { private enabledSensors; private lastAlarm?; private lastLeak; protected readonly device: Sensor; constructor(nvr: ProtectNvr, accessory: ProtectAccessory, device: Sensor); get ufp(): Readonly<WithoutIdentity<ProtectSensorConfig>>; private configureDevice; private configureBatteryService; private updateDevice; private configureAlarmContactSensors; private configureAmbientLightSensor; private configureContactSensor; private configureHumiditySensor; private get leakContext(); private configureLeakSensor; private configureTemperatureSensor; private updateBatteryStatus; private configureStateCharacteristics; private get tampered(); private get alarmDetected(); private get ambientLight(); private get contact(); private get humidity(); private leakDetected; private get temperature(); private configureMqtt; protected spawnObservers(): void; private updateTamperState; private updateAlarmState; } //# sourceMappingURL=sensor.d.ts.map