Skip to content

Commit

Permalink
Support for Multi-factor authentication
Browse files Browse the repository at this point in the history
### UPDATED
- Project development files (`.editorconfig`, `.eslintrc.json`, `.gitignore`)
- Updated base headers to the latest Google Chrome version

### ADDED
- Multi-factor authentication support (thanks to [@Danimal4326](https://github.com/Danimal4326))
- Support for `22.0.0-233`

### REMOVED
- Support for `21.0.0-353`
  • Loading branch information
mrjackyliang committed Nov 3, 2021
1 parent 812cc8f commit 819b1e6
Show file tree
Hide file tree
Showing 8 changed files with 127 additions and 120 deletions.
31 changes: 20 additions & 11 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,20 @@ root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = 200
max_line_length = off
tab_width = 2
trim_trailing_whitespace = true

[{*.ats,*.ts}]
indent_size = 2
tab_width = 2
ij_continuation_indent_size = 2
[*.xml]
indent_size = 4
ij_xml_space_inside_empty_tag = true

[{*.ts,*.tsx}]
ij_html_do_not_indent_children_of_tags = none
ij_html_space_inside_empty_tag = true
ij_typescript_force_quote_style = true
ij_typescript_keep_simple_methods_in_one_line = true
ij_typescript_method_call_chain_wrap = normal
Expand All @@ -22,10 +26,9 @@ ij_typescript_spaces_within_object_literal_braces = true
ij_typescript_use_double_quotes = false
ij_typescript_var_declaration_wrap = split_into_lines

[{*.cjs,*.js}]
indent_size = 2
tab_width = 2
ij_continuation_indent_size = 2
[{*.js,*.jsx}]
ij_html_do_not_indent_children_of_tags = none
ij_html_space_inside_empty_tag = true
ij_javascript_force_quote_style = true
ij_javascript_keep_simple_methods_in_one_line = true
ij_javascript_method_call_chain_wrap = normal
Expand All @@ -35,6 +38,12 @@ ij_javascript_spaces_within_object_literal_braces = true
ij_javascript_use_double_quotes = false
ij_javascript_var_declaration_wrap = split_into_lines

[{*.htm, *.html, *.ng, *.sht, *.shtm, *.shtml}]
[{*.ejs,*.html}]
indent_size = 4
ij_html_attribute_wrap = off
ij_html_do_not_indent_children_of_tags = none
ij_html_space_inside_empty_tag = true
ij_html_text_wrap = off

[{*.markdown,*.md}]
ij_markdown_max_lines_around_block_elements = 0
30 changes: 10 additions & 20 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,10 @@
{
"env": {
"browser": false,
"commonjs": true,
"es6": true,
"node": true
},
"extends": [
"airbnb-base"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "script"
},
"rules": {
"max-len": [
"off"
],
"no-console": [
"off"
]
},
"overrides": [
{
"files": [
Expand All @@ -38,5 +19,14 @@
]
}
}
]
],
"root": true,
"rules": {
"max-len": [
"off"
],
"no-console": [
"off"
]
}
}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### macOS ###
*.DS_Store
.DS_Store
.AppleDouble
.LSOverride
._*
Expand Down
61 changes: 36 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,34 @@ You can also search `adt-pulse` using [HOOBS](https://github.com/mkellsy/homebri
When configuring this plugin, simply add the platform to your existing `config.json` file. Mind that the `platform` name must always be `ADTPulse`.
```json
{
"platforms": [
"platforms": [
{
"platform": "ADTPulse",
"name": "ADT Pulse",
"username": "[email protected]",
"password": "1234567890",
"fingerprint": "abcdef1234567890=",
"overrideSensors": [
{
"platform": "ADTPulse",
"name": "ADT Pulse",
"username": "[email protected]",
"password": "1234567890",
"overrideSensors": [
{
"name": "Sample Sensor 1",
"type": "sensor,doorWindow"
},
{
"name": "...",
"type": "..."
}
],
"country": "us",
"logLevel": 30,
"logActivity": true,
"removeObsoleteZones": true,
"resetAll": false
"name": "Sample Sensor 1",
"type": "sensor,doorWindow"
},
{
"platform": "...",
"name": "..."
"name": "...",
"type": "..."
}
]
],
"country": "us",
"logLevel": 30,
"logActivity": true,
"removeObsoleteZones": true,
"resetAll": false
},
{
"platform": "...",
"name": "..."
}
]
}
```

Expand All @@ -64,7 +65,17 @@ If you have a sensor that is unsupported by this plugin, please [submit an issue

Due to ADT Pulse limitations, accessories that are connected to the Z-Wave Platform cannot be supported. Consider using other Homebridge plugins.

Recently, ADT has added a multi-factor authentication requirement. If you have already opted-in, please consider creating an [alternative account for use](https://portal.adtpulse.com/myhome/system/admin.jsp).
## Configure 2-Factor Authentication
With the recent updates, ADT Pulse now requires 2-factor authentication for your account. In the near future, this fingerprint will be required.

1. Open a Chrome browser tab
2. Open Developer Tools (using **View****Developer****Developer Tools** menu)
3. Click on the **Network** tab (make sure **Preserve log** checkbox is checked)
4. In the filter box, enter **signin.jsp**
5. Go to `https://portal.adtpulse.com` or `https://portal-ca.adtpulse.com` and login to your account
6. Click on the network call (beginning with `signin.jsp`) appearing in the DevTools window
7. In the **Headers** tab, under **Form Data**, copy the entire **fingerprint** (ending in `=`)
8. Paste the copied text into the `fingerprint` field into your `config.json`

## Force Arming (Arm Away/Stay/Night)
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.
Expand Down Expand Up @@ -150,4 +161,4 @@ The script provides an active connection to the ADT Pulse portal. Here is a list
## Credits and Appreciation
If you would like to show your appreciation for its continued development, you can optionally become my supporter on [GitHub Sponsors](https://github.com/sponsors/mrjackyliang)!

Also, thank you to [@kevinmkickey](https://github.com/kevinmhickey) for providing the [ADT Pulse script](https://github.com/kevinmhickey/adt-pulse).
Also, thank you to [@kevinmkickey](https://github.com/kevinmhickey) for providing the [ADT Pulse script](https://github.com/kevinmhickey/adt-pulse) and [@Danimal4326](https://github.com/Danimal4326) for finding the solution for ADT Pulse's 2-factor authentication.
4 changes: 2 additions & 2 deletions api.js
Original file line number Diff line number Diff line change
Expand Up @@ -774,9 +774,9 @@ Pulse.prototype.generateRequestOptions = function generateRequestOptions(additio
const options = {
jar,
headers: {
Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
Host: `${countrySubDomain}.adtpulse.com`,
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.192 Safari/537.36',
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/605.1.15',
},
ciphers: [
'ECDHE-RSA-AES256-GCM-SHA384',
Expand Down
6 changes: 2 additions & 4 deletions config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,11 @@
"description": "Password used for ADT Pulse login"
},
"fingerprint": {
"title": "MFA fingerprint",
"title": "MFA Fingerprint",
"type": "string",
"default": "",
"required": false,
"minLength": 2400,
"maxLength": 3000,
"description": "MFA fingerprint from browser registered with ADT"
"description": "MFA Fingerprint from browser registered with ADT Pulse"
},
"overrideSensors": {
"title": "Override Sensors",
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ ADTPulsePlatform.prototype.portalSync = function portalSync() {
.login()
.then((response) => {
const version = _.get(response, 'info.version');
const supportedVersion = ['21.0.0-353', '21.0.0-354'];
const supportedVersion = ['21.0.0-354', '22.0.0-233'];

if (version !== undefined && !supportedVersion.includes(version) && version !== this.sessionVersion) {
this.logMessage(`Web Portal version ${version} detected. Test plugin to ensure system compatibility...`, 20);
Expand Down
111 changes: 55 additions & 56 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,58 +1,57 @@
{
"name": "homebridge-adt-pulse",
"displayName": "Homebridge ADT Pulse",
"version": "2.0.4",
"description": "Homebridge security system platform for ADT Pulse",
"main": "index.js",
"private": false,
"scripts": {
"start": "homebridge --plugin-path $(pwd)",
"start:debug": "homebridge --debug --plugin-path $(pwd)"
},
"repository": {
"type": "git",
"url": "git://github.com/mrjackyliang/homebridge-adt-pulse.git"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/mrjackyliang"
},
"keywords": [
"homebridge",
"homebridge-plugin",
"homekit",
"adt",
"adt-pulse",
"icontrol",
"security",
"security-system"
],
"author": "Jacky Liang",
"license": "ISC",
"bugs": {
"url": "https://github.com/mrjackyliang/homebridge-adt-pulse/issues"
},
"files": [
"*.js",
"*.schema.json"
],
"homepage": "https://github.com/mrjackyliang/homebridge-adt-pulse#readme",
"engines": {
"node": ">=10.0.0",
"homebridge": ">=0.4.50"
},
"dependencies": {
"cheerio": "1.0.0-rc.5",
"internet-available": "^1.0.0",
"lodash": "^4.17.20",
"q": "^1.5.1",
"request": "^2.88.2"
},
"devDependencies": {
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.22.1",
"homebridge": "^0.4.53",
"typescript": "^3.9.7"
}
"name": "homebridge-adt-pulse",
"displayName": "Homebridge ADT Pulse",
"version": "2.1.0",
"description": "Homebridge security system platform for ADT Pulse",
"main": "index.js",
"private": false,
"scripts": {
"start": "homebridge --plugin-path $(pwd)",
"start:debug": "homebridge --debug --plugin-path $(pwd)"
},
"repository": {
"type": "git",
"url": "git://github.com/mrjackyliang/homebridge-adt-pulse.git"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/mrjackyliang"
},
"keywords": [
"homebridge",
"homebridge-plugin",
"homekit",
"adt",
"adt-pulse",
"icontrol",
"security",
"security-system"
],
"author": "Jacky Liang",
"license": "ISC",
"bugs": {
"url": "https://github.com/mrjackyliang/homebridge-adt-pulse/issues"
},
"files": [
"*.js",
"*.schema.json"
],
"homepage": "https://github.com/mrjackyliang/homebridge-adt-pulse#readme",
"engines": {
"homebridge": ">=0.4.50",
"node": "16"
},
"dependencies": {
"cheerio": "1.0.0-rc.5",
"internet-available": "^1.0.0",
"lodash": "^4.17.20",
"q": "^1.5.1",
"request": "^2.88.2"
},
"devDependencies": {
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.22.1",
"typescript": "^3.9.7"
}
}

0 comments on commit 819b1e6

Please sign in to comment.