Skip to content

Commit d50b302

Browse files
committed
### UPDATED
- Simplify directory traversal towards the `./build` folder structure to not include `src`. - Readme instructions to include `panelSwitch` and better directions toward manual setting up of the `adtType`. - The "Alarm Ringing" switch now applies to all alarm scenarios instead of just "Disarmed" mode. Since the naming convention of "Alarm Ringing while Disarmed" is simply too long.
1 parent 24fc81e commit d50b302

File tree

5 files changed

+15
-19
lines changed

5 files changed

+15
-19
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ While named "ADT Pulse for Homebridge," this Homebridge plugin exclusively accom
5656
This plugin will expose these devices by default:
5757
1. ADT Pulse Gateway (`gateway`)
5858
2. Security Panel (`panel`)
59+
3. Alarm Ringing Switch (`panelSwitch`)
5960

6061
This plugin can expose these devices (in read-only mode) based on your configuration:
6162
1. `co` - Carbon Monoxide Detector
@@ -126,7 +127,7 @@ All sensors are now organized within an array of objects, with each object conta
126127
- Must match the name shown under the "Name" column in the "System" tab when logged into the portal.
127128
- __ADT Type__ (`adtType`)
128129
- Must match the type shown under the "Device Type" column in the "System" tab when logged into the portal.
129-
- Contingent to the devices shown under the [Supported Devices](#supported-devices) section.
130+
- For example, if the type is "Door/Window Sensor", the value should be `doorWindow`. Read the [Supported Devices](#supported-devices) section for more information.
130131
- __ADT Zone__ (`adtZone`)
131132
- Must match the zone shown under the "Zone" column in the "System" tab when logged into the portal.
132133

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "homebridge-adt-pulse",
33
"displayName": "Homebridge ADT Pulse",
4-
"version": "3.0.3",
4+
"version": "3.0.4",
55
"description": "Homebridge security system platform for ADT Pulse",
6-
"main": "./build/src/index.js",
7-
"exports": "./build/src/index.js",
6+
"main": "./build/index.js",
7+
"exports": "./build/index.js",
88
"type": "module",
99
"private": false,
1010
"scripts": {
@@ -16,8 +16,8 @@
1616
"build:fix-paths": "tsconfig-replace-paths --project tsconfig.json",
1717
"prepare": "npm run build",
1818
"prepublishOnly": "npm run build",
19-
"repl": "node ./build/src/scripts/repl.js",
20-
"test-api": "node ./build/src/scripts/test-api.js"
19+
"repl": "node ./build/scripts/repl.js",
20+
"test-api": "node ./build/scripts/test-api.js"
2121
},
2222
"repository": {
2323
"type": "git",

src/lib/accessory.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -720,27 +720,23 @@ export class ADTPulseAccessory {
720720
let hapStatus;
721721

722722
// If panel status has not been retrieved yet.
723-
if (
724-
this.#state.data.panelStatus === null
725-
|| this.#state.data.panelStatus.panelStates.length === 0
726-
|| this.#state.data.panelStatus.panelStatuses.length === 0
727-
) {
723+
if (this.#state.data.panelStatus === null || this.#state.data.panelStatus.panelStatuses.length === 0) {
728724
hapStatus = new this.#api.hap.HapStatusError(this.#api.hap.HAPStatus.RESOURCE_BUSY);
729725

730726
this.#log.debug(`Attempted to get panel switch status on ${chalk.underline(name)} (id: ${id}, uuid: ${uuid}) accessory but panel switch status has not been retrieved yet.`);
731727

732728
return hapStatus;
733729
}
734730

735-
const { panelStates, panelStatuses } = this.#state.data.panelStatus;
731+
const { panelStatuses } = this.#state.data.panelStatus;
736732

737733
// If system is busy setting the state.
738734
if (this.#activity.isBusy && this.#activity.setValue !== null) {
739735
return this.#activity.setValue;
740736
}
741737

742-
// Only show as "On" if panel is "Disarmed" and alarm is ringing.
743-
return panelStates.includes('Disarmed') && isPanelAlarmActive(panelStatuses);
738+
// Only show as "On" if alarm is ringing.
739+
return isPanelAlarmActive(panelStatuses);
744740
}
745741

746742
/**
@@ -921,7 +917,7 @@ export class ADTPulseAccessory {
921917
if (on === true) {
922918
hapStatus = new this.#api.hap.HapStatusError(this.#api.hap.HAPStatus.SUCCESS);
923919

924-
this.#log.error(`Attempted to set panel switch status on ${chalk.underline(name)} (id: ${id}, uuid: ${uuid}) accessory but switch is only used for turning off ringing alarm while system is "Disarmed".`);
920+
this.#log.error(`Attempted to set panel switch status on ${chalk.underline(name)} (id: ${id}, uuid: ${uuid}) accessory but switch is only used for turning off ringing alarm and clearing alarm.`);
925921

926922
throw hapStatus;
927923
}
@@ -942,7 +938,6 @@ export class ADTPulseAccessory {
942938

943939
if (
944940
!this.#activity.isBusy // The system isn't busy setting a state.
945-
&& condensedPanelStates.armValue === 'off' // If the system is disarmed.
946941
&& isAlarmActive // If system alarm is ringing.
947942
) {
948943
// Set accessory activity to "busy" before arming.

src/lib/utility.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ export function getDetectReportUrl(): GetDetectReportUrlReturns {
788788
*/
789789
export function getPackageVersion(): GetPackageVersionReturns {
790790
const require = createRequire(import.meta.url);
791-
const packageJson = require('../../../package.json'); // Assumes it is running in the "build" folder.
791+
const packageJson = require('../../package.json');
792792

793793
return packageJson.version;
794794
}

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
},
2222
"removeComments": true,
2323
"resolveJsonModule": true,
24+
"rootDir": "./src",
2425
"sourceMap": true,
2526
"strict": true,
2627
"target": "ESNext",
@@ -32,7 +33,6 @@
3233
]
3334
},
3435
"include": [
35-
"./src",
36-
"config.schema.json"
36+
"./src"
3737
]
3838
}

0 commit comments

Comments
 (0)