homebridge-texecom-full 4.2.1 → 4.2.5-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,4 +9,4 @@ issuehunt: # Replace with a single IssueHunt username
9
9
  lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
10
10
  polar: # Replace with a single Polar username
11
11
  buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
12
- custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
12
+ custom: ['https://www.paypal.me/chrisposthumus']
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **To Reproduce**
14
+ Steps to reproduce the behavior:
15
+ 1. Go to '...'
16
+ 2. Click on '....'
17
+ 3. Scroll down to '....'
18
+ 4. See error
19
+
20
+ **Expected behavior**
21
+ A clear and concise description of what you expected to happen.
22
+
23
+ **Screenshots**
24
+ If applicable, add screenshots to help explain your problem.
25
+
26
+ **Desktop (please complete the following information):**
27
+ - OS: [e.g. iOS]
28
+ - Browser [e.g. chrome, safari]
29
+ - Version [e.g. 22]
30
+
31
+ **Smartphone (please complete the following information):**
32
+ - Device: [e.g. iPhone6]
33
+ - OS: [e.g. iOS8.1]
34
+ - Browser [e.g. stock browser, safari]
35
+ - Version [e.g. 22]
36
+
37
+ **Additional context**
38
+ Add any other context about the problem here.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: Custom issue template
3
+ about: Describe this issue template's purpose here.
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context or screenshots about the feature request here.
package/CHANGELOG.md CHANGED
@@ -2,10 +2,24 @@
2
2
 
3
3
  This change log documents all release versions of homebridge-texecom
4
4
 
5
+ ### 4.2.3 (2024-10-09)
6
+
7
+ - **TWEAK** - Trying to get verified by homebridge
8
+
9
+ ### 4.2.2-beta2 (2024-10-09)
10
+
11
+ - **TWEAK** - Can not install in certain cases. Added post script to check if python is installed.
12
+ - **TEST** - Tested on Homebridge V2
13
+
14
+ ### 4.2.2-beta1 (2024-09-14)
15
+
16
+ - **TWEAK** - Area triggering reduced to Away Arm only
17
+ - Not triggering when in Home and evening arm
18
+
5
19
  ### 4.2.1 (2024-09-14)
6
20
 
7
- **FEATURE** - Added arm and disarm for each area
8
- - Added zones to each area to be able to trigger an alarm.
21
+ - **FEATURE** - Added arm and disarm for each area
22
+ - Added zones to each area to be able to trigger an alarm.
9
23
 
10
24
  ### 1.0.3 (2017-01-28)
11
25
 
@@ -23,4 +37,4 @@ This change log documents all release versions of homebridge-texecom
23
37
 
24
38
  ### 1.0.0 (2017-01-21)
25
39
 
