Skip to content

Commit

Permalink
Code enhancements
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mrjackyliang committed Jul 21, 2020
1 parent 40f98ff commit f446ae4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
14 changes: 11 additions & 3 deletions api.js
Original file line number Diff line number Diff line change
Expand Up @@ -587,16 +587,24 @@ 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';
} else if (theNameLowercase.match(/^(.*)(gas)(.*)$/g) !== null) {
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';
}
}

Expand Down
10 changes: 5 additions & 5 deletions 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": "1.8.10",
"version": "1.8.11",
"description": "Homebridge security system platform for ADT Pulse",
"main": "index.js",
"private": false,
Expand Down Expand Up @@ -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"
}
}

0 comments on commit f446ae4

Please sign in to comment.