matterbridge 3.3.0-dev-20251002-bbaa166 → 3.3.0-dev-20251003-626ea2f

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
@@ -25,12 +25,13 @@ Advantages:
25
25
 
26
26
  ## [3.3.0] - Not released
27
27
 
28
- ### Development Breaking Changes
28
+ ### Development Breaking Changes Notice
29
29
 
30
+ - [matterbridge]: Now, internal use only properties are private readonly and internal use only methods are private.
30
31
  - [platform]: Now, internal use only properties are private readonly and internal use only methods are private.
31
32
  - [platform]: The signature of the matterbridge param in the platform constructor has changed from Matterbridge to `PlatformMatterbridge` which has only the appropriate readonly properties from matterbridge.
32
33
 
33
- This change, necessary to achieve plugin isolation, will require all plugins to be adapted in two steps.
34
+ This change, necessary to achieve plugin isolation, will require all plugins to be updated in two steps.
34
35
 
35
36
  1. `After` matterbridge `3.3.0` is published as latest:
36
37
 
@@ -89,7 +90,6 @@ In this phase (matterbridge `3.4.x`) all plugins will not build and will not run
89
90
  - [matterbridge]: Added RvcRunMode to frontend state update.
90
91
  - [matterbridge]: Added RvcCleanMode to frontend state update.
91
92
  - [matterbridge]: Added RvcOperationalState to frontend state update.
92
- - [matterbridge]: Added RvcOperationalState to frontend state update.
93
93
  - [matterbridge]: Added ServiceArea to frontend state update.
94
94
  - [matterbridge]: Added ModeSelect to frontend state update.
95
95
 
package/dist/frontend.js CHANGED
@@ -359,12 +359,12 @@ export class Frontend extends EventEmitter {
359
359
  serverNodes.push(this.matterbridge.serverNode);
360
360
  }
