homebridge-texecom-full 4.2.7-beta.1 → 4.2.7

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  This change log documents all release versions of homebridge-texecom
4
4
 
5
+ ### 4.2.7 (2025-7-28)
6
+
7
+ - **FIX** - Connection issue
8
+ - **NEWS** - We are verified!!
9
+
5
10
  ### 4.2.6 (2025-07-25)
6
11
 
7
12
  - **FIX** - Fixed issues for Verification.
package/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
  [![npm beta version](https://badgen.net/npm/v/homebridge-texecom-full/beta)](https://www.npmjs.com/package/homebridge-texecom-full)
3
3
  [![npm downloads](https://badgen.net/npm/dt/homebridge-texecom-full)](https://www.npmjs.com/package/homebridge-texecom-full)
4
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)
5
6
  # homebridge-texecom-full
6
7
 
7
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.
package/index.js CHANGED
@@ -13,7 +13,6 @@ class ResponseEmitter extends EventEmitter { }
13
13
  const responseEmitter = new ResponseEmitter();
14
14
 
15
15
  const LogUtil = require('./util/logutil');
16
- const { platform } = require("os");
17
16
 
18
17
  var areas_armed = []; // Creates an empty array, which can later grow dynamically
19
18
 
@@ -221,7 +220,11 @@ TexecomPlatform.prototype = {
221
220
  });
222
221
  this.texecomConnection = serialPort;
223
222
  } else if (this.ip_address) {
224
- try {
223
+
224
+ setupConnection();
225
+
226
+
227
+ /*try {
225
228
  connection = net.createConnection(platform.ip_port, platform.ip_address, function () {
226
229
  platform.log.log('Connected via IP');
227
230
  });
@@ -236,13 +239,10 @@ TexecomPlatform.prototype = {
236
239
  processData(data);
237
240
  });
238
241
 
239
- connection.on('timeout', () => {
240
- platform.log.error('Connection attempt timed out.');
241
- connection.destroy(); // prevent crash
242
- });
243
242
 
244
- connection.on('error', (err) => {
245
- platform.log.error(`Socket error: ${err.message}`);
243
+ connection.on('error', function (err) {
244
+ platform.log.error(`IP connection error: ${err}`);
245
+
246
246
  });
247
247
 
248
248
  connection.on('end', function () {
@@ -251,27 +251,57 @@ TexecomPlatform.prototype = {
251
251
 
252
252
  connection.on('close', function () {
253
253
  platform.log.log('IP connection closed');
254
-
255
- setTimeout(() => {
256
- platform.log.log('Attempting reconnect...');
257
-
258
- try {
259
- connection = net.createConnection(platform.ip_port, platform.ip_address, function () {
260
- platform.log.log('Re-connected after loss of connection');
261
- });
262
- } catch (err) {
263
- platform.log.error(err);
264
- }
265
- }, 10000);
266
-
254
+ try {
255
+ connection = net.createConnection(platform.ip_port, platform.ip_address, function () {
256
+ platform.log.log('Re-connected after loss of connection');
257
+ });
258
+ } catch (err) {
259
+ platform.log.error(err);
260
+ }
267
261
  });
268
- this.texecomConnection = connection;
262
+ this.texecomConnection = connection;*/
269
263
  } else {
270
264
  this.log.log("Must set either serial_device or ip_address in configuration.");
271
265
  }
272
266
  }
273
267
  }
274
268
 
269
+ function setupConnection() {
270
+ platform.log.log('Attempting connection to Texecom...');
271
+
272
+ connection = net.createConnection(platform.ip_port, platform.ip_address);
273
+
274
+ connection.setNoDelay(true);
275
+
276
+ connection.on('connect', () => {
277
+ platform.log.log('Connected via IP');
278
+ });
279
+
280
+ connection.on('data', function (data) {
281
+ platform.log.debug(`IP data received: ${data}`);
282
+ responseEmitter.emit('data', data);
283
+ processData(data);
284
+ });
285
+
286
+ connection.on('error', (err) => {
287
+ platform.log.error('IP connection error:', err.message);
288
+ // We'll reconnect on 'close'
289
+ });
290
+
291
+ connection.on('close', () => {
292
+ platform.log.error('IP connection closed. Will attempt to reconnect in 10s.');
293
+ setTimeout(() => {
294
+ setupConnection(); // try again
295
+ }, 10000);
296
+ });
297
+
298
+ connection.on('end', () => {
299
+ platform.log.log('IP connection ended');
300
+ });
301
+
302
+ platform.texecomConnection = connection;
303
+ }
304
+
275
305
  function TexecomAccessory(log, config) {
276
306
  this.log = log;
277
307
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "displayName": "Homebridge Texecom",
3
3
  "name": "homebridge-texecom-full",
4
4
  "description": "A plugin for homebridge to integrate Texecom Premier Elite alarm systems into HomeKit",
5
- "version": "4.2.7-beta.1",
5
+ "version": "4.2.7",
6
6
  "author": {
7
7
  "name": "Chris Posthumus",
8
8
  "email": "chris.posthumus@gmail.com"