homebridge-securitysystem 6.1.0 → 6.2.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/release.yml +21 -0
- package/.github/workflows/analyze-package.yml +16 -0
- package/.github/workflows/build-package.yml +5 -21
- package/.github/workflows/clean-issues.yml +10 -0
- package/.github/workflows/publish-package.yml +6 -21
- package/.vscode/settings.json +5 -0
- package/config.schema.json +9 -1
- package/package.json +4 -3
- package/pull_request_template.md +1 -7
- package/src/index.js +34 -2
- package/src/utils/options.js +5 -5
- package/.github/workflows/assign-issue.yml +0 -17
- package/.github/workflows/check-activity.yml +0 -18
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
changelog:
|
|
2
|
+
exclude:
|
|
3
|
+
labels:
|
|
4
|
+
- ignore-for-release
|
|
5
|
+
|
|
6
|
+
categories:
|
|
7
|
+
- title: Breaking Changes ⚠️
|
|
8
|
+
labels:
|
|
9
|
+
- breaking-change
|
|
10
|
+
|
|
11
|
+
- title: New Features 🎉
|
|
12
|
+
labels:
|
|
13
|
+
- enhancement
|
|
14
|
+
|
|
15
|
+
- title: Bug Fixes
|
|
16
|
+
labels:
|
|
17
|
+
- bug
|
|
18
|
+
|
|
19
|
+
- title: Other Changes
|
|
20
|
+
labels:
|
|
21
|
+
- "*"
|
|
@@ -2,29 +2,13 @@ name: Build package
|
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
|
-
branches:
|
|
6
|
-
-
|
|
7
|
-
- 'hotfix/*'
|
|
8
|
-
|
|
9
|
-
pull_request:
|
|
10
|
-
branches:
|
|
11
|
-
- 'beta'
|
|
12
|
-
- 'hotfix/*'
|
|
5
|
+
branches-ignore:
|
|
6
|
+
- stable
|
|
13
7
|
|
|
14
8
|
jobs:
|
|
15
9
|
build-package:
|
|
16
10
|
name: Build package
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
steps:
|
|
20
|
-
- name: Checkout repository
|
|
21
|
-
uses: actions/checkout@v2
|
|
22
|
-
|
|
23
|
-
- name: Setup node
|
|
24
|
-
uses: actions/setup-node@v2
|
|
25
|
-
with:
|
|
26
|
-
node-version: '14'
|
|
27
|
-
cache: 'npm'
|
|
11
|
+
uses: MiguelRipoll23/global/.github/workflows/build-package.yml@main
|
|
28
12
|
|
|
29
|
-
|
|
30
|
-
|
|
13
|
+
with:
|
|
14
|
+
node-version: 16
|
|
@@ -5,27 +5,12 @@ on:
|
|
|
5
5
|
types: [published]
|
|
6
6
|
|
|
7
7
|
jobs:
|
|
8
|
-
publish-
|
|
8
|
+
publish-package:
|
|
9
9
|
name: Publish package
|
|
10
|
-
|
|
10
|
+
uses: MiguelRipoll23/global/.github/workflows/publish-package.yml@main
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
run: |
|
|
15
|
-
echo "NPM_VERSION=${GITHUB_REF##*/v}" >> $GITHUB_ENV
|
|
12
|
+
with:
|
|
13
|
+
node-version: 16
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
- name: Setup node
|
|
21
|
-
uses: actions/setup-node@v2
|
|
22
|
-
with:
|
|
23
|
-
node-version: "14"
|
|
24
|
-
cache: "npm"
|
|
25
|
-
registry-url: https://registry.npmjs.org/
|
|
26
|
-
|
|
27
|
-
- name: Publish package
|
|
28
|
-
env:
|
|
29
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
30
|
-
run: |
|
|
31
|
-
npm publish --access public --tag "$(if [[ $NPM_VERSION == *-* ]]; then echo beta; else echo latest; fi)"
|
|
15
|
+
secrets:
|
|
16
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/config.schema.json
CHANGED
|
@@ -309,6 +309,13 @@
|
|
|
309
309
|
"default": true,
|
|
310
310
|
"required": false
|
|
311
311
|
},
|
|
312
|
+
"audio_switch": {
|
|
313
|
+
"title": "Show Audio Switch",
|
|
314
|
+
"description": "Adds a global switch to enable or disable audio except for alarm triggered.",
|
|
315
|
+
"type": "boolean",
|
|
316
|
+
"default": false,
|
|
317
|
+
"required": false
|
|
318
|
+
},
|
|
312
319
|
"audio": {
|
|
313
320
|
"title": "Play Sounds (local-only, ffmpeg required)",
|
|
314
321
|
"description": "Warns of pending or current events by playing sounds.",
|
|
@@ -603,7 +610,8 @@
|
|
|
603
610
|
"arming_lock_switches",
|
|
604
611
|
"siren_switch",
|
|
605
612
|
"siren_override_switch",
|
|
606
|
-
"siren_mode_switches"
|
|
613
|
+
"siren_mode_switches",
|
|
614
|
+
"audio_switch"
|
|
607
615
|
]
|
|
608
616
|
},
|
|
609
617
|
{
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homebridge-securitysystem",
|
|
3
3
|
"displayName": "Homebridge Security System",
|
|
4
|
-
"version": "6.1.
|
|
4
|
+
"version": "6.2.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": {
|
|
8
|
-
"test": "npm install -g && homebridge -I -D"
|
|
8
|
+
"test": "npm install -g && homebridge -I -D",
|
|
9
|
+
"build": "exit 0"
|
|
9
10
|
},
|
|
10
11
|
"keywords": [
|
|
11
12
|
"homebridge-plugin",
|
|
@@ -44,6 +45,6 @@
|
|
|
44
45
|
"node-persist": "^3.0.5"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
|
-
"eslint": "^
|
|
48
|
+
"eslint": "^8.0.0"
|
|
48
49
|
}
|
|
49
50
|
}
|
package/pull_request_template.md
CHANGED
package/src/index.js
CHANGED
|
@@ -252,6 +252,16 @@ function SecuritySystem(log, config) {
|
|
|
252
252
|
.on('get', this.getModePauseSwitch.bind(this))
|
|
253
253
|
.on('set', this.setModePauseSwitch.bind(this));
|
|
254
254
|
|
|
255
|
+
// Audio switch
|
|
256
|
+
this.audioSwitchService = new Service.Switch('Audio', 'kx82r64zN3txDXKFiX9JDi');
|
|
257
|
+
|
|
258
|
+
this.audioSwitchService
|
|
259
|
+
.getCharacteristic(Characteristic.On)
|
|
260
|
+
.on('get', this.getAudioSwitch.bind(this))
|
|
261
|
+
.on('set', this.setAudioSwitch.bind(this))
|
|
262
|
+
|
|
263
|
+
this.audioSwitchService.getCharacteristic(Characteristic.On).value = true;
|
|
264
|
+
|
|
255
265
|
// Siren sensors
|
|
256
266
|
this.sirenTrippedMotionSensorService = new Service.MotionSensor('Siren Tripped', 'siren-tripped');
|
|
257
267
|
|
|
@@ -359,6 +369,10 @@ function SecuritySystem(log, config) {
|
|
|
359
369
|
this.services.push(this.modePauseSwitchService);
|
|
360
370
|
}
|
|
361
371
|
|
|
372
|
+
if (options.audio && options.audioSwitch) {
|
|
373
|
+
this.services.push(this.audioSwitchService);
|
|
374
|
+
}
|
|
375
|
+
|
|
362
376
|
// Storage
|
|
363
377
|
if (options.saveState) {
|
|
364
378
|
this.load();
|
|
@@ -1214,6 +1228,9 @@ SecuritySystem.prototype.playAudio = async function (type, state) {
|
|
|
1214
1228
|
|
|
1215
1229
|
const mode = this.state2Mode(state);
|
|
1216
1230
|
|
|
1231
|
+
// Close previous player
|
|
1232
|
+
this.stopAudio();
|
|
1233
|
+
|
|
1217
1234
|
// Ignore 'Current Off' event
|
|
1218
1235
|
if (mode === 'off') {
|
|
1219
1236
|
if (type === 'target') {
|
|
@@ -1221,8 +1238,13 @@ SecuritySystem.prototype.playAudio = async function (type, state) {
|
|
|
1221
1238
|
}
|
|
1222
1239
|
}
|
|
1223
1240
|
|
|
1224
|
-
//
|
|
1225
|
-
this.
|
|
1241
|
+
// Check audio switch except for triggered
|
|
1242
|
+
const audioSwitchOnCharacteristic = this.audioSwitchService.getCharacteristic(Characteristic.On);
|
|
1243
|
+
const isAudioDisabledBySwitch = audioSwitchOnCharacteristic.value === false;
|
|
1244
|
+
|
|
1245
|
+
if (mode !== 'triggered' && isAudioDisabledBySwitch) {
|
|
1246
|
+
return;
|
|
1247
|
+
}
|
|
1226
1248
|
|
|
1227
1249
|
// Directory
|
|
1228
1250
|
let directory = `${__dirname}/../sounds`;
|
|
@@ -1846,6 +1868,16 @@ SecuritySystem.prototype.setModePauseSwitch = function (value, callback) {
|
|
|
1846
1868
|
callback(null);
|
|
1847
1869
|
};
|
|
1848
1870
|
|
|
1871
|
+
SecuritySystem.prototype.getAudioSwitch = function (callback) {
|
|
1872
|
+
const value = this.audioSwitchService.getCharacteristic(Characteristic.On).value;
|
|
1873
|
+
callback(null, value);
|
|
1874
|
+
};
|
|
1875
|
+
|
|
1876
|
+
SecuritySystem.prototype.setAudioSwitch = function (value, callback) {
|
|
1877
|
+
this.log.info(`Audio (${value ? 'Enabled' : 'Disabled'})`);
|
|
1878
|
+
callback(null);
|
|
1879
|
+
};
|
|
1880
|
+
|
|
1849
1881
|
// Siren Tripped Motion Sensor
|
|
1850
1882
|
SecuritySystem.prototype.getSirenTrippedMotionDetected = function (callback) {
|
|
1851
1883
|
const value = this.sirenTrippedMotionSensorService.getCharacteristic(Characteristic.MotionDetected).value;
|
package/src/utils/options.js
CHANGED
|
@@ -62,6 +62,8 @@ const options = {
|
|
|
62
62
|
options.awayDoubleKnockSeconds = config.away_double_knock_seconds;
|
|
63
63
|
options.nightDoubleKnockSeconds = config.night_double_knock_seconds;
|
|
64
64
|
|
|
65
|
+
options.audioSwitch = config.audio_switch;
|
|
66
|
+
|
|
65
67
|
// Server
|
|
66
68
|
options.serverPort = config.server_port;
|
|
67
69
|
options.serverCode = config.server_code;
|
|
@@ -276,15 +278,13 @@ const options = {
|
|
|
276
278
|
},
|
|
277
279
|
|
|
278
280
|
validateValues: (log) => {
|
|
279
|
-
if (options.
|
|
281
|
+
if (options.resetMinutes === 0) {
|
|
280
282
|
log.error('Value of setting \'Reset Delay Seconds\' should be at least 1.');
|
|
281
283
|
options.resetMinutes = 1;
|
|
282
284
|
}
|
|
283
285
|
|
|
284
|
-
if (options.serverPort
|
|
285
|
-
|
|
286
|
-
log.error('Value of setting \'Server Port\' not between 0 and 65535.');
|
|
287
|
-
}
|
|
286
|
+
if (options.serverPort < 0 || options.serverPort > 65535) {
|
|
287
|
+
log.error('Value of setting \'Server Port\' not between 0 and 65535.');
|
|
288
288
|
}
|
|
289
289
|
},
|
|
290
290
|
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
name: Assign issue
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
issues:
|
|
5
|
-
types: [opened]
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
auto-assign:
|
|
9
|
-
name: Assign issue
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
|
|
12
|
-
steps:
|
|
13
|
-
- name: Assign issue
|
|
14
|
-
uses: pozil/auto-assign-issue@v1
|
|
15
|
-
with:
|
|
16
|
-
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
17
|
-
assignees: MiguelRipoll23
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
name: 'Close stale issues and PRs'
|
|
2
|
-
on:
|
|
3
|
-
schedule:
|
|
4
|
-
- cron: '0 9 * * *'
|
|
5
|
-
|
|
6
|
-
jobs:
|
|
7
|
-
stale:
|
|
8
|
-
name: Check activity
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
|
|
11
|
-
steps:
|
|
12
|
-
- name: Check issues/pull requests
|
|
13
|
-
uses: actions/stale@v3
|
|
14
|
-
with:
|
|
15
|
-
days-before-stale: 14
|
|
16
|
-
days-before-close: 7
|
|
17
|
-
exempt-issue-labels: 'pinned,help wanted,investigating,evaluating'
|
|
18
|
-
stale-issue-message: 'This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days.'
|