matterbridge 2.2.0-dev.6 → 2.2.0-dev.8

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,27 +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
- ### Breaking Changes
17
-
18
- Starting from v. 2.0.0, Matterbridge is running only in mode edge (no parameter needed and no badge in the frontend).
19
-
20
- Starting from v. 2.1.0, the legacy old api of matter.js have been completely removed from Matterbridge and from all plugins.
21
-
22
- For this reason there is no compatibility with the old versions of the plugins.
23
-
24
- You need to update all plugins you use and Matterbridge in the same moment.
25
-
26
- I suggest to first update all plugins without restarting and then to update Matterbridge so when it restarts, all versions will be the latest.
27
-
28
- If you use docker, all plugins are already installed in the image so you just need to pull the new image.
29
-
30
- Compatibility list:
31
- matterbridge-shelly v. 1.1.5
32
- matterbridge-zigbee2mqtt v. 2.4.4
33
- matterbridge-somfy-tahoma v. 1.2.3
34
- matterbridge-hass v. 0.0.8
35
-
36
- ## [2.2.0] - 2025-02-26
16
+ ## [2.2.0] - 2025-02-28
37
17
 
38
18
  ### Added
39
19
 
@@ -41,24 +21,17 @@ matterbridge-hass v. 0.0.8
41
21
  - [platform]: Saving in the storage the selects for faster loading of plugins.
42
22
  - [icon]: Added matterbridge svg icon (thanks: https://github.com/robvanoostenrijk https://github.com/stuntguy3000).
43
23
  - [pluginManager]: Refactor PluginManager to optimize memory and load time.
44
- - [frontend]: Frontend v.2.4.5. Please refresh the frontend page after the update.
45
- - [frontend]: Added processUptime.
24
+ - [frontend]: Frontend v.2.4.6. Please refresh the frontend page after the update.
25
+ - [frontend]: Added processUptime to SystemInfo.
46
26
  - [frontend]: Added Share fabrics and Stop sharing to the menu. This allows to pair other controllers without the need to share from the first controller.
47
27
  - [frontend]: Added subscriptions to QRDiv.
48
- - [frontend]: Added autoScroll option for the logs.
28
+ - [frontend]: Added autoScroll option for the logs. Default is enabled.
49
29
  - [utils]: Optimized memory and loading time.
50
30
  - [shelly]: Added all shelly api to be used when matterbridge is running on the shelly matterbridge board.
51
31
 
52
32
  ### Changed
53
33
 
54
- - [package]: Update matter.js to 0.12.4-alpha.0-20250212-b2729c9eb
55
- - [package]: Update matter.js to 0.12.4-alpha.0-20250213-1187f81eb
56
- - [package]: Update matter.js to 0.12.4-alpha.0-20250215-5af08a8d6
57
- - [package]: Update matter.js to 0.12.4-alpha.0-20250217-b0bba5179
58
- - [package]: Update matter.js to 0.12.4-alpha.0-20250223-1e0341a1a
59
- - [package]: Update matter.js to 0.12.4-alpha.0-20250224-46934b522
60
- - [package]: Update matter.js to 0.12.4-alpha.0-20250225-52ac4166b
61
- - [package]: Update matter.js to 0.12.4-alpha.0-20250226-e4ba47db7
34
+ - [package]: Update matter.js to 0.12.4
62
35
  - [matterbridge]: The check for available updates now runs at restart and each 24 hours after.
63
36
 
64
37
  ### Fixed
package/dist/frontend.js CHANGED
@@ -402,6 +402,21 @@ export class Frontend {
402
402
  }
403
403
  });
404
404
  });
