Skip to content

Commit

Permalink
New changes
Browse files Browse the repository at this point in the history
### FIXED
- Readme with outdated versions

### ADDED
- Support for `26.0.0-32`
- Pause plugin functionality

### REMOVED
- Support for `24.0.0-117`
  • Loading branch information
mrjackyliang committed Jul 31, 2023
1 parent e8042b7 commit a6c0b0f
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ When configuring this plugin, simply add the platform to your existing `config.j
"logLevel": 30,
"logActivity": true,
"removeObsoleteZones": true,
"pausePlugin": false,
"resetAll": false
},
{
Expand Down Expand Up @@ -149,6 +150,15 @@ The default is `true`. Configure `removeObsoleteZones` with the values below:

__NOTE:__ If recently, you had sensors removed from ADT Pulse, the plugin will not remove these sensors unless `removeObsoleteZones` is set to `true`.

## Pausing the Plugin
The plugin may continuously ping the ADT Pulse servers, even when authentication fails, which will cause your IP to be temporarily banned. This will pause the plugin without you breaking other plugins. _Optional._

The default is `false`. Configure `pausePlugin` with the values below:
* Set `pausePlugin` to `true` for reset mode
* Set `pausePlugin` to `false` for normal mode

__NOTE:__ Once you are ready to resume the plugin, remember to set the `pausePlugin` setting back to `false` or else the plugin will continue to stay paused.

## Resetting the Plugin
Managing many accessories in a Homebridge environment is already a seemingly hard task, and sometimes you might want to step back and do a reset. _Optional._

Expand All @@ -162,7 +172,7 @@ __NOTE:__ Once reset is complete, remember to set the `resetAll` setting back to
The script provides an active connection to the ADT Pulse portal. Here is a list of must-knows, just in case you might want to debug (or improve) the plugin:

1. Device and zone statuses will be fetched every __3 seconds__. If logins have failed more than 2 times, portal sync will pause for 10 minutes.
2. Supported versions are `20.0.0-221` and `20.0.0-244`. If this plugin does not support either version, a warning will appear in the logs. Please [submit an issue](https://github.com/mrjackyliang/homebridge-adt-pulse/issues/new/choose) to let me know!
2. Supported versions are `25.0.0-21` and `26.0.0-32`. If this plugin does not support either version, a warning will appear in the logs. Please [submit an issue](https://github.com/mrjackyliang/homebridge-adt-pulse/issues/new/choose) to let me know!

## 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)!
Expand Down
9 changes: 9 additions & 0 deletions config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,12 @@
"default": true,
"required": false
},
"pausePlugin": {
"title": "Pause Plugin",
"type": "boolean",
"default": false,
"required": false
},
"resetAll": {
"title": "Reset Plugin \uD83D\uDED1",
"type": "boolean",
Expand Down Expand Up @@ -219,6 +225,9 @@
{
"key": "removeObsoleteZones"
},
{
"key": "pausePlugin"
},
{
"key": "resetAll"
}
Expand Down
15 changes: 13 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ function ADTPulsePlatform(log, config, api) {
this.logLevel = _.get(this.config, 'logLevel');
this.logActivity = _.get(this.config, 'logActivity');
this.removeObsoleteZones = _.get(this.config, 'removeObsoleteZones');
this.pausePlugin = _.get(this.config, 'pausePlugin');
this.resetAll = _.get(this.config, 'resetAll');

// Timers.
Expand All @@ -62,7 +63,7 @@ function ADTPulsePlatform(log, config, api) {
this.setDeviceTimeout = 6; // 6 seconds.

// Tested builds.
this.testedBuilds = ['24.0.0-117', '25.0.0-21'];
this.testedBuilds = ['25.0.0-21', '26.0.0-32'];

// Setup logging function.
if (typeof this.logLevel !== 'number' || ![10, 20, 30, 40, 50].includes(this.logLevel)) {
Expand Down Expand Up @@ -113,6 +114,14 @@ function ADTPulsePlatform(log, config, api) {
this.removeObsoleteZones = true;
}

// Prevent accidental pausing.
if (typeof this.pausePlugin !== 'boolean') {
if (this.pausePlugin !== undefined) {
this.logMessage('"pausePlugin" setting should be true or false. Defaulting to false.', 20);
}
this.pausePlugin = false;
}

// Prevent accidental reset.
if (typeof this.resetAll !== 'boolean') {
if (this.resetAll !== undefined) {
Expand Down Expand Up @@ -144,7 +153,9 @@ function ADTPulsePlatform(log, config, api) {
homebridgeVer: _.get(api, 'serverVersion'),
});

if (this.resetAll) {
if (this.pausePlugin) {
this.logMessage('ADT Pulse plugin is now paused...', 20);
} else if (this.resetAll) {
this.logMessage('Removing all ADT Pulse accessories from Homebridge...', 20);

_.forEachRight(this.accessories, (accessory) => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "homebridge-adt-pulse",
"displayName": "Homebridge ADT Pulse",
"version": "2.1.7",
"version": "2.2.0",
"description": "Homebridge security system platform for ADT Pulse",
"main": "index.js",
"private": false,
Expand Down

0 comments on commit a6c0b0f

Please sign in to comment.