homebridge-securitysystem 7.3.0 → 7.5.0-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.
@@ -31,6 +31,6 @@ changelog:
31
31
  labels:
32
32
  - dependencies
33
33
 
34
- - title: Miscellaneous Changes
34
+ - title: 🪄 Other Changes
35
35
  labels:
36
36
  - "*"
@@ -0,0 +1,80 @@
1
+ name: Create release
2
+
3
+ on:
4
+ pull_request:
5
+ types:
6
+ - closed
7
+ branches:
8
+ - main
9
+
10
+ permissions:
11
+ contents: write
12
+ id-token: write
13
+
14
+ jobs:
15
+ create-tag:
16
+ name: Create tag
17
+ runs-on: ubuntu-latest
18
+ if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'new-release')
19
+ outputs:
20
+ tag-name: ${{ steps.prepare-tag.outputs.tag-name }}
21
+ steps:
22
+ - name: Parse tag
23
+ id: prepare-tag
24
+ run: |
25
+ branch_name="${{ github.event.pull_request.head.ref }}"
26
+ tag_name=$(echo $branch_name | sed 's/version\///')
27
+ echo "tag-name=$tag_name" >> $GITHUB_OUTPUT
28
+
29
+ - name: Checkout branch
30
+ uses: actions/checkout@v3
31
+
32
+ - name: Create tag
33
+ run: |
34
+ git tag "${{ steps.prepare-tag.outputs.tag-name }}"
35
+
36
+ - name: Push tag to origin
37
+ run: git push origin "${{ steps.prepare-tag.outputs.tag-name }}"
38
+
39
+ create-release:
40
+ name: Create release
41
+ needs: [create-tag]
42
+ runs-on: ubuntu-latest
43
+ if: needs.create-tag.outputs.tag-name != ''
44
+ permissions:
45
+ contents: write
46
+ steps:
47
+ - name: Create release
48
+ uses: ncipollo/release-action@v1
49
+ with:
50
+ tag: "${{ needs.create-tag.outputs.tag-name }}"
51
+ prerelease: ${{ contains(needs.create-tag.outputs.tag-name, '-') }}
52
+ generateReleaseNotes: true
53
+ allowUpdates: true
54
+
55
+ publish-package:
56
+ name: Publish package
57
+ runs-on: ubuntu-latest
58
+ needs: [create-tag, create-release]
59
+
60
+ steps:
61
+ - name: Checkout repository
62
+ uses: actions/checkout@v3
63
+
64
+ - name: Setup node
65
+ uses: actions/setup-node@v3
66
+
67
+ with:
68
+ registry-url: https://registry.npmjs.org/
69
+
70
+ - name: Get version
71
+ run: |
72
+ echo "NPM_VERSION=${{ needs.create-tag.outputs.tag-name }}" >> $GITHUB_ENV
73
+
74
+ - name: Publish package
75
+
76
+ env:
77
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
78
+
79
+ run: |
80
+ npm publish --access public --provenance --tag "$(if [[ $NPM_VERSION == *-* ]]; then echo beta; else echo latest; fi)"
@@ -1,4 +1,4 @@
1
- name: Update version
1
+ name: Create version
2
2
 
3
3
  on:
4
4
  workflow_dispatch:
@@ -30,13 +30,13 @@ jobs:
30
30
  uses: actions/checkout@v3
31
31
 
32
32
  - name: Generate tag name
33
- uses: MiguelRipoll23/generate-tag-name@playground
33
+ uses: MiguelRipoll23/generate-tag-name@v1.7.0
34
34
  id: generate-tag-name
35
35
  with:
36
36
  channel: ${{ inputs.channel }}
37
37
 
38
38
  - name: Update version name
39
- uses: reedyuk/npm-version@1.1.1
39
+ uses: reedyuk/npm-version@1.2.1
40
40
  with:
41
41
  version: ${{ steps.generate-tag-name.outputs.tag-name }}
42
42
 
@@ -7,5 +7,6 @@
7
7
  "editor.defaultFormatter": "esbenp.prettier-vscode",
8
8
  "[javascript]": {
9
9
  "editor.defaultFormatter": "esbenp.prettier-vscode"
10
- }
10
+ },
11
+ "cSpell.words": ["securitysystem"]
11
12
  }
@@ -109,6 +109,55 @@
109
109
  "default": "Trip Override",
110
110
  "required": false
111
111
  },
