homebridge-adt-pulse 3.0.0-beta.4 → 3.0.0-beta.6

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.
@@ -0,0 +1,446 @@
1
+ import chalk from 'chalk';
2
+ import { arch, argv, env, 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 { platformConfig } from './schema.js';
7
+ import { condenseSensorType, findIndexWithValue, getAccessoryCategory, getPluralForm, sleep, stackTracer, } from './utility.js';
8
+ export class ADTPulsePlatform {
9
+ accessories;
10
+ #api;
11
+ #characteristic;
12
+ #config;
13
+ #constants;
14
+ #debugMode;
15
+ #handlers;
16
+ #instance;
17
+ #log;
18
+ #service;
19
+ #state;
20
+ constructor(log, config, api) {
21
+ this.accessories = [];
22
+ this.#api = api;
23
+ this.#characteristic = api.hap.Characteristic;
24
+ this.#config = null;
25
+ this.#constants = {
26
+ intervalTimestamps: {
27
+ adtKeepAlive: 538000,
28
+ adtSyncCheck: 3000,
29
+ suspendSyncing: 1800000,
30
+ synchronize: 1000,
31
+ },
32
+ maxLoginRetries: 3,
33
+ };
34
+ this.#debugMode = argv.includes('-D') || argv.includes('--debug');
35
+ this.#handlers = {};
36
+ this.#instance = null;
37
+ this.#log = log;
38
+ this.#service = api.hap.Service;
39
+ this.#state = {
40
+ activity: {
41
+ isAdtKeepingAlive: false,
42
+ isAdtSyncChecking: false,
43
+ isLoggingIn: false,
44
+ isSyncing: false,
45
+ },
46
+ data: {
47
+ gatewayInfo: null,
48
+ panelInfo: null,
49
+ panelStatus: null,
50
+ sensorsInfo: [],
51
+ sensorsStatus: [],
52
+ syncCode: '1-0-0',
53
+ },
54
+ eventCounters: {
55
+ failedLogins: 0,
56
+ },
57
+ intervals: {
58
+ synchronize: undefined,
59
+ },
60
+ lastRunOn: {
61
+ adtKeepAlive: 0,
62
+ adtSyncCheck: 0,
63
+ },
64
+ };
65
+ const parsedConfig = platformConfig.safeParse(config);
66
+ if (!parsedConfig.success) {
67
+ this.#log.error('Plugin is unable to initialize due to an invalid platform configuration.');
68
+ stackTracer('zod-error', parsedConfig.error.errors);
69
+ return;
70
+ }
71
+ api.on('didFinishLaunching', async () => {
72
+ this.#config = parsedConfig.data;
73
+ this.#instance = new ADTPulse(this.#config, {
74
+ debug: this.#debugMode === true,
75
+ logger: this.#log,
76
+ });
77
+ this.printSystemInformation();
78
+ this.#log.info('The API gathers anonymous analytics to detect potential bugs or issues. All personally identifiable information redacted. You will see exactly what will be sent out.');
79
+ if (this.#config.mode === 'paused') {
80
+ this.#log.warn('Plugin is now paused and all related accessories will no longer respond.');
81
+ return;
82
+ }
83
+ if (this.#config.mode === 'reset') {
84
+ let warningCount = 0;
85
+ let warningTerm = '';
86
+ this.#log.warn('Plugin started in reset mode and will remove all accessories shortly.');
87
+ await sleep(10000);
88
+ for (let i = 3; i >= 1; i -= 1) {
89
+ const seconds = 10 * i;
90
+ warningCount += 1;
91
+ switch (warningCount) {
92
+ case 1:
93
+ warningTerm = 'FIRST';
94
+ break;
95
+ case 2:
96
+ warningTerm = 'SECOND';
97
+ break;
98
+ case 3:
99
+ default:
100
+ warningTerm = 'FINAL';
101
+ break;
102
+ }
103
+ this.#log.warn(`${warningTerm} WARNING! ${seconds} SECONDS REMAINING before all related accessories are removed.`);
104
+ await sleep(10000);
105
+ }
106
+ this.#log.warn('Plugin is now removing all related accessories from Homebridge ...');
107
+ for (let i = this.accessories.length - 1; i >= 0; i -= 1) {
108
+ this.removeAccessory(this.accessories[i]);
109
+ }
110
+ this.#log.warn('Plugin finished removing all related accessories from Homebridge.');
111
+ return;
112
+ }
113
+ if (this.#config.speed !== 1) {
114
+ this.#log.warn(`Plugin is now running under ${this.#config.speed}x operational speed. You may see slower device updates.`);
115
+ this.#constants.intervalTimestamps.synchronize *= (1 / this.#config.speed);
116
+ }
117
+ this.synchronize();
118
+ });
119
+ }
120
+ configureAccessory(accessory) {
121
+ this.#log.info(`Configuring cached accessory for ${chalk.underline(accessory.context.name)} (id: ${accessory.context.id}, uuid: ${accessory.context.uuid}) ...`);
122
+ this.accessories.push(accessory);
123
+ }
124
+ addAccessory(device) {
125
+ const accessoryIndex = this.accessories.findIndex((accessory) => device.uuid === accessory.context.uuid);
126
+ if (accessoryIndex >= 0) {
127
+ this.#log.error(`Cannot add ${chalk.underline(device.name)} (id: ${device.id}, uuid: ${device.uuid}) accessory that already exists.`);
128
+ return;
129
+ }
130
+ if (this.#instance === null) {
131
+ this.#log.error(`Attempted to add ${chalk.underline(device.name)} (id: ${device.id}, uuid: ${device.uuid}) accessory but API instance is not available.`);
132
+ return;
133
+ }
134
+ const newAccessory = new this.#api.platformAccessory(device.name, device.uuid, getAccessoryCategory(device.category));
135
+ newAccessory.context = device;
136
+ const typedAccessory = newAccessory;
137
+ this.#log.info(`Adding ${chalk.underline(typedAccessory.context.name)} (id: ${typedAccessory.context.id}, uuid: ${typedAccessory.context.uuid}) accessory ...`);
138
+ if (this.#handlers[device.id] === undefined) {
139
+ this.#handlers[device.id] = new ADTPulseAccessory(typedAccessory, this.#state, this.#instance, this.#service, this.#characteristic, this.#api, this.#log);
140
+ }
141
+ this.accessories.push(typedAccessory);
142
+ this.#api.registerPlatformAccessories('homebridge-adt-pulse', 'ADTPulse', [typedAccessory]);
143
+ }
144
+ updateAccessory(device) {
145
+ const { index, value } = findIndexWithValue(this.accessories, (accessory) => device.uuid === accessory.context.uuid);
146
+ if (index < 0 || value === undefined) {
147
+ this.#log.warn(`Attempted to update ${chalk.underline(device.name)} (id: ${device.id}, uuid: ${device.uuid}) accessory that does not exist.`);
148
+ return;
149
+ }
150
+ if (this.#instance === null) {
151
+ this.#log.error(`Attempted to updated ${chalk.underline(device.name)} (id: ${device.id}, uuid: ${device.uuid}) accessory but API instance is not available.`);
152
+ return;
153
+ }
154
+ this.#log.debug(`Updating ${chalk.underline(value.context.name)} (id: ${value.context.id}, uuid: ${value.context.uuid}) accessory ...`);
155
+ value.context = device;
156
+ value.displayName = device.name;
157
+ if (this.#handlers[device.id] === undefined) {
158
+ this.#handlers[device.id] = new ADTPulseAccessory(value, this.#state, this.#instance, this.#service, this.#characteristic, this.#api, this.#log);
159
+ }
160
+ this.accessories[index] = value;
161
+ this.#api.updatePlatformAccessories([value]);
162
+ }
163
+ removeAccessory(accessory) {
164
+ this.#log.info(`Removing ${chalk.underline(accessory.context.name)} (id: ${accessory.context.id}, uuid: ${accessory.context.uuid}) accessory ...`);
165
+ this.accessories = this.accessories.filter((existingAccessory) => existingAccessory.context.uuid !== accessory.context.uuid);
166
+ this.#api.unregisterPlatformAccessories('homebridge-adt-pulse', 'ADTPulse', [accessory]);
167
+ }
168
+ printSystemInformation() {
169
+ const homebridgeVersion = chalk.yellowBright(`v${this.#api.serverVersion}`);
170
+ const nodeVersion = chalk.blueBright(`v${versions.node}`);
171
+ const opensslVersion = chalk.magentaBright(`v${versions.openssl}`);
172
+ const packageVersion = chalk.greenBright(`v${env.npm_package_version ?? '0.1.0'}`);
173
+ const platformPlusArch = chalk.redBright(`${platform} (${arch})`);
174
+ this.#log.info([
175
+ `running on ${platformPlusArch}`,
176
+ `homebridge-adt-pulse ${packageVersion}`,
177
+ `homebridge ${homebridgeVersion}`,
178
+ `node ${nodeVersion}`,
179
+ `openssl ${opensslVersion}`,
180
+ ].join(chalk.gray(' // ')));
181
+ }
182
+ synchronize() {
183
+ this.#state.intervals.synchronize = setInterval(async () => {
184
+ if (this.#state.activity.isSyncing) {
185
+ return;
186
+ }
187
+ if (this.#instance === null) {
188
+ this.#log.warn('synchronize() was called but API is not available.');
189
+ return;
190
+ }
191
+ try {
192
+ this.#state.activity.isSyncing = true;
193
+ if (!this.#instance.isAuthenticated()) {
194
+ if (!this.#state.activity.isLoggingIn) {
195
+ this.#state.activity.isLoggingIn = true;
196
+ const login = await this.#instance.login();
197
+ if (login.success) {
198
+ const currentTimestamp = Date.now();
199
+ this.#state.lastRunOn.adtKeepAlive = currentTimestamp;
200
+ this.#state.lastRunOn.adtSyncCheck = currentTimestamp;
201
+ }
202
+ if (!login.success) {
203
+ this.#state.eventCounters.failedLogins += 1;
204
+ const attemptsLeft = this.#constants.maxLoginRetries - this.#state.eventCounters.failedLogins;
205
+ if (attemptsLeft > 0) {
206
+ this.#log.error(`Login attempt has failed. Trying ${attemptsLeft} more ${getPluralForm(attemptsLeft, 'time', 'times')} ...`);
207
+ }
208
+ else {
209
+ const suspendMinutes = this.#constants.intervalTimestamps.suspendSyncing / 1000 / 60;
210
+ 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 ...`);
211
+ }
212
+ stackTracer('api-response', login);
213
+ }
214
+ this.#state.activity.isLoggingIn = false;
215
+ }
216
+ if (this.#state.eventCounters.failedLogins >= this.#constants.maxLoginRetries) {
217
+ await sleep(this.#constants.intervalTimestamps.suspendSyncing);
218
+ this.#state.eventCounters.failedLogins = 0;
219
+ return;
220
+ }
221
+ if (!this.#instance.isAuthenticated()) {
222
+ return;
223
+ }
224
+ }
225
+ const currentTimestamp = Date.now();
226
+ if (currentTimestamp - this.#state.lastRunOn.adtKeepAlive >= this.#constants.intervalTimestamps.adtKeepAlive) {
227
+ this.synchronizeKeepAlive();
228
+ }
229
+ if (currentTimestamp - this.#state.lastRunOn.adtSyncCheck >= this.#constants.intervalTimestamps.adtSyncCheck) {
230
+ this.synchronizeSyncCheck();
231
+ }
232
+ }
233
+ catch (error) {
234
+ this.#log.error('synchronize() has unexpectedly thrown an error, will continue to sync.');
235
+ stackTracer('serialize-error', serializeError(error));
236
+ }
237
+ finally {
238
+ this.#state.activity.isSyncing = false;
239
+ }
240
+ }, this.#constants.intervalTimestamps.synchronize);
241
+ }
242
+ synchronizeKeepAlive() {
243
+ (async () => {
244
+ if (this.#state.activity.isAdtKeepingAlive) {
245
+ return;
246
+ }
247
+ if (this.#instance === null) {
248
+ this.#log.warn('synchronizeKeepAlive() was called but API instance is not available.');
249
+ return;
250
+ }
251
+ try {
252
+ this.#state.activity.isAdtKeepingAlive = true;
253
+ const keepAlive = await this.#instance.performKeepAlive();
254
+ if (keepAlive.success) {
255
+ this.#log.debug('Keep alive request was successful. The login session should now be extended.');
256
+ }
257
+ if (!keepAlive.success) {
258
+ this.#log.error('Keeping alive attempt has failed. Trying again later.');
259
+ stackTracer('api-response', keepAlive);
260
+ }
261
+ this.#state.lastRunOn.adtKeepAlive = Date.now();
262
+ }
263
+ catch (error) {
264
+ this.#log.error('synchronizeKeepAlive() has unexpectedly thrown an error, will continue to keep alive.');
265
+ stackTracer('serialize-error', serializeError(error));
266
+ }
267
+ finally {
268
+ this.#state.activity.isAdtKeepingAlive = false;
269
+ }
270
+ })();
271
+ }
272
+ synchronizeSyncCheck() {
273
+ (async () => {
274
+ if (this.#state.activity.isAdtSyncChecking) {
275
+ return;
276
+ }
277
+ if (this.#instance === null) {
278
+ this.#log.warn('synchronizeSyncCheck() was called but API instance is not available.');
279
+ return;
280
+ }
281
+ try {
282
+ this.#state.activity.isAdtSyncChecking = true;
283
+ const syncCheck = await this.#instance.performSyncCheck();
284
+ if (syncCheck.success) {
285
+ this.#log.debug('Sync check request was successful. Determining if panel and sensor data is outdated ...');
286
+ if (syncCheck.info.syncCode !== this.#state.data.syncCode) {
287
+ this.#log.debug(`Panel and sensor data is outdated (old: ${this.#state.data.syncCode}, new: ${syncCheck.info.syncCode}). Preparing to retrieve the latest panel and sensor data ...`);
288
+ this.#state.data.syncCode = syncCheck.info.syncCode;
289
+ await this.fetchUpdatedInformation();
290
+ }
291
+ }
292
+ if (!syncCheck.success) {
293
+ const { error } = syncCheck.info;
294
+ const { message } = error ?? {};
295
+ if (message !== undefined) {
296
+ switch (true) {
297
+ case message.includes('ECONNABORTED'):
298
+ this.#log.debug('Sync checking attempt has failed because the connection timed out. Trying again later.');
299
+ break;
300
+ case message.includes('ECONNRESET'):
301
+ this.#log.debug('Sync checking attempt has failed because the connection was reset. Trying again later.');
302
+ break;
303
+ default:
304
+ break;
305
+ }
306
+ }
307
+ else {
308
+ this.#log.error('Sync checking attempt has failed. Trying again later.');
309
+ stackTracer('api-response', syncCheck);
310
+ }
311
+ }
312
+ this.#state.lastRunOn.adtSyncCheck = Date.now();
313
+ }
314
+ catch (error) {
315
+ this.#log.error('synchronizeSyncCheck() has unexpectedly thrown an error, will continue to sync check.');
316
+ stackTracer('serialize-error', serializeError(error));
317
+ }
318
+ finally {
319
+ this.#state.activity.isAdtSyncChecking = false;
320
+ }
321
+ })();
322
+ }
323
+ async fetchUpdatedInformation() {
324
+ if (this.#instance === null) {
325
+ this.#log.warn('fetchUpdatedInformation() was called but API instance is not available.');
326
+ return;
327
+ }
328
+ try {
329
+ const requests = await Promise.all([
330
+ this.#instance.getGatewayInformation(),
331
+ this.#instance.getPanelInformation(),
332
+ this.#instance.getPanelStatus(),
333
+ this.#instance.getSensorsInformation(),
334
+ this.#instance.getSensorsStatus(),
335
+ ]);
336
+ if (requests[0].success) {
337
+ const { info } = requests[0];
338
+ this.#state.data.gatewayInfo = info;
339
+ }
340
+ if (requests[1].success) {
341
+ const { info } = requests[1];
342
+ this.#state.data.panelInfo = info;
343
+ }
344
+ if (requests[2].success) {
345
+ const { info } = requests[2];
346
+ this.#state.data.panelStatus = info;
347
+ }
348
+ if (requests[3].success) {
349
+ const { sensors } = requests[3].info;
350
+ this.#state.data.sensorsInfo = sensors;
351
+ }
352
+ if (requests[4].success) {
353
+ const { sensors } = requests[4].info;
354
+ this.#state.data.sensorsStatus = sensors;
355
+ }
356
+ await this.unifyDevices();
357
+ }
358
+ catch (error) {
359
+ this.#log.error('fetchUpdatedInformation() has unexpectedly thrown an error, will continue to fetch.');
360
+ stackTracer('serialize-error', serializeError(error));
361
+ }
362
+ }
363
+ async unifyDevices() {
364
+ const { gatewayInfo, panelInfo, sensorsInfo } = this.#state.data;
365
+ const devices = [];
366
+ if (gatewayInfo !== null) {
367
+ const id = 'adt-device-0';
368
+ devices.push({
369
+ id,
370
+ name: 'ADT Pulse Gateway',
371
+ type: 'gateway',
372
+ zone: null,
373
+ category: 'OTHER',
374
+ manufacturer: gatewayInfo.manufacturer,
375
+ model: gatewayInfo.model,
376
+ serial: gatewayInfo.serialNumber,
377
+ firmware: gatewayInfo.versions.firmware,
378
+ hardware: gatewayInfo.versions.hardware,
379
+ software: env.npm_package_version ?? '0.1.0',
380
+ uuid: this.#api.hap.uuid.generate(id),
381
+ });
382
+ }
383
+ if (panelInfo !== null) {
384
+ const id = 'adt-device-1';
385
+ devices.push({
386
+ id,
387
+ name: 'Security Panel',
388
+ type: 'panel',
389
+ zone: null,
390
+ category: 'SECURITY_SYSTEM',
391
+ manufacturer: panelInfo.manufacturer,
392
+ model: panelInfo.model,
393
+ serial: 'N/A',
394
+ firmware: null,
395
+ hardware: null,
396
+ software: env.npm_package_version ?? '0.1.0',
397
+ uuid: this.#api.hap.uuid.generate(id),
398
+ });
399
+ }
400
+ if (this.#config !== null && sensorsInfo !== null) {
401
+ for (let i = 0; i < this.#config.sensors.length; i += 1) {
402
+ const { adtName, adtType, adtZone, name, } = this.#config.sensors[i];
403
+ const sensor = sensorsInfo.find((sensorInfo) => {
404
+ const sensorInfoName = sensorInfo.name;
405
+ const sensorInfoType = condenseSensorType(sensorInfo.deviceType);
406
+ const sensorInfoZone = sensorInfo.zone;
407
+ return (adtName === sensorInfoName
408
+ && adtType === sensorInfoType
409
+ && adtZone === sensorInfoZone);
410
+ });
411
+ if (sensor === undefined) {
412
+ this.#log.warn(`Attempted to add or update ${adtName} (zone: ${adtZone}) accessory that does not exist on the portal.`);
413
+ continue;
414
+ }
415
+ const id = `adt-device-${sensor.deviceId}`;
416
+ devices.push({
417
+ id,
418
+ name: name ?? adtName,
419
+ type: adtType,
420
+ zone: adtZone,
421
+ category: 'SENSOR',
422
+ manufacturer: 'ADT',
423
+ model: sensor.deviceType,
424
+ serial: null,
425
+ firmware: null,
426
+ hardware: null,
427
+ software: env.npm_package_version ?? '0.1.0',
428
+ uuid: this.#api.hap.uuid.generate(id),
429
+ });
430
+ }
431
+ }
432
+ await this.pollAccessories(devices);
433
+ }
434
+ async pollAccessories(devices) {
435
+ for (let i = 0; i < devices.length; i += 1) {
436
+ const accessoryIndex = this.accessories.findIndex((accessory) => devices[i].uuid === accessory.context.uuid);
437
+ if (accessoryIndex >= 0) {
438
+ this.updateAccessory(devices[i]);
439
+ }
440
+ else {
441
+ this.addAccessory(devices[i]);
442
+ }
443
+ }
444
+ }
445
+ }
446
+ //# sourceMappingURL=platform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform.js","sourceRoot":"","sources":["../../../src/lib/platform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,GAAG,EACH,QAAQ,EACR,QAAQ,GACT,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,KAAK,EACL,WAAW,GACZ,MAAM,kBAAkB,CAAC;AA2C1B,MAAM,OAAO,gBAAgB;IAQ3B,WAAW,CAA8B;IAShC,IAAI,CAAsB;IAS1B,eAAe,CAAiC;IASzD,OAAO,CAAyB;IAShC,UAAU,CAA4B;IAS7B,UAAU,CAA4B;IAStC,SAAS,CAA2B;IAS7C,SAAS,CAA2B;IAS3B,IAAI,CAAsB;IAS1B,QAAQ,CAA0B;IASlC,MAAM,CAAwB;IAWvC,YAAY,GAAmC,EAAE,MAAyC,EAAE,GAAmC;QA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iBAAM,CAAC;gBACN,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
@@ -1,167 +1,25 @@
1
- /**
2
- * Character backslash forward slash.
3
- *
4
- * @since 1.0.0
5
- */
6
1
  export const characterBackslashForwardSlash = /\\\//g;
7
-
8
- /**
9
- * Character html line break.
10
- *
11
- * @since 1.0.0
12
- */
13
2
  export const characterHtmlLineBreak = /<br( ?\/)?>/;
14
-
15
- /**
16
- * Character whitespace.
17
- *
18
- * @since 1.0.0
19
- */
20
3
  export const characterWhitespace = /\s+/g;
21
-
22
- /**
23
- * Function do submit.
24
- *
25
- * @since 1.0.0
26
- */
27
4
  export const functionDoSubmit = /doSubmit\(\s*'([^']+)\?sat=([^']+)&href=([^&]+)(&armstate=([^&]+)&arm=([^']+))?'\s*\)/;
