matterbridge 1.5.9 → 1.5.10

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
@@ -7,6 +7,7 @@ If you like this project and find it useful, please consider giving it a star on
7
7
  ### Home Assistant Community Add-ons
8
8
 
9
9
  The Home Assistant Community Add-ons and plugins are not verified to work with Matterbridge. I strongly advise against using them. If you do use them and encounter an issue (which is likely because some do not meet the Matterbridge guidelines), please do not open an issue in the Matterbridge repository.
10
+
10
11
  If you want to run Matterbridge in Home Assistant please use the official add-on https://github.com/Luligu/matterbridge-home-assistant-addon.
11
12
 
12
13
  ### New Apple firmware v. 18.0
@@ -19,6 +20,18 @@ Tamer (https://github.com/tammeryousef1006) has created the Matterbridge Discord
19
20
 
20
21
  Feel free to join!
21
22
 
23
+ ## [1.5.10] - 2024-10-01
24
+
25
+ ### Changed
26
+
27
+ - [matterbridge]: Added '--omit=dev' to all install commands to save space and time on low powered devices.
28
+ - [matterbridge]: Integrated the DeviceManager class and removed the old array.
29
+ - [package]: Update dependencies.
30
+
31
+ <a href="https://www.buymeacoffee.com/luligugithub">
32
+ <img src="./yellow-button.png" alt="Buy me a coffee" width="120">
33
+ </a>
34
+
22
35
  ## [1.5.9] - 2024-09-23
23
36
 
24
37
  ### Fixed
package/README-DEV.md CHANGED
@@ -43,23 +43,27 @@ Matterbridge exports from:
43
43
 
44
44
  - NodeStorage classes.
45
45
 
46
- # ****\*\*****
46
+ # \***\*\*\*\*\***
47
47
 
48
- A plugin must never install or import from `matter-node.js` or `matter.js` directly, as this leads to a second instance of `matter.js`, causing instability and unpredictable errors such as "The only instance is Endpoint". Additionally, when Matterbridge updates the `matter.js` version, it should be consistent across all plugins.
48
+ A plugin must never install or import from `matter-node.js` or `matter.js` directly (neither as a dependency, devDependency, nor peerDependency), as this leads to a second instance of `matter.js`, causing instability and unpredictable errors such as "The only instance is Endpoint".
49
49
 
50
- # ****\*\*****
50
+ Additionally, when Matterbridge updates the `matter.js` version, it should be consistent across all plugins.
51
51
 
52
- A plugin must never install Matterbridge (neither as dependencies nor as devDependencies). Matterbridge must be linked to the plugin:
52
+ # \***\*\*\*\*\***
53
+
54
+ A plugin must never install Matterbridge (neither as a dependency, devDependency, nor peerDependency).
55
+
56
+ Matterbridge must be linked to the plugin in development only.
53
57
 
54
58
  ```json
55
59
  "scripts": {
56
60
  '''
57
- "install": "node link-matterbridge-script.js",
61
+ "dev:link": "npm link matterbridge",
58
62
  '''
59
63
  }
60
64
  ```
61
65
 
62
- # ****\*\*****
66
+ # \***\*\*\*\*\***
63
67
 
64
68
  In the next releases I will remove the duplicated exports so please update your plugins.
65
69
 
package/README-PODMAN.md CHANGED
@@ -41,6 +41,7 @@ sudo chown -R $USER:$USER ./Matterbridge ./.matterbridge
41
41
  ```
42
42
 
43
43
  You may need to adapt the script to your setup:
44
+
44
45
  - ./Matterbridge is the position outside of the container of your matterbridge plugin directory (inside your home directory).
45
46
  - ./.matterbridge is the position outside of the container of your matterbridge storage directory (inside your home directory).
46
47
 
@@ -56,6 +57,7 @@ podman run --name matterbridge \
56
57
  ```
57
58
 
58
59
  You may need to adapt the script to your setup:
60
+
59
61
  - ~/Matterbridge is the position outside of the container of your matterbridge plugin directory.
60
62
  - ~/.matterbridge is the position outside of the container of your matterbridge storage directory.
61
63
 
package/README-SERVICE.md CHANGED
@@ -105,48 +105,86 @@ sudo journalctl -u matterbridge.service -f --output cat
105
105
 
106
106
  ### Delete the logs older then 3 days (all of them not only the ones of Matterbridge!)
107
107
 
108
+ Check the space used
109
+
110
+ ```
111
+ sudo journalctl --disk-usage
112
+ ```
113
+
114
+ remove all log older then 3 days
115
+
108
116
  ```
117
+ sudo journalctl --rotate
109
118
  sudo journalctl --vacuum-time=3d
110
119
  ```
111
120
 
112
- If you want to make the setting permanent edit
121
+ ## Prevent the journal logs to grow
122
+
123
+ If you want to make the setting permanent to prevent the journal logs to grow too much, run
124
+
113
125
  ```
114
126
  sudo nano /etc/systemd/journald.conf
115
127
  ```
128
+
116
129
  add
130
+
117
131
  ```
118
- SystemMaxUse=3d
132
+ Compress=yes # Compress logs
133
+ MaxRetentionSec=3days # Keep logs for a maximum of 3 days.
134
+ MaxFileSec=1day # Rotate logs daily within the 3-day retention period.
135
+ ForwardToSyslog=no # Disable forwarding to syslog to prevent duplicate logging.
136
+ SystemMaxUse=100M # Limit persistent logs in /var/log/journal to 100 MB.
137
+ RuntimeMaxUse=100M # Limit runtime logs in /run/log/journal to 100 MB.
119
138
  ```
139
+
120
140
  save it and run
141
+
121
142
  ```
122
143
  sudo systemctl restart systemd-journald
123
144
  ```
124
145
 
125
- ### Verify that with your distro you can run sudo npm install -g matterbridge without the password
146
+ ## Verify that with your distro you can run sudo npm install -g matterbridge without the password
126
147
 
127
148
  Run the following command to verify if you can install Matterbridge globally without being prompted for a password:
128
149
 
129
150
  ```
130
151
  sudo npm install -g matterbridge
131
152
  ```
153
+
132
154
  If you are not prompted for a password, no further action is required.
133
155
 
134
156
  If that is not the case, open the sudoers file for editing using visudo
157
+
135
158
  ```
136
159
  sudo visudo
137
160
  ```
138
161
 
162
+ verify the presence of of a line
163
+
164
+ ```
165
+ @includedir /etc/sudoers.d
166
+ ```
167
+
168
+ exit and create a configuration file for sudoers
169
+
170
+ ```
171
+ sudo nano /etc/sudoers.d/matterbridge
172
+ ```
173
+
139
174
  add this line replacing USER with your user name (e.g. radxa ALL=(ALL) NOPASSWD: ALL)
140
175
 
141
176
  ```
142
177
  <USER> ALL=(ALL) NOPASSWD: ALL
143
178
  ```
144
179
 
145
- or if you prefers to only give access to npm without password try (e.g. radxa ALL=(ALL) NOPASSWD: /usr/bin/npm)
180
+ or if you prefers to only give access to npm without password try with (e.g. radxa ALL=(ALL) NOPASSWD: /usr/bin/npm)
146
181
 
147
182
  ```
148
183
  <USER> ALL=(ALL) NOPASSWD: /usr/bin/npm
149
184
  ```
150
185
 
151
- save the file and restart the system.
186
+ save the file and reload the settings with:
152
187
 
188
+ ```
189
+ sudo visudo -c
190
+ ```
package/README.md CHANGED
@@ -320,6 +320,52 @@ matterbridge -factoryreset
320
320
 
321
321
  This will reset the internal storages. All commissioning informations will be lost. All plugins will be unregistered.
322
322
 
323
+ # Frequently asked questions
324
+
325
+ ## How to enable HTTPS for the frontend
326
+
327
+ ### Provide your own certificates
328
+
329
+ Place your own certificates in the `.matterbridge/cert` directory:
330
+
331
+ - `cert.pem`
332
+ - `key.pem`
333
+ - `ca.pem` (optional)
334
+
335
+ ![image](https://github.com/user-attachments/assets/846785ca-6f5c-458b-b786-a6417a4da319)
336
+
337
+ ### Change the command line
338
+
339
+ Add the **-ssl** parameter to the command line. If desired, you can also change the frontend port with **-frontend 443**.
340
+
341
+ ```sh
342
+ matterbridge -ssl -frontend 443
343
+ ```
344
+
345
+ ### Restart
346
+
347
+ If the certificate are correctly configured, you will be able to connect with https to the frontend.
348
+
349
+ ![image](https://github.com/user-attachments/assets/9c38776d-064f-4d91-9359-a2cd3319b1ff)
350
+
351
+ ## How to send the debug log files
352
+
353
+ ### Enable debug and log on file
354
+
355
+ In the frontend, go to settings and enable debug mode as shown below:
356
+
357
+ ![Debug Matterbridge Settings](https://github.com/user-attachments/assets/83181dc2-969a-4b71-aff4-f1498fa1d665)
358
+
359
+ ![Debug Matter Settings](https://github.com/user-attachments/assets/617961a9-7cb0-46cf-9878-981f61738f8c)
360
+
361
+ ### Restart
362
+
363
+ Wait a few minutes to allow the logs to to accumulate.
364
+
365
+ Then, from the dots menu in the frontend, download the `matterbridge.log` and `matter.log` files.
366
+
367
+ ![image](https://github.com/user-attachments/assets/04ba65f6-594a-4ff8-9732-3df049f5a33e)
368
+
323
369
  # Known general issues
324
370
 
325
371
  ## Session XYZ does not exist
@@ -51,7 +51,6 @@ export declare class Matterbridge extends EventEmitter {
51
51
  private matterLoggerFile;
52
52
  private plugins;
53
53
  private devices;
54
- private registeredDevices;
55
54
  private nodeStorage;
56
55
  private nodeContext;
57
56
  private matterStorageName;
@@ -1 +1 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ACG,kBAAkB,CAAC,IAAI,SAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IA0sBpD;;;;OAIG;IACH,OAAO,CAAC,wBAAwB;IAmDhC;;;;;OAKG;IACU,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,SAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAsEtG;;;;;OAKG;IACU,aAAa;IAa1B;;;;;OAKG;IACI,uBAAuB,IAAI,OAAO;CAI1C"}
@@ -121,7 +121,6 @@ export class Matterbridge extends EventEmitter {
121
121
  matterLoggerFile = 'matter' + (getParameter('profile') ? '.' + getParameter('profile') : '') + '.log';
122
122
  plugins;
123
123
  devices;
124
- registeredDevices = [];
125
124
  nodeStorage;
126
125
  nodeContext;
127
126
  matterStorageName = 'matterbridge' + (getParameter('profile') ? '.' + getParameter('profile') : '') + '.json';
@@ -225,6 +224,8 @@ export class Matterbridge extends EventEmitter {
225
224
  this.nodeStorage = new NodeStorageManager({ dir: path.join(this.matterbridgeDirectory, this.nodeStorageName), writeQueue: false, expiredInterval: undefined, logging: false });
226
225
  // this.log.debug('Creating node storage context for matterbridge');
227
226
  this.nodeContext = await this.nodeStorage.createStorage('matterbridge');
227
+ // Check if the storage is corrupted and remove it
228
+ // TODO: Check if the storage is corrupted and remove it
228
229
  // Create matterbridge logger
229
230
  this.log = new AnsiLogger({ logName: 'Matterbridge', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: "info" /* LogLevel.INFO */ });
230
231
  // Create the file logger for matterbridge (context: matterbridgeFileLog)
@@ -344,7 +345,7 @@ export class Matterbridge extends EventEmitter {
344
345
  // We don't do this when the add parameter is set because we shut down the process after adding the plugin
345
346
  this.log.info(`Error parsing plugin ${plg}${plugin.name}${nf}. Trying to reinstall it from npm.`);
346
347
  try {
347
- await this.spawnCommand('npm', ['install', '-g', plugin.name]);
348
+ await this.spawnCommand('npm', ['install', '-g', '--omit=dev', plugin.name]);
348
349
  this.log.info(`Plugin ${plg}${plugin.name}${nf} reinstalled.`);
349
350
  plugin.error = false;
350
351
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -473,28 +474,24 @@ export class Matterbridge extends EventEmitter {
473
474
  }
474
475
  if (getParameter('add')) {
475
476
  this.log.debug(`Adding plugin ${getParameter('add')}`);
476
- // await this.executeCommandLine(getParameter('add') as string, 'add');
477
477
  await this.plugins.add(getParameter('add'));
478
478
  this.emit('shutdown');
479
479
  return;
480
480
  }
481
481
  if (getParameter('remove')) {
482
482
  this.log.debug(`Removing plugin ${getParameter('remove')}`);
483
- // await this.executeCommandLine(getParameter('remove') as string, 'remove');
484
483
  await this.plugins.remove(getParameter('remove'));
485
484
  this.emit('shutdown');
486
485
  return;
487
486
  }
488
487
  if (getParameter('enable')) {
489
488
  this.log.debug(`Enabling plugin ${getParameter('enable')}`);
490
- // await this.executeCommandLine(getParameter('enable') as string, 'enable');
491
489
  await this.plugins.enable(getParameter('enable'));
492
490
  this.emit('shutdown');
493
491
  return;
494
492
  }
495
493
  if (getParameter('disable')) {
496
494
  this.log.debug(`Disabling plugin ${getParameter('disable')}`);
497
- // await this.executeCommandLine(getParameter('disable') as string, 'disable');
498
495
  await this.plugins.disable(getParameter('disable'));
499
496
  this.emit('shutdown');
500
497
  return;
@@ -518,7 +515,7 @@ export class Matterbridge extends EventEmitter {
518
515
  this.nodeContext = undefined;
519
516
  this.nodeStorage = undefined;
520
517
  this.plugins.clear();
521
- this.registeredDevices = [];
518
+ this.devices.clear();
522
519
  this.emit('shutdown');
523
520
  return;
524
521
  }
@@ -1175,8 +1172,8 @@ export class Matterbridge extends EventEmitter {
1175
1172
  if (this.nodeStorage && this.nodeContext) {
1176
1173
  this.log.info('Saving registered devices...');
1177
1174
  const serializedRegisteredDevices = [];
1178
- this.registeredDevices.forEach((registeredDevice) => {
1179
- const serializedMatterbridgeDevice = registeredDevice.device.serialize(registeredDevice.plugin);
1175
+ this.devices.forEach(async (device) => {
1176
+ const serializedMatterbridgeDevice = device.serialize();
1180
1177
  // this.log.info(`- ${serializedMatterbridgeDevice.deviceName}${rs}\n`, serializedMatterbridgeDevice);
1181
1178
  if (serializedMatterbridgeDevice)
1182
1179
  serializedRegisteredDevices.push(serializedMatterbridgeDevice);
@@ -1203,7 +1200,8 @@ export class Matterbridge extends EventEmitter {
1203
1200
  this.log.error('Error saving registered devices: nodeContext not found!');
1204
1201
  }
1205
1202
  this.plugins.clear();
1206
- this.registeredDevices = [];
1203
+ this.devices.clear();
1204
+ // this.registeredDevices = [];
1207
1205
  // this.log.info('Waiting for matter to deliver last messages...');
1208
1206
  // this.cleanupTimeout2 = setTimeout(async () => {
1209
1207
  if (restart) {
@@ -1301,7 +1299,6 @@ export class Matterbridge extends EventEmitter {
1301
1299
  plugin.aggregator?.addBridgedDevice(device);
1302
1300
  }
1303
1301
  }
1304
- this.registeredDevices.push({ plugin: pluginName, device });
1305
1302
  if (plugin.registeredDevices !== undefined)
1306
1303
  plugin.registeredDevices++;
1307
1304
  if (plugin.addedDevices !== undefined)
@@ -1337,12 +1334,6 @@ export class Matterbridge extends EventEmitter {
1337
1334
  // device.getClusterServerById(BridgedDeviceBasicInformation.Cluster.id)?.triggerShutDownEvent({});
1338
1335
  // device.getClusterServerById(BridgedDeviceBasicInformation.Cluster.id)?.triggerLeaveEvent({});
1339
1336
  this.matterAggregator?.removeBridgedDevice(device);
1340
- this.registeredDevices.forEach((registeredDevice, index) => {
1341
- if (registeredDevice.device === device) {
1342
- this.registeredDevices.splice(index, 1);
1343
- return;
1344
- }
1345
- });
1346
1337
  this.log.info(`Removed bridged device(${plugin.registeredDevices}/${plugin.addedDevices}) ${dev}${device.deviceName}${nf} (${dev}${device.name}${nf}) for plugin ${plg}${pluginName}${nf}`);
1347
1338
  if (plugin.registeredDevices !== undefined)
1348
1339
  plugin.registeredDevices--;
@@ -1356,24 +1347,12 @@ export class Matterbridge extends EventEmitter {
1356
1347
  this.log.error(`Error removing bridged device ${dev}${device.deviceName}${er} (${dev}${device.name}${er}) for plugin ${plg}${pluginName}${er}: commissioning server not found`);
1357
1348
  return;
1358
1349
  }
1359
- this.registeredDevices.forEach((registeredDevice, index) => {
1360
- if (registeredDevice.device === device) {
1361
- this.registeredDevices.splice(index, 1);
1362
- return;
1363
- }
1364
- });
1365
1350
  }
1366
1351
  else if (plugin.type === 'DynamicPlatform') {
1367
1352
  if (!plugin.aggregator) {
1368
1353
  this.log.error(`Error removing bridged device ${dev}${device.deviceName}${er} (${dev}${device.name}${er}) for plugin ${plg}${pluginName}${er}: aggregator not found`);
1369
1354
  return;
1370
1355
  }
1371
- this.registeredDevices.forEach((registeredDevice, index) => {
1372
- if (registeredDevice.device === device) {
1373
- this.registeredDevices.splice(index, 1);
1374
- return;
1375
- }
1376
- });
1377
1356
  if (device.number !== undefined) {
1378
1357
  device.setBridgedDeviceReachability(false);
1379
1358
  device.getClusterServerById(BridgedDeviceBasicInformation.Cluster.id)?.triggerReachableChangedEvent({ reachableNewValue: false });
@@ -1403,18 +1382,14 @@ export class Matterbridge extends EventEmitter {
1403
1382
  */
1404
1383
  async removeAllBridgedDevices(pluginName) {
1405
1384
  this.log.debug(`Removing all bridged devices for plugin ${plg}${pluginName}${db}`);
1406
- const devicesToRemove = [];
1407
- for (const registeredDevice of this.registeredDevices) {
1408
- if (registeredDevice.plugin === pluginName) {
1409
- devicesToRemove.push(registeredDevice);
1385
+ this.devices.forEach(async (device) => {
1386
+ if (device.plugin === pluginName) {
1387
+ await this.removeBridgedDevice(pluginName, device);
1410
1388
  }
1411
- }
1412
- for (const registeredDevice of devicesToRemove) {
1413
- this.removeBridgedDevice(pluginName, registeredDevice.device);
1414
- }
1389
+ });
1415
1390
  }
1416
1391
  async startTest() {
1417
- // Start the Matterbridge
1392
+ // Start the Matterbridge test
1418
1393
  }
1419
1394
  /**
1420
1395
  * Starts the Matterbridge in bridge mode.
@@ -2452,7 +2427,7 @@ export class Matterbridge extends EventEmitter {
2452
2427
  this.wssSendMessage('spawn', this.log.now(), 'Matterbridge:spawn', `child process closed with code ${code} and signal ${signal}`);
2453
2428
  if (code === 0) {
2454
2429
  if (cmdLine.startsWith('npm install -g'))
2455
- this.log.notice(`Package ${cmdLine.replace('npm install -g ', '').replace('--verbose', '')} installed correctly`);
2430
+ this.log.notice(`Package ${cmdLine.replace('npm install -g ', '').replace('--verbose', '').replace('--omit=dev', '')} installed correctly`);
2456
2431
  this.log.debug(`Child process "${cmdLine}" closed with code ${code} and signal ${signal}`);
2457
2432
  resolve();
2458
2433
  }
@@ -2745,21 +2720,21 @@ export class Matterbridge extends EventEmitter {
2745
2720
  this.expressApp.get('/api/devices', (req, res) => {
2746
2721
  this.log.debug('The frontend sent /api/devices');
2747
2722
  const data = [];
2748
- this.registeredDevices.forEach((registeredDevice) => {
2749
- let name = registeredDevice.device.getClusterServer(BasicInformationCluster)?.attributes.nodeLabel?.getLocal();
2723
+ this.devices.forEach(async (device) => {
2724
+ let name = device.getClusterServer(BasicInformationCluster)?.attributes.nodeLabel?.getLocal();
2750
2725
  if (!name)
2751
- name = registeredDevice.device.getClusterServer(BridgedDeviceBasicInformationCluster)?.attributes.nodeLabel?.getLocal() ?? 'Unknown';
2752
- let serial = registeredDevice.device.getClusterServer(BasicInformationCluster)?.attributes.serialNumber?.getLocal();
2726
+ name = device.getClusterServer(BridgedDeviceBasicInformationCluster)?.attributes.nodeLabel?.getLocal() ?? 'Unknown';
2727
+ let serial = device.getClusterServer(BasicInformationCluster)?.attributes.serialNumber?.getLocal();
2753
2728
  if (!serial)
2754
- serial = registeredDevice.device.getClusterServer(BridgedDeviceBasicInformationCluster)?.attributes.serialNumber?.getLocal() ?? 'Unknown';
2755
- let uniqueId = registeredDevice.device.getClusterServer(BasicInformationCluster)?.attributes.uniqueId?.getLocal();
2729
+ serial = device.getClusterServer(BridgedDeviceBasicInformationCluster)?.attributes.serialNumber?.getLocal() ?? 'Unknown';
2730
+ let uniqueId = device.getClusterServer(BasicInformationCluster)?.attributes.uniqueId?.getLocal();
2756
2731
  if (!uniqueId)
2757
- uniqueId = registeredDevice.device.getClusterServer(BridgedDeviceBasicInformationCluster)?.attributes.uniqueId?.getLocal() ?? 'Unknown';
2758
- const cluster = this.getClusterTextFromDevice(registeredDevice.device);
2732
+ uniqueId = device.getClusterServer(BridgedDeviceBasicInformationCluster)?.attributes.uniqueId?.getLocal() ?? 'Unknown';
2733
+ const cluster = this.getClusterTextFromDevice(device);
2759
2734
  data.push({
2760
- pluginName: registeredDevice.plugin,
2761
- type: registeredDevice.device.name + ' (0x' + registeredDevice.device.deviceType.toString(16).padStart(4, '0') + ')',
2762
- endpoint: registeredDevice.device.number,
2735
+ pluginName: device.plugin ?? 'Unknown',
2736
+ type: device.name + ' (0x' + device.deviceType.toString(16).padStart(4, '0') + ')',
2737
+ endpoint: device.number,
2763
2738
  name,
2764
2739
  serial,
2765
2740
  uniqueId,
@@ -2779,9 +2754,9 @@ export class Matterbridge extends EventEmitter {
2779
2754
  return;
2780
2755
  }
2781
2756
  const data = [];
2782
- this.registeredDevices.forEach((registeredDevice) => {
2783
- if (registeredDevice.plugin === selectedPluginName && registeredDevice.device.number === selectedDeviceEndpoint) {
2784
- const clusterServers = registeredDevice.device.getAllClusterServers();
2757
+ this.devices.forEach(async (device) => {
2758
+ if (device.plugin === selectedPluginName && device.number === selectedDeviceEndpoint) {
2759
+ const clusterServers = device.getAllClusterServers();
2785
2760
  clusterServers.forEach((clusterServer) => {
2786
2761
  Object.entries(clusterServer.attributes).forEach(([key, value]) => {
2787
2762
  if (clusterServer.name === 'EveHistory')
@@ -2800,7 +2775,7 @@ export class Matterbridge extends EventEmitter {
2800
2775
  // console.log(error);
2801
2776
  }
2802
2777
  data.push({
2803
- endpoint: registeredDevice.device.number ? registeredDevice.device.number.toString() : '...',
2778
+ endpoint: device.number ? device.number.toString() : '...',
2804
2779
  clusterName: clusterServer.name,
2805
2780
  clusterId: '0x' + clusterServer.id.toString(16).padStart(2, '0'),
2806
2781
  attributeName: key,
@@ -2809,8 +2784,8 @@ export class Matterbridge extends EventEmitter {
2809
2784
  });
2810
2785
  });
2811
2786
  });
2812
- registeredDevice.device.getChildEndpoints().forEach((childEndpoint) => {
2813
- const name = registeredDevice.device.getChildEndpointName(childEndpoint);
2787
+ device.getChildEndpoints().forEach((childEndpoint) => {
2788
+ const name = device.getChildEndpointName(childEndpoint);
2814
2789
  const clusterServers = childEndpoint.getAllClusterServers();
2815
2790
  clusterServers.forEach((clusterServer) => {
2816
2791
  Object.entries(clusterServer.attributes).forEach(([key, value]) => {
@@ -3138,7 +3113,7 @@ export class Matterbridge extends EventEmitter {
3138
3113
  if (command === 'update') {
3139
3114
  this.log.info('Updating matterbridge...');
3140
3115
  try {
3141
- await this.spawnCommand('npm', ['install', '-g', 'matterbridge', '--verbose']);
3116
+ await this.spawnCommand('npm', ['install', '-g', 'matterbridge', '--omit=dev', '--verbose']);
3142
3117
  this.log.info('Matterbridge has been updated. Full restart required.');
3143
3118
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
3144
3119
  }
@@ -3173,7 +3148,7 @@ export class Matterbridge extends EventEmitter {
3173
3148
  param = param.replace(/\*/g, '\\');
3174
3149
  this.log.info(`Installing plugin ${plg}${param}${nf}...`);
3175
3150
  try {
3176
- await this.spawnCommand('npm', ['install', '-g', param, '--verbose']);
3151
+ await this.spawnCommand('npm', ['install', '-g', param, '--omit=dev', '--verbose']);
3177
3152
  this.log.info(`Plugin ${plg}${param}${nf} installed. Full restart required.`);
3178
3153
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
3179
3154
  }