homebridge-securitysystem 8.0.1 → 8.1.0-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.
|
@@ -30,7 +30,7 @@ jobs:
|
|
|
30
30
|
uses: actions/checkout@v4
|
|
31
31
|
|
|
32
32
|
- name: Create tag name
|
|
33
|
-
uses: MiguelRipoll23/create-tag-name@v2.
|
|
33
|
+
uses: MiguelRipoll23/create-tag-name@v2.1.0
|
|
34
34
|
id: create-tag-name
|
|
35
35
|
with:
|
|
36
36
|
channel: ${{ inputs.channel }}
|
|
@@ -41,7 +41,7 @@ jobs:
|
|
|
41
41
|
version: ${{ steps.create-tag-name.outputs.tag-name }}
|
|
42
42
|
|
|
43
43
|
- name: Create pull request
|
|
44
|
-
uses: peter-evans/create-pull-request@
|
|
44
|
+
uses: peter-evans/create-pull-request@v6
|
|
45
45
|
with:
|
|
46
46
|
branch: version/${{ steps.create-tag-name.outputs.tag-name }}
|
|
47
47
|
commit-message: ${{ steps.create-tag-name.outputs.tag-name }}
|
|
@@ -17,7 +17,7 @@ jobs:
|
|
|
17
17
|
pull-requests: write
|
|
18
18
|
|
|
19
19
|
steps:
|
|
20
|
-
- uses: actions/stale@
|
|
20
|
+
- uses: actions/stale@v9
|
|
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": "8.0.1",
|
|
4
|
+
"version": "8.1.0-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": {
|
|
@@ -42,7 +42,8 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"express": "^4.17.1",
|
|
45
|
-
"node-
|
|
45
|
+
"node-fetch": "^2.6.7",
|
|
46
|
+
"node-persist": "^4.0.1"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
49
|
"eslint": "^8.0.0"
|
package/src/index.js
CHANGED
|
@@ -2,6 +2,7 @@ const fs = require("fs");
|
|
|
2
2
|
const path = require("path");
|
|
3
3
|
const storage = require("node-persist");
|
|
4
4
|
const { spawn } = require("child_process");
|
|
5
|
+
const fetch = require("node-fetch");
|
|
5
6
|
const express = require("express");
|
|
6
7
|
|
|
7
8
|
const packageJson = require("../package.json");
|
|
@@ -800,18 +801,7 @@ SecuritySystem.prototype.setCurrentState = function (state, origin) {
|
|
|
800
801
|
this.resetTimeout = null;
|
|
801
802
|
this.log.info("Reset (Finished)");
|
|
802
803
|
|
|
803
|
-
|
|
804
|
-
this.triggeredResetMotionSensorService.updateCharacteristic(
|
|
805
|
-
Characteristic.MotionDetected,
|
|
806
|
-
true
|
|
807
|
-
);
|
|
808
|
-
|
|
809
|
-
setTimeout(() => {
|
|
810
|
-
this.triggeredResetMotionSensorService.updateCharacteristic(
|
|
811
|
-
Characteristic.MotionDetected,
|
|
812
|
-
false
|
|
813
|
-
);
|
|
814
|
-
}, 750);
|
|
804
|
+
this.triggerResetSensor();
|
|
815
805
|
|
|
816
806
|
// Alternative flow (Triggered -> Off -> Armed mode)
|
|
817
807
|
if (options.resetOffFlow) {
|
|
@@ -844,6 +834,21 @@ SecuritySystem.prototype.setCurrentState = function (state, origin) {
|
|
|
844
834
|
this.save();
|
|
845
835
|
};
|
|
846
836
|
|
|
837
|
+
SecuritySystem.prototype.triggerResetSensor = function () {
|
|
838
|
+
// Update triggered reset motion sensor
|
|
839
|
+
this.triggeredResetMotionSensorService.updateCharacteristic(
|
|
840
|
+
Characteristic.MotionDetected,
|
|
841
|
+
true
|
|
842
|
+
);
|
|
843
|
+
|
|
844
|
+
setTimeout(() => {
|
|
845
|
+
this.triggeredResetMotionSensorService.updateCharacteristic(
|
|
846
|
+
Characteristic.MotionDetected,
|
|
847
|
+
false
|
|
848
|
+
);
|
|
849
|
+
}, 750);
|
|
850
|
+
};
|
|
851
|
+
|
|
847
852
|
SecuritySystem.prototype.resetTimers = function () {
|
|
848
853
|
// Clear trigger timeout
|
|
849
854
|
if (this.triggerTimeout !== null) {
|
|
@@ -1026,6 +1031,12 @@ SecuritySystem.prototype.updateTargetState = function (
|
|
|
1026
1031
|
return false;
|
|
1027
1032
|
}
|
|
1028
1033
|
|
|
1034
|
+
// Trigger reset sensor for mode
|
|
1035
|
+
// change in triggered state
|
|
1036
|
+
if (isCurrentStateAlarmTriggered) {
|
|
1037
|
+
this.triggerResetSensor();
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1029
1040
|
// Set arming delay
|
|
1030
1041
|
let armSeconds = 0;
|
|
1031
1042
|
|
|
@@ -1838,7 +1849,7 @@ SecuritySystem.prototype.sendWebhookEvent = function (type, state, origin) {
|
|
|
1838
1849
|
path = path.replace("${currentMode}", this.state2Mode(this.currentState));
|
|
1839
1850
|
|
|
1840
1851
|
// Send GET request to server
|
|
1841
|
-
fetch(options.webhookUrl + path
|
|
1852
|
+
fetch(options.webhookUrl + path)
|
|
1842
1853
|
.then((response) => {
|
|
1843
1854
|
if (response.ok === false) {
|
|
1844
1855
|
throw new Error(`Status code (${response.status})`);
|