matterbridge 1.6.8-dev.5 → 1.6.8-dev.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
@@ -13,11 +13,11 @@ It is also available the official Matterbridge Home Assistant plugin https://git
13
13
 
14
14
  Tamer (https://github.com/tammeryousef1006) has created the Matterbridge Discord group: https://discord.gg/QX58CDe6hd.
15
15
 
16
- ## [1.6.8-dev.5] - 2024-12-18
16
+ ## [1.6.8-dev.7] - 2024-12-19
17
17
 
18
18
  ### Added
19
19
 
20
- - [storage]: Added conversion from old matter storage to the new api format with fabrics, resumptionRecords, network, commissioning, operationalCredentials, acl and parts number. The conversion is automatic the first time you run this release.
20
+ - [storage]: Added conversion from old matter storage to the new api format with fabrics, resumptionRecords, network, commissioning, operationalCredentials, acl and parts number.
21
21
  - [package]: Update README.md and README-SERVICE.md to include instructions for using SSL on port 443.
22
22
 
23
23
  ### Changed
@@ -990,8 +990,8 @@ export class Matterbridge extends EventEmitter {
990
990
  });
991
991
  this.webSocketServer = undefined;
992
992
  }
993
- if (this.edge === false && this.matterbridgeContext && ['updating...', 'restarting...', 'shutting down...'].includes(message)) {
994
- this.convertStorage(this.matterbridgeContext, 'Mattebridge');
993
+ if (hasParameter('convert') && this.edge === false && this.matterbridgeContext && ['updating...', 'restarting...', 'shutting down...'].includes(message)) {
994
+ await this.convertStorage(this.matterbridgeContext, 'Mattebridge');
995
995
  }
996
996
  await this.stopMatterServer();
997
997
  await this.stopMatterStorage();
@@ -1593,14 +1593,24 @@ export class Matterbridge extends EventEmitter {
1593
1593
  });
1594
1594
  nocArray.push({ noc: fabric.operationalCert, icac: null, fabricIndex: fabric.fabricIndex });
1595
1595
  trcArray.push('{\"__object__\":\"Uint8Array\",\"__value__\":\"' + Buffer.from(fabric.rootCert).toString('hex') + '\"}');
1596
- aclArray.push({ fabricIndex: fabric.fabricIndex, privilege: 5, authMode: 2, subjects: ['{\"__object__\":\"BigInt\",\"__value__\":\"' + fabric.rootNodeId.toString().replace('n', '') + '\"}'], targets: null });
1596
+ this.log.info(`- updating ACL for fabricIndex ${fabric.fabricIndex}:`, fabric.scopedClusterData);
1597
+ const acl = fabric.scopedClusterData.get(0x1f)?.get('acl');
1598
+ if (acl && acl.value.length > 0) {
1599
+ aclArray.push(acl.value[0]);
1600
+ this.log.info(`- ACL updated to ${debugStringify(acl.value)}${nf} for fabricIndex ${CYAN}${fabric.fabricIndex}${nf}`);
1601
+ }
1602
+ else {
1603
+ const defaultAcl = { fabricIndex: fabric.fabricIndex, privilege: 5, authMode: 2, subjects: [fabric.rootNodeId], targets: null };
1604
+ aclArray.push(defaultAcl);
1605
+ this.log.info(`- ACL updated to default ${debugStringify(defaultAcl)}${nf} for fabricIndex ${CYAN}${fabric.fabricIndex}${nf}`);
1606
+ }
1597
1607
  }
1598
1608
  await nodeStorage.createContext('fabrics').set('fabrics', fabrics);
1599
1609
  await nodeStorage.createContext('fabrics').set('nextFabricIndex', nextFabricIndex);
1600
1610
  await nodeStorage.createContext('sessions').set('resumptionRecords', await sessionManagerContext.get('resumptionRecords', []));
1601
1611
  await nodeStorage.createContext('events').set('lastEventNumber', await eventHandlerContext.get('lastEventNumber', 1));
1602
1612
  await nodeStorage.createContext('root').set('__number__', 0);
1603
- await nodeStorage.createContext('root').set('__nextNumber__', 1);
1613
+ await nodeStorage.createContext('root').createContext('parts').createContext('Matterbridge').set('__number__', 1);
1604
1614
  await nodeStorage.createContext('root').createContext('commissioning').set('enabled', true);
