homebridge-unifi-protect 5.5.4 → 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 +14 -15
  78. package/dist/protect-accessory.js +0 -184
  79. package/dist/protect-accessory.js.map +0 -1
@@ -1,25 +1,24 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProtectSecuritySystem = void 0;
4
- /* Copyright(C) 2019-2022, HJD (https://github.com/hjdhjd). All rights reserved.
5
- *
6
- * protect-securitysystem.ts: Security system accessory for UniFi Protect.
7
- */
8
- const protect_accessory_1 = require("./protect-accessory");
9
- class ProtectSecuritySystem extends protect_accessory_1.ProtectAccessory {
1
+ import { ProtectBase } from "./protect-device.js";
2
+ import { ProtectReservedNames } from "./protect-types.js";
3
+ export class ProtectSecuritySystem extends ProtectBase {
4
+ // Create an instance.
5
+ constructor(nvr, accessory) {
6
+ super(nvr);
7
+ this.accessory = accessory;
8
+ this.isAlarmTriggered = false;
9
+ this.configureDevice();
10
+ }
10
11
  // Configure a security system accessory for HomeKit.
11
12
  configureDevice() {
12
- var _a;
13
- const accessory = this.accessory;
14
13
  let securityState = this.hap.Characteristic.SecuritySystemCurrentState.STAY_ARM;
15
14
  // Save the security system state before we wipeout the context.
16
- if (accessory.context.securityState !== undefined) {
17
- securityState = accessory.context.securityState;
15
+ if (this.accessory.context.securityState !== undefined) {
16
+ securityState = this.accessory.context.securityState;
18
17
  }
19
18
  // Clean out the context object in case it's been polluted somehow.
20
- accessory.context = {};
21
- accessory.context.nvr = (_a = this.nvr.nvrApi.bootstrap) === null || _a === void 0 ? void 0 : _a.nvr.mac;
22
- accessory.context.securityState = securityState;
19
+ this.accessory.context = {};
20
+ this.accessory.context.nvr = this.nvr.ufp.mac;
21
+ this.accessory.context.securityState = securityState;
23
22
  // Configure accessory information.
24
23
  this.configureInfo();
25
24
  // Configure MQTT services.
@@ -28,38 +27,24 @@ class ProtectSecuritySystem extends protect_accessory_1.ProtectAccessory {
28
27
  this.configureSecuritySystem();
29
28
  // Configure the security alarm.
30
29
  this.configureSecurityAlarm();
31
- return Promise.resolve(true);
30
+ return true;
32
31
  }
33
32
  // Configure the security system device information for HomeKit.
34
33
  configureInfo() {
35
- var _a, _b, _c, _d;
36
- const accessory = this.accessory;
37
- const hap = this.hap;
38
- let nvrInfo;
39
- if (this.nvr && this.nvr.nvrApi && this.nvr.nvrApi.bootstrap && this.nvr.nvrApi.bootstrap.nvr) {
40
- nvrInfo = this.nvr.nvrApi.bootstrap.nvr;
41
- }
42
34
  // Update the manufacturer information for this security system.
43
- (_a = accessory
44
- .getService(hap.Service.AccessoryInformation)) === null || _a === void 0 ? void 0 : _a.updateCharacteristic(hap.Characteristic.Manufacturer, "github.com/hjdhjd");
35
+ this.accessory.getService(this.hap.Service.AccessoryInformation)?.updateCharacteristic(this.hap.Characteristic.Manufacturer, "github.com/hjdhjd");
45
36
  // Update the model information for this security system.
46
- (_b = accessory
47
- .getService(hap.Service.AccessoryInformation)) === null || _b === void 0 ? void 0 : _b.updateCharacteristic(hap.Characteristic.Model, "UniFi Protect Liveview Security System");
48
- if (nvrInfo) {
49
- // Update the serial number for this security system - we base this off of the NVR.
50
- (_c = accessory
51
- .getService(hap.Service.AccessoryInformation)) === null || _c === void 0 ? void 0 : _c.updateCharacteristic(hap.Characteristic.SerialNumber, nvrInfo.mac + ".Security");
52
- // Update the hardware revision for this security system - we base this off of the NVR.
53
- (_d = accessory
54
- .getService(hap.Service.AccessoryInformation)) === null || _d === void 0 ? void 0 : _d.updateCharacteristic(hap.Characteristic.HardwareRevision, nvrInfo.hardwareRevision);
55
- }
37
+ this.accessory.getService(this.hap.Service.AccessoryInformation)?.updateCharacteristic(this.hap.Characteristic.Model, "UniFi Protect Liveview Security System");
38
+ // Update the serial number for this security system - we base this off of the NVR.
39
+ this.accessory.getService(this.hap.Service.AccessoryInformation)?.updateCharacteristic(this.hap.Characteristic.SerialNumber, this.nvr.ufp.mac + ".Security");
40
+ // Update the hardware revision for this security system - we base this off of the NVR.
41
+ this.accessory.getService(this.hap.Service.AccessoryInformation)?.updateCharacteristic(this.hap.Characteristic.HardwareRevision, this.nvr.ufp.hardwareRevision);
56
42
  return true;
57
43
  }
58
44
  // Configure MQTT capabilities for the security system.
59
45
  configureMqtt() {
60
- var _a, _b;
61
46
  // Get the current status of the security system.
62
- (_a = this.nvr.mqtt) === null || _a === void 0 ? void 0 : _a.subscribe(this.accessory, "securitysystem/get", (message) => {
47
+ this.nvr.mqtt?.subscribe(this.accessory, "securitysystem/get", (message) => {
63
48
  const value = message.toString().toLowerCase();
64
49
  // When we get the right message, we return the state of the security system.
65
50
  if (value !== "true") {
@@ -67,11 +52,10 @@ class ProtectSecuritySystem extends protect_accessory_1.ProtectAccessory {
67
52
  }
68
53
  // Publish the current status of the security system.
69
54
  this.publishSecurityState();
70
- this.log.info("%s: Security system status published via MQTT.", this.name());
55
+ this.log.info("Security system status published via MQTT.");
71
56
  });
72
57
  // Set the security system state.
73
- (_b = this.nvr.mqtt) === null || _b === void 0 ? void 0 : _b.subscribe(this.accessory, "securitysystem/set", (message) => {
74
- var _a;
58
+ this.nvr.mqtt?.subscribe(this.accessory, "securitysystem/set", (message) => {
75
59
  const SecuritySystemCurrentState = this.hap.Characteristic.SecuritySystemCurrentState;
76
60
  const SecuritySystemTargetState = this.hap.Characteristic.SecuritySystemTargetState;
77
61
  const value = message.toString().toLowerCase();
@@ -101,42 +85,39 @@ class ProtectSecuritySystem extends protect_accessory_1.ProtectAccessory {
101
85
  break;
102
86
  default:
103
87
  // The user sent a bad value. Ignore it and we're done.
104
- this.log.error("%s: Unable to process MQTT security system setting: %s.", this.name(), message.toString());
88
+ this.log.error("Unable to process MQTT security system setting: %s.", message.toString());
105
89
  return;
106
90
  }
107
91
  // The security alarm gets handled differently than the other state settings.
108
92
  if (targetState === SecuritySystemCurrentState.ALARM_TRIGGERED) {
109
93
  this.setSecurityAlarm(alarmState);
110
- this.log.info("%s: Security alarm %s via MQTT.", this.name(), alarmState ? "triggered" : "reset");
94
+ this.log.info("Security alarm %s via MQTT.", alarmState ? "triggered" : "reset");
111
95
  return;
112
96
  }
113
97
  // Set the security state, and we're done.
114
- (_a = this.accessory.getService(this.hap.Service.SecuritySystem)) === null || _a === void 0 ? void 0 : _a.updateCharacteristic(SecuritySystemTargetState, targetState);
98
+ this.accessory.getService(this.hap.Service.SecuritySystem)?.updateCharacteristic(SecuritySystemTargetState, targetState);
115
99
  this.setSecurityState(targetState);
116
- this.log.info("%s: Security system state set via MQTT: %s.", this.name(), value.charAt(0).toUpperCase() + value.slice(1));
100
+ this.log.info("Security system state set via MQTT: %s.", value.charAt(0).toUpperCase() + value.slice(1));
117
101
  });
118
102
  return true;
119
103
  }
120
104
  // Configure the security system for HomeKit.
121
105
  configureSecuritySystem() {
122
- var _a, _b, _c;
123
- const accessory = this.accessory;
124
- const hap = this.hap;
125
106
  // Find any existing security system service.
126
- let securityService = accessory.getService(hap.Service.SecuritySystem);
107
+ let securityService = this.accessory.getService(this.hap.Service.SecuritySystem);
127
108
  // Add the security system service, if needed.
128
109
  if (!securityService) {
129
- securityService = new hap.Service.SecuritySystem(accessory.displayName);
110
+ securityService = new this.hap.Service.SecuritySystem(this.accessory.displayName);
130
111
  if (!securityService) {
131
- this.log.error("%s: Unable to add security system.", this.name());
112
+ this.log.error("Unable to add security system.");
132
113
  return false;
133
114
  }
134
- accessory.addService(securityService);
115
+ this.accessory.addService(securityService);
135
116
  }
136
117
  const SecuritySystemCurrentState = this.hap.Characteristic.SecuritySystemCurrentState;
137
118
  const SecuritySystemTargetState = this.hap.Characteristic.SecuritySystemTargetState;
138
119
  let targetSecurityState;
139
- switch (accessory.context.securityState) {
120
+ switch (this.accessory.context.securityState) {
140
121
  case SecuritySystemCurrentState.STAY_ARM:
141
122
  targetSecurityState = SecuritySystemTargetState.STAY_ARM;
142
123
  break;
@@ -152,24 +133,22 @@ class ProtectSecuritySystem extends protect_accessory_1.ProtectAccessory {
152
133
  break;
153
134
  }
154
135
  // Handlers to get our current state, and initialize on startup.
155
- (_a = securityService
156
- .updateCharacteristic(SecuritySystemCurrentState, accessory.context.securityState)
157
- .getCharacteristic(SecuritySystemCurrentState)) === null || _a === void 0 ? void 0 : _a.onGet(this.getSecurityState.bind(this));
136
+ securityService.updateCharacteristic(SecuritySystemCurrentState, this.accessory.context.securityState)
137
+ .getCharacteristic(SecuritySystemCurrentState)?.onGet(this.getSecurityState.bind(this));
158
138
  // Handlers for triggering a change in the security system state.
159
- (_b = accessory.getService(hap.Service.SecuritySystem)) === null || _b === void 0 ? void 0 : _b.getCharacteristic(SecuritySystemTargetState).onSet(this.setSecurityState.bind(this));
139
+ this.accessory.getService(this.hap.Service.SecuritySystem)?.getCharacteristic(SecuritySystemTargetState).onSet(this.setSecurityState.bind(this));
160
140
  // Set the initial state after we have setup our handlers above. This way, when we startup, we
161
141
  // automatically restore the scene we've been set to, if any.
162
- (_c = accessory.getService(hap.Service.SecuritySystem)) === null || _c === void 0 ? void 0 : _c.updateCharacteristic(SecuritySystemTargetState, targetSecurityState);
142
+ this.accessory.getService(this.hap.Service.SecuritySystem)?.updateCharacteristic(SecuritySystemTargetState, targetSecurityState);
163
143
  return true;
164
144
  }
165
145
  // Configure the security alarm for HomeKit.
166
146
  configureSecurityAlarm() {
167
- var _a, _b;
168
147
  this.isAlarmTriggered = false;
169
148
  // Find the existing security alarm switch service.
170
149
  let switchService = this.accessory.getService(this.hap.Service.Switch);
171
150
  // Have we enabled the security system alarm?
172
- if (!((_a = this.nvr) === null || _a === void 0 ? void 0 : _a.optionEnabled(null, "SecuritySystem.Alarm", false))) {
151
+ if (!this.nvr?.optionEnabled(null, "SecuritySystem.Alarm", false)) {
173
152
  if (switchService) {
174
153
  this.accessory.removeService(switchService);
175
154
  }
@@ -179,28 +158,56 @@ class ProtectSecuritySystem extends protect_accessory_1.ProtectAccessory {
179
158
  if (!switchService) {
180
159
  switchService = new this.hap.Service.Switch(this.accessory.displayName + " Security Alarm");
181
160
  if (!switchService) {
182
- this.log.error("%s: Unable to add security system alarm.", this.name());
161
+ this.log.error("Unable to add security system alarm.");
183
162
  return false;
184
163
  }
185
164
  this.accessory.addService(switchService);
186
165
  }
187
166
  // Notify the user that we're enabled.
188
- this.log.info("%s: Enabling the security alarm switch on the security system accessory.", this.name());
167
+ this.log.info("Enabling the security alarm switch on the security system accessory.");
189
168
  // Activate or deactivate the security alarm.
190
- (_b = switchService
191
- .getCharacteristic(this.hap.Characteristic.On)) === null || _b === void 0 ? void 0 : _b.onGet(() => {
169
+ switchService.getCharacteristic(this.hap.Characteristic.On)
170
+ ?.onGet(() => {
192
171
  return this.isAlarmTriggered === true;
193
- }).onSet((value) => {
172
+ })
173
+ .onSet((value) => {
194
174
  this.setSecurityAlarm(value === true);
195
- this.log.info("%s: Security system alarm %s.", this.name(), (value === true) ? "triggered" : "reset");
175
+ this.log.info("Security system alarm %s.", (value === true) ? "triggered" : "reset");
196
176
  });
197
177
  // Initialize the value.
198
178
  switchService.updateCharacteristic(this.hap.Characteristic.On, this.isAlarmTriggered);
199
179
  return true;
200
180
  }
181
+ // Update security system accessory settings.
182
+ updateDevice() {
183
+ // We always have a disarmed state available to us.
184
+ const availableSecurityStates = [this.hap.Characteristic.SecuritySystemTargetState.DISARM];
185
+ // No liveviews configured - we're done.
186
+ if (!this.nvr.ufpApi.bootstrap?.liveviews) {
187
+ return false;
188
+ }
189
+ for (const securityState of [
190
+ ["Protect-Away".toLowerCase(), this.hap.Characteristic.SecuritySystemTargetState.AWAY_ARM],
191
+ ["Protect-Home".toLowerCase(), this.hap.Characteristic.SecuritySystemTargetState.STAY_ARM],
192
+ ["Protect-Night".toLowerCase(), this.hap.Characteristic.SecuritySystemTargetState.NIGHT_ARM]
193
+ ]) {
194
+ // If we don't have this liveview configured, don't add it to the property list for the security system accessory.
195
+ if (!this.nvr.ufpApi.bootstrap.liveviews.some(x => x.name.toLowerCase() === securityState[0])) {
196
+ continue;
197
+ }
198
+ availableSecurityStates.push(securityState[1]);
199
+ }
200
+ // No available security states besides disarmed - something probably went wrong, so we're done.
201
+ if (availableSecurityStates.length < 2) {
202
+ return false;
203
+ }
204
+ // Only show the available values we've configured.
205
+ this.accessory.getService(this.hap.Service.SecuritySystem)?.
206
+ getCharacteristic(this.hap.Characteristic.SecuritySystemTargetState).setProps({ validValues: availableSecurityStates });
207
+ return true;
208
+ }
201
209
  // Publish the security system state to MQTT.
202
210
  publishSecurityState() {
203
- var _a;
204
211
  const SecuritySystemCurrentState = this.hap.Characteristic.SecuritySystemCurrentState;
205
212
  let state;
206
213
  switch (this.accessory.context.securityState) {
@@ -221,27 +228,21 @@ class ProtectSecuritySystem extends protect_accessory_1.ProtectAccessory {
221
228
  state = "Off";
222
229
  break;
223
230
  }
224
- (_a = this.nvr.mqtt) === null || _a === void 0 ? void 0 : _a.publish(this.accessory, "securitysystem", this.isAlarmTriggered ? "Alarm" : state);
231
+ this.nvr.mqtt?.publish(this.accessory, "securitysystem", this.isAlarmTriggered ? "Alarm" : state);
225
232
  }
226
233
  // Get the current security system state.
227
234
  getSecurityState() {
228
- return this.isAlarmTriggered ?
229
- this.hap.Characteristic.SecuritySystemCurrentState.ALARM_TRIGGERED :
230
- this.accessory.context.securityState;
235
+ return this.isAlarmTriggered ? this.hap.Characteristic.SecuritySystemCurrentState.ALARM_TRIGGERED : this.accessory.context.securityState;
231
236
  }
232
237
  // Change the security system state, and enable or disable motion detection accordingly.
233
238
  setSecurityState(value) {
234
- var _a, _b, _c, _d, _e, _f;
235
- const accessory = this.accessory;
236
- const hap = this.hap;
237
- const liveviews = (_a = this.nvr.nvrApi.bootstrap) === null || _a === void 0 ? void 0 : _a.liveviews;
239
+ const liveviews = this.nvr.ufpApi.bootstrap?.liveviews;
238
240
  let newState;
239
- const nvrApi = this.nvr.nvrApi;
240
- const SecuritySystemCurrentState = hap.Characteristic.SecuritySystemCurrentState;
241
- const SecuritySystemTargetState = hap.Characteristic.SecuritySystemTargetState;
241
+ const SecuritySystemCurrentState = this.hap.Characteristic.SecuritySystemCurrentState;
242
+ const SecuritySystemTargetState = this.hap.Characteristic.SecuritySystemTargetState;
242
243
  let viewScene = "";
243
- // If we don't have any liveviews or the bootstrap configuration, there's nothing for us to do.
244
- if (!liveviews || !nvrApi.bootstrap) {
244
+ // If we don't have any liveviews, there's nothing for us to do.
245
+ if (!liveviews) {
245
246
  return;
246
247
  }
247
248
  // We have three different states which can be triggered (aside from disarming).
@@ -250,78 +251,74 @@ class ProtectSecuritySystem extends protect_accessory_1.ProtectAccessory {
250
251
  switch (value) {
251
252
  case SecuritySystemTargetState.STAY_ARM:
252
253
  newState = SecuritySystemCurrentState.STAY_ARM;
253
- viewScene = "Protect-Home";
254
+ viewScene = "Protect-Home".toLowerCase();
254
255
  break;
255
256
  case SecuritySystemTargetState.AWAY_ARM:
256
257
  newState = SecuritySystemCurrentState.AWAY_ARM;
257
- viewScene = "Protect-Away";
258
+ viewScene = "Protect-Away".toLowerCase();
258
259
  break;
259
260
  case SecuritySystemTargetState.NIGHT_ARM:
260
261
  newState = SecuritySystemCurrentState.NIGHT_ARM;
261
- viewScene = "Protect-Night";
262
+ viewScene = "Protect-Night".toLowerCase();
262
263
  break;
263
264
  case SecuritySystemTargetState.DISARM:
264
265
  newState = SecuritySystemCurrentState.DISARMED;
265
- viewScene = "Protect-Off";
266
+ viewScene = "Protect-Off".toLowerCase();
266
267
  break;
267
268
  default:
268
269
  newState = SecuritySystemCurrentState.DISARMED;
269
270
  break;
270
271
  }
271
- // Get the complete list of cameras in the liveview we're interested in.
272
- // This cryptic line grabs the list of liveviews that have the name we're interested in
273
- // (turns out, you can define multiple liveviews in Protect with the same name...who knew!),
274
- // and then create a single list containing all of the cameras found.
275
- const targetCameraIds = liveviews.filter(view => view.name === viewScene)
276
- .map(view => view.slots.map(slots => slots.cameras))
277
- .flat(2);
272
+ // Get the complete list of cameras in the liveview we're interested in. This cryptic line grabs the list
273
+ // of liveviews that have the name we're interested in (turns out, you can define multiple liveviews in Protect
274
+ // with the same name...who knew!), and then create a single list containing all of the cameras found.
275
+ const targetCameraIds = liveviews.filter(view => view.name.toLowerCase() === viewScene).map(view => view.slots.map(slots => slots.cameras)).flat(2);
278
276
  // We don't have a liveview for this state and we aren't disarming - update state for the user and we're done.
279
277
  if (newState !== SecuritySystemCurrentState.DISARMED && !targetCameraIds.length) {
280
- this.log.info("%s: No liveview configured for this security system state. Create a liveview named %s in the Protect webUI to use this feature.", this.name(), viewScene);
281
- accessory.context.securityState = newState;
282
- (_b = accessory.getService(hap.Service.SecuritySystem)) === null || _b === void 0 ? void 0 : _b.updateCharacteristic(SecuritySystemCurrentState, newState);
278
+ this.log.info("No liveview configured for this security system state. Create a liveview named %s in the Protect webUI to use this feature.", viewScene);
279
+ this.accessory.context.securityState = newState;
280
+ this.accessory.getService(this.hap.Service.SecuritySystem)?.updateCharacteristic(SecuritySystemCurrentState, newState);
283
281
  return;
284
282
  }
285
- this.log.info("%s: Setting the liveview scene: %s.", this.name(), viewScene);
283
+ this.log.info("Setting the liveview scene: %s.", viewScene);
286
284
  // Iterate through the list of accessories and set the Protect scene.
287
285
  for (const targetAccessory of this.platform.accessories) {
286
+ const targetUfp = this.nvr.configuredDevices[targetAccessory.UUID]?.ufp;
288
287
  // We only want accessories associated with this Protect controller.
289
- if (!((_c = targetAccessory.context) === null || _c === void 0 ? void 0 : _c.device) || targetAccessory.context.nvr !== nvrApi.bootstrap.nvr.mac) {
288
+ if (!targetUfp || (targetAccessory.context.nvr !== this.nvr.ufp.mac)) {
290
289
  continue;
291
290
  }
292
291
  let targetState = false;
293
292
  // If we're disarming, then all Protect cameras will disable motion detection in HomeKit. Otherwise,
294
293
  // check to see if this is one of the cameras we want to turn on motion detection for.
295
294
  if (((newState !== SecuritySystemCurrentState.DISARMED) ||
296
- ((newState === SecuritySystemCurrentState.DISARMED) && targetCameraIds.length)) &&
297
- targetCameraIds.some(thisCameraId => thisCameraId === targetAccessory.context.device.id)) {
295
+ ((newState === SecuritySystemCurrentState.DISARMED) && targetCameraIds.length)) && targetCameraIds.some(thisCameraId => thisCameraId === targetUfp?.id)) {
298
296
  targetState = true;
299
297
  }
300
298
  // Only take action to change motion detection state if needed.
301
299
  if (targetAccessory.context.detectMotion !== targetState) {
302
300
  targetAccessory.context.detectMotion = targetState;
303
301
  // Update the switch service, if present.
304
- const motionSwitch = targetAccessory.getServiceById(hap.Service.Switch, protect_accessory_1.ProtectReservedNames.SWITCH_MOTION_SENSOR);
302
+ const motionSwitch = targetAccessory.getServiceById(this.hap.Service.Switch, ProtectReservedNames.SWITCH_MOTION_SENSOR);
305
303
  if (motionSwitch) {
306
- motionSwitch.updateCharacteristic(hap.Characteristic.On, targetAccessory.context.detectMotion);
304
+ motionSwitch.updateCharacteristic(this.hap.Characteristic.On, targetAccessory.context.detectMotion);
307
305
  }
308
- this.log.info("%s: %s -> %s: Motion detection %s.", this.name(), viewScene, targetAccessory.displayName, targetAccessory.context.detectMotion === true ? "enabled" : "disabled");
306
+ this.log.info("%s -> %s: Motion detection %s.", viewScene, targetAccessory.displayName, targetAccessory.context.detectMotion === true ? "enabled" : "disabled");
309
307
  }
310
308
  }
311
309
  // Inform the user of our new state.
312
- accessory.context.securityState = newState;
313
- (_d = accessory.getService(hap.Service.SecuritySystem)) === null || _d === void 0 ? void 0 : _d.updateCharacteristic(SecuritySystemCurrentState, newState);
310
+ this.accessory.context.securityState = newState;
311
+ this.accessory.getService(this.hap.Service.SecuritySystem)?.updateCharacteristic(SecuritySystemCurrentState, newState);
314
312
  // Reset our alarm state and update our alarm switch.
315
313
  this.isAlarmTriggered = false;
316
- if (((_e = accessory.getService(hap.Service.Switch)) === null || _e === void 0 ? void 0 : _e.getCharacteristic(hap.Characteristic.On).value) !== this.isAlarmTriggered) {
317
- (_f = accessory.getService(hap.Service.Switch)) === null || _f === void 0 ? void 0 : _f.updateCharacteristic(hap.Characteristic.On, this.isAlarmTriggered);
314
+ if (this.accessory.getService(this.hap.Service.Switch)?.getCharacteristic(this.hap.Characteristic.On).value !== this.isAlarmTriggered) {
315
+ this.accessory.getService(this.hap.Service.Switch)?.updateCharacteristic(this.hap.Characteristic.On, this.isAlarmTriggered);
318
316
  }
319
317
  // Publish to MQTT, if configured.
320
318
  this.publishSecurityState();
321
319
  }
322
320
  // Set the security alarm.
323
321
  setSecurityAlarm(value) {
324
- var _a, _b;
325
322
  // Nothing to do.
326
323
  if (this.isAlarmTriggered === value) {
327
324
  return;
@@ -329,12 +326,11 @@ class ProtectSecuritySystem extends protect_accessory_1.ProtectAccessory {
329
326
  // Update the alarm state.
330
327
  this.isAlarmTriggered = value === true;
331
328
  // Update the security system state.
332
- (_a = this.accessory.getService(this.hap.Service.SecuritySystem)) === null || _a === void 0 ? void 0 : _a.updateCharacteristic(this.hap.Characteristic.SecuritySystemCurrentState, this.isAlarmTriggered ? this.hap.Characteristic.SecuritySystemCurrentState.ALARM_TRIGGERED : this.accessory.context.securityState);
329
+ this.accessory.getService(this.hap.Service.SecuritySystem)?.updateCharacteristic(this.hap.Characteristic.SecuritySystemCurrentState, this.isAlarmTriggered ? this.hap.Characteristic.SecuritySystemCurrentState.ALARM_TRIGGERED : this.accessory.context.securityState);
333
330
  // Update the security alarm state.
334
- (_b = this.accessory.getService(this.hap.Service.Switch)) === null || _b === void 0 ? void 0 : _b.updateCharacteristic(this.hap.Characteristic.On, this.isAlarmTriggered);
331
+ this.accessory.getService(this.hap.Service.Switch)?.updateCharacteristic(this.hap.Characteristic.On, this.isAlarmTriggered);
335
332
  // Publish to MQTT, if configured.
336
333
  this.publishSecurityState();
337
334
  }
338
335
  }
339
- exports.ProtectSecuritySystem = ProtectSecuritySystem;
340
336
  //# sourceMappingURL=protect-securitysystem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"protect-securitysystem.js","sourceRoot":"","sources":["../src/protect-securitysystem.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,2DAA6E;AAI7E,MAAa,qBAAsB,SAAQ,oCAAgB;IAGzD,qDAAqD;IAC3C,eAAe;;QACvB,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QACjC,IAAI,aAAa,GAAwB,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,0BAA0B,CAAC,QAAQ,CAAC;QAErG,gEAAgE;QAChE,IAAG,SAAS,CAAC,OAAO,CAAC,aAAa,KAAK,SAAS,EAAE;YAChD,aAAa,GAAG,SAAS,CAAC,OAAO,CAAC,aAAoC,CAAC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B,CAAC;CACF"}
@@ -0,0 +1,28 @@
1
+ import { PlatformAccessory } from "homebridge";
2
+ import { ProtectSensorConfig } from "unifi-protect";
3
+ import { ProtectDevice } from "./protect-device.js";
4
+ import { ProtectNvr } from "./protect-nvr.js";
5
+ export declare class ProtectSensor extends ProtectDevice {
6
+ private savedAlarmSound;
7
+ private savedContact;
8
+ ufp: ProtectSensorConfig;
9
+ constructor(nvr: ProtectNvr, device: ProtectSensorConfig, accessory: PlatformAccessory);
10
+ private configureDevice;
11
+ updateDevice(): string[];
12
+ private configureAlarmSoundSensor;
13
+ private configureAmbientLightSensor;
14
+ private configureContactSensor;
15
+ private configureHumiditySensor;
16
+ private configureTemperatureSensor;
17
+ private configureActiveStatus;
18
+ private configureBatteryStatus;
19
+ private configureTamperedStatus;
20
+ private configureStateCharacteristics;
21
+ private getAlarmSound;
22
+ private getAmbientLight;
23
+ private getContact;
24
+ private getHumidity;
25
+ private getTemperature;
26
+ private configureMqtt;
27
+ private eventHandler;
28
+ }