homebridge-securitysystem 9.1.0 → 9.1.1-beta.2
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 +3 -3
- package/src/index.js +43 -36
|
@@ -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@v6
|
|
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@v6
|
|
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@v6
|
|
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.2",
|
|
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": {
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
}
|
|
38
38
|
],
|
|
39
39
|
"engines": {
|
|
40
|
-
"node": "^18.15.0 || ^20.7.0 || ^22",
|
|
40
|
+
"node": "^18.15.0 || ^20.7.0 || ^22 || ^24",
|
|
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,16 @@ 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 = typeof state === "number" ? state : this.targetState;
|
|
1105
|
+
|
|
1109
1106
|
let armSeconds = options.armSeconds;
|
|
1110
1107
|
|
|
1111
1108
|
const isCurrentStateAlarmTriggered =
|
|
1112
1109
|
this.currentState ===
|
|
1113
1110
|
Characteristic.SecuritySystemCurrentState.ALARM_TRIGGERED;
|
|
1114
1111
|
const isTargetStateDisarm =
|
|
1115
|
-
|
|
1112
|
+
targetState === Characteristic.SecuritySystemTargetState.DISARM;
|
|
1116
1113
|
|
|
1117
1114
|
// No delay when triggered or set to Off
|
|
1118
1115
|
if (isCurrentStateAlarmTriggered || isTargetStateDisarm) {
|
|
@@ -1120,11 +1117,11 @@ SecuritySystem.prototype.getArmingSeconds = function () {
|
|
|
1120
1117
|
}
|
|
1121
1118
|
|
|
1122
1119
|
const isTargetStateHome =
|
|
1123
|
-
|
|
1120
|
+
targetState === Characteristic.SecuritySystemTargetState.STAY_ARM;
|
|
1124
1121
|
const isTargetStateAway =
|
|
1125
|
-
|
|
1122
|
+
targetState === Characteristic.SecuritySystemTargetState.AWAY_ARM;
|
|
1126
1123
|
const isTargetStateNight =
|
|
1127
|
-
|
|
1124
|
+
targetState === Characteristic.SecuritySystemTargetState.NIGHT_ARM;
|
|
1128
1125
|
|
|
1129
1126
|
// Custom mode seconds
|
|
1130
1127
|
if (isTargetStateHome && options.isValueSet(options.homeArmSeconds)) {
|
|
@@ -1154,7 +1151,12 @@ SecuritySystem.prototype.getTargetState = function (callback) {
|
|
|
1154
1151
|
};
|
|
1155
1152
|
|
|
1156
1153
|
SecuritySystem.prototype.setTargetState = function (value, callback) {
|
|
1157
|
-
this.updateTargetState(
|
|
1154
|
+
this.updateTargetState(
|
|
1155
|
+
value,
|
|
1156
|
+
originTypes.REGULAR_SWITCH,
|
|
1157
|
+
this.getArmingSeconds(value),
|
|
1158
|
+
callback
|
|
1159
|
+
);
|
|
1158
1160
|
};
|
|
1159
1161
|
|
|
1160
1162
|
SecuritySystem.prototype.updateTripSwitch = function (
|
|
@@ -1369,7 +1371,7 @@ SecuritySystem.prototype.updateTripSwitch = function (
|
|
|
1369
1371
|
this.updateTargetState(
|
|
1370
1372
|
Characteristic.SecuritySystemTargetState.DISARM,
|
|
1371
1373
|
originTypes.INTERNAL,
|
|
1372
|
-
|
|
1374
|
+
0,
|
|
1373
1375
|
null
|
|
1374
1376
|
);
|
|
1375
1377
|
}
|
|
@@ -1432,7 +1434,13 @@ SecuritySystem.prototype.isAuthenticated = function (req, res) {
|
|
|
1432
1434
|
};
|
|
1433
1435
|
|
|
1434
1436
|
SecuritySystem.prototype.getDelayParameter = function (req) {
|
|
1435
|
-
|
|
1437
|
+
const value = parseInt(req.query.delay, 10);
|
|
1438
|
+
|
|
1439
|
+
if (Number.isNaN(value) || value < 0) {
|
|
1440
|
+
return 0;
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
return value;
|
|
1436
1444
|
};
|
|
1437
1445
|
|
|
1438
1446
|
SecuritySystem.prototype.sendCodeRequiredError = function (res) {
|
|
@@ -1498,7 +1506,7 @@ SecuritySystem.prototype.startServer = async function () {
|
|
|
1498
1506
|
|
|
1499
1507
|
let result = true;
|
|
1500
1508
|
|
|
1501
|
-
if (this.getDelayParameter(req)) {
|
|
1509
|
+
if (this.getDelayParameter(req) > 0) {
|
|
1502
1510
|
// Delay
|
|
1503
1511
|
result = this.updateTripSwitch(true, originTypes.EXTERNAL, false, null);
|
|
1504
1512
|
} else {
|
|
@@ -1578,13 +1586,7 @@ SecuritySystem.prototype.startServer = async function () {
|
|
|
1578
1586
|
}
|
|
1579
1587
|
|
|
1580
1588
|
const state = Characteristic.SecuritySystemTargetState.DISARM;
|
|
1581
|
-
const
|
|
1582
|
-
const result = this.updateTargetState(
|
|
1583
|
-
state,
|
|
1584
|
-
originTypes.EXTERNAL,
|
|
1585
|
-
delay,
|
|
1586
|
-
null
|
|
1587
|
-
);
|
|
1589
|
+
const result = this.updateTargetState(state, originTypes.EXTERNAL, 0, null);
|
|
1588
1590
|
|
|
1589
1591
|
this.sendResultResponse(res, result);
|
|
1590
1592
|
});
|
|
@@ -2264,7 +2266,7 @@ SecuritySystem.prototype.setModeHomeSwitch = function (value, callback) {
|
|
|
2264
2266
|
this.updateTargetState(
|
|
2265
2267
|
Characteristic.SecuritySystemTargetState.STAY_ARM,
|
|
2266
2268
|
originTypes.INTERNAL,
|
|
2267
|
-
|
|
2269
|
+
this.getArmingSeconds(Characteristic.SecuritySystemTargetState.STAY_ARM),
|
|
2268
2270
|
null
|
|
2269
2271
|
);
|
|
2270
2272
|
callback(null);
|
|
@@ -2286,7 +2288,7 @@ SecuritySystem.prototype.setModeAwaySwitch = function (value, callback) {
|
|
|
2286
2288
|
this.updateTargetState(
|
|
2287
2289
|
Characteristic.SecuritySystemTargetState.AWAY_ARM,
|
|
2288
2290
|
originTypes.INTERNAL,
|
|
2289
|
-
|
|
2291
|
+
this.getArmingSeconds(Characteristic.SecuritySystemTargetState.AWAY_ARM),
|
|
2290
2292
|
null
|
|
2291
2293
|
);
|
|
2292
2294
|
callback(null);
|
|
@@ -2308,7 +2310,7 @@ SecuritySystem.prototype.setModeNightSwitch = function (value, callback) {
|
|
|
2308
2310
|
this.updateTargetState(
|
|
2309
2311
|
Characteristic.SecuritySystemTargetState.NIGHT_ARM,
|
|
2310
2312
|
originTypes.INTERNAL,
|
|
2311
|
-
|
|
2313
|
+
this.getArmingSeconds(Characteristic.SecuritySystemTargetState.NIGHT_ARM),
|
|
2312
2314
|
null
|
|
2313
2315
|
);
|
|
2314
2316
|
callback(null);
|
|
@@ -2330,7 +2332,7 @@ SecuritySystem.prototype.setModeOffSwitch = function (value, callback) {
|
|
|
2330
2332
|
this.updateTargetState(
|
|
2331
2333
|
Characteristic.SecuritySystemTargetState.DISARM,
|
|
2332
2334
|
originTypes.INTERNAL,
|
|
2333
|
-
|
|
2335
|
+
0,
|
|
2334
2336
|
null
|
|
2335
2337
|
);
|
|
2336
2338
|
callback(null);
|
|
@@ -2355,7 +2357,7 @@ SecuritySystem.prototype.setModeAwayExtendedSwitch = function (
|
|
|
2355
2357
|
this.updateTargetState(
|
|
2356
2358
|
Characteristic.SecuritySystemTargetState.AWAY_ARM,
|
|
2357
2359
|
originTypes.INTERNAL,
|
|
2358
|
-
|
|
2360
|
+
this.getArmingSeconds(Characteristic.SecuritySystemTargetState.AWAY_ARM),
|
|
2359
2361
|
null
|
|
2360
2362
|
);
|
|
2361
2363
|
callback(null);
|
|
@@ -2393,7 +2395,7 @@ SecuritySystem.prototype.setModePauseSwitch = function (value, callback) {
|
|
|
2393
2395
|
this.updateTargetState(
|
|
2394
2396
|
Characteristic.SecuritySystemTargetState.DISARM,
|
|
2395
2397
|
originTypes.INTERNAL,
|
|
2396
|
-
|
|
2398
|
+
0,
|
|
2397
2399
|
null
|
|
2398
2400
|
);
|
|
2399
2401
|
|
|
@@ -2401,7 +2403,12 @@ SecuritySystem.prototype.setModePauseSwitch = function (value, callback) {
|
|
|
2401
2403
|
if (options.pauseMinutes !== 0) {
|
|
2402
2404
|
this.pauseTimeout = setTimeout(() => {
|
|
2403
2405
|
this.log.info("Mode pause (Finished)");
|
|
2404
|
-
this.
|
|
2406
|
+
this.updateTargetState(
|
|
2407
|
+
this.pausedCurrentState,
|
|
2408
|
+
originTypes.INTERNAL,
|
|
2409
|
+
this.getArmingSeconds(this.pausedCurrentState),
|
|
2410
|
+
null
|
|
2411
|
+
);
|
|
2405
2412
|
}, options.pauseMinutes * 60 * 1000);
|
|
2406
2413
|
}
|
|
2407
2414
|
} else {
|
|
@@ -2415,7 +2422,7 @@ SecuritySystem.prototype.setModePauseSwitch = function (value, callback) {
|
|
|
2415
2422
|
this.updateTargetState(
|
|
2416
2423
|
this.pausedCurrentState,
|
|
2417
2424
|
originTypes.INTERNAL,
|
|
2418
|
-
|
|
2425
|
+
this.getArmingSeconds(this.pausedCurrentState),
|
|
2419
2426
|
null
|
|
2420
2427
|
);
|
|
2421
2428
|
}
|