homebridge-texecom-full 4.3.0-beta.0 → 4.3.0

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.
Files changed (2) hide show
  1. package/index.js +12 -7
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -52,22 +52,27 @@ class TexecomPlatform {
52
52
  const areaCount = areaAccessories.length;
53
53
 
54
54
  // Publish all accessories as external accessories (no cache needed)
55
- [...zoneAccessories, ...areaAccessories].forEach(acc => {
56
- const uuid = hap.uuid.generate(acc.sn);
55
+ // UUID is namespaced with type prefix to prevent collisions between a zone
56
+ // and an area that share the same zone_number / SN.
57
+ const publishAccessory = (acc, typePrefix) => {
58
+ acc._platform = platform; // inject platform ref for onSet handler
59
+ const uuid = hap.uuid.generate(`${typePrefix}:${acc.sn}`);
57
60
  const hapAcc = new api.platformAccessory(acc.name, uuid);
58
61
 
59
- const [infoSvc, mainSvc] = acc.getServices();
62
+ const [, mainSvc] = acc.getServices();
60
63
 
61
64
  // Populate the built-in AccessoryInformation service
62
- const infoTarget = hapAcc.getService(hap.Service.AccessoryInformation);
63
- infoTarget
65
+ hapAcc.getService(hap.Service.AccessoryInformation)
64
66
  .setCharacteristic(hap.Characteristic.Manufacturer, "Homebridge")
65
- .setCharacteristic(hap.Characteristic.Model, `Texecom ${acc.zone_type === "securitysystem" ? "Area" : "Zone"}`)
67
+ .setCharacteristic(hap.Characteristic.Model, `Texecom ${typePrefix === "area" ? "Area" : "Zone"}`)
66
68
  .setCharacteristic(hap.Characteristic.SerialNumber, acc.sn);
67
69
 
68
70
  hapAcc.addService(mainSvc);
69
71
  api.publishExternalAccessories("homebridge-texecom-full", [hapAcc]);
70
- });
72
+ };
73
+
74
+ zoneAccessories.forEach(acc => publishAccessory(acc, "zone"));
75
+ areaAccessories.forEach(acc => publishAccessory(acc, "area"));
71
76
 
72
77
  // ── Data processing ──────────────────────────────────────────────────
73
78
  function processData(data) {
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.3.0-beta.0",
5
+ "version": "4.3.0",
6
6
  "author": {
7
7
  "name": "Chris Posthumus",
8
8
  "email": "chris.posthumus@gmail.com"