homebridge-texecom-full 4.2.1 → 4.2.3

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']
package/CHANGELOG.md CHANGED
@@ -2,10 +2,20 @@
2
2
 
3
3
  This change log documents all release versions of homebridge-texecom
4
4
 
5
+ ### 4.2.2-beta2 (2024-10-09)
6
+
7
+ - **TWEAK** - Can not install in certain cases. Added post script to check if python is installed.
8
+ - **TEST** - Tested on Homebridge V2
9
+
10
+ ### 4.2.2-beta1 (2024-09-14)
11
+
12
+ - **TWEAK** - Area triggering reduced to Away Arm only
13
+ - Not triggering when in Home and evening arm
14
+
5
15
  ### 4.2.1 (2024-09-14)
6
16
 
7
- **FEATURE** - Added arm and disarm for each area
8
- - Added zones to each area to be able to trigger an alarm.
17
+ - **FEATURE** - Added arm and disarm for each area
18
+ - Added zones to each area to be able to trigger an alarm.
9
19
 
10
20
  ### 1.0.3 (2017-01-28)
11
21
 
package/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![npm](https://badgen.net/npm/v/homebridge-texecom-full/latest)](https://www.npmjs.com/package/homebridge-texecom-full)
2
+ [![npm](https://badgen.net/npm/dt/homebridge-texecom-full)](https://www.npmjs.com/package/homebridge-texecom-full)
1
3
  # homebridge-texecom-full
2
4
 
3
5
  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.
@@ -121,6 +121,11 @@
121
121
  "dwell"
122
122
  ]
123
123
  }
124
+ },
125
+ "debug":{
126
+ "type":"boolean",
127
+ "title":"Debug",
128
+ "default":false
124
129
  }
125
130
  },
126
131
  "required": true
package/index.js CHANGED
@@ -24,7 +24,6 @@ var service_area;
24
24
 
25
25
  var setByAlarm = false;
26
26
 
27
- var changed = false;
28
27
 
29
28
  module.exports = function (homebridge) {
30
29
  Accessory = homebridge.platformAccessory;
@@ -129,46 +128,68 @@ TexecomPlatform.prototype = {
129
128
  case "L":
130
129
  stateValue = Characteristic.SecuritySystemCurrentState.ALARM_TRIGGERED;
131
130
  platform.log.log("Area " + updated_area + " triggered");
132
- changed = true;
133
131
  break;
134
132
  case "D":
135
133
  stateValue = Characteristic.SecuritySystemCurrentState.DISARMED;
136
134
  platform.log.log("Area " + updated_area + " disarmed");
137
- changed = true;
138
-
139
- areas_armed = areas_armed.filter(value => value !== zpad(updated_area,3));
140
-
135
+ areas_armed = areas_armed.filter(value => value !== zpad(updated_area, 3));
141
136
  break;
142
137
  case "A":
143
138
  //user is for my setup
144
139
  //my user 17 is full armed (remote)
140
+ //my user on app is 254
145
141
  //all the rest is night armed
146
142
 
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
143
  if (user == "17") {
160
144
  stateValue = Characteristic.SecuritySystemCurrentState.AWAY_ARM;
161
145
  platform.log.log("Area " + updated_area + " armed");
162
146
  }
147
+ else if (user == "25" || user == "254") {
148
+ // Read the target state
149
+ const targetState = areaAccessories[updated_area - 1].target_State;
150
+
151
+ // Map the targetState to the corresponding current state value
152
+ switch (targetState) {
153
+ case Characteristic.SecuritySystemTargetState.AWAY_ARM:
154
+ stateValue = Characteristic.SecuritySystemCurrentState.AWAY_ARM;
155
+ break;
156
+ case Characteristic.SecuritySystemTargetState.STAY_ARM:
157
+ stateValue = Characteristic.SecuritySystemCurrentState.STAY_ARM;
158
+ break;
159
+ case Characteristic.SecuritySystemTargetState.NIGHT_ARM:
160
+ stateValue = Characteristic.SecuritySystemCurrentState.NIGHT_ARM;
161
+ break;
162
+ case Characteristic.SecuritySystemTargetState.DISARM:
163
+ stateValue = Characteristic.SecuritySystemCurrentState.DISARMED;
164
+ break;
165
+ default:
166
+ platform.log.error("Unknown target state: " + targetState);
167
+ return;
168
+ }
169
+
170
+ platform.log.log("User 254: Target state is " + targetState + ", updated stateValue is " + stateValue);
171
+
172
+ }
163
173
  else {
164
174
  stateValue = Characteristic.SecuritySystemCurrentState.NIGHT_ARM;
165
175
  platform.log.log("Area " + updated_area + " night armed");
166
176
  }
167
- changed = true;
177
+
178
+ if (stateValue == Characteristic.SecuritySystemCurrentState.AWAY_ARM) {
179
+ // Find the index of the first null or undefined value
180
+ const index = areas_armed.findIndex(value => value === null || value === undefined);
181
+
182
+ if (index !== -1) {
183
+ // Replace the value at that index
184
+ areas_armed[index] = zpad(updated_area, 3);
185
+ } else {
186
+ // If no open slot, append to the end
187
+ areas_armed.push(zpad(updated_area, 3));
188
+ }
189
+ }
168
190
  break;
169
191
  default:
170
192
  platform.log.log("Unknown status letter " + status);
171
- changed = true;
172
193
  return;
173
194
  }
174
195
  for (var i = 0; i < areaCount; i++) {
@@ -244,6 +265,10 @@ function TexecomAccessory(log, config) {
244
265
  this.name = config["name"];
245
266
  this.zone_type = config["zone_type"] || config["area_type"] || "motion";
246
267
  this.dwell_time = config["dwell"] || 0;
268
+
269
+ if (config["area_type"] == "securitysystem") {
270
+ this.target_State = Characteristic.SecuritySystemTargetState.DISARM;
271
+ }
247
272
  try {
248
273
  if (Array.isArray(config["zones"])) {
249
274
  // If it's an array, apply zpad to each element
@@ -461,6 +486,7 @@ function areaTargetSecurityStateSet(platform, accessory, service, value, callbac
461
486
  platform.log.debug("Setting current status of area " + accessory.zone_number + " to " + currentState + " because alarm responded OK");
462
487
  service.getCharacteristic(Characteristic.SecuritySystemCurrentState)
463
488
  .updateValue(currentState);
489
+ accessory.target_State = currentState;
464
490
  callback();
465
491
  })
466
492
  .catch((err) => {
package/package.json CHANGED
@@ -2,11 +2,29 @@
2
2
  "displayName": "Homebridge Texecom",
3
3
  "name": "homebridge-texecom-full",
4
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",
5
+ "version": "4.2.3",
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": [
@@ -35,4 +54,4 @@
35
54
  "string": "^3.3.3",
36
55
  "zpad": "^0.5.0"
37
56
  }
38
- }
57
+ }
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
- }