homebridge-adt-pulse 3.0.0-beta.2 → 3.0.0-beta.21
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 +198 -12
- package/README.md +174 -114
- package/build/config.schema.json +349 -0
- package/build/src/index.js +6 -0
- package/build/src/index.js.map +1 -0
- package/build/src/lib/accessory.js +432 -0
- package/build/src/lib/accessory.js.map +1 -0
- package/build/src/lib/api.js +1782 -0
- package/build/src/lib/api.js.map +1 -0
- package/build/src/lib/detect.js +480 -0
- package/build/src/lib/detect.js.map +1 -0
- package/build/src/lib/items.js +279 -0
- package/build/src/lib/items.js.map +1 -0
- package/build/src/lib/platform.js +493 -0
- package/build/src/lib/platform.js.map +1 -0
- package/{src/lib/regex.ts → build/src/lib/regex.js} +3 -145
- package/build/src/lib/regex.js.map +1 -0
- package/build/src/lib/schema.js +45 -0
- package/build/src/lib/schema.js.map +1 -0
- package/build/src/lib/utility.js +531 -0
- package/build/src/lib/utility.js.map +1 -0
- package/build/src/scripts/repl.js +176 -0
- package/build/src/scripts/repl.js.map +1 -0
- package/build/src/scripts/test-api.js +171 -0
- package/build/src/scripts/test-api.js.map +1 -0
- package/config.schema.json +330 -218
- package/package.json +34 -20
- package/src/index.ts +0 -18
- package/src/lib/accessory.ts +0 -405
- package/src/lib/api.ts +0 -3483
- package/src/lib/detect.ts +0 -728
- package/src/lib/platform.ts +0 -890
- package/src/lib/schema.ts +0 -34
- package/src/lib/utility.ts +0 -933
- package/src/scripts/repl.ts +0 -300
- package/src/scripts/test-api.ts +0 -278
- package/src/types/constant.d.ts +0 -308
- package/src/types/index.d.ts +0 -1472
- package/src/types/shared.d.ts +0 -517
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { arch, argv, platform, versions, } from 'node:process';
|
|
3
|
+
import { serializeError } from 'serialize-error';
|
|
4
|
+
import { ADTPulseAccessory } from './accessory.js';
|
|
5
|
+
import { ADTPulse } from './api.js';
|
|
6
|
+
import { detectedUnknownSensorsAction } from './detect.js';
|
|
7
|
+
import { platformConfig } from './schema.js';
|
|
8
|
+
import { condenseSensorType, findIndexWithValue, generateHash, getAccessoryCategory, getPackageVersion, getPluralForm, sleep, stackTracer, } from './utility.js';
|
|
9
|
+
export class ADTPulsePlatform {
|
|
10
|
+
accessories;
|
|
11
|
+
#api;
|
|
12
|
+
#characteristic;
|
|
13
|
+
#config;
|
|
14
|
+
#constants;
|
|
15
|
+
#debugMode;
|
|
16
|
+
#handlers;
|
|
17
|
+
#instance;
|
|
18
|
+
#log;
|
|
19
|
+
#service;
|
|
20
|
+
#state;
|
|
21
|
+
constructor(log, config, api) {
|
|
22
|
+
this.accessories = [];
|
|
23
|
+
this.#api = api;
|
|
24
|
+
this.#characteristic = api.hap.Characteristic;
|
|
25
|
+
this.#config = null;
|
|
26
|
+
this.#constants = {
|
|
27
|
+
intervalTimestamps: {
|
|
28
|
+
adtKeepAlive: 538000,
|
|
29
|
+
adtSyncCheck: 3000,
|
|
30
|
+
suspendSyncing: 1800000,
|
|
31
|
+
synchronize: 1000,
|
|
32
|
+
},
|
|
33
|
+
maxLoginRetries: 3,
|
|
34
|
+
};
|
|
35
|
+
this.#debugMode = argv.includes('-D') || argv.includes('--debug');
|
|
36
|
+
this.#handlers = {};
|
|
37
|
+
this.#instance = null;
|
|
38
|
+
this.#log = log;
|
|
39
|
+
this.#service = api.hap.Service;
|
|
40
|
+
this.#state = {
|
|
41
|
+
activity: {
|
|
42
|
+
isAdtKeepingAlive: false,
|
|
43
|
+
isAdtSyncChecking: false,
|
|
44
|
+
isLoggingIn: false,
|
|
45
|
+
isSyncing: false,
|
|
46
|
+
},
|
|
47
|
+
data: {
|
|
48
|
+
gatewayInfo: null,
|
|
49
|
+
panelInfo: null,
|
|
50
|
+
panelStatus: null,
|
|
51
|
+
sensorsInfo: [],
|
|
52
|
+
sensorsStatus: [],
|
|
53
|
+
syncCode: '1-0-0',
|
|
54
|
+
},
|
|
55
|
+
eventCounters: {
|
|
56
|
+
failedLogins: 0,
|
|
57
|
+
},
|
|
58
|
+
intervals: {
|
|
59
|
+
synchronize: undefined,
|
|
60
|
+
},
|
|
61
|
+
lastRunOn: {
|
|
62
|
+
adtKeepAlive: 0,
|
|
63
|
+
adtSyncCheck: 0,
|
|
64
|
+
},
|
|
65
|
+
reportedHashes: [],
|
|
66
|
+
};
|
|
67
|
+
const parsedConfig = platformConfig.safeParse(config);
|
|
68
|
+
if (!parsedConfig.success) {
|
|
69
|
+
this.#log.error('Plugin is unable to initialize due to an invalid platform configuration.');
|
|
70
|
+
this.#log.warn('If you just upgraded from v2 to v3, please update your configuration structure.');
|
|
71
|
+
stackTracer('zod-error', parsedConfig.error.errors);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
api.on('didFinishLaunching', async () => {
|
|
75
|
+
this.#config = parsedConfig.data;
|
|
76
|
+
this.printSystemInformation();
|
|
77
|
+
this.#log.info('The API gathers anonymous analytics to detect potential bugs or issues. All personally identifiable information will be redacted.');
|
|
78
|
+
if (this.#config.mode === 'paused') {
|
|
79
|
+
this.#log.warn('Plugin is now paused and all related accessories will no longer respond.');
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (this.#config.mode === 'reset') {
|
|
83
|
+
let warningCount = 0;
|
|
84
|
+
let warningTerm = '';
|
|
85
|
+
this.#log.warn('Plugin started in reset mode and will remove all accessories shortly.');
|
|
86
|
+
await sleep(10000);
|
|
87
|
+
for (let i = 3; i >= 1; i -= 1) {
|
|
88
|
+
const seconds = 10 * i;
|
|
89
|
+
warningCount += 1;
|
|
90
|
+
switch (warningCount) {
|
|
91
|
+
case 1:
|
|
92
|
+
warningTerm = 'FIRST';
|
|
93
|
+
break;
|
|
94
|
+
case 2:
|
|
95
|
+
warningTerm = 'SECOND';
|
|
96
|
+
break;
|
|
97
|
+
case 3:
|
|
98
|
+
default:
|
|
99
|
+
warningTerm = 'FINAL';
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
this.#log.warn(`${warningTerm} WARNING! ${seconds} SECONDS REMAINING before all related accessories are removed.`);
|
|
103
|
+
await sleep(10000);
|
|
104
|
+
}
|
|
105
|
+
this.#log.warn('Plugin is now removing all related accessories from Homebridge ...');
|
|
106
|
+
for (let i = this.accessories.length - 1; i >= 0; i -= 1) {
|
|
107
|
+
this.removeAccessory(this.accessories[i], 'plugin is in "reset" mode');
|
|
108
|
+
}
|
|
109
|
+
this.#log.info('Plugin finished removing all related accessories from Homebridge.');
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (this.#config.speed !== 1) {
|
|
113
|
+
this.#log.warn(`Plugin is now running under ${this.#config.speed}x operational speed. You may see slower device updates.`);
|
|
114
|
+
this.#constants.intervalTimestamps.synchronize *= (1 / this.#config.speed);
|
|
115
|
+
}
|
|
116
|
+
this.#instance = new ADTPulse(this.#config, {
|
|
117
|
+
debug: this.#debugMode === true,
|
|
118
|
+
logger: this.#log,
|
|
119
|
+
});
|
|
120
|
+
this.synchronize();
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
configureAccessory(accessory) {
|
|
124
|
+
this.#log.info(`Configuring cached accessory for ${chalk.underline(accessory.context.name)} (id: ${accessory.context.id}, uuid: ${accessory.context.uuid}) ...`);
|
|
125
|
+
this.accessories.push(accessory);
|
|
126
|
+
}
|
|
127
|
+
addAccessory(device) {
|
|
128
|
+
const accessoryIndex = this.accessories.findIndex((accessory) => device.uuid === accessory.context.uuid);
|
|
129
|
+
if (accessoryIndex >= 0) {
|
|
130
|
+
this.#log.error(`Cannot add ${chalk.underline(device.name)} (id: ${device.id}, uuid: ${device.uuid}) accessory that already exists.`);
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
if (this.#instance === null) {
|
|
134
|
+
this.#log.error(`Attempted to add ${chalk.underline(device.name)} (id: ${device.id}, uuid: ${device.uuid}) accessory but API instance is not available.`);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
const newAccessory = new this.#api.platformAccessory(device.name, device.uuid, getAccessoryCategory(device.category));
|
|
138
|
+
newAccessory.context = device;
|
|
139
|
+
const typedAccessory = newAccessory;
|
|
140
|
+
this.#log.info(`Adding ${chalk.underline(typedAccessory.context.name)} (id: ${typedAccessory.context.id}, uuid: ${typedAccessory.context.uuid}) accessory ...`);
|
|
141
|
+
if (this.#handlers[device.id] === undefined) {
|
|
142
|
+
this.#handlers[device.id] = new ADTPulseAccessory(typedAccessory, this.#state, this.#instance, this.#service, this.#characteristic, this.#api, this.#log);
|
|
143
|
+
}
|
|
144
|
+
this.accessories.push(typedAccessory);
|
|
145
|
+
this.#api.registerPlatformAccessories('homebridge-adt-pulse', 'ADTPulse', [typedAccessory]);
|
|
146
|
+
}
|
|
147
|
+
updateAccessory(device) {
|
|
148
|
+
const { index, value } = findIndexWithValue(this.accessories, (accessory) => device.uuid === accessory.context.uuid);
|
|
149
|
+
if (index < 0 || value === undefined) {
|
|
150
|
+
this.#log.warn(`Attempted to update ${chalk.underline(device.name)} (id: ${device.id}, uuid: ${device.uuid}) accessory that does not exist.`);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (this.#instance === null) {
|
|
154
|
+
this.#log.error(`Attempted to updated ${chalk.underline(device.name)} (id: ${device.id}, uuid: ${device.uuid}) accessory but API instance is not available.`);
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
this.#log.debug(`Updating ${chalk.underline(value.context.name)} (id: ${value.context.id}, uuid: ${value.context.uuid}) accessory ...`);
|
|
158
|
+
value.context = device;
|
|
159
|
+
value.displayName = device.name;
|
|
160
|
+
if (this.#handlers[device.id] === undefined) {
|
|
161
|
+
this.#handlers[device.id] = new ADTPulseAccessory(value, this.#state, this.#instance, this.#service, this.#characteristic, this.#api, this.#log);
|
|
162
|
+
}
|
|
163
|
+
this.accessories[index] = value;
|
|
164
|
+
this.#api.updatePlatformAccessories([value]);
|
|
165
|
+
}
|
|
166
|
+
removeAccessory(accessory, reason) {
|
|
167
|
+
this.#log.info(`Removing ${chalk.underline(accessory.context.name)} (id: ${accessory.context.id}, uuid: ${accessory.context.uuid}) accessory ...`);
|
|
168
|
+
this.#log.debug(`${chalk.underline(accessory.context.name)} (id: ${accessory.context.id}, uuid: ${accessory.context.uuid}) is removed because ${reason}.`);
|
|
169
|
+
this.accessories = this.accessories.filter((existingAccessory) => existingAccessory.context.uuid !== accessory.context.uuid);
|
|
170
|
+
this.#api.unregisterPlatformAccessories('homebridge-adt-pulse', 'ADTPulse', [accessory]);
|
|
171
|
+
}
|
|
172
|
+
printSystemInformation() {
|
|
173
|
+
const homebridgeVersion = chalk.yellowBright(`v${this.#api.serverVersion}`);
|
|
174
|
+
const nodeVersion = chalk.blueBright(`v${versions.node}`);
|
|
175
|
+
const opensslVersion = chalk.magentaBright(`v${versions.openssl}`);
|
|
176
|
+
const packageVersion = chalk.greenBright(`v${getPackageVersion()}`);
|
|
177
|
+
const platformPlusArch = chalk.redBright(`${platform} (${arch})`);
|
|
178
|
+
this.#log.info([
|
|
179
|
+
`running on ${platformPlusArch}`,
|
|
180
|
+
`homebridge-adt-pulse ${packageVersion}`,
|
|
181
|
+
`homebridge ${homebridgeVersion}`,
|
|
182
|
+
`node ${nodeVersion}`,
|
|
183
|
+
`openssl ${opensslVersion}`,
|
|
184
|
+
].join(chalk.gray(' // ')));
|
|
185
|
+
}
|
|
186
|
+
synchronize() {
|
|
187
|
+
this.#state.intervals.synchronize = setInterval(async () => {
|
|
188
|
+
if (this.#state.activity.isSyncing) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
if (this.#instance === null) {
|
|
192
|
+
this.#log.warn('synchronize() was called but API is not available.');
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
try {
|
|
196
|
+
this.#state.activity.isSyncing = true;
|
|
197
|
+
if (!this.#instance.isAuthenticated()) {
|
|
198
|
+
if (!this.#state.activity.isLoggingIn) {
|
|
199
|
+
this.#state.activity.isLoggingIn = true;
|
|
200
|
+
const login = await this.#instance.login();
|
|
201
|
+
if (login.success) {
|
|
202
|
+
const currentTimestamp = Date.now();
|
|
203
|
+
this.#state.lastRunOn.adtKeepAlive = currentTimestamp;
|
|
204
|
+
this.#state.lastRunOn.adtSyncCheck = currentTimestamp;
|
|
205
|
+
}
|
|
206
|
+
if (!login.success) {
|
|
207
|
+
this.#state.eventCounters.failedLogins += 1;
|
|
208
|
+
const attemptsLeft = this.#constants.maxLoginRetries - this.#state.eventCounters.failedLogins;
|
|
209
|
+
if (attemptsLeft > 0) {
|
|
210
|
+
this.#log.error(`Login attempt has failed. Trying ${attemptsLeft} more ${getPluralForm(attemptsLeft, 'time', 'times')} ...`);
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
const suspendMinutes = this.#constants.intervalTimestamps.suspendSyncing / 1000 / 60;
|
|
214
|
+
this.#log.error(`Login attempt has failed for ${this.#constants.maxLoginRetries} ${getPluralForm(this.#constants.maxLoginRetries, 'time', 'times')}. Sleeping for ${suspendMinutes} ${getPluralForm(suspendMinutes, 'minute', 'minutes')} before resuming ...`);
|
|
215
|
+
}
|
|
216
|
+
stackTracer('api-response', login);
|
|
217
|
+
}
|
|
218
|
+
this.#state.activity.isLoggingIn = false;
|
|
219
|
+
}
|
|
220
|
+
if (this.#state.eventCounters.failedLogins >= this.#constants.maxLoginRetries) {
|
|
221
|
+
await sleep(this.#constants.intervalTimestamps.suspendSyncing);
|
|
222
|
+
this.#state.eventCounters.failedLogins = 0;
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
if (!this.#instance.isAuthenticated()) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
const currentTimestamp = Date.now();
|
|
230
|
+
if (currentTimestamp - this.#state.lastRunOn.adtKeepAlive >= this.#constants.intervalTimestamps.adtKeepAlive) {
|
|
231
|
+
this.synchronizeKeepAlive();
|
|
232
|
+
}
|
|
233
|
+
if (currentTimestamp - this.#state.lastRunOn.adtSyncCheck >= this.#constants.intervalTimestamps.adtSyncCheck) {
|
|
234
|
+
this.synchronizeSyncCheck();
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
catch (error) {
|
|
238
|
+
this.#log.error('synchronize() has unexpectedly thrown an error, will continue to sync.');
|
|
239
|
+
stackTracer('serialize-error', serializeError(error));
|
|
240
|
+
}
|
|
241
|
+
finally {
|
|
242
|
+
this.#state.activity.isSyncing = false;
|
|
243
|
+
}
|
|
244
|
+
}, this.#constants.intervalTimestamps.synchronize);
|
|
245
|
+
}
|
|
246
|
+
synchronizeKeepAlive() {
|
|
247
|
+
(async () => {
|
|
248
|
+
if (this.#state.activity.isAdtKeepingAlive) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
if (this.#instance === null) {
|
|
252
|
+
this.#log.warn('synchronizeKeepAlive() was called but API instance is not available.');
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
try {
|
|
256
|
+
this.#state.activity.isAdtKeepingAlive = true;
|
|
257
|
+
const keepAlive = await this.#instance.performKeepAlive();
|
|
258
|
+
if (keepAlive.success) {
|
|
259
|
+
this.#log.debug('Keep alive request was successful. The login session should now be extended.');
|
|
260
|
+
}
|
|
261
|
+
if (!keepAlive.success) {
|
|
262
|
+
this.#log.error('Keeping alive attempt has failed. Trying again later.');
|
|
263
|
+
stackTracer('api-response', keepAlive);
|
|
264
|
+
}
|
|
265
|
+
this.#state.lastRunOn.adtKeepAlive = Date.now();
|
|
266
|
+
}
|
|
267
|
+
catch (error) {
|
|
268
|
+
this.#log.error('synchronizeKeepAlive() has unexpectedly thrown an error, will continue to keep alive.');
|
|
269
|
+
stackTracer('serialize-error', serializeError(error));
|
|
270
|
+
}
|
|
271
|
+
finally {
|
|
272
|
+
this.#state.activity.isAdtKeepingAlive = false;
|
|
273
|
+
}
|
|
274
|
+
})();
|
|
275
|
+
}
|
|
276
|
+
synchronizeSyncCheck() {
|
|
277
|
+
(async () => {
|
|
278
|
+
if (this.#state.activity.isAdtSyncChecking) {
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
if (this.#instance === null) {
|
|
282
|
+
this.#log.warn('synchronizeSyncCheck() was called but API instance is not available.');
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
try {
|
|
286
|
+
this.#state.activity.isAdtSyncChecking = true;
|
|
287
|
+
const syncCheck = await this.#instance.performSyncCheck();
|
|
288
|
+
if (syncCheck.success) {
|
|
289
|
+
this.#log.debug('Sync check request was successful. Determining if panel and sensor data is outdated ...');
|
|
290
|
+
if (syncCheck.info.syncCode !== this.#state.data.syncCode) {
|
|
291
|
+
this.#log.debug(`Panel and sensor data is outdated (cached: ${this.#state.data.syncCode}, fetched: ${syncCheck.info.syncCode}). Preparing to retrieve the latest panel and sensor data ...`);
|
|
292
|
+
this.#state.data.syncCode = syncCheck.info.syncCode;
|
|
293
|
+
await this.fetchUpdatedInformation();
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
this.#log.debug(`Panel and sensor data is up to date (cached: ${this.#state.data.syncCode}, fetched: ${syncCheck.info.syncCode}).`);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
if (!syncCheck.success) {
|
|
300
|
+
const { error } = syncCheck.info;
|
|
301
|
+
const { message } = error ?? {};
|
|
302
|
+
if (message !== undefined) {
|
|
303
|
+
switch (true) {
|
|
304
|
+
case message.includes('ECONNABORTED'):
|
|
305
|
+
this.#log.debug('Sync checking attempt has failed because the connection timed out. Trying again later.');
|
|
306
|
+
break;
|
|
307
|
+
case message.includes('ECONNRESET'):
|
|
308
|
+
this.#log.debug('Sync checking attempt has failed because the connection was reset. Trying again later.');
|
|
309
|
+
break;
|
|
310
|
+
default:
|
|
311
|
+
break;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
this.#log.error('Sync checking attempt has failed. Trying again later.');
|
|
316
|
+
stackTracer('api-response', syncCheck);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
this.#state.lastRunOn.adtSyncCheck = Date.now();
|
|
320
|
+
}
|
|
321
|
+
catch (error) {
|
|
322
|
+
this.#log.error('synchronizeSyncCheck() has unexpectedly thrown an error, will continue to sync check.');
|
|
323
|
+
stackTracer('serialize-error', serializeError(error));
|
|
324
|
+
}
|
|
325
|
+
finally {
|
|
326
|
+
this.#state.activity.isAdtSyncChecking = false;
|
|
327
|
+
}
|
|
328
|
+
})();
|
|
329
|
+
}
|
|
330
|
+
async fetchUpdatedInformation() {
|
|
331
|
+
if (this.#instance === null) {
|
|
332
|
+
this.#log.warn('fetchUpdatedInformation() was called but API instance is not available.');
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
try {
|
|
336
|
+
const requests = await Promise.all([
|
|
337
|
+
this.#instance.getGatewayInformation(),
|
|
338
|
+
this.#instance.getPanelInformation(),
|
|
339
|
+
this.#instance.getPanelStatus(),
|
|
340
|
+
this.#instance.getSensorsInformation(),
|
|
341
|
+
this.#instance.getSensorsStatus(),
|
|
342
|
+
]);
|
|
343
|
+
if (requests[0].success) {
|
|
344
|
+
const { info } = requests[0];
|
|
345
|
+
this.#state.data.gatewayInfo = info;
|
|
346
|
+
}
|
|
347
|
+
if (requests[1].success) {
|
|
348
|
+
const { info } = requests[1];
|
|
349
|
+
this.#state.data.panelInfo = info;
|
|
350
|
+
}
|
|
351
|
+
if (requests[2].success) {
|
|
352
|
+
const { info } = requests[2];
|
|
353
|
+
this.#state.data.panelStatus = info;
|
|
354
|
+
}
|
|
355
|
+
if (requests[3].success) {
|
|
356
|
+
const { sensors } = requests[3].info;
|
|
357
|
+
this.#state.data.sensorsInfo = sensors;
|
|
358
|
+
}
|
|
359
|
+
if (requests[4].success) {
|
|
360
|
+
const { sensors } = requests[4].info;
|
|
361
|
+
this.#state.data.sensorsStatus = sensors;
|
|
362
|
+
}
|
|
363
|
+
await this.unknownInformationDispatcher();
|
|
364
|
+
await this.unifyDevices();
|
|
365
|
+
}
|
|
366
|
+
catch (error) {
|
|
367
|
+
this.#log.error('fetchUpdatedInformation() has unexpectedly thrown an error, will continue to fetch.');
|
|
368
|
+
stackTracer('serialize-error', serializeError(error));
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
async unknownInformationDispatcher() {
|
|
372
|
+
const { sensorsInfo, sensorsStatus } = this.#state.data;
|
|
373
|
+
if (sensorsInfo.length !== sensorsStatus.length) {
|
|
374
|
+
this.#log.error('It seems like there is a mis-match between the sensors information and sensors status. This should not be happening.');
|
|
375
|
+
stackTracer('sensor-mismatch', {
|
|
376
|
+
sensorsInfo,
|
|
377
|
+
sensorsStatus,
|
|
378
|
+
});
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
const sensors = sensorsInfo.map((sensorInfo, sensorsInfoKey) => ({
|
|
382
|
+
info: sensorInfo,
|
|
383
|
+
status: sensorsStatus[sensorsInfoKey],
|
|
384
|
+
type: condenseSensorType(sensorInfo.deviceType),
|
|
385
|
+
}));
|
|
386
|
+
const matchedSensors = sensors.filter((sensor) => sensor !== null);
|
|
387
|
+
const dataHash = generateHash(JSON.stringify(sensors));
|
|
388
|
+
if (this.#state.reportedHashes.find((reportedHash) => dataHash === reportedHash) === undefined) {
|
|
389
|
+
const detectedNew = await detectedUnknownSensorsAction(matchedSensors, this.#log, this.#debugMode);
|
|
390
|
+
if (detectedNew) {
|
|
391
|
+
this.#state.reportedHashes.push(dataHash);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
async unifyDevices() {
|
|
396
|
+
const { gatewayInfo, panelInfo, sensorsInfo } = this.#state.data;
|
|
397
|
+
const devices = [];
|
|
398
|
+
if (gatewayInfo !== null) {
|
|
399
|
+
const id = 'adt-device-0';
|
|
400
|
+
devices.push({
|
|
401
|
+
id,
|
|
402
|
+
name: 'ADT Pulse Gateway',
|
|
403
|
+
originalName: 'ADT Pulse Gateway',
|
|
404
|
+
type: 'gateway',
|
|
405
|
+
zone: null,
|
|
406
|
+
category: 'OTHER',
|
|
407
|
+
manufacturer: gatewayInfo.manufacturer,
|
|
408
|
+
model: gatewayInfo.model,
|
|
409
|
+
serial: gatewayInfo.serialNumber,
|
|
410
|
+
firmware: gatewayInfo.versions.firmware,
|
|
411
|
+
hardware: gatewayInfo.versions.hardware,
|
|
412
|
+
software: getPackageVersion(),
|
|
413
|
+
uuid: this.#api.hap.uuid.generate(id),
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
if (panelInfo !== null) {
|
|
417
|
+
const id = 'adt-device-1';
|
|
418
|
+
devices.push({
|
|
419
|
+
id,
|
|
420
|
+
name: 'Security Panel',
|
|
421
|
+
originalName: 'Security Panel',
|
|
422
|
+
type: 'panel',
|
|
423
|
+
zone: null,
|
|
424
|
+
category: 'SECURITY_SYSTEM',
|
|
425
|
+
manufacturer: panelInfo.manufacturer,
|
|
426
|
+
model: panelInfo.model,
|
|
427
|
+
serial: 'N/A',
|
|
428
|
+
firmware: null,
|
|
429
|
+
hardware: null,
|
|
430
|
+
software: getPackageVersion(),
|
|
431
|
+
uuid: this.#api.hap.uuid.generate(id),
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
if (this.#config !== null && sensorsInfo !== null) {
|
|
435
|
+
for (let i = 0; i < this.#config.sensors.length; i += 1) {
|
|
436
|
+
const { adtName, adtType, adtZone, name, } = this.#config.sensors[i];
|
|
437
|
+
const sensor = sensorsInfo.find((sensorInfo) => {
|
|
438
|
+
const sensorInfoName = sensorInfo.name;
|
|
439
|
+
const sensorInfoType = condenseSensorType(sensorInfo.deviceType);
|
|
440
|
+
const sensorInfoZone = sensorInfo.zone;
|
|
441
|
+
return (adtName === sensorInfoName
|
|
442
|
+
&& adtType === sensorInfoType
|
|
443
|
+
&& adtZone === sensorInfoZone);
|
|
444
|
+
});
|
|
445
|
+
if (sensor === undefined) {
|
|
446
|
+
this.#log.warn(`Attempted to add or update ${chalk.underline(name)} (adtName: ${adtName}, adtType: ${adtType}, adtZone: ${adtZone}) accessory that does not exist on the portal.`);
|
|
447
|
+
continue;
|
|
448
|
+
}
|
|
449
|
+
const id = `adt-device-${sensor.deviceId}`;
|
|
450
|
+
devices.push({
|
|
451
|
+
id,
|
|
452
|
+
name: name ?? adtName,
|
|
453
|
+
originalName: adtName,
|
|
454
|
+
type: adtType,
|
|
455
|
+
zone: adtZone,
|
|
456
|
+
category: 'SENSOR',
|
|
457
|
+
manufacturer: 'ADT',
|
|
458
|
+
model: sensor.deviceType,
|
|
459
|
+
serial: null,
|
|
460
|
+
firmware: null,
|
|
461
|
+
hardware: null,
|
|
462
|
+
software: getPackageVersion(),
|
|
463
|
+
uuid: this.#api.hap.uuid.generate(id),
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
if (this.#config !== null) {
|
|
468
|
+
const { sensors } = this.#config;
|
|
469
|
+
for (let i = this.accessories.length - 1; i >= 0; i -= 1) {
|
|
470
|
+
const { originalName, type, zone } = this.accessories[i].context;
|
|
471
|
+
if (type === 'gateway' || type === 'panel') {
|
|
472
|
+
continue;
|
|
473
|
+
}
|
|
474
|
+
if (!sensors.some((sensor) => originalName === sensor.adtName && zone !== null && zone === sensor.adtZone)) {
|
|
475
|
+
this.removeAccessory(this.accessories[i], 'accessory is missing in config');
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
await this.pollAccessories(devices);
|
|
480
|
+
}
|
|
481
|
+
async pollAccessories(devices) {
|
|
482
|
+
for (let i = 0; i < devices.length; i += 1) {
|
|
483
|
+
const accessoryIndex = this.accessories.findIndex((accessory) => devices[i].uuid === accessory.context.uuid);
|
|
484
|
+
if (accessoryIndex >= 0) {
|
|
485
|
+
this.updateAccessory(devices[i]);
|
|
486
|
+
}
|
|
487
|
+
else {
|
|
488
|
+
this.addAccessory(devices[i]);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
//# sourceMappingURL=platform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