homebridge-unifi-protect 5.5.4 → 6.0.1

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 -15
  78. package/dist/protect-accessory.js +0 -184
  79. package/dist/protect-accessory.js.map +0 -1
package/README.md CHANGED
@@ -13,7 +13,7 @@
13
13
  </DIV>
14
14
  </SPAN>
15
15
 
16
- `homebridge-unifi-protect` is a [Homebridge](https://homebridge.io) plugin that provides HomeKit support to the [UniFi Protect](https://ui.com/camera-security) device ecosystem. [UniFi Protect](https://ui.com/camera-security) is [Ubiquiti's](https://www.ui.com) next-generation video security platform, with rich camera, doorbell, and NVR controller hardware options for you to choose from, as well as an app which you can use to view, configure and manage your video camera and doorbells.
16
+ `homebridge-unifi-protect` is a [Homebridge](https://homebridge.io) plugin that provides HomeKit support to the [UniFi Protect](https://unifi-network.ui.com/video-security) device ecosystem. [UniFi Protect](https://unifi-network.ui.com/video-security) is [Ubiquiti's](https://www.ui.com) video security platform, with rich camera, doorbell, and NVR controller hardware options for you to choose from, as well as an app which you can use to view, configure and manage your video camera and doorbells.
17
17
 
18
18
  ## <A NAME="why"></A>Why Use This Plugin For UniFi Protect Support In HomeKit?
19
19
  This plugin attempts to bridge a gap in the UniFi Protect ecosystem by providing native HomeKit support on par with what you would expect from a first-party of native HomeKit solution. My north star is to create a plugin that *just works* with minimal required configuration by you to get up and running. The goal is to provide as close to a streamlined experience as you would expect from a first-party or native HomeKit solution. For the adventurous, there are more granular options available to enable you to further tailor your experience.
@@ -111,7 +111,7 @@ Audio on cameras is tricky in the HomeKit world to begin with, and when you thro
111
111
  - ***For extra clarity and to reiterate the above - before you install this plugin, make sure you are on the latest production / stable controller platform firmware and the latest production / stable UniFi Protect firmware.***
112
112
 
113
113
  ## Plugin Configuration
114
- If you choose to configure this plugin directly instead of using the [Homebridge Configuration web UI](https://github.com/oznu/homebridge-config-ui-x), you'll need to add the platform to your `config.json` in your home directory inside `.homebridge`.
114
+ If you choose to configure this plugin directly instead of using the [Homebridge Configuration webUI](https://github.com/oznu/homebridge-config-ui-x), you'll need to add the platform to your `config.json` in your home directory inside `.homebridge`.
115
115
 
116
116
  ```js
117
117
  "platforms": [
@@ -128,7 +128,7 @@ If you choose to configure this plugin directly instead of using the [Homebridge
128
128
  }
129
129
  ]
130
130
  ```
131
- For most people, I recommend using [Homebridge Configuration web UI](https://github.com/oznu/homebridge-config-ui-x) to configure this plugin rather than doing so directly. It's easier to use for most users, especially newer users, and less prone to typos, leading to other problems.
131
+ **For most people, I recommend using [Homebridge Configuration web UI](https://github.com/oznu/homebridge-config-ui-x) to configure this plugin rather than doing so directly. It's easier to use for most users, especially newer users, and less prone to typos, leading to other problems. This plugin has a custom webUI built on top of the Homebridge webUI framework that should simplify feature configuration, and make them more accessible to users.**
132
132
 
133
133
  You can use your Ubiquiti account credentials, though 2FA is not currently supported. That said, **I strongly recommend creating a local user just for Homebridge instead of using this option.**
134
134
 
@@ -4,6 +4,7 @@
4
4
  "headerDisplay": "Full HomeKit support UniFi Protect devices. See the [homebridge-unifi-protect](https://github.com/hjdhjd/homebridge-unifi-protect) developer page for detailed documentation.",
5
5
  "footerDisplay": "A working **ffmpeg** installation is required for this plugin to work. For audio support, make sure your version of ffmpeg is compiled with support for **fdk-aac**.",
6
6
  "singular": true,
7
+ "customUi": true,
7
8
 
8
9
  "schema": {
9
10
  "type": "object",
@@ -27,6 +28,15 @@
27
28
  "description": "Hostname or IP address of your UniFi Protect controller."
28
29
  },
29
30
 
31
+ "defaultDoorbellMessage": {
32
+ "type": "string",
33
+ "title": "Default doorbell message",
34
+ "required": false,
35
+ "maxLength": 30,
36
+ "placeholder": "e.g. WELCOME",
37
+ "description": "Default message to be used on UniFi Protect doorbells. Default: WELCOME."
38
+ },
39
+
30
40
  "doorbellMessages": {
31
41
  "type": "array",
32
42
  "title": "Doorbell Messages",
@@ -80,7 +90,7 @@
80
90
  "title": "Controller Name",
81
91
  "required": false,
82
92
  "placeholder": "e.g. UNVR",
83
- "description": "Name for this UniFi Protect controller to be used for logging purposes. password. Default: Defined by the controller."
93
+ "description": "Name for this UniFi Protect controller to be used for logging purposes. Default: Defined by the controller."
84
94
  },
85
95
 
86
96
  "password": {
@@ -91,16 +101,6 @@
91
101
  "description": "UniFi Protect password for this controller. Creating a homebridge-specific local user is strongly encouraged for security and sanity."
92
102
  },
93
103
 
94
- "refreshInterval": {
95
- "type": "integer",
96
- "title": "Controller Refresh Interval (seconds)",
97
- "required": false,
98
- "minimum": 2,
99
- "maximum": 30,
100
- "placeholder": "e.g. 10",
101
- "description": "Refresh interval to check for cameras that have been added or removed to a controller. For UCK Gen2+ devices only, this is also the interval used to check for motion events. Default: 5 seconds for UCK Gen2+, 10 seconds for UniFI OS."
102
- },
103
-
104
104
  "username": {
105
105
  "type": "string",
106
106
  "title": "Controller Username",
@@ -130,8 +130,8 @@
130
130
  "type": "string",
131
131
  "title": "Feature Option",
132
132
  "required": false,
133
- "description": "Enter only one option per entry. See project page for the complete list of available options.",
134
- "placeholder": "e.g. Disable.Stream.High"
133
+ "description": "Enter only one option per entry. See the feature options tab above for the complete list of available options.",
134
+ "placeholder": "e.g. Disable.Video.Transcode"
135
135
  }
136
136
  },
137
137
 
@@ -212,6 +212,8 @@
212
212
  "expandable": true,
213
213
  "expanded": false,
214
214
  "items": [
215
+
216
+ "controllers[].defaultDoorbellMessage",
215
217
  {
216
218
  "key": "controllers[].doorbellMessages",
217
219
  "type": "array",
@@ -237,8 +239,7 @@
237
239
  {
238
240
  "description": "These settings are optional. The defaults work well for almost everyone.",
239
241
  "items": [
240
- "controllers[].name",
241
- "controllers[].refreshInterval"
242
+ "controllers[].name"
242
243
  ]
243
244
  }
244
245
  ]
@@ -274,7 +275,7 @@
274
275
  "key": "options",
275
276
  "type": "array",
276
277
  "name": " ",
277
- "description": "Feature options allow you to further customize the behavior of this plugin such as the ability to show or hide cameras or specify stream quality.",
278
+ "description": "Feature options allow you to further customize the behavior of this plugin such as the ability to show or hide cameras or specify stream quality. You can use the the feature options tab above (recommended) to customize these settings or enter them manually below.",
278
279
  "orderable": false,
279
280
  "buttonText": "Add Feature Option",
280
281
  "items": [
@@ -0,0 +1,3 @@
1
+ import { API } from "homebridge";
2
+ declare const _default: (api: API) => void;
3
+ export default _default;
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- "use strict";
2
- /* 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.
3
2
  *
4
3
  * index.ts: homebridge-unifi-protect plugin registration.
5
4
  */
6
- const settings_1 = require("./settings");
7
- const protect_platform_1 = require("./protect-platform");
8
- module.exports = (api) => {
9
- api.registerPlatform(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, protect_platform_1.ProtectPlatform);
5
+ import { PLATFORM_NAME, PLUGIN_NAME } from "./settings.js";
6
+ import { ProtectPlatform } from "./protect-platform.js";
7
+ // Register our platform with homebridge.
8
+ export default (api) => {
9
+ api.registerPlatform(PLUGIN_NAME, PLATFORM_NAME, ProtectPlatform);
10
10
  };
11
11
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH,yCAAwD;AAExD,yDAAqD;AAGrD,iBAAS,CAAC,GAAQ,EAAQ,EAAE;IAC1B,GAAG,CAAC,gBAAgB,CAAC,sBAAW,EAAE,wBAAa,EAAE,kCAAe,CAAC,CAAC;AACpE,CAAC,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,yCAAyC;AACzC,eAAe,CAAC,GAAQ,EAAQ,EAAE;IAEhC,GAAG,CAAC,gBAAgB,CAAC,WAAW,EAAE,aAAa,EAAE,eAAe,CAAC,CAAC;AACpE,CAAC,CAAC"}
@@ -0,0 +1,58 @@
1
+ import { PlatformAccessory } from "homebridge";
2
+ import { ProtectCameraChannelConfig, ProtectCameraConfig, ProtectEventPacket } from "unifi-protect";
3
+ import { ProtectDevice } from "./protect-device.js";
4
+ import { ProtectNvr } from "./protect-nvr.js";
5
+ import { ProtectStreamingDelegate } from "./protect-stream.js";
6
+ export interface RtspEntry {
7
+ channel: ProtectCameraChannelConfig;
8
+ name: string;
9
+ resolution: [number, number, number];
10
+ url: string;
11
+ }
12
+ export declare class ProtectCamera extends ProtectDevice {
13
+ hasHksv: boolean;
14
+ hasHwAccel: boolean;
15
+ private isDeleted;
16
+ private isDoorbellConfigured;
17
+ isRinging: boolean;
18
+ private isVideoConfigured;
19
+ packageCamera: ProtectPackageCamera | null;
20
+ private rtspEntries;
21
+ private rtspQuality;
22
+ snapshotUrl: string;
23
+ stream: ProtectStreamingDelegate;
24
+ ufp: ProtectCameraConfig;
25
+ constructor(nvr: ProtectNvr, device: ProtectCameraConfig, accessory: PlatformAccessory);
26
+ protected configureHints(): boolean;
27
+ protected configureDevice(): Promise<boolean>;
28
+ cleanup(): void;
29
+ protected eventHandler(packet: ProtectEventPacket): void;
30
+ private smartMotionEventHandler;
31
+ private configureMotionSmartSensor;
32
+ private configureMotionTrigger;
33
+ private configureDoorbellTrigger;
34
+ protected configureVideoDoorbell(): boolean;
35
+ private configureCameraDetails;
36
+ private configureVideoStream;
37
+ protected configureSnapshotUpdates(): Promise<boolean>;
38
+ private configurePackageCamera;
39
+ private configureHksv;
40
+ private configureHksvRecordingSwitch;
41
+ private configureDynamicBitrateSwitch;
42
+ private configureNvrRecordingSwitch;
43
+ protected configureMqtt(): boolean;
44
+ updateDevice(): boolean;
45
+ getBitrate(channelId: number): number;
46
+ setBitrate(channelId: number, value: number): Promise<boolean>;
47
+ private findRtspEntry;
48
+ findRtsp(width: number, height: number, camera?: ProtectCameraConfig | null, address?: string, rtspEntries?: RtspEntry[]): RtspEntry | null;
49
+ findRecordingRtsp(width: number, height: number, camera?: ProtectCameraConfig | null, rtspEntries?: RtspEntry[]): RtspEntry | null;
50
+ private sortByResolutions;
51
+ private getResolution;
52
+ }
53
+ export declare class ProtectPackageCamera extends ProtectCamera {
54
+ protected configureDevice(): Promise<boolean>;
55
+ findRtsp(): RtspEntry | null;
56
+ getBitrate(channelId: number): number;
57
+ setBitrate(): Promise<boolean>;
58
+ }