homebridge-unifi-protect 5.5.2 → 6.0.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.
Files changed (79) hide show
  1. package/README.md +3 -3
  2. package/config.schema.json +17 -16
  3. package/dist/index.d.ts +3 -0
  4. package/dist/index.js +6 -6
  5. package/dist/index.js.map +1 -1
  6. package/dist/protect-camera.d.ts +58 -0
  7. package/dist/protect-camera.js +367 -246
  8. package/dist/protect-camera.js.map +1 -1
  9. package/dist/protect-device.d.ts +48 -0
  10. package/dist/protect-device.js +189 -0
  11. package/dist/protect-device.js.map +1 -0
  12. package/dist/protect-doorbell.d.ts +22 -0
  13. package/dist/protect-doorbell.js +75 -64
  14. package/dist/protect-doorbell.js.map +1 -1
  15. package/dist/protect-ffmpeg-record.d.ts +15 -0
  16. package/dist/protect-ffmpeg-record.js +48 -34
  17. package/dist/protect-ffmpeg-record.js.map +1 -1
  18. package/dist/protect-ffmpeg-stream.d.ts +15 -0
  19. package/dist/protect-ffmpeg-stream.js +22 -12
  20. package/dist/protect-ffmpeg-stream.js.map +1 -1
  21. package/dist/protect-ffmpeg.d.ts +42 -0
  22. package/dist/protect-ffmpeg.js +49 -58
  23. package/dist/protect-ffmpeg.js.map +1 -1
  24. package/dist/protect-light.d.ts +13 -0
  25. package/dist/protect-light.js +63 -40
  26. package/dist/protect-light.js.map +1 -1
  27. package/dist/protect-liveviews.d.ts +17 -0
  28. package/dist/protect-liveviews.js +117 -101
  29. package/dist/protect-liveviews.js.map +1 -1
  30. package/dist/protect-mqtt.d.ts +19 -0
  31. package/dist/protect-mqtt.js +26 -35
  32. package/dist/protect-mqtt.js.map +1 -1
  33. package/dist/protect-nvr-events.d.ts +30 -0
  34. package/dist/protect-nvr-events.js +168 -431
  35. package/dist/protect-nvr-events.js.map +1 -1
  36. package/dist/protect-nvr-systeminfo.d.ts +15 -0
  37. package/dist/protect-nvr-systeminfo.js +43 -49
  38. package/dist/protect-nvr-systeminfo.js.map +1 -1
  39. package/dist/protect-nvr.d.ts +48 -0
  40. package/dist/protect-nvr.js +327 -359
  41. package/dist/protect-nvr.js.map +1 -1
  42. package/dist/protect-options.d.ts +39 -0
  43. package/dist/protect-options.js +172 -6
  44. package/dist/protect-options.js.map +1 -1
  45. package/dist/protect-platform.d.ts +17 -0
  46. package/dist/protect-platform.js +17 -30
  47. package/dist/protect-platform.js.map +1 -1
  48. package/dist/protect-record.d.ts +33 -0
  49. package/dist/protect-record.js +130 -126
  50. package/dist/protect-record.js.map +1 -1
  51. package/dist/protect-rtp.d.ts +29 -0
  52. package/dist/protect-rtp.js +133 -16
  53. package/dist/protect-rtp.js.map +1 -1
  54. package/dist/protect-securitysystem.d.ts +18 -0
  55. package/dist/protect-securitysystem.js +105 -109
  56. package/dist/protect-securitysystem.js.map +1 -1
  57. package/dist/protect-sensor.d.ts +28 -0
  58. package/dist/protect-sensor.js +79 -97
  59. package/dist/protect-sensor.js.map +1 -1
  60. package/dist/protect-stream.d.ts +41 -0
  61. package/dist/protect-stream.js +298 -156
  62. package/dist/protect-stream.js.map +1 -1
  63. package/dist/protect-timeshift.d.ts +30 -0
  64. package/dist/protect-timeshift.js +65 -48
  65. package/dist/protect-timeshift.js.map +1 -1
  66. package/dist/protect-types.d.ts +50 -0
  67. package/dist/protect-types.js +22 -0
  68. package/dist/protect-types.js.map +1 -0
  69. package/dist/protect-viewer.d.ts +17 -0
  70. package/dist/protect-viewer.js +41 -47
  71. package/dist/protect-viewer.js.map +1 -1
  72. package/dist/settings.d.ts +22 -0
  73. package/dist/settings.js +30 -35
  74. package/dist/settings.js.map +1 -1
  75. package/homebridge-ui/public/index.html +715 -0
  76. package/homebridge-ui/server.js +156 -0
  77. package/package.json +15 -16
  78. package/dist/protect-accessory.js +0 -184
  79. package/dist/protect-accessory.js.map +0 -1