1605
1615
  await nodeStorage.createContext('root').createContext('commissioning').set('commissioned', true);
1606
1616
  await nodeStorage.createContext('root').createContext('commissioning').set('fabrics', fabricInfo);
@@ -1622,8 +1632,10 @@ export class Matterbridge extends EventEmitter {
1622
1632
  await nodeStorage.createContext('root').createContext('productDescription').set('productId', 0x8000);
1623
1633
  await nodeStorage.createContext('root').createContext('productDescription').set('vendorId', 0xfff1);
1624
1634
  for (const key of await endpointStructureContext.keys()) {
1625
- if (key === 'nextEndpointId')
1635
+ if (key === 'nextEndpointId') {
1636
+ await nodeStorage.createContext('root').set('__nextNumber__', await endpointStructureContext.get(key));
1626
1637
  continue;
1638
+ }
1627
1639
  const parts = key.split('-');
1628
1640
  const number = await endpointStructureContext.get(key);
1629
1641
  if (parts.length === 2) {
@@ -1642,8 +1654,21 @@ export class Matterbridge extends EventEmitter {
1642
1654
  }
1643
1655
  }
1644
1656
  }
1645
- await nodeStorage.createContext('root').createContext('parts').createContext('Matterbridge').set('__number__', 1);
1646
1657
  await nodeStorage.createContext('persist').set('converted', true);
1658
+ await nodeStorage.createContext('persist').set('deviceName', await context.get('deviceName'));
1659
+ await nodeStorage.createContext('persist').set('deviceType', await context.get('deviceType'));
1660
+ await nodeStorage.createContext('persist').set('vendorId', await context.get('vendorId'));
1661
+ await nodeStorage.createContext('persist').set('vendorName', await context.get('vendorName'));
1662
+ await nodeStorage.createContext('persist').set('productId', await context.get('productId'));
1663
+ await nodeStorage.createContext('persist').set('productName', await context.get('productName'));
1664
+ await nodeStorage.createContext('persist').set('nodeLabel', await context.get('nodeLabel'));
1665
+ await nodeStorage.createContext('persist').set('productLabel', await context.get('productLabel'));
1666
+ await nodeStorage.createContext('persist').set('serialNumber', 'SN' + (await context.get('serialNumber')));
1667
+ await nodeStorage.createContext('persist').set('uniqueId', await context.get('uniqueId'));
1668
+ await nodeStorage.createContext('persist').set('softwareVersion', await context.get('softwareVersion'));
1669
+ await nodeStorage.createContext('persist').set('softwareVersionString', await context.get('softwareVersionString'));
1670
+ await nodeStorage.createContext('persist').set('hardwareVersion', await context.get('hardwareVersion'));
1671
+ await nodeStorage.createContext('persist').set('hardwareVersionString', await context.get('hardwareVersionString'));
1647
1672
  await context.set('converted', true);
1648
1673
  this.log.notice(`Matter storage converted to Matterbridge edge for ${plg}${pluginName}${nt}`);
1649
1674
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "matterbridge",
3
- "version": "1.6.8-dev.5",
3
+ "version": "1.6.8-dev.7",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "matterbridge",
9
- "version": "1.6.8-dev.5",
9
+ "version": "1.6.8-dev.7",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@matter/main": "0.11.9",
@@ -1186,9 +1186,9 @@
1186
1186
  "license": "MIT"
1187
1187
  },
1188
1188
  "node_modules/math-intrinsics": {
1189
- "version": "1.0.0",
1190
- "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.0.0.tgz",
1191
- "integrity": "sha512-4MqMiKP90ybymYvsut0CH2g4XWbfLtmlCkXmtmdcDCxNB+mQcu1w/1+L/VD7vi/PSv7X2JYV7SCcR+jiPXnQtA==",
1189
+ "version": "1.1.0",
1190
+ "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
1191
+ "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
1192
1192
  "license": "MIT",
1193
1193
  "engines": {
1194
1194
  "node": ">= 0.4"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "matterbridge",
3
- "version": "1.6.8-dev.5",
3
+ "version": "1.6.8-dev.7",
4
4
  "description": "Matterbridge plugin manager for Matter",
5
5
  "author": "https://github.com/Luligu",
6
6
  "license": "Apache-2.0",