homebridge-securitysystem 7.0.0-beta.2 → 7.0.0-beta.3
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.
- package/.vscode/settings.json +8 -2
- package/README.md +2 -0
- package/package.json +1 -1
- package/src/index.js +71 -9
package/.vscode/settings.json
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"javascript.inlayHints.parameterNames.enabled": "all",
|
|
3
3
|
"editor.bracketPairColorization.enabled": true,
|
|
4
|
-
"editor.guides.bracketPairs": true
|
|
5
|
-
|
|
4
|
+
"editor.guides.bracketPairs": true,
|
|
5
|
+
"editor.formatOnSave": true,
|
|
6
|
+
"editor.formatOnPaste": true,
|
|
7
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
8
|
+
"[javascript]": {
|
|
9
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
10
|
+
}
|
|
11
|
+
}
|
package/README.md
CHANGED
|
@@ -14,6 +14,8 @@ If you already have [Homebridge](https://github.com/homebridge/homebridge) insta
|
|
|
14
14
|
|
|
15
15
|
`npm i -g --unsafe-perm homebridge-securitysystem`
|
|
16
16
|
|
|
17
|
+
During accessory setup, when asked the name of the accessories tap the close button on the upper right to exit setup and use the accessory names provided by the plugin.
|
|
18
|
+
|
|
17
19
|
## Demo
|
|
18
20
|
|
|
19
21
|
<div align="left">
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homebridge-securitysystem",
|
|
3
3
|
"displayName": "Homebridge Security System",
|
|
4
|
-
"version": "7.0.0-beta.
|
|
4
|
+
"version": "7.0.0-beta.3",
|
|
5
5
|
"description": "Homebridge plugin that creates a security system accessory that can be triggered by HomeKit sensors.",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"scripts": {
|
package/src/index.js
CHANGED
|
@@ -158,8 +158,10 @@ function SecuritySystem(log, config) {
|
|
|
158
158
|
|
|
159
159
|
// Trip switches
|
|
160
160
|
this.tripSwitchService = new Service.Switch("Trip", "siren-switch");
|
|
161
|
+
this.tripSwitchService.addCharacteristic(Characteristic.ConfiguredName);
|
|
161
162
|
|
|
162
163
|
this.tripSwitchService
|
|
164
|
+
.setCharacteristic(Characteristic.ConfiguredName, "Trip")
|
|
163
165
|
.getCharacteristic(Characteristic.On)
|
|
164
166
|
.on("get", this.getTripSwitch.bind(this))
|
|
165
167
|
.on("set", this.setTripSwitch.bind(this));
|
|
@@ -169,31 +171,39 @@ function SecuritySystem(log, config) {
|
|
|
169
171
|
"BdW9ce0mUYatqiRqEjT4iA"
|
|
170
172
|
);
|
|
171
173
|
|
|
174
|
+
this.tripOverrideSwitchService.addCharacteristic(
|
|
175
|
+
Characteristic.ConfiguredName
|
|
176
|
+
);
|
|
177
|
+
|
|
172
178
|
this.tripOverrideSwitchService
|
|
179
|
+
.setCharacteristic(Characteristic.ConfiguredName, "Trip Override")
|
|
173
180
|
.getCharacteristic(Characteristic.On)
|
|
174
181
|
.on("get", this.getTripOverrideSwitch.bind(this))
|
|
175
182
|
.on("set", this.setTripOverrideSwitch.bind(this));
|
|
176
183
|
|
|
177
184
|
this.tripHomeSwitchService = new Service.Switch("Trip Home", "siren-home");
|
|
185
|
+
this.tripHomeSwitchService.addCharacteristic(Characteristic.ConfiguredName);
|
|
178
186
|
|
|
179
187
|
this.tripHomeSwitchService
|
|
188
|
+
.setCharacteristic(Characteristic.ConfiguredName, "Trip Home")
|
|
180
189
|
.getCharacteristic(Characteristic.On)
|
|
181
190
|
.on("get", this.getTripHomeSwitch.bind(this))
|
|
182
191
|
.on("set", this.setTripHomeSwitch.bind(this));
|
|
183
192
|
|
|
184
193
|
this.tripAwaySwitchService = new Service.Switch("Trip Away", "siren-away");
|
|
194
|
+
this.tripAwaySwitchService.addCharacteristic(Characteristic.ConfiguredName);
|
|
185
195
|
|
|
186
196
|
this.tripAwaySwitchService
|
|
187
197
|
.getCharacteristic(Characteristic.On)
|
|
188
198
|
.on("get", this.getTripAwaySwitch.bind(this))
|
|
189
199
|
.on("set", this.setTripAwaySwitch.bind(this));
|
|
190
200
|
|
|
191
|
-
this.tripNightSwitchService = new Service.Switch(
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
);
|
|
201
|
+
this.tripNightSwitchService = new Service.Switch("Trip Night", "siren-night");
|
|
202
|
+
|
|
203
|
+
this.tripNightSwitchService.addCharacteristic(Characteristic.ConfiguredName);
|
|
195
204
|
|
|
196
205
|
this.tripNightSwitchService
|
|
206
|
+
.setCharacteristic(Characteristic.ConfiguredName, "Trip Night")
|
|
197
207
|
.getCharacteristic(Characteristic.On)
|
|
198
208
|
.on("get", this.getTripNightSwitch.bind(this))
|
|
199
209
|
.on("set", this.setTripNightSwitch.bind(this));
|
|
@@ -204,7 +214,10 @@ function SecuritySystem(log, config) {
|
|
|
204
214
|
"arming-lock"
|
|
205
215
|
);
|
|
206
216
|
|
|
217
|
+
this.armingLockSwitchService.addCharacteristic(Characteristic.ConfiguredName);
|
|
218
|
+
|
|
207
219
|
this.armingLockSwitchService
|
|
220
|
+
.setCharacteristic(Characteristic.ConfiguredName, "Arming Lock")
|
|
208
221
|
.getCharacteristic(Characteristic.On)
|
|
209
222
|
.on("get", this.getArmingLockSwitch.bind(this))
|
|
210
223
|
.on("set", this.setArmingLockSwitch.bind(this));
|
|
@@ -214,7 +227,12 @@ function SecuritySystem(log, config) {
|
|
|
214
227
|
"arming-lock-home"
|
|
215
228
|
);
|
|
216
229
|
|
|
230
|
+
this.armingLockHomeSwitchService.addCharacteristic(
|
|
231
|
+
Characteristic.ConfiguredName
|
|
232
|
+
);
|
|
233
|
+
|
|
217
234
|
this.armingLockHomeSwitchService
|
|
235
|
+
.setCharacteristic(Characteristic.ConfiguredName, "Arming Lock Home")
|
|
218
236
|
.getCharacteristic(Characteristic.On)
|
|
219
237
|
.on("get", this.getArmingLockHomeSwitch.bind(this))
|
|
220
238
|
.on("set", this.setArmingLockHomeSwitch.bind(this));
|
|
@@ -224,7 +242,12 @@ function SecuritySystem(log, config) {
|
|
|
224
242
|
"arming-lock-away"
|
|
225
243
|
);
|
|
226
244
|
|
|
245
|
+
this.armingLockAwaySwitchService.addCharacteristic(
|
|
246
|
+
Characteristic.ConfiguredName
|
|
247
|
+
);
|
|
248
|
+
|
|
227
249
|
this.armingLockAwaySwitchService
|
|
250
|
+
.setCharacteristic(Characteristic.ConfiguredName, "Arming Lock Away")
|
|
228
251
|
.getCharacteristic(Characteristic.On)
|
|
229
252
|
.on("get", this.getArmingLockAwaySwitch.bind(this))
|
|
230
253
|
.on("set", this.setArmingLockAwaySwitch.bind(this));
|
|
@@ -234,36 +257,49 @@ function SecuritySystem(log, config) {
|
|
|
234
257
|
"arming-lock-night"
|
|
235
258
|
);
|
|
236
259
|
|
|
260
|
+
this.armingLockNightSwitchService.addCharacteristic(
|
|
261
|
+
Characteristic.ConfiguredName
|
|
262
|
+
);
|
|
263
|
+
|
|
237
264
|
this.armingLockNightSwitchService
|
|
265
|
+
.setCharacteristic(Characteristic.ConfiguredName, "Arming Lock Night")
|
|
238
266
|
.getCharacteristic(Characteristic.On)
|
|
239
267
|
.on("get", this.getArmingLockNightSwitch.bind(this))
|
|
240
268
|
.on("set", this.setArmingLockNightSwitch.bind(this));
|
|
241
269
|
|
|
242
270
|
// Mode switches
|
|
243
271
|
this.modeHomeSwitchService = new Service.Switch("Mode Home", "mode-home");
|
|
272
|
+
this.modeHomeSwitchService.addCharacteristic(Characteristic.ConfiguredName);
|
|
244
273
|
|
|
245
274
|
this.modeHomeSwitchService
|
|
275
|
+
.setCharacteristic(Characteristic.ConfiguredName, "Mode Home")
|
|
246
276
|
.getCharacteristic(Characteristic.On)
|
|
247
277
|
.on("get", this.getModeHomeSwitch.bind(this))
|
|
248
278
|
.on("set", this.setModeHomeSwitch.bind(this));
|
|
249
279
|
|
|
250
280
|
this.modeAwaySwitchService = new Service.Switch("Mode Away", "mode-away");
|
|
281
|
+
this.modeAwaySwitchService.addCharacteristic(Characteristic.ConfiguredName);
|
|
251
282
|
|
|
252
283
|
this.modeAwaySwitchService
|
|
284
|
+
.setCharacteristic(Characteristic.ConfiguredName, "Mode Away")
|
|
253
285
|
.getCharacteristic(Characteristic.On)
|
|
254
286
|
.on("get", this.getModeAwaySwitch.bind(this))
|
|
255
287
|
.on("set", this.setModeAwaySwitch.bind(this));
|
|
256
288
|
|
|
257
289
|
this.modeNightSwitchService = new Service.Switch("Mode Night", "mode-night");
|
|
290
|
+
this.modeNightSwitchService.addCharacteristic(Characteristic.ConfiguredName);
|
|
258
291
|
|
|
259
292
|
this.modeNightSwitchService
|
|
293
|
+
.setCharacteristic(Characteristic.ConfiguredName, "Mode Night")
|
|
260
294
|
.getCharacteristic(Characteristic.On)
|
|
261
295
|
.on("get", this.getModeNightSwitch.bind(this))
|
|
262
296
|
.on("set", this.setModeNightSwitch.bind(this));
|
|
263
297
|
|
|
264
298
|
this.modeOffSwitchService = new Service.Switch("Mode Off", "mode-off");
|
|
299
|
+
this.modeOffSwitchService.addCharacteristic(Characteristic.ConfiguredName);
|
|
265
300
|
|
|
266
301
|
this.modeOffSwitchService
|
|
302
|
+
.setCharacteristic(Characteristic.ConfiguredName, "Mode Off")
|
|
267
303
|
.getCharacteristic(Characteristic.On)
|
|
268
304
|
.on("get", this.getModeOffSwitch.bind(this))
|
|
269
305
|
.on("set", this.setModeOffSwitch.bind(this));
|
|
@@ -273,14 +309,21 @@ function SecuritySystem(log, config) {
|
|
|
273
309
|
"mode-away-extended"
|
|
274
310
|
);
|
|
275
311
|
|
|
312
|
+
this.modeAwayExtendedSwitchService.addCharacteristic(
|
|
313
|
+
Characteristic.ConfiguredName
|
|
314
|
+
);
|
|
315
|
+
|
|
276
316
|
this.modeAwayExtendedSwitchService
|
|
317
|
+
.setCharacteristic(Characteristic.ConfiguredName, "Mode Away Extended")
|
|
277
318
|
.getCharacteristic(Characteristic.On)
|
|
278
319
|
.on("get", this.getModeAwayExtendedSwitch.bind(this))
|
|
279
320
|
.on("set", this.setModeAwayExtendedSwitch.bind(this));
|
|
280
321
|
|
|
281
322
|
this.modePauseSwitchService = new Service.Switch("Mode Pause", "mode-pause");
|
|
323
|
+
this.modePauseSwitchService.addCharacteristic(Characteristic.ConfiguredName);
|
|
282
324
|
|
|
283
325
|
this.modePauseSwitchService
|
|
326
|
+
.setCharacteristic(Characteristic.ConfiguredName, "Mode Pause")
|
|
284
327
|
.getCharacteristic(Characteristic.On)
|
|
285
328
|
.on("get", this.getModePauseSwitch.bind(this))
|
|
286
329
|
.on("set", this.setModePauseSwitch.bind(this));
|
|
@@ -291,7 +334,10 @@ function SecuritySystem(log, config) {
|
|
|
291
334
|
"kx82r64zN3txDXKFiX9JDi"
|
|
292
335
|
);
|
|
293
336
|
|
|
337
|
+
this.audioSwitchService.addCharacteristic(Characteristic.ConfiguredName);
|
|
338
|
+
|
|
294
339
|
this.audioSwitchService
|
|
340
|
+
.setCharacteristic(Characteristic.ConfiguredName, "Audio")
|
|
295
341
|
.getCharacteristic(Characteristic.On)
|
|
296
342
|
.on("get", this.getAudioSwitch.bind(this))
|
|
297
343
|
.on("set", this.setAudioSwitch.bind(this));
|
|
@@ -304,7 +350,12 @@ function SecuritySystem(log, config) {
|
|
|
304
350
|
"siren-tripped"
|
|
305
351
|
);
|
|
306
352
|
|
|
353
|
+
this.trippedMotionSensorService.addCharacteristic(
|
|
354
|
+
Characteristic.ConfiguredName
|
|
355
|
+
);
|
|
356
|
+
|
|
307
357
|
this.trippedMotionSensorService
|
|
358
|
+
.setCharacteristic(Characteristic.ConfiguredName, "Tripped")
|
|
308
359
|
.getCharacteristic(Characteristic.MotionDetected)
|
|
309
360
|
.on("get", this.getTrippedMotionDetected.bind(this));
|
|
310
361
|
|
|
@@ -313,7 +364,12 @@ function SecuritySystem(log, config) {
|
|
|
313
364
|
"siren-triggered"
|
|
314
365
|
);
|
|
315
366
|
|
|
367
|
+
this.triggeredMotionSensorService.addCharacteristic(
|
|
368
|
+
Characteristic.ConfiguredName
|
|
369
|
+
);
|
|
370
|
+
|
|
316
371
|
this.triggeredMotionSensorService
|
|
372
|
+
.setCharacteristic(Characteristic.ConfiguredName, "Triggered")
|
|
317
373
|
.getCharacteristic(Characteristic.MotionDetected)
|
|
318
374
|
.on("get", this.getTriggeredMotionDetected.bind(this));
|
|
319
375
|
|
|
@@ -322,7 +378,12 @@ function SecuritySystem(log, config) {
|
|
|
322
378
|
"reset-event"
|
|
323
379
|
);
|
|
324
380
|
|
|
381
|
+
this.triggeredResetMotionSensorService.addOptionalCharacteristic(
|
|
382
|
+
Characteristic.ConfiguredName
|
|
383
|
+
);
|
|
384
|
+
|
|
325
385
|
this.triggeredResetMotionSensorService
|
|
386
|
+
.setCharacteristic(Characteristic.ConfiguredName, "Triggered Reset")
|
|
326
387
|
.getCharacteristic(Characteristic.MotionDetected)
|
|
327
388
|
.on("get", this.getTriggeredResetMotionDetected.bind(this));
|
|
328
389
|
|
|
@@ -1048,7 +1109,6 @@ SecuritySystem.prototype.updateTripSwitch = function (
|
|
|
1048
1109
|
}, doubleKnockSeconds * 1000);
|
|
1049
1110
|
|
|
1050
1111
|
if (callback !== null) {
|
|
1051
|
-
|
|
1052
1112
|
callback(HK_NOT_ALLOWED_IN_CURRENT_STATE, false);
|
|
1053
1113
|
}
|
|
1054
1114
|
|
|
@@ -1759,10 +1819,12 @@ SecuritySystem.prototype.setTripOverrideSwitch = function (value, callback) {
|
|
|
1759
1819
|
};
|
|
1760
1820
|
|
|
1761
1821
|
SecuritySystem.prototype.resetTripSwitches = function () {
|
|
1762
|
-
const tripHomeOnCharacteristic =
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1822
|
+
const tripHomeOnCharacteristic = this.tripHomeSwitchService.getCharacteristic(
|
|
1823
|
+
Characteristic.On
|
|
1824
|
+
);
|
|
1825
|
+
const tripAwayOnCharacteristic = this.tripAwaySwitchService.getCharacteristic(
|
|
1826
|
+
Characteristic.On
|
|
1827
|
+
);
|
|
1766
1828
|
const tripNightOnCharacteristic =
|
|
1767
1829
|
this.tripNightSwitchService.getCharacteristic(Characteristic.On);
|
|
1768
1830
|
|