From f446ae476cca8ebb8e306ba1c1459d84931af994 Mon Sep 17 00:00:00 2001 From: Jacky Liang Date: Tue, 21 Jul 2020 19:52:02 -0400 Subject: [PATCH] Code enhancements UPDATED - [Main script] Separated device name detection for users with special naming configurations - [PackageJSON] Production and development dependencies FIXED - [Main script] Fixed glass and smoke sensors being detected as contact sensors ADDED - [Main script] Support for `Z** Service` door sensors --- api.js | 14 +++++++++++--- package.json | 10 +++++----- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/api.js b/api.js index abbee5f..2e12820 100644 --- a/api.js +++ b/api.js @@ -587,9 +587,7 @@ Pulse.prototype.getZoneStatus = function getZoneStatus() { if (typeof theName === 'string' && theState !== 'devStatUnknown') { const theNameLowercase = theName.toLowerCase(); - if (theNameLowercase.match(/^(.*)(door|window|dr|win|slider|nook)(.*)$/g) !== null) { - theTag = 'sensor,doorWindow'; - } else if (theNameLowercase.match(/^(.*)(glass)(.*)$/g) !== null) { + if (theNameLowercase.match(/^(.*)(glass)(.*)$/g) !== null) { theTag = 'sensor,glass'; } else if (theNameLowercase.match(/^(.*)(motion)(.*)$/g) !== null) { theTag = 'sensor,motion'; @@ -597,6 +595,16 @@ Pulse.prototype.getZoneStatus = function getZoneStatus() { theTag = 'sensor,co'; } else if (theNameLowercase.match(/^(.*)(smoke|heat)(.*)$/g) !== null) { theTag = 'sensor,fire'; + } else if (theNameLowercase.match(/^(.*)(door|window|dr|win|slider)(.*)$/g) !== null) { + theTag = 'sensor,doorWindow'; + } else if (theNameLowercase.match(/^(kitchen nook)|(z[0-9]{2} service)$/g) !== null) { + /** + * GitHub users with special naming configurations. + * + * @Glitch482 - "KITCHEN NOOK" + * @w1llf0rd - "Z** Service" + */ + theTag = 'sensor,doorWindow'; } } diff --git a/package.json b/package.json index 7e1ea3c..9bdd478 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "homebridge-adt-pulse", "displayName": "Homebridge ADT Pulse", - "version": "1.8.10", + "version": "1.8.11", "description": "Homebridge security system platform for ADT Pulse", "main": "index.js", "private": false, @@ -45,15 +45,15 @@ "dependencies": { "cheerio": "^1.0.0-rc.3", "internet-available": "^1.0.0", - "lodash": "^4.17.15", + "lodash": "^4.17.19", "q": "^1.5.1", "request": "^2.88.2" }, "devDependencies": { "eslint": "^6.8.0", - "eslint-config-airbnb-base": "^14.1.0", - "eslint-plugin-import": "^2.20.2", + "eslint-config-airbnb-base": "^14.2.0", + "eslint-plugin-import": "^2.22.0", "homebridge": "^0.4.53", - "typescript": "^3.9.3" + "typescript": "^3.9.7" } }