28
-
29
- /**
30
- * Function go to url.
31
- *
32
- * @since 1.0.0
33
- */
34
5
  export const functionGoToUrl = /^goToUrl\('device\.jsp\?id=([0-9]+)'\);$/;
35
-
36
- /**
37
- * Function set arm state.
38
- *
39
- * @since 1.0.0
40
- */
41
6
  export const functionSetArmState = /setArmState\(\s*'([^']+)',\s*'([^']+)',\s*'([^']+)',\s*'([^']+)',\s*'([^']+)',\s*'href=([^']+)&armstate=([^&]+)&arm=([^&]+)&sat=([^']+?)'\s*\)/;
42
-
43
- /**
44
- * Param network id.
45
- *
46
- * @since 1.0.0
47
- */
48
7
  export const paramNetworkId = /[?&]networkid=([^&#']*)/;
49
-
50
- /**
51
- * Param sat.
52
- *
53
- * @since 1.0.0
54
- */
55
8
  export const paramSat = /sat=([^&']*)/;
56
-
57
- /**
58
- * Request path access sign in.
59
- *
60
- * @since 1.0.0
61
- */
62
9
  export const requestPathAccessSignIn = /^(\/myhome\/)([0-9.-]+)(\/access\/signin\.jsp)$/;
63
-
64
- /**
65
- * Request path access sign in e ns partner adt.
66
- *
67
- * @since 1.0.0
68
- */
69
10
  export const requestPathAccessSignInENsPartnerAdt = /^(\/myhome\/)([0-9.-]+)(\/access\/signin\.jsp\?e=ns&partner=adt)$/;
70
-
71
- /**
72
- * Request path access sign in network id xx partner adt.
73
- *
74
- * @since 1.0.0
75
- */
76
11
  export const requestPathAccessSignInNetworkIdXxPartnerAdt = /^(\/myhome\/)([0-9.-]+)(\/access\/signin\.jsp)(\?networkid=[a-z0-9]+)(&partner=adt)$/;
77
-
78
- /**
79
- * Request path ajax sync check serv t xx.
80
- *
81
- * @since 1.0.0
82
- */
83
12
  export const requestPathAjaxSyncCheckServTXx = /^(\/myhome\/)([0-9.-]+)(\/Ajax\/SyncCheckServ\?t=\d+)$/;
84
-
85
- /**
86
- * Request path keep alive.
87
- *
88
- * @since 1.0.0
89
- */
90
13
  export const requestPathKeepAlive = /^(\/myhome\/)([0-9.-]+)(\/KeepAlive)$/;
91
-
92
- /**
93
- * Request path mfa mfa sign in workflow challenge.
94
- *
95
- * @since 1.0.0
96
- */
97
14
  export const requestPathMfaMfaSignInWorkflowChallenge = /^(\/myhome\/)([0-9.-]+)(\/mfa\/mfaSignIn\.jsp\?workflow=challenge)$/;
98
-
99
- /**
100
- * Request path quick control arm disarm.
101
- *
102
- * @since 1.0.0
103
- */
104
15
  export const requestPathQuickControlArmDisarm = /^(\/myhome\/)([0-9.-]+)(\/quickcontrol\/armDisarm\.jsp)$/;
105
-
106
- /**
107
- * Request path quick control serv run rra command.
108
- *
109
- * @since 1.0.0
110
- */
111
16
  export const requestPathQuickControlServRunRraCommand = /^(\/myhome\/)([0-9.-]+)(\/quickcontrol\/serv\/RunRRACommand)$/;
112
-
113
- /**
114
- * Request path summary summary.
115
- *
116
- * @since 1.0.0
117
- */
118
17
  export const requestPathSummarySummary = /^(\/myhome\/)([0-9.-]+)(\/summary\/summary\.jsp)$/;
119
-
120
- /**
121
- * Request path system device id 1.
122
- *
123
- * @since 1.0.0
124
- */
125
18
  export const requestPathSystemDeviceId1 = /^(\/myhome\/)([0-9.-]+)(\/system\/device\.jsp\?id=1)$/;
126
-
127
- /**
128
- * Request path system gateway.
129
- *
130
- * @since 1.0.0
131
- */
132
19
  export const requestPathSystemGateway = /^(\/myhome\/)([0-9.-]+)(\/system\/gateway\.jsp)$/;
133
-
134
- /**
135
- * Request path system system.
136
- *
137
- * @since 1.0.0
138
- */
139
20
  export const requestPathSystemSystem = /^(\/myhome\/)([0-9.-]+)(\/system\/system\.jsp)$/;
140
-
141
- /**
142
- * Text orb sensor zone.
143
- *
144
- * @since 1.0.0
145
- */
146
21
  export const textOrbSensorZone = /^(Zone )(.*)$/;
147
-
148
- /**
149
- * Text orb text summary.
150
- *
151
- * @since 1.0.0
152
- */
153
22
  export const textOrbTextSummary = /^([A-Za-z0-9 ]+)\. ?([A-Za-z0-9 ]*)\.?$/;
154
-
155
- /**
156
- * Text panel emergency keys.
157
- *
158
- * @since 1.0.0
159
- */
160
23
  export const textPanelEmergencyKeys = /([A-Za-z0-9]+: [A-Za-z0-9 ]+? \(Zone \d+\))/g;
161
-
162
- /**
163
- * Text sync code.
164
- *
165
- * @since 1.0.0
166
- */
167
24
  export const textSyncCode = /^[0-9]+-[0-9]+-[0-9]+$/;
25
+ //# sourceMappingURL=regex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"regex.js","sourceRoot":"","sources":["../../../src/lib/regex.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,8BAA8B,GAAG,OAAO,CAAC;AAOtD,MAAM,CAAC,MAAM,sBAAsB,GAAG,aAAa,CAAC;AAOpD,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAO1C,MAAM,CAAC,MAAM,gBAAgB,GAAG,uFAAuF,CAAC;AAOxH,MAAM,CAAC,MAAM,eAAe,GAAG,0CAA0C,CAAC;AAO1E,MAAM,CAAC,MAAM,mBAAmB,GAAG,gJAAgJ,CAAC;AAOpL,MAAM,CAAC,MAAM,cAAc,GAAG,yBAAyB,CAAC;AAOxD,MAAM,CAAC,MA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