361
361
  else if (this.matterbridge.bridgeMode === 'childbridge') {
362
- for (const plugin of this.matterbridge.getPlugins()) {
362
+ for (const plugin of this.matterbridge.plugins.array()) {
363
363
  if (plugin.serverNode)
364
364
  serverNodes.push(plugin.serverNode);
365
365
  }
366
366
  }
367
- for (const device of this.matterbridge.getDevices()) {
367
+ for (const device of this.matterbridge.devices.array()) {
368
368
  if (device.serverNode)
369
369
  serverNodes.push(device.serverNode);
370
370
  }
@@ -1291,7 +1291,8 @@ export class Frontend extends EventEmitter {
1291
1291
  if (data.params.id === 'Matterbridge')
1292
1292
  serverNode = this.matterbridge.serverNode;
1293
1293
  else
1294
- serverNode = this.matterbridge.getPlugins().find((p) => p.serverNode && p.serverNode.id === localData.params.id)?.serverNode || this.matterbridge.getDevices().find((d) => d.serverNode && d.serverNode.id === localData.params.id)?.serverNode;
1294
+ serverNode =
1295
+ this.matterbridge.plugins.array().find((p) => p.serverNode && p.serverNode.id === localData.params.id)?.serverNode || this.matterbridge.devices.array().find((d) => d.serverNode && d.serverNode.id === localData.params.id)?.serverNode;
1295
1296
  if (!serverNode) {
1296
1297
  sendResponse({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, error: `Unknown server node id ${localData.params.id} in /api/matter` });
1297
1298
  return;
@@ -136,12 +136,6 @@ export class Matterbridge extends EventEmitter {
136
136
  super();
137
137
  this.log.logNameColor = '\x1b[38;5;115m';
138
138
  }
139
- getDevices() {
140
- return this.devices.array();
141
- }
142
- getPlugins() {
143
- return this.plugins.array();
144
- }
145
139
  async setLogLevel(logLevel) {
146
140
  if (this.log)
147
141
  this.log.logLevel = logLevel;
@@ -553,8 +547,8 @@ export class Matterbridge extends EventEmitter {
553
547
  --childbridge: start Matterbridge in childbridge mode
554
548
  --port [port]: start the commissioning server on the given port (default 5540)
555
549
  --mdnsinterface [name]: set the interface to use for the matter server mdnsInterface (default all interfaces)
556
- --ipv4address [address]: set the ipv4 interface address to use for the matter listener (default all interfaces)
557
- --ipv6address [address]: set the ipv6 interface address to use for the matter listener (default all interfaces)
550
+ --ipv4address [address]: set the ipv4 interface address to use for the matter listener (default all addresses)
551
+ --ipv6address [address]: set the ipv6 interface address to use for the matter listener (default all addresses)
558
552
  --frontend [port]: start the frontend on the given port (default 8283)
559
553
  --logger: set the matterbridge logger level: debug | info | notice | warn | error | fatal (default info)
560
554
  --filelogger enable the matterbridge file logger (matterbridge.log)
@@ -1023,8 +1017,10 @@ export class Matterbridge extends EventEmitter {
1023
1017
  }
1024
1018
  }
1025
1019
  this.log.notice(`Stopping matter server nodes in ${this.bridgeMode} mode...`);
1026
- this.log.debug('Waiting for the MessageExchange to finish...');
1027
- await wait(timeout, 'Waiting for the MessageExchange to finish...', true);
1020
+ if (timeout > 0) {
1021
+ this.log.debug(`Waiting ${timeout}ms for the MessageExchange to finish...`);
1022
+ await wait(timeout, `Waiting ${timeout}ms for the MessageExchange to finish...`, true);
1023
+ }
1028
1024
  if (this.bridgeMode === 'bridge') {
1029
1025
  if (this.serverNode) {
1030
1026
  await this.stopServerNode(this.serverNode);
@@ -1146,36 +1142,10 @@ export class Matterbridge extends EventEmitter {
1146
1142
  this.emit('cleanup_completed');
1147
1143
  }
1148
1144
  else {
1149
- this.log.debug('Cleanup already started...');
1150
- }
1151
- }
1152
- async createDeviceServerNode(plugin, device) {
1153
- if (device.mode === 'server' && !device.serverNode && device.deviceType && device.deviceName && device.vendorId && device.vendorName && device.productId && device.productName) {
1154
- this.log.debug(`Creating device ${plg}${plugin.name}${db}:${dev}${device.deviceName}${db} server node...`);
1155
- const context = await this.createServerNodeContext(device.deviceName.replace(/[ .]/g, ''), device.deviceName, DeviceTypeId(device.deviceType), device.vendorId, device.vendorName, device.productId, device.productName);
1156
- device.serverNode = await this.createServerNode(context, this.port ? this.port++ : undefined, this.passcode ? this.passcode++ : undefined, this.discriminator ? this.discriminator++ : undefined);
1157
- this.log.debug(`Adding ${plg}${plugin.name}${db}:${dev}${device.deviceName}${db} to server node...`);
1158
- await device.serverNode.add(device);
1159
- this.log.debug(`Added ${plg}${plugin.name}${db}:${dev}${device.deviceName}${db} to server node`);
1160
- }
1161
- }
1162
- async createAccessoryPlugin(plugin, device) {
1163
- if (!plugin.locked && device.deviceType && device.deviceName && device.vendorId && device.productId && device.vendorName && device.productName) {
1164
- plugin.locked = true;
1165
- plugin.device = device;
1166
- plugin.storageContext = await this.createServerNodeContext(plugin.name, device.deviceName, DeviceTypeId(device.deviceType), device.vendorId, device.vendorName, device.productId, device.productName);
1167
- plugin.serverNode = await this.createServerNode(plugin.storageContext, this.port ? this.port++ : undefined, this.passcode ? this.passcode++ : undefined, this.discriminator ? this.discriminator++ : undefined);
1168
- this.log.debug(`Adding ${plg}${plugin.name}${db}:${dev}${device.deviceName}${db} to ${plg}${plugin.name}${db} server node`);
1169
- await plugin.serverNode.add(device);
1170
- }
1171
- }
1172
- async createDynamicPlugin(plugin) {
1173
- if (!plugin.locked) {
1174
- plugin.locked = true;
1175
- plugin.storageContext = await this.createServerNodeContext(plugin.name, 'Matterbridge', this.aggregatorDeviceType, this.aggregatorVendorId, this.aggregatorVendorName, this.aggregatorProductId, plugin.description);
1176
- plugin.serverNode = await this.createServerNode(plugin.storageContext, this.port ? this.port++ : undefined, this.passcode ? this.passcode++ : undefined, this.discriminator ? this.discriminator++ : undefined);
1177
- plugin.aggregatorNode = await this.createAggregatorNode(plugin.storageContext);
1178
- await plugin.serverNode.add(plugin.aggregatorNode);
1145
+ if (!this.initialized)
1146
+ this.log.debug('Cleanup with instance not initialized...');
1147
+ if (this.hasCleanupStarted)
1148
+ this.log.debug('Cleanup already started...');
1179
1149
  }
1180
1150
  }
1181
1151
  async startBridge() {
@@ -1572,6 +1542,39 @@ export class Matterbridge extends EventEmitter {
1572
1542
  this.log.info(`Created ${await storageContext.get('storeId')} aggregator`);
1573
1543
  return aggregatorNode;
1574
1544
  }
1545
+ async createAccessoryPlugin(plugin, device) {
1546
+ if (!plugin.locked && device.deviceType && device.deviceName && device.vendorId && device.productId && device.vendorName && device.productName) {
1547
+ plugin.locked = true;
1548
+ plugin.device = device;
1549
+ this.log.debug(`Creating accessory plugin ${plg}${plugin.name}${db} server node...`);
1550
+ plugin.storageContext = await this.createServerNodeContext(plugin.name, device.deviceName, DeviceTypeId(device.deviceType), device.vendorId, device.vendorName, device.productId, device.productName);
1551
+ plugin.serverNode = await this.createServerNode(plugin.storageContext, this.port ? this.port++ : undefined, this.passcode ? this.passcode++ : undefined, this.discriminator ? this.discriminator++ : undefined);
1552
+ this.log.debug(`Adding ${plg}${plugin.name}${db}:${dev}${device.deviceName}${db} to ${plg}${plugin.name}${db} server node...`);
1553
+ await plugin.serverNode.add(device);
1554
+ }
1555
+ }
1556
+ async createDynamicPlugin(plugin) {
1557
+ if (!plugin.locked) {
1558
+ plugin.locked = true;
1559
+ this.log.debug(`Creating dynamic plugin ${plg}${plugin.name}${db} server node...`);
1560
+ plugin.storageContext = await this.createServerNodeContext(plugin.name, 'Matterbridge', this.aggregatorDeviceType, this.aggregatorVendorId, this.aggregatorVendorName, this.aggregatorProductId, plugin.description);
1561
+ plugin.serverNode = await this.createServerNode(plugin.storageContext, this.port ? this.port++ : undefined, this.passcode ? this.passcode++ : undefined, this.discriminator ? this.discriminator++ : undefined);
1562
+ this.log.debug(`Creating dynamic plugin ${plg}${plugin.name}${db} aggregator node...`);
1563
+ plugin.aggregatorNode = await this.createAggregatorNode(plugin.storageContext);
1564
+ this.log.debug(`Adding dynamic plugin ${plg}${plugin.name}${db} aggregator node...`);
1565
+ await plugin.serverNode.add(plugin.aggregatorNode);
1566
+ }
1567
+ }
1568
+ async createDeviceServerNode(plugin, device) {
1569
+ if (device.mode === 'server' && !device.serverNode && device.deviceType && device.deviceName && device.vendorId && device.vendorName && device.productId && device.productName) {
1570
+ this.log.debug(`Creating device ${plg}${plugin.name}${db}:${dev}${device.deviceName}${db} server node...`);
1571
+ const context = await this.createServerNodeContext(device.deviceName.replace(/[ .]/g, ''), device.deviceName, DeviceTypeId(device.deviceType), device.vendorId, device.vendorName, device.productId, device.productName);
1572
+ device.serverNode = await this.createServerNode(context, this.port ? this.port++ : undefined, this.passcode ? this.passcode++ : undefined, this.discriminator ? this.discriminator++ : undefined);
1573
+ this.log.debug(`Adding ${plg}${plugin.name}${db}:${dev}${device.deviceName}${db} to server node...`);
1574
+ await device.serverNode.add(device);
1575
+ this.log.debug(`Added ${plg}${plugin.name}${db}:${dev}${device.deviceName}${db} to server node`);
1576
+ }
1577
+ }
1575
1578
  async addBridgedEndpoint(pluginName, device) {
1576
1579
  const plugin = this.plugins.get(pluginName);
1577
1580
  if (!plugin) {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "matterbridge",
3
- "version": "3.3.0-dev-20251002-bbaa166",
3
+ "version": "3.3.0-dev-20251003-626ea2f",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "matterbridge",
9
- "version": "3.3.0-dev-20251002-bbaa166",
9
+ "version": "3.3.0-dev-20251003-626ea2f",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@matter/main": "0.15.4",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "matterbridge",
3
- "version": "3.3.0-dev-20251002-bbaa166",
3
+ "version": "3.3.0-dev-20251003-626ea2f",
4
4
  "description": "Matterbridge plugin manager for Matter",
5
5
  "author": "https://github.com/Luligu",
6
6
  "license": "Apache-2.0",