homebridge-unifi-protect 5.0.6 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,170 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProtectTimeshiftBuffer = void 0;
4
+ const unifi_protect_1 = require("unifi-protect");
5
+ const events_1 = require("events");
6
+ const settings_1 = require("./settings");
7
+ // UniFi Protect livestream timeshift buffer.
8
+ class ProtectTimeshiftBuffer extends events_1.EventEmitter {
9
+ constructor(protectCamera) {
10
+ // Initialize the event emitter.
11
+ super();
12
+ this.accessory = protectCamera.accessory;
13
+ this.buffer = [];
14
+ this.bufferSize = 1;
15
+ this.livestream = new unifi_protect_1.ProtectLivestream(protectCamera.nvr.nvrApi, protectCamera.platform.log);
16
+ this.log = protectCamera.platform.log;
17
+ this.name = protectCamera.name.bind(protectCamera);
18
+ this.nvr = protectCamera.nvr;
19
+ this.protectCamera = protectCamera;
20
+ // We use 100ms in segment resolution for our timeshift buffer to ensure we provide an optimal
21
+ // timeshifting experience. It's a very small amount of additional overhead for most modern CPUs,
22
+ // but the result is a much better HKSV event recording. We may eventually allow for a larger segment
23
+ // resolution in order to give devices at the lower end of the performance curve some added cushion,
24
+ // albeit at the expense of a suboptimal user experience when reviewing HKSV recorded events.
25
+ this._segmentLength = settings_1.PROTECT_HKSV_SEGMENT_RESOLUTION;
26
+ this._isTransmitting = false;
27
+ this.configureTimeshiftBuffer();
28
+ }
29
+ // Configure the timeshift buffer.
30
+ configureTimeshiftBuffer() {
31
+ let seenFtyp = false;
32
+ let seenMoov = false;
33
+ // First, we need to listen for any segments sent by the UniFi Protect livestream in order
34
+ // to create our timeshift buffer.
35
+ this.livestream.on("message", (segment) => {
36
+ var _a, _b;
37
+ // Crucially, we don't want to keep any FTYP or MOOV atoms in our timeshift buffer. The
38
+ // reason for this is that these atoms are special in the MP4 world and must be transmitted
39
+ // at the beginning of any new MP4 stream. So what do we do? The livestream saves these atoms
40
+ // for us, so all we need to do is ensure we don't include them in our timeshift buffer. There
41
+ // should only ever be a single FTYP or MOOV atom, so once we've seen one, we don't need to
42
+ // worry about it again.
43
+ if (!seenFtyp && ((_a = this.livestream.ftyp) === null || _a === void 0 ? void 0 : _a.equals(segment))) {
44
+ seenFtyp = true;
45
+ return;
46
+ }
47
+ if (!seenMoov && ((_b = this.livestream.moov) === null || _b === void 0 ? void 0 : _b.equals(segment))) {
48
+ seenMoov = true;
49
+ return;
50
+ }
51
+ // Add the livestream segment to the end of the timeshift buffer.
52
+ this.buffer.push(segment);
53
+ // At a minimum we always want to maintain a single segment buffer.
54
+ if (this.bufferSize <= 0) {
55
+ this.bufferSize = 1;
56
+ }
57
+ // Trim the beginning of the buffer to our configured size unless we are transmitting
58
+ // to HomeKit, in which case, we queue up all the segments for consumption.
59
+ if (!this.isTransmitting && (this.buffer.length > this.bufferSize)) {
60
+ this.buffer.splice(0, this.buffer.length - this.bufferSize);
61
+ }
62
+ // If we're transmitting, we want to send all the segments we can so FFmpeg can consume it.
63
+ if (this.isTransmitting) {
64
+ for (let nextOne = this.buffer.shift(); nextOne; nextOne = this.buffer.shift()) {
65
+ this.emit("segment", nextOne);
66
+ }
67
+ }
68
+ });
69
+ }
70
+ // Start the livestream and begin creating our timeshift buffer.
71
+ async start(channelId) {
72
+ var _a, _b, _c, _d, _e, _f;
73
+ // Ensure we have sane values configured for the segment resolution.
74
+ if ((_b = (_a = this.protectCamera.stream.hksv) === null || _a === void 0 ? void 0 : _a.recordingConfiguration) === null || _b === void 0 ? void 0 : _b.mediaContainerConfiguration.fragmentLength) {
75
+ if ((this.segmentLength < 100) ||
76
+ (this.segmentLength > (((_d = (_c = this.protectCamera.stream.hksv) === null || _c === void 0 ? void 0 : _c.recordingConfiguration) === null || _d === void 0 ? void 0 : _d.mediaContainerConfiguration.fragmentLength) / 2))) {
77
+ this._segmentLength = ((_f = (_e = this.protectCamera.stream.hksv) === null || _e === void 0 ? void 0 : _e.recordingConfiguration) === null || _f === void 0 ? void 0 : _f.mediaContainerConfiguration.fragmentLength) / 2;
78
+ this.log.error("%s: An invalid HomeKit Secure Video segment length was configured. " +
79
+ "Choosing a safe value instead, though one that provides a less than ideal event clip viewing experience: %s.", this.name(), this.segmentLength);
80
+ }
81
+ }
82
+ // Clear out the timeshift buffer, if it's been previously filled, and then fire up the timeshift buffer.
83
+ this.buffer = [];
84
+ // Start the livestream and start buffering.
85
+ if (!(await this.livestream.start(this.accessory.context.device.id, channelId, this.segmentLength))) {
86
+ return false;
87
+ }
88
+ return true;
89
+ }
90
+ // Stop timeshifting the livestream.
91
+ stop() {
92
+ this.livestream.stop();
93
+ this.buffer = [];
94
+ return true;
95
+ }
96
+ // Start or stop transmitting our timeshift buffer.
97
+ transmitStream(transmitState) {
98
+ // If we're done transmitting, flag it, and allow our buffer to resume maintaining itself.
99
+ if (!transmitState) {
100
+ this._isTransmitting = false;
101
+ return;
102
+ }
103
+ // Add the FTYP and MOOV atoms to the beginning of the timeshift buffer, if we have them.
104
+ // If we don't, FFmpeg will still be able to generate a valid fMP4 stream, albeit a slightly
105
+ // less elegantly.
106
+ if (this.livestream.ftyp && this.livestream.moov) {
107
+ this.buffer.unshift(this.livestream.ftyp, this.livestream.moov);
108
+ }
109
+ else {
110
+ this.log.debug("%s: Warning: no MP4 stream headers found. This error can be largely ignored - FFmpeg will compensate.", this.name());
111
+ }
112
+ // Signal our livestream listener that it's time to start transmitting our queued segments and timeshift.
113
+ this._isTransmitting = true;
114
+ }
115
+ // Return the fMP4 stream header for an HKSV session.
116
+ async getStreamHeader() {
117
+ // Keep looping until we see both, but don't loop for more than two seconds, as a failsafe.
118
+ for (let i = 0; i < 20; i++) {
119
+ // We have what we're looking for. We're done.
120
+ if (this.livestream.ftyp && this.livestream.moov) {
121
+ break;
122
+ }
123
+ // Let's try again shortly.
124
+ // eslint-disable-next-line no-await-in-loop
125
+ await this.nvr.sleep(100);
126
+ }
127
+ // We still don't have the boxes that make up the stream header. Time to give up.
128
+ if (!this.livestream.ftyp || !this.livestream.moov) {
129
+ return null;
130
+ }
131
+ // Return the header.
132
+ return Buffer.concat([this.livestream.ftyp, this.livestream.moov]);
133
+ }
134
+ // Check if a segment is the FTYP box.
135
+ isFtyp(segment) {
136
+ var _a;
137
+ if ((_a = this.livestream.ftyp) === null || _a === void 0 ? void 0 : _a.equals(segment)) {
138
+ return true;
139
+ }
140
+ return false;
141
+ }
142
+ // Check if a segment is the MOOV box.
143
+ isMoov(segment) {
144
+ var _a;
145
+ if ((_a = this.livestream.moov) === null || _a === void 0 ? void 0 : _a.equals(segment)) {
146
+ return true;
147
+ }
148
+ return false;
149
+ }
150
+ // Return whether we are transmitting our timeshift buffer or not.
151
+ get isTransmitting() {
152
+ return this._isTransmitting;
153
+ }
154
+ // Retrieve the current size of the timeshift buffer, in milliseconds.
155
+ get length() {
156
+ return (this.bufferSize * this.segmentLength);
157
+ }
158
+ // Set the size of the timeshift buffer, in milliseconds.
159
+ set length(bufferMillis) {
160
+ // Calculate how many segments we need to keep in order to have the appropriate number of seconds in
161
+ // our buffer.
162
+ this.bufferSize = bufferMillis / this.segmentLength;
163
+ }
164
+ // Return the recording length, in milliseconds, of an individual segment.
165
+ get segmentLength() {
166
+ return this._segmentLength;
167
+ }
168
+ }
169
+ exports.ProtectTimeshiftBuffer = ProtectTimeshiftBuffer;
170
+ //# sourceMappingURL=protect-timeshift.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protect-timeshift.js","sourceRoot":"","sources":["../src/protect-timeshift.ts"],"names":[],"mappings":";;;AAKA,iDAAuE;AACvE,mCAAsC;AACtC,yCAA6D;AAI7D,6CAA6C;AAC7C,MAAa,sBAAuB,SAAQ,qBAAY;IAatD,YAAY,aAA4B;QAEtC,gCAAgC;QAChC,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC;QACzC,IAAI,CAAC,MAAM,GAAG,EAAE,CAA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QAEf,OAAO,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC;IAChD,CAAC;IAED,yDAAyD;IACzD,IAAW,MAAM,CAAC,YAAoB;QAEpC,oGAAoG;QACpG,cAAc;QACd,IAAI,CAAC,UAAU,GAAG,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC;IACtD,CAAC;IAED,0EAA0E;IAC1E,IAAW,aAAa;QAEtB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;CACF;AAtOD,wDAsOC"}
package/dist/settings.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PROTECT_TWOWAY_HEARTBEAT_INTERVAL = exports.PROTECT_RING_DURATION = exports.PROTECT_NVR_UNIFIOS_REFRESH_INTERVAL = exports.PROTECT_MQTT_TOPIC = exports.PROTECT_MQTT_RECONNECT_INTERVAL = exports.PROTECT_MOTION_DURATION = exports.PROTECT_LOGIN_REFRESH_INTERVAL = exports.PROTECT_HOMEKIT_IDR_INTERVAL = exports.PROTECT_FFMPEG_VERBOSE_DURATION = exports.PROTECT_FFMPEG_OPTIONS = exports.PROTECT_FFMPEG_AUDIO_FILTER_LOWPASS = exports.PROTECT_FFMPEG_AUDIO_FILTER_HIGHPASS = exports.PROTECT_EVENTS_HEARTBEAT_INTERVAL = exports.PROTECT_API_TIMEOUT = exports.PROTECT_API_RETRY_INTERVAL = exports.PROTECT_API_ERROR_LIMIT = exports.PLATFORM_NAME = exports.PLUGIN_NAME = void 0;
3
+ exports.PROTECT_HKSV_BUFFER_LENGTH = exports.PROTECT_HKSV_SEGMENT_LENGTH = exports.PROTECT_HKSV_SEGMENT_RESOLUTION = exports.PROTECT_TWOWAY_HEARTBEAT_INTERVAL = exports.PROTECT_RING_DURATION = exports.PROTECT_NVR_UNIFIOS_REFRESH_INTERVAL = exports.PROTECT_MQTT_TOPIC = exports.PROTECT_MQTT_RECONNECT_INTERVAL = exports.PROTECT_MOTION_DURATION = exports.PROTECT_LOGIN_REFRESH_INTERVAL = exports.PROTECT_HOMEKIT_IDR_INTERVAL = exports.PROTECT_FFMPEG_VERBOSE_DURATION = exports.PROTECT_FFMPEG_OPTIONS = exports.PROTECT_FFMPEG_AUDIO_FILTER_LOWPASS = exports.PROTECT_FFMPEG_AUDIO_FILTER_HIGHPASS = exports.PROTECT_EVENTS_HEARTBEAT_INTERVAL = exports.PROTECT_API_TIMEOUT = exports.PROTECT_API_RETRY_INTERVAL = exports.PROTECT_API_ERROR_LIMIT = exports.PLATFORM_NAME = exports.PLUGIN_NAME = void 0;
4
4
  /* Copyright(C) 2017-2022, HJD (https://github.com/hjdhjd). All rights reserved.
5
5
  *
6
6
  * settings.ts: Settings and constants for homebridge-unifi-protect.
@@ -26,7 +26,7 @@ exports.PROTECT_FFMPEG_AUDIO_FILTER_LOWPASS = 1000;
26
26
  exports.PROTECT_FFMPEG_OPTIONS = [];
27
27
  // Duration, in minutes, to increase the level of logging for FFmpeg when we encounter errors.
28
28
  exports.PROTECT_FFMPEG_VERBOSE_DURATION = 5;
29
- // HomeKit wants an I-frame interval of 4 seconds.
29
+ // HomeKit prefers a video streaming I-frame interval of 4 seconds.
30
30
  exports.PROTECT_HOMEKIT_IDR_INTERVAL = 4;
31
31
  // How often, in seconds, should we refresh our Protect login credentials.
32
32
  exports.PROTECT_LOGIN_REFRESH_INTERVAL = 1800;
@@ -44,4 +44,10 @@ exports.PROTECT_RING_DURATION = 3;
44
44
  // How often, in seconds, should we heartbeat FFmpeg in two-way audio sessions. This should be less than 5 seconds, which is
45
45
  // FFmpeg's input timeout interval.
46
46
  exports.PROTECT_TWOWAY_HEARTBEAT_INTERVAL = 3.5;
47
+ // HomeKit Secure Video segment resolution, in milliseconds. This defines the resolution of our buffer.
48
+ exports.PROTECT_HKSV_SEGMENT_RESOLUTION = 100;
49
+ // HomeKit Secure Video segment length, in milliseconds. HomeKit only supports this value currently.
50
+ exports.PROTECT_HKSV_SEGMENT_LENGTH = 4000;
51
+ // HomeKit Secure Video buffer length, in milliseconds. This defines how far back in time we can look when we see a motion event.
52
+ exports.PROTECT_HKSV_BUFFER_LENGTH = exports.PROTECT_HKSV_SEGMENT_LENGTH * 2;
47
53
  //# sourceMappingURL=settings.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,0BAA0B;AACb,QAAA,WAAW,GAAG,0BAA0B,CAAC;AAEtD,mCAAmC;AACtB,QAAA,aAAa,GAAG,eAAe,CAAC;AAE7C,oGAAoG;AACvF,QAAA,uBAAuB,GAAG,EAAE,CAAC;AAE1C,4HAA4H;AAC/G,QAAA,0BAA0B,GAAG,GAAG,CAAC;AAE9C,yFAAyF;AAC5E,QAAA,mBAAmB,GAAG,GAAG,CAAC;AAEvC,oFAAoF;AACpF,qDAAqD;AACxC,QAAA,iCAAiC,GAAG,EAAE,CAAC;AAEpD,4GAA4G;AAC/F,QAAA,oCAAoC,GAAG,GAAG,CAAC;AAExD,2GAA2G;AAC9F,QAAA,mCAAmC,GAAG,IAAI,CAAC;AAExD,+DAA+D;AAClD,QAAA,sBAAsB,GAAG,EAAE,CAAC;AAEzC,8FAA8F;AACjF,QAAA,+BAA+B,GAAG,CAAC,CAAC;AAEjD,kDAAkD;AACrC,QAAA,4BAA4B,GAAG,CAAC,CAAC;AAE9C,0EAA0E;AAC7D,QAAA,8BAA8B,GAAG,IAAI,CAAC;AAEnD,0HAA0H;AAC7G,QAAA,uBAAuB,GAAG,EAAE,CAAC;AAE1C,oGAAoG;AACvF,QAAA,+BAA+B,GAAG,EAAE,CAAC;AAElD,uGAAuG;AAC1F,QAAA,kBAAkB,GAAG,eAAe,CAAC;AAElD,yFAAyF;AACzF,+EAA+E;AAClE,QAAA,oCAAoC,GAAG,EAAE,CAAC;AAEvD,gDAAgD;AACnC,QAAA,qBAAqB,GAAG,CAAC,CAAC;AAEvC,4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ACvF,QAAA,2BAA2B,GAAG,IAAI,CAAC;AAEhD,iIAAiI;AACpH,QAAA,0BAA0B,GAAG,mCAA2B,GAAG,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homebridge-unifi-protect",
3
- "version": "5.0.6",
3
+ "version": "5.3.0",
4
4
  "displayName": "Homebridge UniFi Protect",
5
5
  "description": "Homebridge UniFi Protect plugin providing complete HomeKit integration for the UniFi Protect ecosystem with full support for most features including autoconfiguration, motion detection, multiple controllers, and realtime updates.",
6
6
  "author": {
@@ -67,20 +67,20 @@
67
67
  "@homebridge/camera-utils": "^2.0.4",
68
68
  "execa": "=5.1.1",
69
69
  "ffmpeg-for-homebridge": "^0.0.9",
70
- "mqtt": "4.3.4",
71
- "unifi-protect": "^2.1.1",
72
- "ws": "^8.4.2"
70
+ "mqtt": "4.3.5",
71
+ "unifi-protect": "^3.0.2",
72
+ "ws": "^8.5.0"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@types/ip": "^1.1.0",
76
- "@types/node": "^17.0.8",
76
+ "@types/node": "^17.0.17",
77
77
  "@types/ws": "^8.2.2",
78
- "@typescript-eslint/eslint-plugin": "^5.9.1",
79
- "@typescript-eslint/parser": "^5.9.1",
80
- "eslint": "^8.7.0",
81
- "homebridge": "^1.3.9",
78
+ "@typescript-eslint/eslint-plugin": "^5.11.0",
79
+ "@typescript-eslint/parser": "^5.11.0",
80
+ "eslint": "^8.9.0",
81
+ "homebridge": "^1.4.0",
82
82
  "nodemon": "^2.0.15",
83
83
  "rimraf": "^3.0.2",
84
- "typescript": "^4.5.4"
84
+ "typescript": "^4.5.5"
85
85
  }
86
86
  }