26
- - **FEATURE** - Initial release.
40
+ - **FEATURE** - Initial release.
package/README.md CHANGED
@@ -1,14 +1,19 @@
1
+ [![npm version](https://badgen.net/npm/v/homebridge-texecom-full/latest)](https://www.npmjs.com/package/homebridge-texecom-full)
2
+ [![npm beta version](https://badgen.net/npm/v/homebridge-texecom-full/beta)](https://www.npmjs.com/package/homebridge-texecom-full)
3
+ [![npm downloads](https://badgen.net/npm/dt/homebridge-texecom-full)](https://www.npmjs.com/package/homebridge-texecom-full)
4
+ [![GitHub last commit](https://badgen.net/github/last-commit/K1LL3R234/homebridge-texecom)](https://github.com/K1LL3R234/homebridge-texecom)
5
+ [![verified-by-homebridge](https://badgen.net/badge/homebridge/verified/purple)](https://github.com/homebridge/homebridge/wiki/Verified-Plugins)[![verified-by-homebridge](https://img.shields.io/badge/homebridge-verified-blueviolet?color=%23491F59&style=for-the-badge&logoColor=%23FFFFFF&logo=homebridge)](https://github.com/homebridge/homebridge/wiki/Verified-Plugins)
1
6
  # homebridge-texecom-full
2
7
 
3
8
  A plugin for [Homebridge](https://github.com/nfarina/homebridge) that creates HomeKit motion, contact, smoke, or carbon monoxide sensors for alarm zones from a Texecom Premier intruder alarm via a serial connection or COM-IP module.
4
9
 
5
10
  You can receive notifications, which can be set to work only when you're away from home:
6
11
 
7
- ![example of notifications](https://github.com/max-christian/homebridge-texecom/blob/master/images/example-notifications.jpg?raw=true)
12
+ ![example of notifications](https://github.com/K1LL3R234/homebridge-texecom/blob/master/images/example-notifications.jpg?raw=true)
8
13
 
9
14
  Another great use is to use the alarm's motion sensors to switch lights on automatically:
10
15
 
11
- ![example of automation](https://github.com/max-christian/homebridge-texecom/blob/master/images/example-automation.jpg?raw=true)
16
+ ![example of automation](https://github.com/K1LL3R234/homebridge-texecom/blob/master/images/example-automation.jpg?raw=true)
12
17
 
13
18
  You can also set automations to happen when you arm the alarm and when the alarm goes off.
14
19
 
@@ -132,6 +137,8 @@ To configure your COM1 port for the Crestron protocol:
132
137
 
133
138
  Press "Menu" repeatedly to exit the engineer menu.
134
139
 
140
+ **Make sure you program your UDL code in the panel too.**
141
+
135
142
  If connecting to a COM-IP, set up the COM-IP as usual and ensure it is working. Then change the configuration for the port the COM-IP is connected to to Crestron as detailed above. This allows the panel to configure the IP address into the module, then changing to Crestron will allow the panel to input/output the correct commands.
136
143
 
137
144
  ## Future features
@@ -48,6 +48,7 @@
48
48
  },
49
49
  "zones": {
50
50
  "type": "array",
51
+ "title": "Zones",
51
52
  "items": {
52
53
  "type": "object",
53
54
  "properties": {
@@ -83,6 +84,7 @@
83
84
  },
84
85
  "areas": {
85
86
  "type": "array",
87
+ "title": "Areas",
86
88
  "items": {
87
89
  "type": "object",
88
90
  "properties": {
@@ -121,6 +123,11 @@
121
123
  "dwell"
122
124
  ]
123
125
  }
126
+ },
127
+ "debug":{
128
+ "type":"boolean",
129
+ "title":"Debug",
130
+ "default":false
124
131
  }
125
132
  },
126
133
  "required": true
package/index.js CHANGED
@@ -17,14 +17,8 @@ const LogUtil = require('./util/logutil');
17
17
  var areas_armed = []; // Creates an empty array, which can later grow dynamically
18
18
 
19
19
 
20
- var serialPort;
21
- var connection;
22
-
23
- var service_area;
24
-
25
20
  var setByAlarm = false;
26
21
 
27
- var changed = false;
28
22
 
29
23
  module.exports = function (homebridge) {
30
24
  Accessory = homebridge.platformAccessory;
@@ -129,46 +123,68 @@ TexecomPlatform.prototype = {
129
123
  case "L":
130
124
  stateValue = Characteristic.SecuritySystemCurrentState.ALARM_TRIGGERED;
131
125
  platform.log.log("Area " + updated_area + " triggered");
132
- changed = true;
133
126
  break;
134
127
  case "D":
135
128
  stateValue = Characteristic.SecuritySystemCurrentState.DISARMED;
136
129
  platform.log.log("Area " + updated_area + " disarmed");
137
- changed = true;
138
-
139
- areas_armed = areas_armed.filter(value => value !== zpad(updated_area,3));
140
-
130
+ areas_armed = areas_armed.filter(value => value !== zpad(updated_area, 3));
141
131
  break;
142
132
  case "A":
143
133
  //user is for my setup
144
134
  //my user 17 is full armed (remote)
135
+ //my user on app is 254
145
136
  //all the rest is night armed
146
137
 
147
- // Find the index of the first null or undefined value
148
- const index = areas_armed.findIndex(value => value === null || value === undefined);
149
-
150
- if (index !== -1) {
151
- // Replace the value at that index
152
- areas_armed[index] = zpad(updated_area,3);
153
- } else {
154
- // If no open slot, append to the end
155
- areas_armed.push(zpad(updated_area,3));
156
- }
157
-
158
-
159
138
  if (user == "17") {
160
139
  stateValue = Characteristic.SecuritySystemCurrentState.AWAY_ARM;
161
140
  platform.log.log("Area " + updated_area + " armed");
162
141
  }
142
+ else if (user == "25" || user == "254") {
143
+ // Read the target state
144
+ const targetState = areaAccessories[updated_area - 1].target_State;
145
+
146
+ // Map the targetState to the corresponding current state value
147
+ switch (targetState) {
148
+ case Characteristic.SecuritySystemTargetState.AWAY_ARM:
149
+ stateValue = Characteristic.SecuritySystemCurrentState.AWAY_ARM;
150
+ break;
151
+ case Characteristic.SecuritySystemTargetState.STAY_ARM:
152
+ stateValue = Characteristic.SecuritySystemCurrentState.STAY_ARM;
153
+ break;
154
+ case Characteristic.SecuritySystemTargetState.NIGHT_ARM:
155
+ stateValue = Characteristic.SecuritySystemCurrentState.NIGHT_ARM;
156
+ break;
157
+ case Characteristic.SecuritySystemTargetState.DISARM:
158
+ stateValue = Characteristic.SecuritySystemCurrentState.DISARMED;
159
+ break;
160
+ default:
161
+ platform.log.error("Unknown target state: " + targetState);
162
+ return;
163
+ }
164
+
165
+ platform.log.log("User 254: Target state is " + targetState + ", updated stateValue is " + stateValue);
166
+
167
+ }
163
168
  else {
164
169
  stateValue = Characteristic.SecuritySystemCurrentState.NIGHT_ARM;
165
170
  platform.log.log("Area " + updated_area + " night armed");
166
171
  }
167
- changed = true;
172
+
173
+ if (stateValue == Characteristic.SecuritySystemCurrentState.AWAY_ARM) {
174
+ // Find the index of the first null or undefined value
175
+ const index = areas_armed.findIndex(value => value === null || value === undefined);
176
+
177
+ if (index !== -1) {
178
+ // Replace the value at that index
179
+ areas_armed[index] = zpad(updated_area, 3);
180
+ } else {
181
+ // If no open slot, append to the end
182
+ areas_armed.push(zpad(updated_area, 3));
183
+ }
184
+ }
168
185
  break;
169
186
  default:
170
187
  platform.log.log("Unknown status letter " + status);
171
- changed = true;
172
188
  return;
173
189
  }
174
190
  for (var i = 0; i < areaCount; i++) {
@@ -244,6 +260,10 @@ function TexecomAccessory(log, config) {
244
260
  this.name = config["name"];
245
261
  this.zone_type = config["zone_type"] || config["area_type"] || "motion";
246
262
  this.dwell_time = config["dwell"] || 0;
263
+
264
+ if (config["area_type"] == "securitysystem") {
265
+ this.target_State = Characteristic.SecuritySystemTargetState.DISARM;
266
+ }
247
267
  try {
248
268
  if (Array.isArray(config["zones"])) {
249
269
  // If it's an array, apply zpad to each element
@@ -461,6 +481,7 @@ function areaTargetSecurityStateSet(platform, accessory, service, value, callbac
461
481
  platform.log.debug("Setting current status of area " + accessory.zone_number + " to " + currentState + " because alarm responded OK");
462
482
  service.getCharacteristic(Characteristic.SecuritySystemCurrentState)
463
483
  .updateValue(currentState);
484
+ accessory.target_State = currentState;
464
485
  callback();
465
486
  })
466
487
  .catch((err) => {
@@ -502,14 +523,7 @@ function writeCommandAndWaitForOK(connection, command, retryCount = 1) {
502
523
  }
503
524
 
504
525
  function is_armed(area_number) {
505
- //let isAreaArmed = false;
506
-
507
526
  let isAreaArmed = areas_armed.some(value => value === area_number);
508
- /*areas_armed.forEach(function (value) {
509
- if (value === area_number) {
510
- isAreaArmed = true;
511
- }
512
- });*/
513
527
 
514
528
  return isAreaArmed;
515
529
  }
package/package.json CHANGED
@@ -1,12 +1,30 @@
1
1
  {
2
2
  "displayName": "Homebridge Texecom",
3
3
  "name": "homebridge-texecom-full",
4
- "description": "A plugin for homebridge (https://github.com/nfarina/homebridge) to integrate Texecom Premier Elite alarm systems into HomeKit",
5
- "version": "4.2.1",
4
+ "description": "A plugin for homebridge to integrate Texecom Premier Elite alarm systems into HomeKit",
5
+ "version": "4.2.5-beta.1",
6
+ "author": {
7
+ "name": "Chris Posthumus",
8
+ "email": "chris.posthumus@gmail.com"
9
+ },
10
+ "homepage": "https://github.com/K1LL3R234/homebridge-texecom",
6
11
  "repository": {
7
12
  "type": "git",
8
- "url": "https://github.com/K1LL3R234/homebridge-texecom"
13
+ "url": "https://github.com/K1LL3R234/homebridge-texecom.git"
14
+ },
15
+ "bugs": {
16
+ "url": "https://https://github.com/K1LL3R234/homebridge-texecom/issues"
9
17
  },
18
+ "funding": [
19
+ {
20
+ "type": "github",
21
+ "url": "https://github.com/sponsors/K1LL3R234"
22
+ },
23
+ {
24
+ "type": "paypal",
25
+ "url": "https://www.paypal.me/chrisposthumus"
26
+ }
27
+ ],
10
28
  "license": "MIT",
11
29
  "preferGlobal": true,
12
30
  "keywords": [
@@ -21,8 +39,9 @@
21
39
  "Texecom"
22
40
  ],
23
41
  "engines": {
24
- "node": ">=0.12.0",
25
- "homebridge": ">=0.2.5"
42
+ "homebridge": "^1.6.0 || ^2.0.0-beta.0",
43
+ "node": "^18.20.4 || ^20.15.1",
44
+ "python": ">=3.6.0"
26
45
  },
27
46
  "homebridge": {
28
47
  "platforms": [
@@ -30,8 +49,8 @@
30
49
  ]
31
50
  },
32
51
  "dependencies": {
33
- "debug": "^2.6.9",
34
- "serialport": "^8.0.8",
52
+ "debug": "^4.2.0",
53
+ "serialport": "^12.0.0",
35
54
  "string": "^3.3.3",
36
55
  "zpad": "^0.5.0"
37
56
  }
package/util/logutil.js CHANGED
@@ -34,4 +34,4 @@ class LogUtil {
34
34
  }
35
35
  }
36
36
 
37
- module.exports = LogUtil;
37
+ module.exports = LogUtil;
@@ -1,23 +0,0 @@
1
- {
2
- /*"configurations": [
3
- {
4
- "type": "chrome",
5
- "name": "localhost:8581",
6
- "request": "launch",
7
- "program":"${env:APPDATA}\\Roaming\\npm\\node_modules\\homebridge\\bin\\homebridge",
8
- "url": "localhost:8581"
9
- }
10
- ]*/
11
- "version": "0.2.0",
12
- "configurations": [
13
- {
14
- "name": "Launch Program",
15
- "program": "${env:APPDATA}\\npm\\node_modules\\homebridge\\bin\\homebridge",
16
- "request": "launch",
17
- "skipFiles": [
18
- "<node_internals>//**"
19
- ],
20
- "type":"pwa-node"
21
- }
22
- ]
23
- }