112
+ "mode_home_switch_name": {
113
+ "title": "Mode Home Switch Name",
114
+ "description": "",
115
+ "type": "string",
116
+ "default": "Mode Home",
117
+ "required": false
118
+ },
119
+ "mode_away_switch_name": {
120
+ "title": "Mode Away Switch Name",
121
+ "description": "",
122
+ "type": "string",
123
+ "default": "Mode Away",
124
+ "required": false
125
+ },
126
+ "mode_night_switch_name": {
127
+ "title": "Mode Night Switch Name",
128
+ "description": "",
129
+ "type": "string",
130
+ "default": "Mode Night",
131
+ "required": false
132
+ },
133
+ "mode_off_switch_name": {
134
+ "title": "Mode Off Switch Name",
135
+ "description": "",
136
+ "type": "string",
137
+ "default": "Mode Off",
138
+ "required": false
139
+ },
140
+ "mode_away_extended_switch_name": {
141
+ "title": "Mode Away Extended Switch Name",
142
+ "description": "",
143
+ "type": "string",
144
+ "default": "Mode Away Extended",
145
+ "required": false
146
+ },
147
+ "mode_pause_switch_name": {
148
+ "title": "Mode Pause Name",
149
+ "description": "",
150
+ "type": "string",
151
+ "default": "Mode Pause",
152
+ "required": false
153
+ },
154
+ "audio_switch_name": {
155
+ "title": "Audio Name",
156
+ "description": "",
157
+ "type": "string",
158
+ "default": "Audio",
159
+ "required": false
160
+ },
112
161
  "log_directory": {
113
162
  "title": "Log Directory Path",
114
163
  "description": "",
@@ -611,7 +660,14 @@
611
660
  "trip_home_switch_name",
612
661
  "trip_away_switch_name",
613
662
  "trip_night_switch_name",
614
- "trip_override_switch_name"
663
+ "trip_override_switch_name",
664
+ "mode_home_switch_name",
665
+ "mode_away_switch_name",
666
+ "mode_night_switch_name",
667
+ "mode_off_switch_name",
668
+ "mode_away_extended_switch_name",
669
+ "mode_pause_switch_name",
670
+ "audio_switch_name"
615
671
  ]
616
672
  },