@@ -1,16 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RtpDemuxer = void 0;
4
- /* Copyright(C) 2017-2022, HJD (https://github.com/hjdhjd). All rights reserved.
1
+ /* Copyright(C) 2017-2023, HJD (https://github.com/hjdhjd). All rights reserved.
5
2
  *
6
3
  * protect-rtp.ts: RTP-related utilities to slice and dice RTP streams.
7
4
  *
8
5
  * This module is heavily inspired by the homebridge and homebridge-camera-ffmpeg source code and
9
6
  * borrows heavily from both. Thank you for your contributions to the HomeKit world.
10
7
  */
11
- const events_1 = require("events");
12
- const settings_1 = require("./settings");
13
- const dgram_1 = require("dgram");
8
+ import { EventEmitter, once } from "node:events";
9
+ import { PROTECT_TWOWAY_HEARTBEAT_INTERVAL } from "./settings.js";
10
+ import { createSocket } from "node:dgram";
14
11
  /*
15
12
  * Here's the problem this class solves: FFmpeg doesn't support multiplexing RTP and RTCP data on a single UDP port (RFC 5761).
16
13
  * If it did, we wouldn't need this workaround for HomeKit compatibility, which does multiplex RTP and RTCP over a single UDP port.
@@ -21,19 +18,18 @@ const dgram_1 = require("dgram");
21
18
  * in answering the questions needed to bring all this together. A special thank you to @Sunoo for the many hours of
22
19
  * discussion and brainstorming on this and other topics.
23
20
  */
24
- class RtpDemuxer extends events_1.EventEmitter {
21
+ export class RtpDemuxer extends EventEmitter {
25
22
  // Create an instance of RtpDemuxer.
26
23
  constructor(streamingDelegate, ipFamily, inputPort, rtcpPort, rtpPort) {
27
24
  super();
28
25
  this._isRunning = false;
29
- this.debug = streamingDelegate.platform.debug.bind(streamingDelegate.platform);
30
26
  this.delegate = streamingDelegate;
31
27
  this.log = streamingDelegate.log;
32
28
  this.inputPort = inputPort;
33
- this.socket = (0, dgram_1.createSocket)(ipFamily === "ipv6" ? "udp6" : "udp4");
29
+ this.socket = createSocket(ipFamily === "ipv6" ? "udp6" : "udp4");
34
30
  // Catch errors when they happen on our demuxer.
35
31
  this.socket.on("error", (error) => {
36
- this.log.error("%s: RtpDemuxer Error: %s", this.delegate.protectCamera.name(), error);
32
+ this.log.error("RtpDemuxer Error: %s", error);
37
33
  this.socket.close();
38
34
  });
39
35
  // Split the message into RTP and RTCP packets.
@@ -55,7 +51,7 @@ class RtpDemuxer extends events_1.EventEmitter {
55
51
  this.socket.send(msg, rtcpPort);
56
52
  }
57
53
  });
58
- this.debug("%s: Creating an RtpDemuxer instance - inbound port: %s, RTCP port: %s, RTP port: %s.", this.delegate.protectCamera.name(), this.inputPort, rtcpPort, rtpPort);
54
+ this.log.debug("Creating an RtpDemuxer instance - inbound port: %s, RTCP port: %s, RTP port: %s.", this.inputPort, rtcpPort, rtpPort);
59
55
  // Take the socket live.
60
56
  this.socket.bind(this.inputPort);
61
57
  this._isRunning = true;
@@ -68,14 +64,14 @@ class RtpDemuxer extends events_1.EventEmitter {
68
64
  // in reading input, and we want to be comfortably within the margin for error to ensure the process
69
65
  // continues to run.
70
66
  this.heartbeatTimer = setTimeout(() => {
71
- this.debug("Sending ffmpeg a heartbeat.");
67
+ this.log.debug("Sending ffmpeg a heartbeat.");
72
68
  this.socket.send(this.heartbeatMsg, port);
73
69
  this.heartbeat(port);
74
- }, settings_1.PROTECT_TWOWAY_HEARTBEAT_INTERVAL * 1000);
70
+ }, PROTECT_TWOWAY_HEARTBEAT_INTERVAL * 1000);
75
71
  }
76
72
  // Close the socket and cleanup.
