@brandonarrindell/homebridge-envisalink 2.0.1 → 2.0.2
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/README.md +2 -0
- package/RELEASE_NOTES.md +26 -0
- package/dist/settings.d.ts +1 -1
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +1 -1
- package/dist/settings.js.map +1 -1
- package/docs/testing.md +14 -0
- package/package.json +1 -1
- package/src/settings.ts +1 -1
- package/test/e2e/homebridge.test.cjs +118 -6
- package/test/settings.spec.ts +7 -0
package/README.md
CHANGED
|
@@ -15,6 +15,8 @@ This Homebridge plugin integrates your Envisalink security system with HomeKit,
|
|
|
15
15
|
|
|
16
16
|
This fork continues from version 1.2.10 of the original plugin:
|
|
17
17
|
|
|
18
|
+
- v2.0.2 (2026-09-30) - Fix scoped plugin registration and verify legacy cache
|
|
19
|
+
migration. Thanks to Marc Kagan for [PR #75](https://github.com/brandonarrindell/homebridge-envisalink/pull/75).
|
|
18
20
|
- v2.0.1 (2026-09-30) - Missing-name fallbacks, valid HomeKit names and cached
|
|
19
21
|
accessory-name repairs. See [upgrade and release notes](RELEASE_NOTES.md).
|
|
20
22
|
- v2.0.0 (2026-09-30) - Node.js 22/24 support, custom-command cache cleanup,
|
package/RELEASE_NOTES.md
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
# 2.0.2 — 2026-09-30
|
|
2
|
+
|
|
3
|
+
## Fixed
|
|
4
|
+
|
|
5
|
+
- Register accessories under `@brandonarrindell/homebridge-envisalink`, matching
|
|
6
|
+
the installed package name and preventing Homebridge's "no loaded plugin"
|
|
7
|
+
registration warning. Thanks to Marc Kagan for contributing
|
|
8
|
+
[PR #75](https://github.com/brandonarrindell/homebridge-envisalink/pull/75).
|
|
9
|
+
|
|
10
|
+
## Upgrading and verification
|
|
11
|
+
|
|
12
|
+
Keep the existing accessory cache, bridge username and panel settings.
|
|
13
|
+
Homebridge migrates legacy unscoped plugin associations through the active
|
|
14
|
+
Envisalink platform; regression tests verify unchanged accessory UUIDs and
|
|
15
|
+
HomeKit AIDs/IIDs, working restored controls, and persisted migration across
|
|
16
|
+
restarts. No cache deletion or re-pairing is required in the tested scenarios.
|
|
17
|
+
|
|
18
|
+
Real Homebridge-process, simulated DSC TCP panel and HAP HTTP tests cover fresh
|
|
19
|
+
scoped registrations, legacy cache migration, custom-command add/remove/restart,
|
|
20
|
+
and main/child bridges across Homebridge 1.6.0, 1.11.4 and 2.4.0 on supported Node
|
|
21
|
+
22/24 runtimes. All 41 active unit tests and 8 E2E scenarios pass. Physical alarm
|
|
22
|
+
hardware and Apple Home pairing remain outside the simulated test scope.
|
|
23
|
+
See [testing documentation](docs/testing.md) for details.
|
|
24
|
+
|
|
25
|
+
The Node.js 22/24 requirement introduced in 2.0.0 is unchanged.
|
|
26
|
+
|
|
1
27
|
# 2.0.1 — 2026-09-30
|
|
2
28
|
|
|
3
29
|
## Fixed
|
package/dist/settings.d.ts
CHANGED
|
@@ -5,5 +5,5 @@ export declare const PLATFORM_NAME = "Envisalink";
|
|
|
5
5
|
/**
|
|
6
6
|
* This must match the name of your plugin as defined the package.json
|
|
7
7
|
*/
|
|
8
|
-
export declare const PLUGIN_NAME = "homebridge-envisalink";
|
|
8
|
+
export declare const PLUGIN_NAME = "@brandonarrindell/homebridge-envisalink";
|
|
9
9
|
//# sourceMappingURL=settings.d.ts.map
|
package/dist/settings.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,aAAa,eAAe,CAAC;AAE1C;;GAEG;AACH,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,aAAa,eAAe,CAAC;AAE1C;;GAEG;AACH,eAAO,MAAM,WAAW,4CAA4C,CAAC"}
|
package/dist/settings.js
CHANGED
|
@@ -8,5 +8,5 @@ exports.PLATFORM_NAME = 'Envisalink';
|
|
|
8
8
|
/**
|
|
9
9
|
* This must match the name of your plugin as defined the package.json
|
|
10
10
|
*/
|
|
11
|
-
exports.PLUGIN_NAME = 'homebridge-envisalink';
|
|
11
|
+
exports.PLUGIN_NAME = '@brandonarrindell/homebridge-envisalink';
|
|
12
12
|
//# sourceMappingURL=settings.js.map
|
package/dist/settings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACU,QAAA,aAAa,GAAG,YAAY,CAAC;AAE1C;;GAEG;AACU,QAAA,WAAW,GAAG,
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACU,QAAA,aAAa,GAAG,YAAY,CAAC;AAE1C;;GAEG;AACU,QAAA,WAAW,GAAG,yCAAyC,CAAC"}
|
package/docs/testing.md
CHANGED
|
@@ -45,6 +45,15 @@ ranges, so HTTP client connections do not claim a bridge's port between restarts
|
|
|
45
45
|
`502024` failure logging/reset, and a successful command after that failure
|
|
46
46
|
- Actual process restarts with the same Homebridge `persist` and `accessories`
|
|
47
47
|
directories, rather than simulated lifecycle callbacks
|
|
48
|
+
- `PLUGIN_NAME` equals the package name used by Homebridge; all fresh accessory
|
|
49
|
+
cache entries have the scoped plugin/platform association and registration
|
|
50
|
+
emits no "no loaded plugin" warning
|
|
51
|
+
- Synthetic legacy unscoped associations across every accessory type migrate
|
|
52
|
+
through Homebridge's own platform resolution on main and child bridges,
|
|
53
|
+
preserve UUIDs and HAP AIDs/IIDs, and persist the scoped association; restored
|
|
54
|
+
sensors, partition controls, panic switches and custom commands still work
|
|
55
|
+
- Adding/removing commands after that migration survives process restarts without
|
|
56
|
+
duplicate accessories, stale cache entries or repeated association migration
|
|
48
57
|
- Legacy custom-command cache entries with empty context; name-only changes
|
|
49
58
|
preserve command-derived UUID and HomeKit AID and update both visible names
|
|
50
59
|
- Command edits remove the old accessory; deleting entries removes their stale
|
|
@@ -78,6 +87,9 @@ claiming that HomeKit receives a failure status.
|
|
|
78
87
|
npm run build
|
|
79
88
|
node --test --test-name-pattern='names:' test/e2e/homebridge.test.cjs
|
|
80
89
|
|
|
90
|
+
# Focused registration and legacy plugin-association migration regressions.
|
|
91
|
+
node --test --test-name-pattern='registration:' test/e2e/homebridge.test.cjs
|
|
92
|
+
|
|
81
93
|
# Fast restart/cache iteration. Reports reconnect as skipped.
|
|
82
94
|
E2E_SKIP_RECONNECT=1 npm run test:e2e
|
|
83
95
|
|
|
@@ -100,6 +112,8 @@ package metadata, accommodating both Homebridge 1.x and 2.x entrypoint names.
|
|
|
100
112
|
`HOMEBRIDGE_BIN` must be an absolute path. Failure artifacts are retained and their
|
|
101
113
|
temporary directory is printed. Successful runs remove their own temporary
|
|
102
114
|
storage unless `E2E_KEEP_STORAGE=1` is set. No production cache is touched.
|
|
115
|
+
CI runs the complete suite against Homebridge 1.11.4 and 2.4.0 on Node 22 and 24,
|
|
116
|
+
plus the supported Homebridge 1.6.0 / Node 22.0.0 runtime floor.
|
|
103
117
|
|
|
104
118
|
### Restricted containers
|
|
105
119
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "Homebridge EnvisaLink (Fork)",
|
|
3
3
|
"name": "@brandonarrindell/homebridge-envisalink",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.2",
|
|
5
5
|
"description": "A homebridge plugin for the EnvisaLink alarm module - Maintained fork of homebridge-envisalink",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"scripts": {
|
package/src/settings.ts
CHANGED
|
@@ -15,6 +15,9 @@ const { DscSimulator, frame } = require('./dsc-simulator.cjs');
|
|
|
15
15
|
|
|
16
16
|
const ROOT = path.resolve(__dirname, '../..');
|
|
17
17
|
const BRIDGE_PIN = '031-45-154'; // Synthetic test credentials only.
|
|
18
|
+
const PLUGIN_NAME = require('../../package.json').name;
|
|
19
|
+
const LEGACY_PLUGIN_NAME = 'homebridge-envisalink';
|
|
20
|
+
const REGISTRATION_WARNING = /no loaded plugin could be found|Could not restore cached accessory|Failed to find plugin to handle accessory|Removing orphaned accessory/;
|
|
18
21
|
const TYPES = {
|
|
19
22
|
information: '3E', switch: '49', security: '7E', name: '23', serial: '30', on: '25',
|
|
20
23
|
contact: '6A', motion: '22', leak: '70', smoke: '76', current: '66', target: '67',
|
|
@@ -410,8 +413,8 @@ function assertNames(accessories) {
|
|
|
410
413
|
}
|
|
411
414
|
}
|
|
412
415
|
|
|
413
|
-
async function
|
|
414
|
-
const storage = await fs.mkdtemp(path.join(os.tmpdir(), 'envisalink-
|
|
416
|
+
async function bridgeFixture(t, child, action) {
|
|
417
|
+
const storage = await fs.mkdtemp(path.join(os.tmpdir(), 'envisalink-regression-'));
|
|
415
418
|
const panel = await new DscSimulator().start();
|
|
416
419
|
const port = await freePort();
|
|
417
420
|
const bridge = new HomebridgeHarness(storage, port, panel,
|
|
@@ -430,13 +433,122 @@ async function namingFixture(t, child, action) {
|
|
|
430
433
|
await panel.close();
|
|
431
434
|
await fs.writeFile(path.join(storage, 'dsc-commands.json'), JSON.stringify(panel.commands, null, 2));
|
|
432
435
|
if (passed && process.env.E2E_KEEP_STORAGE !== '1') await fs.rm(storage, { recursive: true, force: true });
|
|
433
|
-
else t.diagnostic(`
|
|
436
|
+
else t.diagnostic(`Regression artifacts retained: ${storage}`);
|
|
434
437
|
}
|
|
435
438
|
}
|
|
436
439
|
|
|
437
440
|
for (const child of [false, true]) {
|
|
441
|
+
test(`registration: scoped fresh accessories, unscoped cache migration and command lifecycle (${child ? 'child' : 'main'} bridge)`,
|
|
442
|
+
{ timeout: 120000 }, async t => bridgeFixture(t, child, async (bridge, panel) => {
|
|
443
|
+
const commands = [{ name: 'Output One', command: '02011' }, { name: 'Output Two', command: '02012' }];
|
|
444
|
+
const stableSerials = ['Partition 1', 'Partition 2', 'Partition 1 Zone 1', 'Partition 1 Zone 2',
|
|
445
|
+
'Partition 2 Zone 3', 'Partition 2 Zone 4', 'Partition 2 Zone 7', 'Panic'];
|
|
446
|
+
const expectedSerials = [...stableSerials, '02011', '02012'].sort();
|
|
447
|
+
const cacheSerial = accessory => accessory.services.flatMap(s => s.characteristics)
|
|
448
|
+
.find(c => isType(c.UUID, TYPES.serial)).value;
|
|
449
|
+
const uuids = cache => Object.fromEntries(cache.map(a => [cacheSerial(a), a.UUID]));
|
|
450
|
+
// Include IIDs so handlers are tested at the same HAP addresses after migration.
|
|
451
|
+
const addresses = accessories => Object.fromEntries(accessories.filter(a => a.aid !== 1).map(a =>
|
|
452
|
+
[bridge.serial(a), { aid: a.aid, services: a.services.map(s =>
|
|
453
|
+
({ iid: s.iid, type: s.type, characteristics: s.characteristics.map(c => ({ iid: c.iid, type: c.type })) })) }]));
|
|
454
|
+
function assertAssociations(cache) {
|
|
455
|
+
assert.ok(cache.length > 0);
|
|
456
|
+
for (const accessory of cache) {
|
|
457
|
+
assert.equal(accessory.plugin, PLUGIN_NAME, `Scoped plugin association for ${cacheSerial(accessory)}`);
|
|
458
|
+
assert.equal(accessory.platform, 'Envisalink');
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
async function expectCommand(body, action) {
|
|
462
|
+
const start = panel.commands.length;
|
|
463
|
+
await action();
|
|
464
|
+
await until(`DSC ${body} after plugin migration`, () => panel.commands.slice(start).some(c => c.body === body));
|
|
465
|
+
assert.equal(panel.commands.slice(start).filter(c => c.body === body).length, 1);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
await bridge.start(commands);
|
|
469
|
+
const fresh = await bridge.accessories();
|
|
470
|
+
assert.deepEqual(Object.keys(addresses(fresh)).sort(), expectedSerials);
|
|
471
|
+
assert.doesNotMatch(bridge.output, REGISTRATION_WARNING, 'Fresh registrations resolve the loaded plugin');
|
|
472
|
+
const originalAddresses = addresses(fresh);
|
|
473
|
+
await bridge.stop();
|
|
474
|
+
const legacy = await bridge.cache();
|
|
475
|
+
assertAssociations(legacy);
|
|
476
|
+
const originalUUIDs = uuids(legacy);
|
|
477
|
+
// Reproduce pre-#75 on-disk plugin associations for EVERY accessory type.
|
|
478
|
+
// Leave Homebridge persist (AIDs/IIDs), UUIDs, services and serials intact.
|
|
479
|
+
for (const accessory of legacy) {
|
|
480
|
+
accessory.plugin = LEGACY_PLUGIN_NAME;
|
|
481
|
+
if (['02011', '02012'].includes(cacheSerial(accessory))) accessory.context = {};
|
|
482
|
+
}
|
|
483
|
+
await bridge.writeCache(legacy);
|
|
484
|
+
const renamed = [{ name: 'Renamed Output', command: '02011' }, commands[1]];
|
|
485
|
+
await bridge.start(renamed);
|
|
486
|
+
assert.deepEqual(addresses(await bridge.accessories()), originalAddresses, 'Migration retains every AID and IID');
|
|
487
|
+
assert.equal(bridge.characteristic(await bridge.bySerial('02011'), TYPES.name, TYPES.switch).value, 'Renamed Output');
|
|
488
|
+
assert.equal((bridge.output.match(/Plugin association is now being transformed!/g) || []).length, legacy.length,
|
|
489
|
+
'Real Homebridge migrates every unscoped cache association');
|
|
490
|
+
assert.doesNotMatch(bridge.output, REGISTRATION_WARNING);
|
|
491
|
+
for (const body of ['02011', '02012']) {
|
|
492
|
+
const id = bridge.characteristic(await bridge.bySerial(body), TYPES.on, TYPES.switch);
|
|
493
|
+
await expectCommand(body, () => bridge.write(id, true));
|
|
494
|
+
await until('restored momentary reset', async () => !await bridge.read(id), 4000);
|
|
495
|
+
}
|
|
496
|
+
for (const [zone, partition, type] of [[1, 1, TYPES.contact], [2, 1, TYPES.motion], [3, 2, TYPES.smoke],
|
|
497
|
+
[4, 2, TYPES.leak], [7, 2, TYPES.contact]]) {
|
|
498
|
+
const id = bridge.characteristic(await bridge.bySerial(`Partition ${partition} Zone ${zone}`), type);
|
|
499
|
+
panel.setZone(zone, true);
|
|
500
|
+
await until(`migrated sensor ${zone} opens`, async () => Number(await bridge.read(id)) === 1);
|
|
501
|
+
panel.setZone(zone, false);
|
|
502
|
+
await until(`migrated sensor ${zone} restores`, async () => Number(await bridge.read(id)) === 0);
|
|
503
|
+
}
|
|
504
|
+
for (const number of [1, 2]) {
|
|
505
|
+
const partition = await bridge.bySerial(`Partition ${number}`);
|
|
506
|
+
await expectCommand(`030${number}`, () => bridge.write(bridge.characteristic(partition, TYPES.target), 1));
|
|
507
|
+
await until('migrated partition arms', async () => await bridge.read(bridge.characteristic(partition, TYPES.current)) === 1);
|
|
508
|
+
await expectCommand(number === 1 ? '04011234' : '04025678',
|
|
509
|
+
() => bridge.write(bridge.characteristic(partition, TYPES.target), 3));
|
|
510
|
+
await until('migrated partition disarms', async () => await bridge.read(bridge.characteristic(partition, TYPES.current)) === 3);
|
|
511
|
+
}
|
|
512
|
+
const panic = await bridge.bySerial('Panic');
|
|
513
|
+
for (const [name, body] of [['Test Fire Panic', '0601'], ['Test Ambulance Panic', '0602'], ['Test Police Panic', '0603']]) {
|
|
514
|
+
const service = panic.services.find(s => s.characteristics.some(c => isType(c.type, TYPES.name) && c.value === name));
|
|
515
|
+
const id = { aid: panic.aid, iid: service.characteristics.find(c => isType(c.type, TYPES.on)).iid };
|
|
516
|
+
await expectCommand(body, () => bridge.write(id, true));
|
|
517
|
+
}
|
|
518
|
+
await bridge.stop();
|
|
519
|
+
const migrated = await bridge.cache();
|
|
520
|
+
assertAssociations(migrated);
|
|
521
|
+
assert.deepEqual(uuids(migrated), originalUUIDs, 'Migration retains every UUID');
|
|
522
|
+
|
|
523
|
+
const added = { name: 'Added Output', command: '02013' };
|
|
524
|
+
await bridge.start([...renamed, added]);
|
|
525
|
+
const afterAdd = addresses(await bridge.accessories());
|
|
526
|
+
for (const serial of expectedSerials) assert.deepEqual(afterAdd[serial], originalAddresses[serial]);
|
|
527
|
+
assert.ok(afterAdd['02013'], 'New command appears beside the migrated accessories');
|
|
528
|
+
assert.doesNotMatch(bridge.output, /Plugin association is now being transformed!/,
|
|
529
|
+
'Persisted migration does not repeat on the next restart');
|
|
530
|
+
await expectCommand('02013', async () => bridge.write(bridge.characteristic(await bridge.bySerial('02013'), TYPES.on, TYPES.switch), true));
|
|
531
|
+
await bridge.stop();
|
|
532
|
+
assertAssociations(await bridge.cache());
|
|
533
|
+
|
|
534
|
+
await bridge.start([added]);
|
|
535
|
+
const afterRemove = addresses(await bridge.accessories());
|
|
536
|
+
assert.deepEqual(Object.keys(afterRemove).sort(), [...stableSerials, '02013'].sort());
|
|
537
|
+
for (const serial of stableSerials) assert.deepEqual(afterRemove[serial], originalAddresses[serial]);
|
|
538
|
+
assert.deepEqual(afterRemove['02013'], afterAdd['02013']);
|
|
539
|
+
await bridge.stop();
|
|
540
|
+
const removed = await bridge.cache();
|
|
541
|
+
assertAssociations(removed);
|
|
542
|
+
assert.ok(!removed.some(a => ['02011', '02012'].includes(cacheSerial(a))), 'Removed commands leave the disk cache');
|
|
543
|
+
await bridge.start([added]);
|
|
544
|
+
assert.deepEqual(addresses(await bridge.accessories()), afterRemove, 'Removal survives another real restart');
|
|
545
|
+
await expectCommand('02013', async () => bridge.write(bridge.characteristic(await bridge.bySerial('02013'), TYPES.on, TYPES.switch), true));
|
|
546
|
+
assert.doesNotMatch(bridge.allOutput, REGISTRATION_WARNING, 'Every process startup and registration resolves its plugin');
|
|
547
|
+
t.diagnostic('PASS: scoped fresh cache, real legacy association migration, stable UUID/AID/IID, restored sensors/controls and command add/remove/restart');
|
|
548
|
+
}));
|
|
549
|
+
|
|
438
550
|
test(`names: missing, empty and whitespace partition/platform names, restart identity (${child ? 'child' : 'main'} bridge)`,
|
|
439
|
-
{ timeout: 90000 }, async t =>
|
|
551
|
+
{ timeout: 90000 }, async t => bridgeFixture(t, child, async (bridge, panel) => {
|
|
440
552
|
// _bridge.name is selected by Homebridge BEFORE constructing the plugin.
|
|
441
553
|
// Explicitly set it when testing a child with an omitted platform name.
|
|
442
554
|
if (child) bridge.options.bridgeName = 'Envisalink';
|
|
@@ -473,7 +585,7 @@ for (const child of [false, true]) {
|
|
|
473
585
|
}));
|
|
474
586
|
|
|
475
587
|
test(`names: malformed fresh names and legacy cache upgrade across every accessory (${child ? 'child' : 'main'} bridge)`,
|
|
476
|
-
{ timeout: 120000 }, async t =>
|
|
588
|
+
{ timeout: 120000 }, async t => bridgeFixture(t, child, async (bridge, panel) => {
|
|
477
589
|
bridge.options.platform = {
|
|
478
590
|
name: 'Envisalink',
|
|
479
591
|
partitions: [{ name: ' Main 🚨 Alarm ', enableChimeSwitch: true }, { name: " Étage (2) & O’Brien ", pin: '5678' }],
|
|
@@ -592,7 +704,7 @@ for (const child of [false, true]) {
|
|
|
592
704
|
}
|
|
593
705
|
|
|
594
706
|
test('names: supported child bridge display-name upgrade keeps scoped plugin identifier and bridge identity',
|
|
595
|
-
{ timeout: 45000 }, async t =>
|
|
707
|
+
{ timeout: 45000 }, async t => bridgeFixture(t, true, async bridge => {
|
|
596
708
|
bridge.options.platform = { name: undefined };
|
|
597
709
|
await bridge.start([]);
|
|
598
710
|
const initial = await bridge.accessories();
|