From a6c0b0f56214f351b0c1b0ccdb0886cc7c167c11 Mon Sep 17 00:00:00 2001 From: Jacky Liang Date: Mon, 31 Jul 2023 11:13:43 -0400 Subject: [PATCH] New changes ### FIXED - Readme with outdated versions ### ADDED - Support for `26.0.0-32` - Pause plugin functionality ### REMOVED - Support for `24.0.0-117` --- README.md | 12 +++++++++++- config.schema.json | 9 +++++++++ index.js | 15 +++++++++++++-- package.json | 2 +- 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index edaa524..669a3b2 100644 --- a/README.md +++ b/README.md @@ -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 }, { @@ -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._ @@ -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)! diff --git a/config.schema.json b/config.schema.json index 7e55519..566bb86 100644 --- a/config.schema.json +++ b/config.schema.json @@ -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", @@ -219,6 +225,9 @@ { "key": "removeObsoleteZones" }, + { + "key": "pausePlugin" + }, { "key": "resetAll" } diff --git a/index.js b/index.js index 8087089..7746e89 100644 --- a/index.js +++ b/index.js @@ -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. @@ -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)) { @@ -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) { @@ -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) => { diff --git a/package.json b/package.json index 3a0a16f..0d6c42d 100644 --- a/package.json +++ b/package.json @@ -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,