homebridge-securitysystem 9.1.0-beta.1 → 9.1.1-beta.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.
- package/.github/workflows/build-package.yml +15 -3
- package/.github/workflows/bump-version.yml +2 -2
- package/.github/workflows/dependency-review.yml +1 -1
- package/.github/workflows/publish-release.yml +3 -3
- package/.github/workflows/stale-activity.yml +1 -1
- package/package.json +2 -2
- package/src/index.js +43 -29
|
@@ -15,17 +15,29 @@ jobs:
|
|
|
15
15
|
build-package:
|
|
16
16
|
name: Build package
|
|
17
17
|
runs-on: ubuntu-latest
|
|
18
|
+
permissions:
|
|
19
|
+
contents: read
|
|
20
|
+
id-token: write
|
|
21
|
+
attestations: write
|
|
18
22
|
|
|
19
23
|
steps:
|
|
20
24
|
- name: Checkout repository
|
|
21
|
-
uses: actions/checkout@
|
|
25
|
+
uses: actions/checkout@v5
|
|
22
26
|
|
|
23
27
|
- name: Setup node
|
|
24
|
-
uses: actions/setup-node@
|
|
28
|
+
uses: actions/setup-node@v5
|
|
25
29
|
|
|
26
30
|
with:
|
|
27
31
|
cache: "npm"
|
|
28
32
|
registry-url: https://registry.npmjs.org/
|
|
29
33
|
|
|
30
34
|
- name: Build package
|
|
31
|
-
run:
|
|
35
|
+
run: |
|
|
36
|
+
npm ci
|
|
37
|
+
npm pack
|
|
38
|
+
|
|
39
|
+
- name: Attest build provenance
|
|
40
|
+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
|
41
|
+
uses: actions/attest-build-provenance@v3
|
|
42
|
+
with:
|
|
43
|
+
subject-path: "*.tgz"
|
|
@@ -27,10 +27,10 @@ jobs:
|
|
|
27
27
|
|
|
28
28
|
steps:
|
|
29
29
|
- name: Checkout branch
|
|
30
|
-
uses: actions/checkout@
|
|
30
|
+
uses: actions/checkout@v5
|
|
31
31
|
|
|
32
32
|
- name: Setup node
|
|
33
|
-
uses: actions/setup-node@
|
|
33
|
+
uses: actions/setup-node@v5
|
|
34
34
|
|
|
35
35
|
- name: Get next version
|
|
36
36
|
uses: MiguelRipoll23/get-next-version@v3.0.0
|
|
@@ -23,7 +23,7 @@ jobs:
|
|
|
23
23
|
|
|
24
24
|
steps:
|
|
25
25
|
- name: Checkout branch
|
|
26
|
-
uses: actions/checkout@
|
|
26
|
+
uses: actions/checkout@v5
|
|
27
27
|
|
|
28
28
|
- name: Get tag name
|
|
29
29
|
id: get-tag-name
|
|
@@ -66,10 +66,10 @@ jobs:
|
|
|
66
66
|
|
|
67
67
|
steps:
|
|
68
68
|
- name: Checkout branch
|
|
69
|
-
uses: actions/checkout@
|
|
69
|
+
uses: actions/checkout@v5
|
|
70
70
|
|
|
71
71
|
- name: Setup node
|
|
72
|
-
uses: actions/setup-node@
|
|
72
|
+
uses: actions/setup-node@v5
|
|
73
73
|
|
|
74
74
|
with:
|
|
75
75
|
registry-url: https://registry.npmjs.org/
|
|
@@ -17,7 +17,7 @@ jobs:
|
|
|
17
17
|
pull-requests: write
|
|
18
18
|
|
|
19
19
|
steps:
|
|
20
|
-
- uses: actions/stale@
|
|
20
|
+
- uses: actions/stale@v10
|
|
21
21
|
with:
|
|
22
22
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
23
23
|
stale-issue-message: "This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a few days if no further activity occurs. Thank you for your contributions."
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homebridge-securitysystem",
|
|
3
3
|
"displayName": "Homebridge Security System",
|
|
4
|
-
"version": "9.1.
|
|
4
|
+
"version": "9.1.1-beta.1",
|
|
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": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"homebridge": "^1.6.0 || ^2.0.0"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"express": "^
|
|
44
|
+
"express": "^5.1.0",
|
|
45
45
|
"node-fetch": "^2.6.7",
|
|
46
46
|
"node-persist": "^4.0.1"
|
|
47
47
|
},
|
package/src/index.js
CHANGED
|
@@ -900,7 +900,7 @@ SecuritySystem.prototype.resetUsingOffMode = function () {
|
|
|
900
900
|
this.updateTargetState(
|
|
901
901
|
Characteristic.SecuritySystemTargetState.DISARM,
|
|
902
902
|
originTypes.INTERNAL,
|
|
903
|
-
|
|
903
|
+
0,
|
|
904
904
|
null
|
|
905
905
|
);
|
|
906
906
|
|
|
@@ -908,7 +908,7 @@ SecuritySystem.prototype.resetUsingOffMode = function () {
|
|
|
908
908
|
this.updateTargetState(
|
|
909
909
|
originalTargetState,
|
|
910
910
|
originTypes.INTERNAL,
|
|
911
|
-
|
|
911
|
+
this.getArmingSeconds(originalTargetState),
|
|
912
912
|
null
|
|
913
913
|
);
|
|
914
914
|
}, 100);
|
|
@@ -1077,18 +1077,13 @@ SecuritySystem.prototype.updateTargetState = function (
|
|
|
1077
1077
|
}
|
|
1078
1078
|
|
|
1079
1079
|
// Set arming delay
|
|
1080
|
-
|
|
1080
|
+
const armSeconds = Number(delay) || 0;
|
|
1081
1081
|
|
|
1082
|
-
if (
|
|
1083
|
-
|
|
1082
|
+
if (armSeconds > 0) {
|
|
1083
|
+
this.handleArmingState();
|
|
1084
1084
|
|
|
1085
|
-
//
|
|
1086
|
-
|
|
1087
|
-
this.handleArmingState();
|
|
1088
|
-
|
|
1089
|
-
// Log
|
|
1090
|
-
this.log.info("Arm delay (" + armSeconds + " second/s)");
|
|
1091
|
-
}
|
|
1085
|
+
// Log
|
|
1086
|
+
this.log.info("Arm delay (" + armSeconds + " second/s)");
|
|
1092
1087
|
}
|
|
1093
1088
|
|
|
1094
1089
|
// Arm the security system
|
|
@@ -1105,14 +1100,17 @@ SecuritySystem.prototype.updateTargetState = function (
|
|
|
1105
1100
|
return true;
|
|
1106
1101
|
};
|
|
1107
1102
|
|
|
1108
|
-
SecuritySystem.prototype.getArmingSeconds = function () {
|
|
1103
|
+
SecuritySystem.prototype.getArmingSeconds = function (state) {
|
|
1104
|
+
const targetState =
|
|
1105
|
+
typeof state === "number" ? state : this.targetState;
|
|
1106
|
+
|
|
1109
1107
|
let armSeconds = options.armSeconds;
|
|
1110
1108
|
|
|
1111
1109
|
const isCurrentStateAlarmTriggered =
|
|
1112
1110
|
this.currentState ===
|
|
1113
1111
|
Characteristic.SecuritySystemCurrentState.ALARM_TRIGGERED;
|
|
1114
1112
|
const isTargetStateDisarm =
|
|
1115
|
-
|
|
1113
|
+
targetState === Characteristic.SecuritySystemTargetState.DISARM;
|
|
1116
1114
|
|
|
1117
1115
|
// No delay when triggered or set to Off
|
|
1118
1116
|
if (isCurrentStateAlarmTriggered || isTargetStateDisarm) {
|
|
@@ -1120,11 +1118,11 @@ SecuritySystem.prototype.getArmingSeconds = function () {
|
|
|
1120
1118
|
}
|
|
1121
1119
|
|
|
1122
1120
|
const isTargetStateHome =
|
|
1123
|
-
|
|
1121
|
+
targetState === Characteristic.SecuritySystemTargetState.STAY_ARM;
|
|
1124
1122
|
const isTargetStateAway =
|
|
1125
|
-
|
|
1123
|
+
targetState === Characteristic.SecuritySystemTargetState.AWAY_ARM;
|
|
1126
1124
|
const isTargetStateNight =
|
|
1127
|
-
|
|
1125
|
+
targetState === Characteristic.SecuritySystemTargetState.NIGHT_ARM;
|
|
1128
1126
|
|
|
1129
1127
|
// Custom mode seconds
|
|
1130
1128
|
if (isTargetStateHome && options.isValueSet(options.homeArmSeconds)) {
|
|
@@ -1154,7 +1152,12 @@ SecuritySystem.prototype.getTargetState = function (callback) {
|
|
|
1154
1152
|
};
|
|
1155
1153
|
|
|
1156
1154
|
SecuritySystem.prototype.setTargetState = function (value, callback) {
|
|
1157
|
-
this.updateTargetState(
|
|
1155
|
+
this.updateTargetState(
|
|
1156
|
+
value,
|
|
1157
|
+
originTypes.REGULAR_SWITCH,
|
|
1158
|
+
this.getArmingSeconds(value),
|
|
1159
|
+
callback
|
|
1160
|
+
);
|
|
1158
1161
|
};
|
|
1159
1162
|
|
|
1160
1163
|
SecuritySystem.prototype.updateTripSwitch = function (
|
|
@@ -1369,7 +1372,7 @@ SecuritySystem.prototype.updateTripSwitch = function (
|
|
|
1369
1372
|
this.updateTargetState(
|
|
1370
1373
|
Characteristic.SecuritySystemTargetState.DISARM,
|
|
1371
1374
|
originTypes.INTERNAL,
|
|
1372
|
-
|
|
1375
|
+
0,
|
|
1373
1376
|
null
|
|
1374
1377
|
);
|
|
1375
1378
|
}
|
|
@@ -1432,7 +1435,13 @@ SecuritySystem.prototype.isAuthenticated = function (req, res) {
|
|
|
1432
1435
|
};
|
|
1433
1436
|
|
|
1434
1437
|
SecuritySystem.prototype.getDelayParameter = function (req) {
|
|
1435
|
-
|
|
1438
|
+
const value = parseInt(req.query.delay, 10);
|
|
1439
|
+
|
|
1440
|
+
if (Number.isNaN(value) || value < 0) {
|
|
1441
|
+
return 0;
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
return value;
|
|
1436
1445
|
};
|
|
1437
1446
|
|
|
1438
1447
|
SecuritySystem.prototype.sendCodeRequiredError = function (res) {
|
|
@@ -1498,7 +1507,7 @@ SecuritySystem.prototype.startServer = async function () {
|
|
|
1498
1507
|
|
|
1499
1508
|
let result = true;
|
|
1500
1509
|
|
|
1501
|
-
if (this.getDelayParameter(req)) {
|
|
1510
|
+
if (this.getDelayParameter(req) > 0) {
|
|
1502
1511
|
// Delay
|
|
1503
1512
|
result = this.updateTripSwitch(true, originTypes.EXTERNAL, false, null);
|
|
1504
1513
|
} else {
|
|
@@ -2264,7 +2273,7 @@ SecuritySystem.prototype.setModeHomeSwitch = function (value, callback) {
|
|
|
2264
2273
|
this.updateTargetState(
|
|
2265
2274
|
Characteristic.SecuritySystemTargetState.STAY_ARM,
|
|
2266
2275
|
originTypes.INTERNAL,
|
|
2267
|
-
|
|
2276
|
+
this.getArmingSeconds(Characteristic.SecuritySystemTargetState.STAY_ARM),
|
|
2268
2277
|
null
|
|
2269
2278
|
);
|
|
2270
2279
|
callback(null);
|
|
@@ -2286,7 +2295,7 @@ SecuritySystem.prototype.setModeAwaySwitch = function (value, callback) {
|
|
|
2286
2295
|
this.updateTargetState(
|
|
2287
2296
|
Characteristic.SecuritySystemTargetState.AWAY_ARM,
|
|
2288
2297
|
originTypes.INTERNAL,
|
|
2289
|
-
|
|
2298
|
+
this.getArmingSeconds(Characteristic.SecuritySystemTargetState.AWAY_ARM),
|
|
2290
2299
|
null
|
|
2291
2300
|
);
|
|
2292
2301
|
callback(null);
|
|
@@ -2308,7 +2317,7 @@ SecuritySystem.prototype.setModeNightSwitch = function (value, callback) {
|
|
|
2308
2317
|
this.updateTargetState(
|
|
2309
2318
|
Characteristic.SecuritySystemTargetState.NIGHT_ARM,
|
|
2310
2319
|
originTypes.INTERNAL,
|
|
2311
|
-
|
|
2320
|
+
this.getArmingSeconds(Characteristic.SecuritySystemTargetState.NIGHT_ARM),
|
|
2312
2321
|
null
|
|
2313
2322
|
);
|
|
2314
2323
|
callback(null);
|
|
@@ -2330,7 +2339,7 @@ SecuritySystem.prototype.setModeOffSwitch = function (value, callback) {
|
|
|
2330
2339
|
this.updateTargetState(
|
|
2331
2340
|
Characteristic.SecuritySystemTargetState.DISARM,
|
|
2332
2341
|
originTypes.INTERNAL,
|
|
2333
|
-
|
|
2342
|
+
0,
|
|
2334
2343
|
null
|
|
2335
2344
|
);
|
|
2336
2345
|
callback(null);
|
|
@@ -2355,7 +2364,7 @@ SecuritySystem.prototype.setModeAwayExtendedSwitch = function (
|
|
|
2355
2364
|
this.updateTargetState(
|
|
2356
2365
|
Characteristic.SecuritySystemTargetState.AWAY_ARM,
|
|
2357
2366
|
originTypes.INTERNAL,
|
|
2358
|
-
|
|
2367
|
+
this.getArmingSeconds(Characteristic.SecuritySystemTargetState.AWAY_ARM),
|
|
2359
2368
|
null
|
|
2360
2369
|
);
|
|
2361
2370
|
callback(null);
|
|
@@ -2393,7 +2402,7 @@ SecuritySystem.prototype.setModePauseSwitch = function (value, callback) {
|
|
|
2393
2402
|
this.updateTargetState(
|
|
2394
2403
|
Characteristic.SecuritySystemTargetState.DISARM,
|
|
2395
2404
|
originTypes.INTERNAL,
|
|
2396
|
-
|
|
2405
|
+
0,
|
|
2397
2406
|
null
|
|
2398
2407
|
);
|
|
2399
2408
|
|
|
@@ -2401,7 +2410,12 @@ SecuritySystem.prototype.setModePauseSwitch = function (value, callback) {
|
|
|
2401
2410
|
if (options.pauseMinutes !== 0) {
|
|
2402
2411
|
this.pauseTimeout = setTimeout(() => {
|
|
2403
2412
|
this.log.info("Mode pause (Finished)");
|
|
2404
|
-
this.
|
|
2413
|
+
this.updateTargetState(
|
|
2414
|
+
this.pausedCurrentState,
|
|
2415
|
+
originTypes.INTERNAL,
|
|
2416
|
+
this.getArmingSeconds(this.pausedCurrentState),
|
|
2417
|
+
null
|
|
2418
|
+
);
|
|
2405
2419
|
}, options.pauseMinutes * 60 * 1000);
|
|
2406
2420
|
}
|
|
2407
2421
|
} else {
|
|
@@ -2415,7 +2429,7 @@ SecuritySystem.prototype.setModePauseSwitch = function (value, callback) {
|
|
|
2415
2429
|
this.updateTargetState(
|
|
2416
2430
|
this.pausedCurrentState,
|
|
2417
2431
|
originTypes.INTERNAL,
|
|
2418
|
-
|
|
2432
|
+
this.getArmingSeconds(this.pausedCurrentState),
|
|
2419
2433
|
null
|
|
2420
2434
|
);
|
|
2421
2435
|
}
|