matterbridge 2.2.2-dev.1 → 2.2.2-dev.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/CHANGELOG.md CHANGED
@@ -13,7 +13,7 @@ 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
- ## [2.2.2] - 2025-03-03
16
+ ## [2.2.2] - 2025-03-04
17
17
 
18
18
  ### Added
19
19
 
@@ -21,6 +21,11 @@ Tamer (https://github.com/tammeryousef1006) has created the Matterbridge Discord
21
21
  - [frontend]: Added in the Header the primary color for restart icon when restart is needed.
22
22
  - [frontend]: Added in the HomeDevices a message when restart is needed.
23
23
 
24
+ ### Changed
25
+
26
+ - [frontend]: Optimized rendering of main components.
27
+ - [frontend]: The config editor cannot be opened a second time before the restart.
28
+
24
29
  <a href="https://www.buymeacoffee.com/luligugithub">
25
30
  <img src="./yellow-button.png" alt="Buy me a coffee" width="120">
26
31
  </a>
package/dist/frontend.js CHANGED
@@ -11,6 +11,7 @@ import { createZip, deepCopy, isValidArray, isValidNumber, isValidObject, isVali
11
11
  import { plg } from './matterbridgeTypes.js';
12
12
  import { hasParameter } from './utils/export.js';
13
13
  import { BridgedDeviceBasicInformation } from '@matter/main/clusters';
14
+ import { cliEmitter } from './cli.js';
14
15
  export const WS_ID_LOG = 0;
15
16
  export const WS_ID_REFRESH_NEEDED = 1;
16
17
  export const WS_ID_RESTART_NEEDED = 2;
@@ -177,7 +178,6 @@ export class Frontend {
177
178
  this.webSocketServer.on('error', (ws, error) => {
178
179
  this.log.error(`WebSocketServer error: ${error}`);
179
180
  });
180
- const { cliEmitter } = await import('./cli.js');
181
181
  cliEmitter.on('uptime', (systemUptime, processUptime) => {
182
182
  this.wssSendUptimeUpdate(systemUptime, processUptime);
183
183
  });
@@ -784,6 +784,7 @@ export class Frontend {
784
784
  this.log.debug(`Frontend initialized on port ${YELLOW}${this.port}${db} static ${UNDERLINE}${path.join(this.matterbridge.rootDirectory, 'frontend/build')}${UNDERLINEOFF}${rs}`);
785
785
  }
786
786
  async stop() {
787
+ cliEmitter.removeAllListeners();
787
788
  if (this.httpServer) {
788
789
  this.httpServer.close();
789
790
  this.httpServer.removeAllListeners();
@@ -1482,11 +1483,11 @@ export class Frontend {
1482
1483
  }
1483
1484
  });
1484
1485
  }
1485
- wssSendSnackbarMessage(message, timeout = 5) {
1486
+ wssSendSnackbarMessage(message, timeout = 5, severity = 'info') {
1486
1487
  this.log.debug('Sending a snackbar message to all connected clients');
1487
1488
  this.webSocketServer?.clients.forEach((client) => {
1488
1489
  if (client.readyState === WebSocket.OPEN) {
1489
- client.send(JSON.stringify({ id: WS_ID_SNACKBAR, src: 'Matterbridge', dst: 'Frontend', method: 'memory_update', params: { message, timeout } }));
1490
+ client.send(JSON.stringify({ id: WS_ID_SNACKBAR, src: 'Matterbridge', dst: 'Frontend', method: 'memory_update', params: { message, timeout, severity } }));
1490
1491
  }
1491
1492
  });
1492
1493
  }
@@ -91,6 +91,7 @@ export class Matterbridge extends EventEmitter {
91
91
  profile = getParameter('profile');
92
92
  shutdown = false;
93
93
  edge = true;
94
+ failCountLimit = hasParameter('shelly') ? 120 : 60;
94
95
  log;
95
96
  matterbrideLoggerFile = 'matterbridge' + (getParameter('profile') ? '.' + getParameter('profile') : '') + '.log';
96
97
  matterLoggerFile = 'matter' + (getParameter('profile') ? '.' + getParameter('profile') : '') + '.log';
@@ -1132,12 +1133,13 @@ export class Matterbridge extends EventEmitter {
1132
1133
  this.log.error(`The plugin ${plg}${plugin.name}${er} is in error state.`);
1133
1134
  this.log.error('The bridge will not start until the problem is solved to prevent the controllers from deleting all registered devices.');
1134
1135
  this.log.error('If you want to start the bridge disable the plugin in error state and restart.');
1136
+ this.frontend.wssSendSnackbarMessage(`The plugin ${plugin.name} is in error state. Check the logs.`, 0, 'error');
1135
1137
  return;
1136
1138
  }
1137
1139
  if (!plugin.loaded || !plugin.started) {
1138
- this.log.debug(`Waiting (failSafeCount=${failCount}/60) in startMatterInterval interval for plugin ${plg}${plugin.name}${db} loaded: ${plugin.loaded} started: ${plugin.started}...`);
1140
+ this.log.debug(`Waiting (failSafeCount=${failCount}/${this.failCountLimit}) in startMatterInterval interval for plugin ${plg}${plugin.name}${db} loaded: ${plugin.loaded} started: ${plugin.started}...`);
1139
1141
  failCount++;
1140
- if (failCount > 60) {
1142
+ if (failCount > this.failCountLimit) {
1141
1143
  this.log.error(`Error waiting for plugin ${plg}${plugin.name}${er} to load and start. Plugin is in error state.`);
1142
1144
  plugin.error = true;
1143
1145
  }
@@ -1153,7 +1155,9 @@ export class Matterbridge extends EventEmitter {
1153
1155
  if (!plugin.enabled || !plugin.loaded || !plugin.started || plugin.error)
1154
1156
  continue;
1155
1157
  try {
1156
- await this.plugins.configure(plugin);
1158
+ if ((await this.plugins.configure(plugin)) === undefined) {
1159
+ this.frontend.wssSendSnackbarMessage(`The plugin ${plugin.name} failed to configure. Check the logs.`, 0, 'error');
1160
+ }
1157
1161
  }
1158
1162
  catch (error) {
1159
1163
  plugin.error = true;
@@ -1195,14 +1199,15 @@ export class Matterbridge extends EventEmitter {
1195
1199
  this.log.error(`The plugin ${plg}${plugin.name}${er} is in error state.`);
1196
1200
  this.log.error('The bridge will not start until the problem is solved to prevent the controllers from deleting all registered devices.');
1197
1201
  this.log.error('If you want to start the bridge disable the plugin in error state and restart.');
1202
+ this.frontend.wssSendSnackbarMessage(`The plugin ${plugin.name} is in error state. Check the logs.`, 0, 'error');
1198
1203
  return;
1199
1204
  }
1200
1205
  this.log.debug(`Checking plugin ${plg}${plugin.name}${db} to start matter in childbridge mode...`);
1201
1206
  if (!plugin.loaded || !plugin.started) {
1202
1207
  allStarted = false;
1203
- this.log.debug(`Waiting (failSafeCount=${failCount}/60) for plugin ${plg}${plugin.name}${db} to load (${plugin.loaded}) and start (${plugin.started}) ...`);
1208
+ this.log.debug(`Waiting (failSafeCount=${failCount}/${this.failCountLimit}) for plugin ${plg}${plugin.name}${db} to load (${plugin.loaded}) and start (${plugin.started}) ...`);
1204
1209
  failCount++;
1205
- if (failCount > 60) {
1210
+ if (failCount > this.failCountLimit) {
1206
1211
  this.log.error(`Error waiting for plugin ${plg}${plugin.name}${er} to load and start. Plugin is in error mode.`);
1207
1212
  plugin.error = true;
1208
1213
  }
@@ -1218,7 +1223,9 @@ export class Matterbridge extends EventEmitter {
1218
1223
  if (!plugin.enabled || !plugin.loaded || !plugin.started || plugin.error)
1219
1224
  continue;
1220
1225
  try {
1221
- await this.plugins.configure(plugin);
1226
+ if ((await this.plugins.configure(plugin)) === undefined) {
1227
+ this.frontend.wssSendSnackbarMessage(`The plugin ${plugin.name} failed to configure. Check the logs.`, 0, 'error');
1228
+ }
1222
1229
  }
1223
1230
  catch (error) {
1224
1231
  plugin.error = true;
@@ -1419,7 +1426,7 @@ export class Matterbridge extends EventEmitter {
1419
1426
  }
1420
1427
  this.frontend.wssSendRefreshRequired('plugins');
1421
1428
  this.frontend.wssSendRefreshRequired('settings');
1422
- this.frontend.wssSendSnackbarMessage(`${storeId} is online`);
1429
+ this.frontend.wssSendSnackbarMessage(`${storeId} is online`, 5, 'success');
1423
1430
  });
1424
1431
  serverNode.lifecycle.offline.on(() => {
1425
1432
  this.log.notice(`Server node for ${storeId} is offline`);
@@ -1442,7 +1449,7 @@ export class Matterbridge extends EventEmitter {
1442
1449
  }
1443
1450
  this.frontend.wssSendRefreshRequired('plugins');
1444
1451
  this.frontend.wssSendRefreshRequired('settings');
1445
- this.frontend.wssSendSnackbarMessage(`${storeId} is offline`);
1452
+ this.frontend.wssSendSnackbarMessage(`${storeId} is offline`, 5, 'warning');
1446
1453
  });
1447
1454
  serverNode.events.commissioning.fabricsChanged.on((fabricIndex, fabricAction) => {
1448
1455
  let action = '';
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "files": {
3
3
  "main.css": "./static/css/main.b9449869.css",
4
- "main.js": "./static/js/main.92802eb1.js",
4
+ "main.js": "./static/js/main.eb443b23.js",
5
5
  "static/js/453.abd36b29.chunk.js": "./static/js/453.abd36b29.chunk.js",
6
6
  "static/media/roboto-latin-700-normal.woff2": "./static/media/roboto-latin-700-normal.4535474e1cf8598695ad.woff2",
7
7
  "static/media/roboto-latin-500-normal.woff2": "./static/media/roboto-latin-500-normal.7077203b1982951ecf76.woff2",
@@ -61,11 +61,11 @@
61
61
  "static/media/roboto-greek-ext-400-normal.woff": "./static/media/roboto-greek-ext-400-normal.16eb83b4a3b1ea994243.woff",
62
62
  "index.html": "./index.html",
63
63
  "main.b9449869.css.map": "./static/css/main.b9449869.css.map",
64
- "main.92802eb1.js.map": "./static/js/main.92802eb1.js.map",
64
+ "main.eb443b23.js.map": "./static/js/main.eb443b23.js.map",
65
65
  "453.abd36b29.chunk.js.map": "./static/js/453.abd36b29.chunk.js.map"
66
66
  },
67
67
  "entrypoints": [
68
68
  "static/css/main.b9449869.css",
69
- "static/js/main.92802eb1.js"
69
+ "static/js/main.eb443b23.js"
70
70
  ]
71
71
  }
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><meta charset="utf-8"/><base href="./"><link rel="icon" href="./matterbridge 32x32.png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><title>Matterbridge</title><link rel="manifest" href="./manifest.json"/><script defer="defer" src="./static/js/main.92802eb1.js"></script><link href="./static/css/main.b9449869.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
1
+ <!doctype html><html lang="en"><head><meta charset="utf-8"/><base href="./"><link rel="icon" href="./matterbridge 32x32.png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><title>Matterbridge</title><link rel="manifest" href="./manifest.json"/><script defer="defer" src="./static/js/main.eb443b23.js"></script><link href="./static/css/main.b9449869.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>