homebridge-adt-pulse 3.0.0-beta.11 → 3.0.0-beta.13

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/LICENSE CHANGED
@@ -6,10 +6,10 @@ Permission to use, copy, modify, and/or distribute this software for any
6
6
  purpose with or without fee is hereby granted, provided that the above
7
7
  copyright notice and this permission notice appear in all copies.
8
8
 
9
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
+ PERFORMANCE OF THIS SOFTWARE.
package/README.md CHANGED
@@ -10,14 +10,15 @@ __HOOBS Users:__ Please do not use the configuration UI as that is currently out
10
10
 
11
11
  Additionally, I am seeing that the developers for HOOBS are stale based on the activity and complaints I see on [Reddit](https://www.reddit.com/r/HOOBS/). Support will be "best effort", and official status will be pulled in the meantime.
12
12
 
13
- [![NPM Version](https://img.shields.io/npm/v/homebridge-adt-pulse.svg?style=flat-square&color=blue)](https://www.npmjs.com/package/homebridge-adt-pulse)
14
- [![NPM Downloads](https://img.shields.io/npm/dt/homebridge-adt-pulse.svg?style=flat-square&color=success)](https://www.npmjs.com/package/homebridge-adt-pulse)
15
- [![GitHub License](https://img.shields.io/github/license/mrjackyliang/homebridge-adt-pulse?style=flat-square&color=yellow)](https://github.com/mrjackyliang/homebridge-adt-pulse/blob/master/LICENSE)
16
- [![Become a GitHub Sponsor](https://img.shields.io/badge/sponsor-github-black?style=flat-square&color=orange)](https://github.com/sponsors/mrjackyliang)
13
+ [![NPM Package](https://img.shields.io/npm/v/homebridge-adt-pulse?style=flat-square&logo=npm&logoColor=%23ffffff&color=%23b25da6)](https://www.npmjs.com/package/homebridge-adt-pulse)
14
+ [![NPM Downloads](https://img.shields.io/npm/dt/homebridge-adt-pulse?style=flat-square&logo=npm&logoColor=%23ffffff&color=%236688c3)](https://www.npmjs.com/package/homebridge-adt-pulse)
15
+ [![GitHub License](https://img.shields.io/github/license/mrjackyliang/homebridge-adt-pulse?style=flat-square&logo=googledocs&logoColor=%23ffffff&color=%2348a56a)](https://github.com/mrjackyliang/homebridge-adt-pulse/blob/main/LICENSE)
16
+ [![Become a GitHub Sponsor](https://img.shields.io/badge/github-sponsor-gray?style=flat-square&logo=githubsponsors&logoColor=%23ffffff&color=%23eaaf41)](https://github.com/sponsors/mrjackyliang)
17
+ [![Donate via PayPal](https://img.shields.io/badge/paypal-donate-gray?style=flat-square&logo=paypal&logoColor=%23ffffff&color=%23ce4a4a)](https://liang.nyc/paypal)
17
18
 
18
19
  This is a [verified Homebridge plugin](https://github.com/homebridge/homebridge/wiki/verified-Plugins#verified-plugins) for ADT Pulse customers that allow homeowners to control their security system and view sensor status through the Home app (the HAP protocol).
19
20
 
20
- The API relies on the ADT Pulse Web Portal (powered by Icontrol One, owned by ICN Acquisition LLC, an indirect subsidiary of [Alarm.com](https://alarm.com)). View details of the acquisition via the [SEC Form 8-K](https://www.sec.gov/Archives/edgar/data/1459200/000119312517074906/d355785d8k.htm).
21
+ The API relies on the ADT Pulse Web Portal (powered by Icontrol One, owned by ICN Acquisition LLC, an indirect subsidiary of [Alarm.com](https://alarm.com))
21
22
 
22
23
  To use this plugin, here are three simple steps you need to follow:
23
24
  1. Run `npm install homebridge-adt-pulse`
@@ -75,7 +76,9 @@ This plugin can expose these devices (in read-only mode) based on your configura
75
76
  7. `motion` - Motion Sensor __::__ Motion Sensor (Notable Events Only)
76
77
  8. `panic` - Audible Panic Button/Pendant __::__ Silent Panic Button/Pendant
77
78
  9. `shock` - Shock Sensor
78
- 10. `temperature` - Temperature Sensor
79
+ 10. `supervisory` - System/Supervisory
80
+ 11. `temperature` - Temperature Sensor
81
+ 12. `unknown` - Unknown Device Type
79
82
 
80
83
  Due to implementation complexity and platform instability, all Z-Wave accessories connected to the ADT Pulse gateway will not be planned for development or be supported overall. Consider purchasing the [Hubitat Hub](https://hubitat.com) for a seamless setup experience, or read about the [Home Assistant Z-Wave](https://www.home-assistant.io/integrations/zwave_js/) integration.
81
84
 
@@ -85,13 +88,13 @@ ADT Pulse is available to consumers in either the United States or Canada. To sp
85
88
  - If you are a United States customer, set the `subdomain` value to `"portal"`.
86
89
  - If you are a Canada customer, set the `subdomain` value to `"portal-ca"`.
87
90
 
88
- Select the appropriate setting based on your country, as the ability to switch between countries is determined by the ADT region to which you are subscribed to.
91
+ Select the appropriate setting based on your country, as the ability to switch between countries is determined by the ADT region you are subscribed to.
89
92
 
90
93
  ## Finding the Device Fingerprint
91
- Since the introduction of 2-factor authentication during login is now required, a device fingerprint has become a necessity. Follow these steps:
94
+ Since the introduction of 2-factor authentication, a device fingerprint has become a necessity during login. To retrieve the fingerprint, follow these steps:
92
95
 
93
96
  1. Log in to the ADT Pulse portal, complete the MFA challenge, and choose to "Trust this device" (you can name the device as you see fit).
94
- 2. Using the same browser used for login, access the [ADT Pulse Device Fingerprint Detector](https://raw.githack.com/mrjackyliang/homebridge-adt-pulse/main/fingerprint/index.html).
97
+ 2. Using the same browser that was used for login, visit the [ADT Pulse Device Fingerprint Detector](https://raw.githack.com/mrjackyliang/homebridge-adt-pulse/main/fingerprint/index.html) web page.
95
98
  3. Click the "Copy Fingerprint" button and paste it into the `fingerprint` value in the `config.json` file.
96
99
 
97
100
  For a detailed breakdown of the device fingerprint contents, explore the "Device Details" tab located at the top right of the web page.
@@ -110,14 +113,14 @@ This precautionary measure is in place to avoid unintended resets that could lea
110
113
  ## Specifying the Synchronization Speed
111
114
  Typically, the plugin triggers every second to assess whether sync check signals or keep-alive signals should be dispatched.
112
115
 
113
- However, for older devices incompatible with newer OpenSSL versions (e.g. `v3.1`), this may result in consistent 100% CPU usage. To adjust the firing interval, use the following settings:
116
+ However, for certain consumer routers, this plugin may induce a network slowdown, and on older devices incompatible with newer OpenSSL versions (`v3.1`), may result in sustained 100% CPU usage. In an attempt to address both issues, adjust the firing interval using the following settings:
114
117
 
115
118
  - For "Normal" operation speed, set the `speed` value to `1`.
116
119
  - For "Moderate" operation speed, set the `speed` value to `0.75`.
117
120
  - For "Slower" operation speed, set the `speed` value to `0.5`.
118
121
  - For "Slowest" operation speed, set the `speed` value to `0.25`.
119
122
 
120
- If the plugin does not operate under "Normal" mode, a warning will be issued on every startup, and this warning cannot be disabled. While an option is available to downgrade to the deprecated OpenSSL version (`v1.1.1`), it is not recommended.
123
+ If the plugin does not operate under "Normal" mode, a warning will be issued on every startup, and this warning cannot be disabled.
121
124
 
122
125
  ## Specifying the Sensors
123
126
  In the past, this plugin would automatically detect sensors and dynamically manage their addition and removal based on its observations.
@@ -144,7 +147,7 @@ If you do not find the supported type listed, please note that the plugin will n
144
147
  Your patience is appreciated as I address and incorporate the necessary updates.
145
148
 
146
149
  ## Force Arming (Arm Away / Arm Stay / Arm Night)
147
- Due to the way how the Home app (the HAP protocol) establishes arm states, the plugin will force arm upon detecting active motion or open sensors. Disabling this feature is not possible, as this will result in arming failures without alert notifications from the Home app.
150
+ Due to the way how the Home app (the HAP protocol) establishes arm states, the plugin will force arm upon detecting active motion or open sensors. Disabling this feature is not possible, as this will result in arming failures without alert notifications.
148
151
 
149
152
  If you are concerned about this, please read the instructions below to check the status of the sensors in your home before arming your system:
150
153
 
@@ -158,9 +161,11 @@ If you are using automation, __you acknowledge that this will happen__ and accep
158
161
  As for ADT Pulse systems, __Arm Night__ is only available for use through the panel itself. Although it is not visible on the Web Portal or the mobile app, you can still place your system in __Arm Night__ mode with this plugin.
159
162
 
160
163
  ## Debug Mode
161
- Previously, there was a specific setting to configure debug logs at five different levels. Over time, it became apparent that this setting made debugging excessively challenging for the average consumer. To improve this, debug mode is now activated __ONLY when the debug mode is enabled on the Homebridge__ itself.
164
+ Previously, there was a setting to allow users to switch the plugin to debug mode. Over time, it became apparent that this setting made resolving issues excessively challenging.
162
165
 
163
- This approach promotes isolation (by using a separate bridge for each plugin) and helps enhance the troubleshooting experience in case any issues arise.
166
+ Consumers would enable debug mode, but forget to also enable Homebridge debug mode, causing contributors to not be able to effectively resolve bug reports.
167
+
168
+ To improve this, debug mode is now activated __ONLY when debug mode is enabled on Homebridge__ itself. This approach promotes isolation (logs can be separated for each bridge) and helps enhance the troubleshooting experience in case any issues arise.
164
169
 
165
170
  ## Documentation, Logging, and Detection
166
171
  This function comes with a built-in feature to notify me if the plugin detects anomalies in the states of sensors and panel statuses. In the event of such occurrences, especially when these statuses are undocumented, I will receive notifications.
@@ -84,7 +84,7 @@
84
84
  ]
85
85
  },
86
86
  {
87
- "title": "Reset (danger)",
87
+ "title": "Reset - \uD83D\uDED1 DANGER",
88
88
  "enum": [
89
89
  "reset"
90
90
  ]
@@ -211,11 +211,23 @@
211
211
  "shock"
212
212
  ]
213
213
  },
214
+ {
215
+ "title": "System/Supervisory",
216
+ "enum": [
217
+ "supervisory"
218
+ ]
219
+ },
214
220
  {
215
221
  "title": "Temperature Sensor",
216
222
  "enum": [
217
223
  "temperature"
218
224
  ]
225
+ },
226
+ {
227
+ "title": "Unknown Device Type",
228
+ "enum": [
229
+ "unknown"
230
+ ]
219
231
  }
220
232
  ]
221
233
  },
@@ -289,12 +301,11 @@
289
301
  "items": [
290
302
  {
291
303
  "key": "sensors",
292
- "htmlClass": "p-10",
293
304
  "buttonText": "Add Sensor",
294
305
  "items": [
295
306
  {
296
307
  "type": "div",
297
- "htmlClass": "my-3",
308
+ "htmlClass": "my-4 p-4",
298
309
  "items": [
299
310
  {
300
311
  "key": "sensors[].name",
@@ -1,17 +1,25 @@
1
+ import chalk from 'chalk';
2
+ import { detectedNewDeviceContext } from './detect.js';
3
+ import { condensedSensorTypeItems } from './items.js';
4
+ import { condensePanelStates, generateHash } from './utility.js';
1
5
  export class ADTPulseAccessory {
2
6
  #accessory;
3
7
  #api;
4
8
  #characteristic;
9
+ #debugMode;
5
10
  #instance;
6
11
  #log;
12
+ #reportedHashes;
7
13
  #services;
8
14
  #state;
9
- constructor(accessory, state, instance, service, characteristic, api, log) {
15
+ constructor(accessory, state, instance, service, characteristic, api, log, debugMode) {
10
16
  this.#accessory = accessory;
11
17
  this.#api = api;
12
18
  this.#characteristic = characteristic;
19
+ this.#debugMode = debugMode;
13
20
  this.#instance = instance;
14
21
  this.#log = log;
22
+ this.#reportedHashes = [];
15
23
  this.#services = {};
16
24
  this.#state = state;
17
25
  this.#services.Information = this.#accessory.getService(service.AccessoryInformation) ?? this.#accessory.addService(service.AccessoryInformation);
@@ -40,9 +48,10 @@ export class ADTPulseAccessory {
40
48
  case 'gateway':
41
49
  break;
42
50
  case 'glass':
43
- this.#services.Primary = this.#accessory.getService(service.MotionSensor) ?? this.#accessory.addService(service.MotionSensor);
51
+ this.#services.Primary = this.#accessory.getService(service.OccupancySensor) ?? this.#accessory.addService(service.OccupancySensor);
44
52
  break;
45
53
  case 'keypad':
54
+ this.#services.Primary = this.#accessory.getService(service.OccupancySensor) ?? this.#accessory.addService(service.OccupancySensor);
46
55
  break;
47
56
  case 'motion':
48
57
  this.#services.Primary = this.#accessory.getService(service.MotionSensor) ?? this.#accessory.addService(service.MotionSensor);
@@ -51,12 +60,20 @@ export class ADTPulseAccessory {
51
60
  this.#services.Primary = this.#accessory.getService(service.SecuritySystem) ?? this.#accessory.addService(service.SecuritySystem);
52
61
  break;
53
62
  case 'panic':
63
+ this.#services.Primary = this.#accessory.getService(service.OccupancySensor) ?? this.#accessory.addService(service.OccupancySensor);
54
64
  break;
55
65
  case 'shock':
66
+ this.#services.Primary = this.#accessory.getService(service.OccupancySensor) ?? this.#accessory.addService(service.OccupancySensor);
67
+ break;
68
+ case 'supervisory':
69
+ this.#services.Primary = this.#accessory.getService(service.OccupancySensor) ?? this.#accessory.addService(service.OccupancySensor);
56
70
  break;
57
71
  case 'temperature':
58
72
  this.#services.Primary = this.#accessory.getService(service.TemperatureSensor) ?? this.#accessory.addService(service.TemperatureSensor);
59
73
  break;
74
+ case 'unknown':
75
+ this.#services.Primary = this.#accessory.getService(service.OccupancySensor) ?? this.#accessory.addService(service.OccupancySensor);
76
+ break;
60
77
  default:
61
78
  break;
62
79
  }
@@ -86,10 +103,12 @@ export class ADTPulseAccessory {
86
103
  case 'gateway':
87
104
  break;
88
105
  case 'glass':
89
- this.#services.Primary.getCharacteristic(this.#characteristic.MotionDetected)
106
+ this.#services.Primary.getCharacteristic(this.#characteristic.OccupancyDetected)
90
107
  .onGet(() => this.getSensorStatus(accessory.context));
91
108
  break;
92
109
  case 'keypad':
110
+ this.#services.Primary.getCharacteristic(this.#characteristic.OccupancyDetected)
111
+ .onGet(() => this.getSensorStatus(accessory.context));
93
112
  break;
94
113
  case 'motion':
95
114
  this.#services.Primary.getCharacteristic(this.#characteristic.MotionDetected)
@@ -103,75 +122,74 @@ export class ADTPulseAccessory {
103
122
  .onSet((value) => this.setPanelStatus(value, accessory.context));
104
123
  break;
105
124
  case 'panic':
125
+ this.#services.Primary.getCharacteristic(this.#characteristic.OccupancyDetected)
126
+ .onGet(() => this.getSensorStatus(accessory.context));
106
127
  break;
107
128
  case 'shock':
129
+ this.#services.Primary.getCharacteristic(this.#characteristic.OccupancyDetected)
130
+ .onGet(() => this.getSensorStatus(accessory.context));
131
+ break;
132
+ case 'supervisory':
133
+ this.#services.Primary.getCharacteristic(this.#characteristic.OccupancyDetected)
134
+ .onGet(() => this.getSensorStatus(accessory.context));
108
135
  break;
109
136
  case 'temperature':
110
137
  this.#services.Primary.getCharacteristic(this.#characteristic.CurrentTemperature)
111
138
  .onGet(() => this.getSensorStatus(accessory.context));
112
139
  break;
140
+ case 'unknown':
141
+ this.#services.Primary.getCharacteristic(this.#characteristic.OccupancyDetected)
142
+ .onGet(() => this.getSensorStatus(accessory.context));
143
+ break;
113
144
  default:
114
145
  break;
115
146
  }
116
147
  }
117
- getSensorStatus(context) {
118
- const { name, type, zone } = context;
148
+ async getSensorStatus(context) {
149
+ const { id, name, type, uuid, zone, } = context;
119
150
  const sensor = this.#state.data.sensorsStatus.find((sensorStatus) => zone !== null && sensorStatus.name === name && sensorStatus.zone === zone);
120
- const knownSensorTypes = [
121
- 'co',
122
- 'doorWindow',
123
- 'fire',
124
- 'flood',
125
- 'glass',
126
- 'keypad',
127
- 'motion',
128
- 'panic',
129
- 'shock',
130
- 'temperature',
131
- ];
132
- if (sensor === undefined || !knownSensorTypes.includes(type)) {
151
+ if (sensor === undefined
152
+ || type === 'gateway'
153
+ || type === 'panel'
154
+ || !condensedSensorTypeItems.includes(type)) {
155
+ this.#log.error(`Attempted to get sensor status on ${chalk.underline(name)} (id: ${id}, uuid: ${uuid}) accessory but sensor is not found or sensor type is not supported.`);
133
156
  throw new this.#api.hap.HapStatusError(-70409);
134
157
  }
135
- const { status } = sensor;
136
- if (status === 'Unknown') {
137
- throw new this.#api.hap.HapStatusError(-70402);
158
+ const { statuses } = sensor;
159
+ if (statuses.includes('Offline') || statuses.includes('Unknown')) {
160
+ this.#log.warn(`Attempted to get sensor status on ${chalk.underline(name)} (id: ${id}, uuid: ${uuid}) accessory but sensor is currently "Offline" or "Unknown".`);
161
+ throw new this.#api.hap.HapStatusError(-70412);
138
162
  }
139
- switch (context.type) {
163
+ switch (type) {
140
164
  case 'co':
141
- return this.#characteristic.CarbonMonoxideDetected.CO_LEVELS_NORMAL;
165
+ break;
142
166
  case 'doorWindow':
143
- if (status.includes('Open')) {
167
+ if (statuses.includes('Open')) {
144
168
  return this.#characteristic.ContactSensorState.CONTACT_NOT_DETECTED;
145
169
  }
146
- if (status.includes('Closed')) {
170
+ if (statuses.includes('Closed')) {
147
171
  return this.#characteristic.ContactSensorState.CONTACT_DETECTED;
148
172
  }
149
173
  break;
150
174
  case 'fire':
151
- return this.#characteristic.SmokeDetected.SMOKE_NOT_DETECTED;
175
+ break;
152
176
  case 'flood':
153
- if (status.includes('ALARM')) {
154
- return this.#characteristic.LeakDetected.LEAK_DETECTED;
155
- }
156
- if (status.includes('Okay')) {
157
- return this.#characteristic.LeakDetected.LEAK_NOT_DETECTED;
158
- }
159
177
  break;
160
178
  case 'glass':
161
- if (status.includes('Okay')) {
162
- return false;
163
- }
164
- if (status.includes('Tripped')) {
179
+ if (statuses.includes('Tripped')) {
165
180
  return true;
166
181
  }
182
+ if (statuses.includes('Okay')) {
183
+ return false;
184
+ }
167
185
  break;
168
186
  case 'keypad':
169
187
  break;
170
188
  case 'motion':
171
- if (status.includes('No Motion')) {
189
+ if (statuses.includes('No Motion')) {
172
190
  return false;
173
191
  }
174
- if (status.includes('Motion')) {
192
+ if (statuses.includes('Motion')) {
175
193
  return true;
176
194
  }
177
195
  break;
@@ -179,68 +197,109 @@ export class ADTPulseAccessory {
179
197
  break;
180
198
  case 'shock':
181
199
  break;
200
+ case 'supervisory':
201
+ break;
182
202
  case 'temperature':
183
- return 75;
203
+ break;
204
+ case 'unknown':
205
+ break;
184
206
  default:
185
207
  break;
186
208
  }
187
- throw new this.#api.hap.HapStatusError(-70409);
209
+ this.#log.warn(`Attempted to get sensor status on ${chalk.underline(name)} (id: ${id}, uuid: ${uuid}) accessory but actions have not been implemented yet.`);
210
+ await this.newInformationDispatcher(context);
211
+ throw new this.#api.hap.HapStatusError(-70410);
188
212
  }
189
- getPanelStatus(mode, context) {
190
- if (context.type !== 'panel') {
191
- throw new this.#api.hap.HapStatusError(-70409);
213
+ async getPanelStatus(mode, context) {
214
+ const { id, name, type, uuid, } = context;
215
+ if (type !== 'panel') {
216
+ this.#log.error(`Attempted to get panel status on ${chalk.underline(name)} (id: ${id}, uuid: ${uuid}) accessory but device is not a security panel.`);
217
+ throw new this.#api.hap.HapStatusError(-70410);
192
218
  }
193
219
  if (this.#state.data.panelStatus === null
194
- || this.#state.data.panelStatus.state === null
195
- || this.#state.data.panelStatus.status === null) {
196
- throw new this.#api.hap.HapStatusError(-70402);
220
+ || this.#state.data.panelStatus.panelStates.length === 0
221
+ || this.#state.data.panelStatus.panelStatuses.length === 0) {
222
+ this.#log.warn(`Attempted to get panel status on ${chalk.underline(name)} (id: ${id}, uuid: ${uuid}) accessory but panel status has not been retrieved yet.`);
223
+ throw new this.#api.hap.HapStatusError(-70403);
197
224
  }
198
- const { state, status } = this.#state.data.panelStatus;
199
- if (state === 'Status Unavailable') {
200
- throw new this.#api.hap.HapStatusError(-70402);
225
+ const { panelStates, panelStatuses } = this.#state.data.panelStatus;
226
+ if (panelStates.includes('Status Unavailable')) {
227
+ this.#log.warn(`Attempted to get panel status on ${chalk.underline(name)} (id: ${id}, uuid: ${uuid}) accessory but panel state is "Service Unavailable".`);
228
+ throw new this.#api.hap.HapStatusError(-70403);
201
229
  }
202
- if (mode === 'current' && status === 'BURGLARY ALARM') {
230
+ if (mode === 'current' && panelStatuses.includes('BURGLARY ALARM')) {
203
231
  return this.#characteristic.SecuritySystemCurrentState.ALARM_TRIGGERED;
204
232
  }
205
- switch (state) {
206
- case 'Armed Away':
233
+ switch (true) {
234
+ case panelStates.includes('Armed Away'):
207
235
  return (mode === 'current') ? this.#characteristic.SecuritySystemCurrentState.AWAY_ARM : this.#characteristic.SecuritySystemTargetState.AWAY_ARM;
208
- case 'Armed Stay':
236
+ case panelStates.includes('Armed Stay'):
209
237
  return (mode === 'current') ? this.#characteristic.SecuritySystemCurrentState.STAY_ARM : this.#characteristic.SecuritySystemTargetState.STAY_ARM;
210
- case 'Armed Night':
238
+ case panelStates.includes('Armed Night'):
211
239
  return (mode === 'current') ? this.#characteristic.SecuritySystemCurrentState.NIGHT_ARM : this.#characteristic.SecuritySystemTargetState.NIGHT_ARM;
212
- case 'Disarmed':
240
+ case panelStates.includes('Disarmed'):
213
241
  return (mode === 'current') ? this.#characteristic.SecuritySystemCurrentState.DISARMED : this.#characteristic.SecuritySystemTargetState.DISARM;
214
242
  default:
215
243
  break;
216
244
  }
245
+ this.#log.warn(`Attempted to get panel status on ${chalk.underline(name)} (id: ${id}, uuid: ${uuid}) accessory but actions have not been implemented yet.`);
246
+ await this.newInformationDispatcher(context);
217
247
  throw new this.#api.hap.HapStatusError(-70402);
218
248
  }
219
249
  async setPanelStatus(arm, context) {
220
- let result;
221
- if (context.type !== 'panel') {
222
- throw new this.#api.hap.HapStatusError(-70409);
250
+ const { id, name, type, uuid, } = context;
251
+ let result = {
252
+ success: false,
253
+ };
254
+ let unknownArmValue = false;
255
+ if (type !== 'panel') {
256
+ this.#log.error(`Attempted to set panel status on ${chalk.underline(name)} (id: ${id}, uuid: ${uuid}) accessory but device is not a security panel.`);
257
+ throw new this.#api.hap.HapStatusError(-70410);
258
+ }
259
+ if (this.#state.data.panelStatus === null || this.#state.data.panelStatus.panelStates.length === 0) {
260
+ this.#log.warn(`Attempted to set panel status on ${chalk.underline(name)} (id: ${id}, uuid: ${uuid}) accessory but panel status has not been retrieved yet.`);
261
+ throw new this.#api.hap.HapStatusError(-70403);
262
+ }
263
+ const { panelStates } = this.#state.data.panelStatus;
264
+ const armFrom = condensePanelStates(panelStates);
265
+ if (armFrom === undefined) {
266
+ this.#log.warn(`Attempted to set panel status on ${chalk.underline(name)} (id: ${id}, uuid: ${uuid}) accessory but panel status cannot be found or most likely "Status Unavailable".`);
267
+ throw new this.#api.hap.HapStatusError(-70403);
223
268
  }
224
269
  switch (arm) {
225
270
  case this.#characteristic.SecuritySystemTargetState.STAY_ARM:
226
- result = await this.#instance.setPanelStatus('stay');
271
+ result = await this.#instance.setPanelStatus(armFrom, 'stay');
227
272
  break;
228
273
  case this.#characteristic.SecuritySystemTargetState.AWAY_ARM:
229
- result = await this.#instance.setPanelStatus('away');
274
+ result = await this.#instance.setPanelStatus(armFrom, 'away');
230
275
  break;
231
276
  case this.#characteristic.SecuritySystemTargetState.NIGHT_ARM:
232
- result = await this.#instance.setPanelStatus('night');
277
+ result = await this.#instance.setPanelStatus(armFrom, 'night');
233
278
  break;
234
279
  case this.#characteristic.SecuritySystemTargetState.DISARM:
235
- result = await this.#instance.setPanelStatus('off');
280
+ result = await this.#instance.setPanelStatus(armFrom, 'off');
236
281
  break;
237
282
  default:
283
+ unknownArmValue = true;
238
284
  break;
239
285
  }
240
- if (result && result.success) {
241
- return;
286
+ if (unknownArmValue) {
287
+ this.#log.error(`Attempted to set panel status on ${chalk.underline(name)} (id: ${id}, uuid: ${uuid}) accessory but request has unknown arm value.`);
288
+ throw new this.#api.hap.HapStatusError(-70410);
289
+ }
290
+ if (!result.success) {
291
+ this.#log.error(`Attempted to set panel status on ${chalk.underline(name)} (id: ${id}, uuid: ${uuid}) accessory but request was not successful.`);
292
+ throw new this.#api.hap.HapStatusError(-70408);
293
+ }
294
+ }
295
+ async newInformationDispatcher(context) {
296
+ const dataHash = generateHash(JSON.stringify(context));
297
+ if (this.#reportedHashes.find((reportedHash) => dataHash === reportedHash) === undefined) {
298
+ const detectedNew = await detectedNewDeviceContext(context, this.#log, this.#debugMode);
299
+ if (detectedNew) {
300
+ this.#reportedHashes.push(dataHash);
301
+ }
242
302
  }
243
- throw new this.#api.hap.HapStatusError(-70410);
244
303
  }
245
304
  }
246
305
  //# sourceMappingURL=accessory.js.map
@@ -1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AAC,IAAI,CAAC,KAAK,CAAC,oCAAoC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,IAAI,gDAAgD,CAAC,CAAC;YAErJ,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,cAAc,QAAkD,CAAC;QAC3F,CAAC;QAGD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,oCAAoC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,IAAI,6CAA6C,CAAC,CAAC;YAElJ,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,cAAc,QAA6C,CAAC;QACtF,CAAC;IACH,CAAC;IAaO,KAAK,CAAC,wBAAwB,CAAC,OAAyD;QAC9F,MAAM,QAAQ,GAAG,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;QAGvD,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,QAAQ,KAAK,YAAY,CAAC,KAAK,SAAS,EAAE,CAAC;YACzF,MAAM,WAAW,GAAG,MAAM,wBAAwB,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;YAGxF,IAAI,WAAW,EAAE,CAAC;gBAChB,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACtC,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
@@ -25,7 +25,7 @@ export class ADTPulse {
25
25
  reportedHashes: [],
26
26
  testMode: {
27
27
  enabled: internalConfig.testMode?.enabled ?? false,
28
- isDisarmChecked: internalConfig.testMode?.isDisarmChecked ?? false,
28
+ isSystemDisarmedBeforeTest: internalConfig.testMode?.isSystemDisarmedBeforeTest ?? false,
29
29
  },
30
30
  };
31
31
  this.#session = {
@@ -565,13 +565,13 @@ export class ADTPulse {
565
565
  'Type/Model:',
566
566
  ], 1, 1);
567
567
  const emergencyKeys = _.get(fetchedTableCells, ['Emergency Keys:', 0], null);
568
- const parsedEmergencyKeys = (typeof emergencyKeys === 'string') ? emergencyKeys.match(textPanelEmergencyKeys) : null;
568
+ const parsedEmergencyKeys = (emergencyKeys !== null) ? emergencyKeys.match(textPanelEmergencyKeys) : null;
569
569
  const manufacturerProvider = _.get(fetchedTableCells, ['Manufacturer/Provider:', 0], null);
570
- const parsedManufacturer = (typeof manufacturerProvider === 'string') ? manufacturerProvider.split(' - ')[0] ?? null : null;
571
- const parsedProvider = (typeof manufacturerProvider === 'string') ? manufacturerProvider.split(' - ')[1] ?? null : null;
570
+ const parsedManufacturer = (manufacturerProvider !== null) ? manufacturerProvider.split(' - ')[0] ?? null : null;
571
+ const parsedProvider = (manufacturerProvider !== null) ? manufacturerProvider.split(' - ')[1] ?? null : null;
572
572
  const typeModel = _.get(fetchedTableCells, ['Type/Model:', 0], null);
573
- const parsedType = (typeof typeModel === 'string') ? typeModel.split(' - ')[0] ?? null : null;
574
- const parsedModel = (typeof typeModel === 'string') ? typeModel.split(' - ')[1] ?? null : null;
573
+ const parsedType = (typeModel !== null) ? typeModel.split(' - ')[0] ?? null : null;
574
+ const parsedModel = (typeModel !== null) ? typeModel.split(' - ')[1] ?? null : null;
575
575
  const panelInformation = {
576
576
  emergencyKeys: parsedEmergencyKeys,
577
577
  manufacturer: parsedManufacturer,
@@ -712,10 +712,22 @@ export class ADTPulse {
712
712
  },
713
713
  };
714
714
  }
715
- async setPanelStatus(armTo) {
715
+ async setPanelStatus(armFrom, armTo) {
716
716
  let errorObject;
717
717
  if (this.#internal.debug) {
718
- debugLog(this.#internal.logger, 'api.ts / ADTPulse.setPanelStatus()', 'info', `Attempting to update panel status to "${armTo}" at "${this.#internal.baseUrl}"`);
718
+ debugLog(this.#internal.logger, 'api.ts / ADTPulse.setPanelStatus()', 'info', `Attempting to update panel status from "${armFrom}" to "${armTo}" at "${this.#internal.baseUrl}"`);
719
+ }
720
+ if (armFrom !== 'away'
721
+ && armFrom !== 'night'
722
+ && armFrom !== 'off'
723
+ && armFrom !== 'stay') {
724
+ return {
725
+ action: 'SET_PANEL_STATUS',
726
+ success: false,
727
+ info: {
728
+ message: `"${armFrom}" is an invalid arm from state`,
729
+ },
730
+ };
719
731
  }
720
732
  if (armTo !== 'away'
721
733
  && armTo !== 'night'
@@ -729,6 +741,18 @@ export class ADTPulse {
729
741
  },
730
742
  };
731
743
  }
744
+ if (armFrom === armTo) {
745
+ if (this.#internal.debug) {
746
+ debugLog(this.#internal.logger, 'api.ts / ADTPulse.setPanelStatus()', 'info', `No need to change arm state from "${armFrom}" to "${armTo}" due to its equivalence`);
747
+ }
748
+ return {
749
+ action: 'SET_PANEL_STATUS',
750
+ success: true,
751
+ info: {
752
+ forceArmRequired: false,
753
+ },
754
+ };
755
+ }
732
756
  try {
733
757
  const internet = await this.isPortalAccessible();
734
758
  const sessions = {};
@@ -847,7 +871,7 @@ export class ADTPulse {
847
871
  };
848
872
  }
849
873
  if (this.#internal.testMode.enabled
850
- && !this.#internal.testMode.isDisarmChecked) {
874
+ && !this.#internal.testMode.isSystemDisarmedBeforeTest) {
851
875
  if (!['off', 'disarmed'].includes(readyButtons[0].urlParams.armState)) {
852
876
  if (this.#internal.debug) {
853
877
  debugLog(this.#internal.logger, 'api.ts / ADTPulse.setPanelStatus()', 'error', 'Test mode is active and system is not disarmed');
@@ -860,7 +884,7 @@ export class ADTPulse {
860
884
  },
861
885
  };
862
886
  }
863
- this.#internal.testMode.isDisarmChecked = true;
887
+ this.#internal.testMode.isSystemDisarmedBeforeTest = true;
864
888
  }
865
889
  while (!['off', 'disarmed'].includes(readyButtons[0].urlParams.armState)) {
866
890
  const armDisarmResponse = await this.armDisarmHandler(readyButtons[0].relativeUrl, readyButtons[0].urlParams.href, readyButtons[0].urlParams.armState, 'off', readyButtons[0].urlParams.sat);