matterbridge 1.6.6-dev.13 → 1.6.6-dev.14

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.
@@ -2335,7 +2335,7 @@ export class Matterbridge extends EventEmitter {
2335
2335
  });
2336
2336
  this.expressApp.get('/api/devices', (req, res) => {
2337
2337
  this.log.debug('The frontend sent /api/devices');
2338
- const data = [];
2338
+ const devices = [];
2339
2339
  this.devices.forEach(async (device) => {
2340
2340
  const pluginName = device.plugin ?? 'Unknown';
2341
2341
  if (this.edge)
@@ -2353,7 +2353,7 @@ export class Matterbridge extends EventEmitter {
2353
2353
  if (!uniqueId)
2354
2354
  uniqueId = device.getClusterServer(BridgedDeviceBasicInformationCluster)?.attributes.uniqueId?.getLocal() ?? 'Unknown';
2355
2355
  const cluster = this.getClusterTextFromDevice(device);
2356
- data.push({
2356
+ devices.push({
2357
2357
  pluginName,
2358
2358
  type: device.name + ' (0x' + device.deviceType.toString(16).padStart(4, '0') + ')',
2359
2359
  endpoint: device.number,
@@ -2365,7 +2365,7 @@ export class Matterbridge extends EventEmitter {
2365
2365
  cluster: cluster,
2366
2366
  });
2367
2367
  });
2368
- res.json(data);
2368
+ res.json(devices);
2369
2369
  });
2370
2370
  this.expressApp.get('/api/devices_clusters/:selectedPluginName/:selectedDeviceEndpoint', (req, res) => {
2371
2371
  const selectedPluginName = req.params.selectedPluginName;
@@ -71,17 +71,33 @@ export class MatterbridgePlatform {
71
71
  return true;
72
72
  }
73
73
  validateDeviceWhiteBlackList(device, log = true) {
74
- if (isValidArray(this.config.whiteList, 1) && !this.config.whiteList.includes(device)) {
74
+ if (!Array.isArray(device))
75
+ device = [device];
76
+ let blackListBlocked = 0;
77
+ if (isValidArray(this.config.blackList, 1)) {
78
+ for (const d of device)
79
+ if (this.config.blackList.includes(d))
80
+ blackListBlocked++;
81
+ }
82
+ if (blackListBlocked > 0) {
75
83
  if (log)
76
- this.log.info(`Skipping device ${CYAN}${device}${nf} because not in whitelist`);
84
+ this.log.info(`Skipping device ${CYAN}${device.join(', ')}${nf} because in blacklist`);
77
85
  return false;
78
86
  }
79
- if (isValidArray(this.config.blackList, 1) && this.config.blackList.includes(device)) {
87
+ let whiteListPassed = 0;
88
+ if (isValidArray(this.config.whiteList, 1)) {
89
+ for (const d of device)
90
+ if (this.config.whiteList.includes(d))
91
+ whiteListPassed++;
92
+ }
93
+ else
94
+ whiteListPassed++;
95
+ if (whiteListPassed > 0) {
80
96
  if (log)
81
- this.log.info(`Skipping device ${CYAN}${device}${nf} because in blacklist`);
82
- return false;
97
+ this.log.info(`Skipping device ${CYAN}${device.join(', ')}${nf} because not in whitelist`);
98
+ return true;
83
99
  }
84
- return true;
100
+ return false;
85
101
  }
86
102
  validateEntityBlackList(device, entity, log = true) {
87
103
  if (isValidArray(this.config.entityBlackList, 1) && this.config.entityBlackList.find((e) => e === entity)) {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "matterbridge",
3
- "version": "1.6.6-dev.13",
3
+ "version": "1.6.6-dev.14",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "matterbridge",
9
- "version": "1.6.6-dev.13",
9
+ "version": "1.6.6-dev.14",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@matter/main": "^0.11.9-alpha.0-20241207-b604cfa44",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "matterbridge",
3
- "version": "1.6.6-dev.13",
3
+ "version": "1.6.6-dev.14",
4
4
  "description": "Matterbridge plugin manager for Matter",
5
5
  "author": "https://github.com/Luligu",
6
6
  "license": "Apache-2.0",