homebridge-adt-pulse 2.1.0 → 2.1.3

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/README.md CHANGED
@@ -66,16 +66,22 @@ If you have a sensor that is unsupported by this plugin, please [submit an issue
66
66
  Due to ADT Pulse limitations, accessories that are connected to the Z-Wave Platform cannot be supported. Consider using other Homebridge plugins.
67
67
 
68
68
  ## Configure 2-Factor Authentication
69
- With the recent updates, ADT Pulse now requires 2-factor authentication for your account. In the near future, this fingerprint will be required.
69
+ With the recent updates, ADT Pulse now requires 2-factor authentication for your account. In the near future, this fingerprint will be required. Before you begin, make sure 2-Factor Authentication is already setup.
70
70
 
71
- 1. Open a Chrome browser tab
71
+ 1. Open a Chrome browser tab (under Incognito mode)
72
72
  2. Open Developer Tools (using **View** ➜ **Developer** ➜ **Developer Tools** menu)
73
73
  3. Click on the **Network** tab (make sure **Preserve log** checkbox is checked)
74
- 4. In the filter box, enter **signin.jsp**
74
+ 4. In the filter box, enter `signin.jsp?networkid=`
75
75
  5. Go to `https://portal.adtpulse.com` or `https://portal-ca.adtpulse.com` and login to your account
76
- 6. Click on the network call (beginning with `signin.jsp`) appearing in the DevTools window
77
- 7. In the **Headers** tab, under **Form Data**, copy the entire **fingerprint** (ending in `=`)
78
- 8. Paste the copied text into the `fingerprint` field into your `config.json`
76
+ 6. Click **Request Code**, type in the requested code, and then click **Submit Code**
77
+ 7. Click **Trust this device** and name the device `Homebridge`
78
+ 8. Click **Save and Continue**
79
+ 9. Click **Sign Out** in the top right corner of the webpage
80
+ 10. Login to your account (once again)
81
+ 11. Click on the network call (beginning with `signin.jsp?networkid=`) appearing in the DevTools window. Select the last one.
82
+ 12. In the **Payload** tab, under **Form Data**, copy the entire **fingerprint** (after `fingerprint:`, do not include spaces)
83
+ 13. Paste the copied text into the `fingerprint` field into your `config.json`
84
+ 14. Close the Chrome window (DO NOT sign out)
79
85
 
80
86
  ## Force Arming (Arm Away/Stay/Night)
81
87
  Due to the nature of how HomeKit and ADT Pulse processes `setDeviceStatus` commands, this plugin will force arm when it detects active motion or open sensors.
package/api.js CHANGED
@@ -419,19 +419,20 @@ Pulse.prototype.getDeviceStatus = function getDeviceStatus() {
419
419
  * - When Arming Night, armState will be set to "night+stay". It will be set to "night" after re-login.
420
420
  * - If alarm occurred, you must Clear Alarm before setting to Armed Away/Stay/Night.
421
421
  * - For ADT Pulse Canada, you must replace the "portal" sub-domain to "portal-ca" sub-domain.
422
+ * - "sat" code is now required for all set actions.
422
423
  *
423
424
  * Disarmed:
424
- * - Arm Away (https://portal.adtpulse.com/myhome/quickcontrol/armDisarm.jsp?href=rest/adt/ui/client/security/setArmState&armstate=disarmed&arm=away).
425
- * - Arm Stay (https://portal.adtpulse.com/myhome/quickcontrol/armDisarm.jsp?href=rest/adt/ui/client/security/setArmState&armstate=disarmed&arm=stay).
426
- * - Arm Night (https://portal.adtpulse.com/myhome/quickcontrol/armDisarm.jsp?href=rest/adt/ui/client/security/setArmState&armstate=disarmed&arm=night).
427
- * - Disarm (https://portal.adtpulse.com/myhome/quickcontrol/armDisarm.jsp?href=rest/adt/ui/client/security/setArmState&armstate=disarmed&arm=off).
428
- * - Clear Alarm (https://portal.adtpulse.com/myhome/quickcontrol/armDisarm.jsp?href=rest/adt/ui/client/security/setArmState&armstate=disarmed+with+alarm&arm=off).
425
+ * - Arm Away (https://portal.adtpulse.com/myhome/quickcontrol/armDisarm.jsp?href=rest/adt/ui/client/security/setArmState&armstate=disarmed&arm=away&sat=).
426
+ * - Arm Stay (https://portal.adtpulse.com/myhome/quickcontrol/armDisarm.jsp?href=rest/adt/ui/client/security/setArmState&armstate=disarmed&arm=stay&sat=).
427
+ * - Arm Night (https://portal.adtpulse.com/myhome/quickcontrol/armDisarm.jsp?href=rest/adt/ui/client/security/setArmState&armstate=disarmed&arm=night&sat=).
428
+ * - Disarm (https://portal.adtpulse.com/myhome/quickcontrol/armDisarm.jsp?href=rest/adt/ui/client/security/setArmState&armstate=disarmed&arm=off&sat=).
429
+ * - Clear Alarm (https://portal.adtpulse.com/myhome/quickcontrol/armDisarm.jsp?href=rest/adt/ui/client/security/setArmState&armstate=disarmed+with+alarm&arm=off&sat=).
429
430
  * Armed Away:
430
- * - Disarm (https://portal.adtpulse.com/myhome/quickcontrol/armDisarm.jsp?href=rest/adt/ui/client/security/setArmState&armstate=away&arm=off).
431
+ * - Disarm (https://portal.adtpulse.com/myhome/quickcontrol/armDisarm.jsp?href=rest/adt/ui/client/security/setArmState&armstate=away&arm=off&sat=).
431
432
  * Armed Stay:
432
- * - Disarm (https://portal.adtpulse.com/myhome/quickcontrol/armDisarm.jsp?href=rest/adt/ui/client/security/setArmState&armstate=stay&arm=off).
433
+ * - Disarm (https://portal.adtpulse.com/myhome/quickcontrol/armDisarm.jsp?href=rest/adt/ui/client/security/setArmState&armstate=stay&arm=off&sat=).
433
434
  * Armed Night:
434
- * - Disarm (https://portal.adtpulse.com/myhome/quickcontrol/armDisarm.jsp?href=rest/adt/ui/client/security/setArmState&armstate=night&arm=off).
435
+ * - Disarm (https://portal.adtpulse.com/myhome/quickcontrol/armDisarm.jsp?href=rest/adt/ui/client/security/setArmState&armstate=night&arm=off&sat=).
435
436
  *
436
437
  * @param {string} armState - Can be "disarmed", "disarmed+with+alarm", "away", "stay", or "night".
437
438
  * @param {string} arm - Can be "off", "away", "stay", or "night".
@@ -444,26 +445,21 @@ Pulse.prototype.setDeviceStatus = function setDeviceStatus(armState, arm) {
444
445
  const deferred = Q.defer();
445
446
 
446
447
  this.hasInternetWrapper(deferred, () => {
447
- const url = `https://${countrySubDomain}.adtpulse.com/myhome/${lastKnownVersion}/quickcontrol/armDisarm.jsp`;
448
- const arg = `?href=rest/adt/ui/client/security/setArmState&armstate=${armState}&arm=${arm}`;
448
+ const url1 = `https://${countrySubDomain}.adtpulse.com/myhome/${lastKnownVersion}/summary/summary.jsp`;
449
449
 
450
450
  this.consoleLogger('ADT Pulse: Setting device status...', 'log');
451
451
 
452
452
  request.get(
453
- url + arg,
454
- this.generateRequestOptions({
455
- headers: {
456
- Referer: `https://${countrySubDomain}.adtpulse.com/myhome/${lastKnownVersion}/summary/summary.jsp`,
457
- },
458
- }),
459
- (error, response, body) => {
460
- const regex = new RegExp(/(\/myhome\/)([0-9.-]+)(\/quickcontrol\/armDisarm\.jsp)(.*)/);
461
- const responsePath = _.get(response, 'request.uri.path');
453
+ url1,
454
+ this.generateRequestOptions(),
455
+ (error1, response1, body1) => {
456
+ const regex1 = new RegExp(/(\/myhome\/)([0-9.-]+)(\/summary\/summary\.jsp)(.*)/);
457
+ const responsePath1 = _.get(response1, 'request.uri.path');
462
458
 
463
- this.consoleLogger(`ADT Pulse: Response path -> ${responsePath}`, 'log');
464
- this.consoleLogger(`ADT Pulse: Response path matches -> ${regex.test(responsePath)}`, 'log');
459
+ this.consoleLogger(`ADT Pulse: Response path -> ${responsePath1}`, 'log');
460
+ this.consoleLogger(`ADT Pulse: Response path matches -> ${regex1.test(responsePath1)}`, 'log');
465
461
 
466
- if (error || !regex.test(responsePath)) {
462
+ if (error1 || !regex1.test(responsePath1)) {
467
463
  authenticated = false;
468
464
 
469
465
  this.consoleLogger(`ADT Pulse: Set device status to ${arm} failed.`, 'error');
@@ -472,50 +468,99 @@ Pulse.prototype.setDeviceStatus = function setDeviceStatus(armState, arm) {
472
468
  action: 'SET_DEVICE_STATUS',
473
469
  success: false,
474
470
  info: {
475
- error,
476
- message: this.getErrorMessage(body),
471
+ error: error1,
472
+ message: this.getErrorMessage(body1),
477
473
  },
478
474
  });
479
475
  } else {
480
- const $ = cheerio.load(body);
481
- const onClick = $('input[id^="arm_button_"][value="Arm Anyway"]').attr('onclick');
482
- const satCode = (onClick !== undefined) ? onClick.replace(/(.*)(\?sat=)([0-9a-z-]*)(&href=)(.*)/g, '$3') : undefined;
483
-
484
- const forceUrl = `https://${countrySubDomain}.adtpulse.com/myhome/${lastKnownVersion}/quickcontrol/serv/RunRRACommand`;
485
- const forceArg = `?sat=${satCode}&href=rest/adt/ui/client/security/setForceArm&armstate=forcearm&arm=${arm}`;
486
-
487
- // Check if system requires force arming.
488
- if (['away', 'stay', 'night'].includes(arm) && onClick !== undefined && satCode !== undefined) {
489
- this.consoleLogger('ADT Pulse: Some sensors are open or reporting motion. Arming Anyway...', 'warn');
490
-
491
- request.get(
492
- forceUrl + forceArg,
493
- this.generateRequestOptions({
494
- headers: {
495
- Accept: '*/*',
496
- Referer: `https://${countrySubDomain}.adtpulse.com/myhome/${lastKnownVersion}/quickcontrol/armDisarm.jsp`,
497
- },
498
- }),
499
- (forceError, forceResponse, forceBody) => {
500
- const forceRegex = new RegExp(/(\/myhome\/)([0-9.-]+)(\/quickcontrol\/serv\/RunRRACommand)(.*)/);
501
- const forceResponsePath = _.get(forceResponse, 'request.uri.path');
502
-
503
- this.consoleLogger(`ADT Pulse: Response path -> ${forceResponsePath}`, 'log');
504
- this.consoleLogger(`ADT Pulse: Response path matches -> ${forceRegex.test(forceResponsePath)}`, 'log');
505
-
506
- if (forceError || !forceRegex.test(forceResponsePath)) {
507
- authenticated = false;
508
-
509
- this.consoleLogger(`ADT Pulse: Set device status to ${arm} failed.`, 'error');
510
-
511
- deferred.reject({
512
- action: 'SET_DEVICE_STATUS',
513
- success: false,
514
- info: {
515
- error: forceError,
516
- message: this.getErrorMessage(forceBody),
476
+ const $2 = cheerio.load(body1);
477
+ const onClick2 = $2('input[id^="security_button_"]').attr('onclick');
478
+ const satCode2 = (onClick2 !== undefined) ? onClick2.replace(/(.*)(&sat=)([0-9a-z-]*)('\))/g, '$3') : undefined;
479
+ const url2 = `https://${countrySubDomain}.adtpulse.com/myhome/${lastKnownVersion}/quickcontrol/armDisarm.jsp`;
480
+ const arg2 = `?href=rest/adt/ui/client/security/setArmState&armstate=${armState}&arm=${arm}&sat=${satCode2}`;
481
+
482
+ request.get(
483
+ url2 + arg2,
484
+ this.generateRequestOptions({
485
+ headers: {
486
+ Referer: `https://${countrySubDomain}.adtpulse.com/myhome/${lastKnownVersion}/summary/summary.jsp`,
487
+ },
488
+ }),
489
+ (error2, response2, body2) => {
490
+ const regex2 = new RegExp(/(\/myhome\/)([0-9.-]+)(\/quickcontrol\/armDisarm\.jsp)(.*)/);
491
+ const responsePath2 = _.get(response2, 'request.uri.path');
492
+
493
+ this.consoleLogger(`ADT Pulse: Response path -> ${responsePath2}`, 'log');
494
+ this.consoleLogger(`ADT Pulse: Response path matches -> ${regex2.test(responsePath2)}`, 'log');
495
+
496
+ if (error2 || !regex2.test(responsePath2)) {
497
+ authenticated = false;
498
+
499
+ this.consoleLogger(`ADT Pulse: Set device status to ${arm} failed.`, 'error');
500
+
501
+ deferred.reject({
502
+ action: 'SET_DEVICE_STATUS',
503
+ success: false,
504
+ info: {
505
+ error: error2,
506
+ message: this.getErrorMessage(body2),
507
+ },
508
+ });
509
+ } else {
510
+ const $3 = cheerio.load(body2);
511
+ const onClick3 = $3('input[id^="arm_button_"][value="Arm Anyway"]').attr('onclick');
512
+ const satCode3 = (onClick3 !== undefined) ? onClick3.replace(/(.*)(\?sat=)([0-9a-z-]*)(&href=)(.*)/g, '$3') : undefined;
513
+
514
+ const url3 = `https://${countrySubDomain}.adtpulse.com/myhome/${lastKnownVersion}/quickcontrol/serv/RunRRACommand`;
515
+ const arg3 = `?sat=${satCode3}&href=rest/adt/ui/client/security/setForceArm&armstate=forcearm&arm=${arm}`;
516
+
517
+ // Check if system requires force arming.
518
+ if (['away', 'stay', 'night'].includes(arm) && onClick3 !== undefined && satCode3 !== undefined) {
519
+ this.consoleLogger('ADT Pulse: Some sensors are open or reporting motion. Arming Anyway...', 'warn');
520
+
521
+ request.get(
522
+ url3 + arg3,
523
+ this.generateRequestOptions({
524
+ headers: {
525
+ Accept: '*/*',
526
+ Referer: `https://${countrySubDomain}.adtpulse.com/myhome/${lastKnownVersion}/quickcontrol/armDisarm.jsp`,
527
+ },
528
+ }),
529
+ (forceError, forceResponse, forceBody) => {
530
+ const forceRegex = new RegExp(/(\/myhome\/)([0-9.-]+)(\/quickcontrol\/serv\/RunRRACommand)(.*)/);
531
+ const forceResponsePath = _.get(forceResponse, 'request.uri.path');
532
+
533
+ this.consoleLogger(`ADT Pulse: Response path -> ${forceResponsePath}`, 'log');
534
+ this.consoleLogger(`ADT Pulse: Response path matches -> ${forceRegex.test(forceResponsePath)}`, 'log');
535
+
536
+ if (forceError || !forceRegex.test(forceResponsePath)) {
537
+ authenticated = false;
538
+
539
+ this.consoleLogger(`ADT Pulse: Set device status to ${arm} failed.`, 'error');
540
+
541
+ deferred.reject({
542
+ action: 'SET_DEVICE_STATUS',
543
+ success: false,
544
+ info: {
545
+ error: forceError,
546
+ message: this.getErrorMessage(forceBody),
547
+ },
548
+ });
549
+ } else {
550
+ this.consoleLogger(`ADT Pulse: Set device status to ${arm} success.`, 'log');
551
+
552
+ deferred.resolve({
553
+ action: 'SET_DEVICE_STATUS',
554
+ success: true,
555
+ info: {
556
+ forceArm: true,
557
+ previousArm: armState,
558
+ afterArm: arm,
559
+ },
560
+ });
561
+ }
517
562
  },
518
- });
563
+ );
519
564
  } else {
520
565
  this.consoleLogger(`ADT Pulse: Set device status to ${arm} success.`, 'log');
521
566
 
@@ -523,27 +568,15 @@ Pulse.prototype.setDeviceStatus = function setDeviceStatus(armState, arm) {
523
568
  action: 'SET_DEVICE_STATUS',
524
569
  success: true,
525
570
  info: {
526
- forceArm: true,
571
+ forceArm: false,
527
572
  previousArm: armState,
528
573
  afterArm: arm,
529
574
  },
530
575
  });
531
576
  }
532
- },
533
- );
534
- } else {
535
- this.consoleLogger(`ADT Pulse: Set device status to ${arm} success.`, 'log');
536
-
537
- deferred.resolve({
538
- action: 'SET_DEVICE_STATUS',
539
- success: true,
540
- info: {
541
- forceArm: false,
542
- previousArm: armState,
543
- afterArm: arm,
544
- },
545
- });
546
- }
577
+ }
578
+ },
579
+ );
547
580
  }
548
581
  },
549
582
  );
@@ -37,7 +37,7 @@
37
37
  "title": "MFA Fingerprint",
38
38
  "type": "string",
39
39
  "default": "",
40
- "required": false,
40
+ "required": true,
41
41
  "description": "MFA Fingerprint from browser registered with ADT Pulse"
42
42
  },
43
43
  "overrideSensors": {
package/index.js CHANGED
@@ -5,7 +5,7 @@
5
5
  */
6
6
  const _ = require('lodash');
7
7
 
8
- const packageJson = require('./package');
8
+ const packageJson = require('./package.json');
9
9
  const Pulse = require('./api');
10
10
 
11
11
  let Accessory;
@@ -847,7 +847,7 @@ ADTPulsePlatform.prototype.portalSync = function portalSync() {
847
847
  .login()
848
848
  .then((response) => {
849
849
  const version = _.get(response, 'info.version');
850
- const supportedVersion = ['21.0.0-354', '22.0.0-233'];
850
+ const supportedVersion = ['22.0.0-233', '23.0.0-99'];
851
851
 
852
852
  if (version !== undefined && !supportedVersion.includes(version) && version !== this.sessionVersion) {
853
853
  this.logMessage(`Web Portal version ${version} detected. Test plugin to ensure system compatibility...`, 20);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "homebridge-adt-pulse",
3
3
  "displayName": "Homebridge ADT Pulse",
4
- "version": "2.1.0",
4
+ "version": "2.1.3",
5
5
  "description": "Homebridge security system platform for ADT Pulse",
6
6
  "main": "index.js",
7
7
  "private": false,
@@ -39,7 +39,7 @@
39
39
  "homepage": "https://github.com/mrjackyliang/homebridge-adt-pulse#readme",
40
40
  "engines": {
41
41
  "homebridge": ">=0.4.50",
42
- "node": "16"
42
+ "node": ">=14.16.0"
43
43
  },
44
44
  "dependencies": {
45
45
  "cheerio": "1.0.0-rc.5",