77
73
  close() {
78
- this.debug("%s: Closing the RtpDemuxer instance on port %s.", this.delegate.protectCamera.name(), this.inputPort);
74
+ this.log.debug("Closing the RtpDemuxer instance on port %s.", this.inputPort);
79
75
  clearTimeout(this.heartbeatTimer);
80
76
  this.socket.close();
81
77
  this._isRunning = false;
@@ -95,5 +91,126 @@ class RtpDemuxer extends events_1.EventEmitter {
95
91
  return this._isRunning;
96
92
  }
97
93
  }
98
- exports.RtpDemuxer = RtpDemuxer;
94
+ // RTP port allocator class that keeps track of ports that are currently earmarked for use.
95
+ export class RtpPortAllocator {
96
+ // Instantiate our port retrieval.
97
+ constructor() {
98
+ // Initialize our in use tracker.
99
+ this.portsInUse = {};
100
+ }
101
+ // Find an available UDP port by binding to one to validate it's availability.
102
+ async getPort(ipFamily, port = 0) {
103
+ try {
104
+ // Keep looping until we find what we're looking for: local UDP ports that are unspoken for.
105
+ for (;;) {
106
+ // Create a datagram socket, so we can use it to find a port.
107
+ const socket = createSocket(ipFamily === "ipv6" ? "udp6" : "udp4");
108
+ // Exclude this socket from Node's reference counting so we don't have issues later.
109
+ socket.unref();
110
+ // Bind to the port in question. If port is set to 0, we'll get a randomly generated port generated for us.
111
+ socket.bind(port);
112
+ // Ensure we wait for the socket to be bound.
113
+ // eslint-disable-next-line no-await-in-loop
114
+ await once(socket, "listening");
115
+ // Retrieve the port number we've gotten from the bind request.
116
+ const assignedPort = socket.address().port;
117
+ // We're done with the socket, let's cleanup.
118
+ socket.close();
119
+ // Check to see if the port is one we're already using. If it is, try again.
120
+ if (this.portsInUse[assignedPort]) {
121
+ continue;
122
+ }
123
+ // Now let's mark the port in use.
124
+ this.portsInUse[assignedPort] = true;
125
+ // Return the port.
126
+ return assignedPort;
127
+ }
128
+ }
129
+ catch (error) {
130
+ return -1;
131
+ }
132
+ }
133
+ // Reserve consecutive ports for use with FFmpeg. FFmpeg currently lacks the ability to specify both the RTP and RTCP ports.
134
+ // FFmpeg always assumes, by convention, that when you specify an RTP port, the RTCP port is the RTP port + 1. In order to
135
+ // work around that challenge, we need to always ensure that when we reserve multiple ports for RTP (primarily for two-way audio)
136
+ // that we we are reserving consecutive ports only.
137
+ async reservePort(ipFamily = "ipv4", portCount = 1, attempts = 0) {
138
+ // Sanity check and make sure we're not requesting any more than two ports at a time, or if we've exceeded our attempt limit.
139
+ if (((portCount !== 1) && (portCount !== 2)) || (attempts > 10)) {
140
+ return -1;
141
+ }
142
+ let firstPort = 0;
143
+ // Find the appropriate number of ports being requested.
144
+ for (let i = 0; i < portCount; i++) {
145
+ // eslint-disable-next-line no-await-in-loop
146
+ const assignedPort = await this.getPort(ipFamily, firstPort ? firstPort + 1 : 0);
147
+ // We haven't gotten a port, let's try again.
148
+ if (assignedPort === -1) {
149
+ // If we've gotten the first port of a pair of ports, make sure we release it here.
150
+ if (firstPort) {
151
+ this.freePort(firstPort);
152
+ }
153
+ // We still haven't found what we're looking for...keep looking.
154
+ return this.reservePort(ipFamily, portCount, attempts++);
155
+ }
156
+ // We've seen the first port we may be looking for, let's save it.
157
+ if (!firstPort) {
158
+ firstPort = assignedPort;
159
+ }
160
+ }
161
+ // Return the first port we've found.
162
+ return firstPort;
163
+ }
164
+ // Delete a port reservation that's no longer needed.
165
+ freePort(port) {
166
+ delete this.portsInUse[port];
167
+ }
168
+ }
169
+ // RTP-related utilities.
170
+ export class RtpUtils {
171
+ // Reserve consecutive ports for use with FFmpeg. FFmpeg currently lacks the ability to specify both the RTP and RTCP ports.
172
+ // FFmpeg always assumes, by convention, that when you specify an RTP port, the RTCP port is the RTP port + 1. In order to
173
+ // work around that challenge, we need to always ensure that when we reserve multiple ports for RTP (primarily for two-way audio)
174
+ // that we we are reserving consecutive ports only.
175
+ static async reservePort(ipFamily = "ipv4", portCount = 1, attempts = 0) {
176
+ // Find an available UDP port by binding to one to validate it's availability.
177
+ const getPort = (ipFamily, port = 0) => {
178
+ const socket = createSocket(ipFamily === "ipv6" ? "udp6" : "udp4");
179
+ return new Promise((resolve) => {
180
+ // Exclude this socket from Node's reference counting so we don't have issues later.
181
+ socket.unref();
182
+ // In case we error out, try to do so gracefully.
183
+ socket.once("error", () => resolve(-1));
184
+ // Bind to the port in question. If port is set to 0, we'll get a randomly generated port generated for us.
185
+ socket.bind(port, () => {
186
+ // Retrieve the port number we've gotten from the bind request.
187
+ const assignedPort = socket.address().port;
188
+ // Resolve the promise by returning the port we've gotten.
189
+ socket.close(() => resolve(assignedPort));
190
+ });
191
+ });
192
+ };
193
+ // Sanity check and make sure we're not requesting any more than two ports at a time, or if we've exceeded our attempt limit.
194
+ if (((portCount !== 1) && (portCount !== 2)) || (attempts > 10)) {
195
+ return -1;
196
+ }
197
+ let firstPort = 0;
198
+ // Find the appropriate number of ports being requested.
199
+ for (let i = 0; i < portCount; i++) {
200
+ // eslint-disable-next-line no-await-in-loop
201
+ const assignedPort = await getPort(ipFamily, firstPort ? firstPort + 1 : 0);
202
+ // We haven't gotten a port, let's try again.
203
+ if (assignedPort === -1) {
204
+ return RtpUtils.reservePort(ipFamily, portCount, attempts++);
205
+ }
206
+ // We've seen the first port we may be looking for, let's save it.
207
+ if (!firstPort) {
208
+ firstPort = assignedPort;
209
+ }
210
+ }
211
+ // Return the first port we've found.
212
+ return firstPort;
213
+ }
214
+ }
215
+ /* */
99
216
  //# sourceMappingURL=protect-rtp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"protect-rtp.js","sourceRoot":"","sources":["../src/protect-rtp.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,mCAAsC;AAEtC,yCAA+D;AAE/D,iCAAqC;AAErC;;;;;;;;;GASG;AACH,MAAa,UAAW,SAAQ,qBAAY;IAW1C,oCAAoC;IACpC,YAAY,iBAA2C,EAAE,QAA2B,EAAG,SAAiB,EAAE,QAAgB,EAAE,OAAe;QAEzI,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,iBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAC/E,IAAI,CAAC,QAAQ,GAAG,iBAAiB,CAAC;QAClC,IAAI,CAAC,GAAG,GAAG,iBAAiB,CAAC,GAAG,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,IAAA,oBAAY,EAAC,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAE,CAAC;QAEnE,gDAAgD;QAChD,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAG,EAAE;YACjC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,0BAA0B,EAAE,IAA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AAI,CAAC,QAAQ,GAAG,EAAE,CAAC,EAAE;YAE9D,OAAO,CAAC,CAAC,CAAC;SACX;QAED,IAAI,SAAS,GAAG,CAAC,CAAC;QAElB,wDAAwD;QACxD,KAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,EAAE;YAEjC,4CAA4C;YAC5C,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAE5E,6CAA6C;YAC7C,IAAG,YAAY,KAAK,CAAC,CAAC,EAAE;gBAEtB,OAAO,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;aAC9D;YAED,kEAAkE;YAClE,IAAG,CAAC,SAAS,EAAE;gBAEb,SAAS,GAAG,YAAY,CAAC;aAC1B;SACF;QAED,qCAAqC;QACrC,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAED,KAAK"}
@@ -0,0 +1,18 @@
1
+ import { PlatformAccessory } from "homebridge";
2
+ import { ProtectBase } from "./protect-device.js";
3
+ import { ProtectNvr } from "./protect-nvr.js";
4
+ export declare class ProtectSecuritySystem extends ProtectBase {
5
+ accessory: PlatformAccessory;
6
+ private isAlarmTriggered;
7
+ constructor(nvr: ProtectNvr, accessory: PlatformAccessory);
8
+ private configureDevice;
9
+ private configureInfo;
10
+ private configureMqtt;
11
+ private configureSecuritySystem;
12
+ private configureSecurityAlarm;
13
+ updateDevice(): boolean;
14
+ private publishSecurityState;
15
+ private getSecurityState;
16
+ private setSecurityState;
17
+ private setSecurityAlarm;
18
+ }