homebridge-securitysystem 6.0.2 → 6.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.
@@ -3,33 +3,29 @@ name: Publish package
3
3
  on:
4
4
  release:
5
5
  types: [published]
6
-
6
+
7
7
  jobs:
8
8
  publish-npm:
9
9
  name: Publish package
10
10
  runs-on: ubuntu-latest
11
11
 
12
12
  steps:
13
- - name: Checkout repository
14
- uses: actions/checkout@v2
15
-
16
- - name: Setup node
17
- uses: actions/setup-node@v2
18
- with:
19
- node-version: '14'
20
- cache: 'npm'
21
- registry-url: https://registry.npmjs.org/
13
+ - name: Get version
14
+ run: |
15
+ echo "NPM_VERSION=${GITHUB_REF##*/v}" >> $GITHUB_ENV
22
16
 
23
- - name: Get version
24
- run: |
25
- echo "NPM_VERSION=${GITHUB_REF##*/v}" >> $GITHUB_ENV
17
+ - name: Checkout repository
18
+ uses: actions/checkout@v2
26
19
 
27
- - name: Check version
28
- if: ${{ github.event.release.target_commitish == 'release' }}
29
- run: if [[ $NPM_VERSION == *-* ]]; then exit 1; else exit 0; fi
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/
30
26
 
31
- - name: Publish package
32
- env:
33
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
34
- run: |
35
- npm publish --access public --tag "$(if [[ $NPM_VERSION == *-* ]]; then echo beta; else echo latest; fi)"
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)"
package/package.json CHANGED
@@ -1,14 +1,11 @@
1
1
  {
2
2
  "name": "homebridge-securitysystem",
3
- "displayName": "Security System",
4
- "version": "6.0.2",
3
+ "displayName": "Homebridge Security System",
4
+ "version": "6.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": {
8
- "start": "node src/index.js",
9
- "test": "npm install -g && homebridge -I -D",
10
- "beta": "publish --tag beta",
11
- "release": "publish"
8
+ "test": "npm install -g && homebridge -I -D"
12
9
  },
13
10
  "keywords": [
14
11
  "homebridge-plugin",
package/src/index.js CHANGED
@@ -485,6 +485,7 @@ SecuritySystem.prototype.state2Mode = function (state) {
485
485
 
486
486
  // Custom
487
487
  case 'lock':
488
+ // Audio sound
488
489
  return state;
489
490
 
490
491
  case 'warning':
@@ -679,6 +680,7 @@ SecuritySystem.prototype.handleStateUpdate = function (alarmTriggered) {
679
680
  SecuritySystem.prototype.updateTargetState = function (state, origin, delay, callback) {
680
681
  const isTargetStateAlreadySet = this.targetState === state;
681
682
  const isCurrentStateAlarmTriggered = this.currentState === Characteristic.SecuritySystemCurrentState.ALARM_TRIGGERED;
683
+ const isTargetStateDisarm = state === Characteristic.SecuritySystemTargetState.DISARM;
682
684
 
683
685
  // Check if target state is already set
684
686
  if (isTargetStateAlreadySet && isCurrentStateAlarmTriggered === false) {
@@ -704,7 +706,9 @@ SecuritySystem.prototype.updateTargetState = function (state, origin, delay, cal
704
706
  }
705
707
 
706
708
  // Check arming lock switches
707
- if (this.isArmingLocked(state)) {
709
+ const isArmingLockEnabled = options.isValueSet(options.armingLockSwitch) || options.isValueSet(options.armingLockSwitches);
710
+
711
+ if (isTargetStateDisarm === false && isArmingLockEnabled && this.isArmingLocked(state)) {
708
712
  this.log.warn('Arming lock (Not allowed)');
709
713
 
710
714
  if (callback !== null) {
@@ -722,7 +726,6 @@ SecuritySystem.prototype.updateTargetState = function (state, origin, delay, cal
722
726
  const isTargetStateHome = this.targetState === Characteristic.SecuritySystemTargetState.STAY_ARM;
723
727
  const isTargetStateAway = this.targetState === Characteristic.SecuritySystemTargetState.AWAY_ARM;
724
728
  const isTargetStateNight = this.targetState === Characteristic.SecuritySystemTargetState.NIGHT_ARM;
725
- const isTargetStateDisarm = this.targetState === Characteristic.SecuritySystemTargetState.DISARM;
726
729
 
727
730
  // Update characteristic
728
731
  if (origin === originTypes.INTERNAL || origin === originTypes.EXTERNAL) {
@@ -1362,7 +1365,7 @@ SecuritySystem.prototype.executeCommand = function (type, state, origin) {
1362
1365
  break;
1363
1366
 
1364
1367
  default:
1365
- this.log.error(`Unknown ${type} state (${state})`);
1368
+ this.log.error(`Unknown command ${type} state (${state})`);
1366
1369
  }
1367
1370
 
1368
1371
  if (command === undefined || command === null) {
@@ -1446,7 +1449,7 @@ SecuritySystem.prototype.sendWebhookEvent = function (type, state, origin) {
1446
1449
  break;
1447
1450
 
1448
1451
  default:
1449
- this.log.error(`Unknown ${type} state (${state})`);
1452
+ this.log.error(`Unknown webhook ${type} state (${state})`);
1450
1453
  return;
1451
1454
  }
1452
1455
 
@@ -1525,7 +1528,7 @@ SecuritySystem.prototype.triggerIfModeSet = function (switchRequiredState, value
1525
1528
  this.updateSiren(value, originTypes.REGULAR_SWITCH, false, callback);
1526
1529
  }
1527
1530
  else {
1528
- this.log.warn('Siren (Mode not set)');
1531
+ this.log.debug('Siren (Mode switch not set)');
1529
1532
  callback(-70412, false);
1530
1533
  }
1531
1534
  }
@@ -1598,6 +1601,7 @@ SecuritySystem.prototype.isArmingLocked = function (state) {
1598
1601
  // Check mode switches
1599
1602
  switch (state) {
1600
1603
  case 'global':
1604
+ // Server status endpoint
1601
1605
  return false;
1602
1606
 
1603
1607
  case Characteristic.SecuritySystemCurrentState.STAY_ARM:
@@ -1613,7 +1617,7 @@ SecuritySystem.prototype.isArmingLocked = function (state) {
1613
1617
  break;
1614
1618
 
1615
1619
  default:
1616
- this.log.error(`Unknown state (${state})`);
1620
+ this.log.debug(`Unknown arming lock state (${state})`);
1617
1621
  }
1618
1622
 
1619
1623
  return armingLockSwitchService.getCharacteristic(Characteristic.On).value;
@@ -1640,7 +1644,7 @@ SecuritySystem.prototype.updateArmingLock = function (mode, value) {
1640
1644
  break;
1641
1645
 
1642
1646
  default:
1643
- this.log.warn(`Unknown arming lock type (${mode})`);
1647
+ this.log.debug(`Unknown arming lock mode (${mode})`);
1644
1648
  return false;
1645
1649
  }
1646
1650