617
673
  {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "homebridge-securitysystem",
3
3
  "displayName": "Homebridge Security System",
4
- "version": "7.3.0",
4
+ "version": "7.5.0-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": {
package/src/index.js CHANGED
@@ -299,44 +299,69 @@ function SecuritySystem(log, config) {
299
299
  .on("set", this.setArmingLockNightSwitch.bind(this));
300
300
 
301
301
  // Mode switches
302
- this.modeHomeSwitchService = new Service.Switch("Mode Home", "mode-home");
302
+ this.modeHomeSwitchService = new Service.Switch(
303
+ options.modeHomeSwitchName,
304
+ "mode-home"
305
+ );
306
+
303
307
  this.modeHomeSwitchService.addCharacteristic(Characteristic.ConfiguredName);
304
308
 
305
309
  this.modeHomeSwitchService
306
- .setCharacteristic(Characteristic.ConfiguredName, "Mode Home")
310
+ .setCharacteristic(
311
+ Characteristic.ConfiguredName,
312
+ options.modeHomeSwitchName
313
+ )
307
314
  .getCharacteristic(Characteristic.On)
308
315
  .on("get", this.getModeHomeSwitch.bind(this))
309
316
  .on("set", this.setModeHomeSwitch.bind(this));
310
317
 
311
- this.modeAwaySwitchService = new Service.Switch("Mode Away", "mode-away");
318
+ this.modeAwaySwitchService = new Service.Switch(
319
+ options.modeAwaySwitchName,
320
+ "mode-away"
321
+ );
322
+
312
323
  this.modeAwaySwitchService.addCharacteristic(Characteristic.ConfiguredName);
313
324
 
314
325
  this.modeAwaySwitchService
315
- .setCharacteristic(Characteristic.ConfiguredName, "Mode Away")
326
+ .setCharacteristic(
327
+ Characteristic.ConfiguredName,
328
+ options.modeAwaySwitchName
329
+ )
316
330
  .getCharacteristic(Characteristic.On)
317
331
  .on("get", this.getModeAwaySwitch.bind(this))
318
332
  .on("set", this.setModeAwaySwitch.bind(this));
319
333
 
320
- this.modeNightSwitchService = new Service.Switch("Mode Night", "mode-night");
334
+ this.modeNightSwitchService = new Service.Switch(
335
+ options.modeNightSwitchName,
336
+ "mode-night"
337
+ );
338
+
321
339
  this.modeNightSwitchService.addCharacteristic(Characteristic.ConfiguredName);
322
340
 
323
341
  this.modeNightSwitchService
324
- .setCharacteristic(Characteristic.ConfiguredName, "Mode Night")
342
+ .setCharacteristic(
343
+ Characteristic.ConfiguredName,
344
+ options.modeNightSwitchName
345
+ )
325
346
  .getCharacteristic(Characteristic.On)
326
347
  .on("get", this.getModeNightSwitch.bind(this))
327
348
  .on("set", this.setModeNightSwitch.bind(this));
328
349
 
329
- this.modeOffSwitchService = new Service.Switch("Mode Off", "mode-off");
350
+ this.modeOffSwitchService = new Service.Switch(
351
+ options.modeOffSwitchName,
352
+ "mode-off"
353
+ );
354
+
330
355
  this.modeOffSwitchService.addCharacteristic(Characteristic.ConfiguredName);
331
356
 
332
357
  this.modeOffSwitchService
333
- .setCharacteristic(Characteristic.ConfiguredName, "Mode Off")
358
+ .setCharacteristic(Characteristic.ConfiguredName, options.modeOffSwitchName)
334
359
  .getCharacteristic(Characteristic.On)
335
360
  .on("get", this.getModeOffSwitch.bind(this))
336
361
  .on("set", this.setModeOffSwitch.bind(this));
337
362
 
338
363
  this.modeAwayExtendedSwitchService = new Service.Switch(
339
- "Mode Away Extended",
364
+ options.modeAwayExtendedSwitchName,
340
365
  "mode-away-extended"
341
366
  );
342
367
 
@@ -345,30 +370,40 @@ function SecuritySystem(log, config) {
345
370
  );
346
371
 
347
372
  this.modeAwayExtendedSwitchService
348
- .setCharacteristic(Characteristic.ConfiguredName, "Mode Away Extended")
373
+ .setCharacteristic(
374
+ Characteristic.ConfiguredName,
375
+ options.modeAwayExtendedSwitchName
376
+ )
349
377
  .getCharacteristic(Characteristic.On)
350
378
  .on("get", this.getModeAwayExtendedSwitch.bind(this))
351
379
  .on("set", this.setModeAwayExtendedSwitch.bind(this));
352
380
 
353
- this.modePauseSwitchService = new Service.Switch("Mode Pause", "mode-pause");
381
+ this.modePauseSwitchService = new Service.Switch(
382
+ options.modePauseSwitchName,
383
+ "mode-pause"
384
+ );
385
+
354
386
  this.modePauseSwitchService.addCharacteristic(Characteristic.ConfiguredName);
355
387
 
356
388
  this.modePauseSwitchService
357
- .setCharacteristic(Characteristic.ConfiguredName, "Mode Pause")
389
+ .setCharacteristic(
390
+ Characteristic.ConfiguredName,
391
+ options.modePauseSwitchName
392
+ )
358
393
  .getCharacteristic(Characteristic.On)
359
394
  .on("get", this.getModePauseSwitch.bind(this))
360
395
  .on("set", this.setModePauseSwitch.bind(this));
361
396
 
362
397
  // Audio switch
363
398
  this.audioSwitchService = new Service.Switch(
364
- "Audio",
399
+ options.audioSwitchName,
365
400
  "kx82r64zN3txDXKFiX9JDi"
366
401
  );
367
402
 
368
403
  this.audioSwitchService.addCharacteristic(Characteristic.ConfiguredName);
369
404
 
370
405
  this.audioSwitchService
371
- .setCharacteristic(Characteristic.ConfiguredName, "Audio")
406
+ .setCharacteristic(Characteristic.ConfiguredName, options.audioSwitchName)
372
407
  .getCharacteristic(Characteristic.On)
373
408
  .on("get", this.getAudioSwitch.bind(this))
374
409
  .on("set", this.setAudioSwitch.bind(this));
@@ -1917,7 +1952,7 @@ SecuritySystem.prototype.triggerIfModeSet = function (
1917
1952
  ) {
1918
1953
  this.updateTripSwitch(value, originTypes.REGULAR_SWITCH, false, callback);
1919
1954
  } else {
1920
- this.log.debug("Security System (Trip mode not set)");
1955
+ this.log.warn("Security System (Trip mode not set)");
1921
1956
  callback(HK_NOT_ALLOWED_IN_CURRENT_STATE, false);
1922
1957
  }
1923
1958
  } else {
@@ -16,13 +16,25 @@ const options = {
16
16
  options.proxyMode = config.proxy_mode;
17
17
  options.testMode = config.test_mode;
18
18
 
19
- // Names
19
+ // START: Names
20
20
  options.tripSwitchName = config.trip_switch_name;
21
21
  options.tripHomeSwitchName = config.trip_home_switch_name;
22
22
  options.tripAwaySwitchName = config.trip_away_switch_name;
23
23
  options.tripNightSwitchName = config.trip_night_switch_name;
24
24
  options.tripOverrideSwitchName = config.trip_override_switch_name;
25
25
 
26
+ options.modeHomeSwitchName = config.mode_home_switch_name;
27
+ options.modeAwaySwitchName = config.mode_away_switch_name;
28
+ options.modeNightSwitchName = config.mode_night_switch_name;
29
+ options.modeOffSwitchName = config.mode_off_switch_name;
30
+
31
+ options.modeAwayExtendedSwitchName = config.mode_away_extended_switch_name;
32
+ options.modePauseSwitchName = config.mode_pause_switch_name;
33
+
34
+ options.audioSwitchName = config.audio_switch_name;
35
+
36
+ // END: Names
37
+
26
38
  options.logDirectory = config.log_directory;
27
39
  options.overrideOff = config.override_off;
28
40
  options.resetOffFlow = config.reset_off_flow;
@@ -193,6 +205,34 @@ const options = {
193
205
  options.tripOverrideSwitchName = "Trip Override";
194
206
  }
195
207
 
208
+ if (options.isValueSet(options.modeHomeSwitchName) === false) {
209
+ options.modeHomeSwitchName = "Mode Home";
210
+ }
211
+
212
+ if (options.isValueSet(options.modeAwaySwitchName) === false) {
213
+ options.modeAwaySwitchName = "Mode Away";
214
+ }
215
+
216
+ if (options.isValueSet(options.modeNightSwitchName) === false) {
217
+ options.modeNightSwitchName = "Mode Night";
218
+ }
219
+
220
+ if (options.isValueSet(options.modeOffSwitch) === false) {
221
+ options.modeOffSwitchName = "Mode Off";
222
+ }
223
+
224
+ if (options.isValueSet(options.modeAwayExtendedSwitchName) === false) {
225
+ options.modeAwayExtendedSwitchName = "Mode Away Extended";
226
+ }
227
+
228
+ if (options.isValueSet(options.modePauseSwitchName) === false) {
229
+ options.modePauseSwitchName = "Mode Away Extended";
230
+ }
231
+
232
+ if (options.isValueSet(options.audioSwitchName) === false) {
233
+ options.audioSwitchName = "Audio";
234
+ }
235
+
196
236
  if (options.isValueSet(options.overrideOff) === false) {
197
237
  options.overrideOff = false;
198
238
  }
@@ -1,39 +0,0 @@
1
- name: Create tag
2
-
3
- on:
4
- pull_request:
5
- types:
6
- - closed
7
- branches:
8
- - main
9
-
10
- jobs:
11
- get-tag-name:
12
- name: Get tag name
13
- runs-on: ubuntu-latest
14
- if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'new-release')
15
- outputs:
16
- tag-name: ${{ steps.get-tag-name.outputs.tag-name }}
17
- steps:
18
- - name: Get tag name
19
- id: get-tag-name
20
- run: |
21
- branch_name="${{ github.event.pull_request.head.ref }}"
22
- tag_name=$(echo $branch_name | sed 's/version\///')
23
- echo "tag-name=$tag_name" >> $GITHUB_OUTPUT
24
-
25
- create-tag:
26
- name: Create new tag
27
- needs: get-tag-name
28
- runs-on: ubuntu-latest
29
- if: needs.get-tag-name.outputs.tag-name != ''
30
- steps:
31
- - name: Checkout branch
32
- uses: actions/checkout@v3
33
-
34
- - name: Create tag name
35
- run: |
36
- git tag "${{ needs.get-tag-name.outputs.tag-name }}"
37
-
38
- - name: Push tag to origin
39
- run: git push origin "${{ needs.get-tag-name.outputs.tag-name }}"
@@ -1,51 +0,0 @@
1
- name: Publish package
2
-
3
- on:
4
- release:
5
- types: [published]
6
-
7
- jobs:
8
- install-package:
9
- name: Install package
10
- runs-on: ubuntu-latest
11
-
12
- steps:
13
- - name: Checkout repository
14
- uses: actions/checkout@v3
15
-
16
- - name: Setup node
17
- uses: actions/setup-node@v3
18
-
19
- with:
20
- cache: "npm"
21
- registry-url: https://registry.npmjs.org/
22
-
23
- - name: Install package
24
- run: npm ci
25
-
26
- publish-package:
27
- name: Publish package
28
- runs-on: ubuntu-latest
29
- needs: [install-package]
30
-
31
- steps:
32
- - name: Checkout repository
33
- uses: actions/checkout@v3
34
-
35
- - name: Setup node
36
- uses: actions/setup-node@v3
37
-
38
- with:
39
- registry-url: https://registry.npmjs.org/
40
-
41
- - name: Get version
42
- run: |
43
- echo "NPM_VERSION=${GITHUB_REF##*/v}" >> $GITHUB_ENV
44
-
45
- - name: Publish package
46
-
47
- env:
48
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
49
-
50
- run: |
51
- npm publish --access public --tag "$(if [[ $NPM_VERSION == *-* ]]; then echo beta; else echo latest; fi)"