405
+ this.expressApp.get('/api/shellydownloadsystemlog', async (req, res) => {
406
+ this.log.debug('The frontend sent /api/shellydownloadsystemlog');
407
+ try {
408
+ await fs.access(path.join(this.matterbridge.matterbridgeDirectory, 'shelly.log'), fs.constants.F_OK);
409
+ }
410
+ catch (error) {
411
+ fs.appendFile(path.join(this.matterbridge.matterbridgeDirectory, 'shelly.log'), 'Create the Shelly system log before downloading it.');
412
+ }
413
+ res.download(path.join(this.matterbridge.matterbridgeDirectory, 'shelly.log'), 'shelly.log', (error) => {
414
+ if (error) {
415
+ this.log.error(`Error downloading Shelly system log file: ${error instanceof Error ? error.message : error}`);
416
+ res.status(500).send('Error downloading Shelly system log file');
417
+ }
418
+ });
419
+ });
405
420
  this.expressApp.get('/api/download-mjstorage', async (req, res) => {
406
421
  this.log.debug('The frontend sent /api/download-mjstorage');
407
422
  await createZip(path.join(os.tmpdir(), `matterbridge.${this.matterbridge.matterStorageName}.zip`), path.join(this.matterbridge.matterbridgeDirectory, this.matterbridge.matterStorageName));
@@ -1088,6 +1103,11 @@ export class Frontend {
1088
1103
  triggerShellyMainUpdate(this.matterbridge);
1089
1104
  return;
1090
1105
  }
1106
+ else if (data.method === '/api/shellycreatesystemlog') {
1107
+ const { createShellySystemLog } = await import('./shelly.js');
1108
+ createShellySystemLog(this.matterbridge);
1109
+ return;
1110
+ }
1091
1111
  else if (data.method === '/api/shellynetconfig') {
1092
1112
  this.log.debug('/api/shellynetconfig:', data.params);
1093
1113
  const { triggerShellyChangeIp: triggerShellyChangeNet } = await import('./shelly.js');
@@ -914,7 +914,7 @@ export class Matterbridge extends EventEmitter {
914
914
  async unregisterAndShutdownProcess() {
915
915
  this.log.info('Unregistering all devices and shutting down...');
916
916
  for (const plugin of this.plugins) {
917
- await this.removeAllBridgedEndpoints(plugin.name);
917
+ await this.removeAllBridgedEndpoints(plugin.name, 250);
918
918
  }
919
919
  this.log.debug('Waiting for the MessageExchange to finish...');
920
920
  await new Promise((resolve) => setTimeout(resolve, 1000));
@@ -1597,10 +1597,12 @@ export class Matterbridge extends EventEmitter {
1597
1597
  }
1598
1598
  this.devices.remove(device);
1599
1599
  }
1600
- async removeAllBridgedEndpoints(pluginName) {
1600
+ async removeAllBridgedEndpoints(pluginName, delay = 0) {
1601
1601
  this.log.debug(`Removing all bridged endpoints for plugin ${plg}${pluginName}${db}`);
1602
1602
  for (const device of this.devices.array().filter((device) => device.plugin === pluginName)) {
1603
1603
  await this.removeBridgedEndpoint(pluginName, device);
1604
+ if (delay > 0)
1605
+ await new Promise((resolve) => setTimeout(resolve, delay));
1604
1606
  }
1605
1607
  }
1606
1608
  sanitizeFabricInformations(fabricInfo) {
package/dist/shelly.js CHANGED
@@ -5,12 +5,12 @@ export async function getShellySysUpdate(matterbridge) {
5
5
  .then(async (data) => {
6
6
  if (data.length > 0) {
7
7
  matterbridge.matterbridgeInformation.shellySysUpdate = true;
8
- matterbridge.log.notice(`Shelly system update available: ${debugStringify(data)}`);
9
- matterbridge.frontend.wssSendSnackbarMessage('Shelly system update available', 60);
10
8
  matterbridge.frontend.wssBroadcastMessage(WS_ID_SHELLY_SYS_UPDATE, 'shelly-sys-update', { available: true });
11
9
  for (const update of data) {
12
10
  if (update.name)
13
- matterbridge.frontend.wssSendSnackbarMessage('Shelly system update available: ' + update.name, 10);
11
+ matterbridge.log.notice(`Shelly system update available: ${update.name}`);
12
+ if (update.name)
13
+ matterbridge.frontend.wssSendSnackbarMessage(`Shelly system update available: ${update.name}`, 10);
14
14
  }
15
15
  }
16
16
  })
@@ -29,8 +29,9 @@ export async function triggerShellySysUpdate(matterbridge) {
29
29
  .finally(() => {
30
30
  matterbridge.matterbridgeInformation.shellySysUpdate = false;
31
31
  matterbridge.log.notice(`Installing Shelly system update...`);
32
- matterbridge.frontend.wssSendSnackbarMessage('Installing Shelly system update...', 60);
32
+ matterbridge.frontend.wssSendSnackbarMessage('Installing Shelly system update...', 15);
33
33
  matterbridge.frontend.wssBroadcastMessage(WS_ID_SHELLY_SYS_UPDATE, 'shelly-sys-update', { available: false });
34
+ verifyShellyUpdate(matterbridge, '/api/updates/sys/status', 'Shelly system update');
34
35
  });
35
36
  }
36
37
  export async function getShellyMainUpdate(matterbridge) {
@@ -38,12 +39,12 @@ export async function getShellyMainUpdate(matterbridge) {
38
39
  .then(async (data) => {
39
40
  if (data.length > 0) {
40
41
  matterbridge.matterbridgeInformation.shellyMainUpdate = true;
41
- matterbridge.log.notice(`Shelly software update available: ${debugStringify(data)}`);
42
- matterbridge.frontend.wssSendSnackbarMessage('Shelly software update available', 60);
43
42
  matterbridge.frontend.wssBroadcastMessage(WS_ID_SHELLY_MAIN_UPDATE, 'shelly-main-update', { available: true });
44
43
  for (const update of data) {
45
44
  if (update.name)
46
- matterbridge.frontend.wssSendSnackbarMessage('Shelly software update available: ' + update.name, 10);
45
+ matterbridge.log.notice(`Shelly software update available: ${update.name}`);
46
+ if (update.name)
47
+ matterbridge.frontend.wssSendSnackbarMessage(`Shelly software update available: ${update.name}`, 10);
47
48
  }
48
49
  }
49
50
  })
@@ -62,8 +63,40 @@ export async function triggerShellyMainUpdate(matterbridge) {
62
63
  .finally(() => {
63
64
  matterbridge.matterbridgeInformation.shellyMainUpdate = false;
64
65
  matterbridge.log.notice(`Installing Shelly software update...`);
65
- matterbridge.frontend.wssSendSnackbarMessage('Installing Shelly software update...', 60);
66
+ matterbridge.frontend.wssSendSnackbarMessage('Installing Shelly software update...', 15);
66
67
  matterbridge.frontend.wssBroadcastMessage(WS_ID_SHELLY_MAIN_UPDATE, 'shelly-main-update', { available: false });
68
+ verifyShellyUpdate(matterbridge, '/api/updates/main/status', 'Shelly software update');
69
+ });
70
+ }
71
+ async function verifyShellyUpdate(matterbridge, api, name) {
72
+ return new Promise((resolve) => {
73
+ const timeout = setTimeout(() => {
74
+ matterbridge.log.warn(`${name} check timed out`);
75
+ clearInterval(interval);
76
+ resolve();
77
+ }, 600 * 1000);
78
+ const interval = setInterval(() => {
79
+ getShelly(api, 10 * 1000)
80
+ .then(async (data) => {
81
+ if (data.updatingInProgress) {
82
+ matterbridge.log.notice(`${name} in progress...`);
83
+ matterbridge.frontend.wssSendSnackbarMessage(`${name} in progress...`, 20);
84
+ }
85
+ else {
86
+ matterbridge.log.notice(`${name} installed`);
87
+ matterbridge.frontend.wssSendSnackbarMessage(`${name} installed`, 20);
88
+ clearInterval(interval);
89
+ clearTimeout(timeout);
90
+ resolve();
91
+ }
92
+ })
93
+ .catch((error) => {
94
+ matterbridge.log.warn(`Error getting status of ${name}: ${error instanceof Error ? error.message : error}`);
95
+ clearInterval(interval);
96
+ clearTimeout(timeout);
97
+ resolve();
98
+ });
99
+ }, 15 * 1000);
67
100
  });
68
101
  }
69
102
  export async function triggerShellyChangeIp(matterbridge, config) {
@@ -102,6 +135,25 @@ export async function triggerShellyReboot(matterbridge) {
102
135
  matterbridge.frontend.wssSendSnackbarMessage('Rebooting Shelly board...');
103
136
  });
104
137
  }
138
+ export async function createShellySystemLog(matterbridge) {
139
+ const { promises: fs } = await import('node:fs');
140
+ const path = await import('node:path');
141
+ matterbridge.log.debug(`Downloading Shelly system log...`);
142
+ getShelly('/api/logs/system', 60 * 1000)
143
+ .then(async (data) => {
144
+ fs.writeFile(path.join(matterbridge.matterbridgeDirectory, 'shelly.log'), data)
145
+ .then(() => {
146
+ matterbridge.log.notice(`Shelly system log ready for download`);
147
+ matterbridge.frontend.wssSendSnackbarMessage('Shelly system log ready for download');
148
+ })
149
+ .catch((error) => {
150
+ matterbridge.log.warn(`Error writing Shelly system log to file: ${error instanceof Error ? error.message : error}`);
151
+ });
152
+ })
153
+ .catch((error) => {
154
+ matterbridge.log.warn(`Error getting Shelly system log: ${error instanceof Error ? error.message : error}`);
155
+ });
156
+ }
105
157
  async function getShelly(api, timeout = 60000) {
106
158
  const http = await import('node:http');
107
159
  return new Promise((resolve, reject) => {
@@ -125,12 +177,17 @@ async function getShelly(api, timeout = 60000) {
125
177
  });
126
178
  res.on('end', () => {
127
179
  clearTimeout(timeoutId);
128
- try {
129
- const jsonData = JSON.parse(data);
130
- resolve(jsonData);
180
+ if (api !== '/api/logs/system') {
181
+ try {
182
+ const jsonData = JSON.parse(data);
183
+ resolve(jsonData);
184
+ }
185
+ catch (error) {
186
+ reject(new Error(`Failed to parse response JSON: ${error instanceof Error ? error.message : error}`));
187
+ }
131
188
  }
132
- catch (error) {
133
- reject(new Error(`Failed to parse response JSON: ${error instanceof Error ? error.message : error}`));
189
+ else {
190
+ resolve(data);
134
191
  }
135
192
  });
136
193
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "files": {
3
3
  "main.css": "./static/css/main.cf25d33e.css",
4
- "main.js": "./static/js/main.f60aae10.js",
4
+ "main.js": "./static/js/main.8240902c.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.cf25d33e.css.map": "./static/css/main.cf25d33e.css.map",
64
- "main.f60aae10.js.map": "./static/js/main.f60aae10.js.map",
64
+ "main.8240902c.js.map": "./static/js/main.8240902c.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.cf25d33e.css",
69
- "static/js/main.f60aae10.js"
69
+ "static/js/main.8240902c.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.f60aae10.js"></script><link href="./static/css/main.cf25d33e.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.8240902c.js"></script><link href="./static/css/main.cf25d33e.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>