matterbridge 1.2.15 → 1.2.16
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 +18 -0
- package/dist/matterbridge.d.ts +18 -0
- package/dist/matterbridge.d.ts.map +1 -1
- package/dist/matterbridge.js +103 -66
- package/dist/matterbridge.js.map +1 -1
- package/dist/matterbridgeDevice.d.ts +14 -30
- package/dist/matterbridgeDevice.d.ts.map +1 -1
- package/dist/matterbridgeDevice.js +1 -1
- package/dist/matterbridgeDevice.js.map +1 -1
- package/frontend/build/asset-manifest.json +3 -3
- package/frontend/build/index.html +1 -1
- package/frontend/build/static/js/main.b08bfdf4.js +3 -0
- package/frontend/build/static/js/main.b08bfdf4.js.map +1 -0
- package/package.json +12 -11
- package/frontend/build/static/js/main.5886e61b.js +0 -3
- package/frontend/build/static/js/main.5886e61b.js.map +0 -1
- /package/frontend/build/static/js/{main.5886e61b.js.LICENSE.txt → main.b08bfdf4.js.LICENSE.txt} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.2.16] - 2024-05-15
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- [matter.js]: Update to @project-chip/matter-node.js v. 0.9.0
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- [frontend]: Frontend updated to 1.0.0.
|
|
13
|
+
- [frontend]: Added check version interval.
|
|
14
|
+
- [frontend]: Added help and version information icons for plugins.
|
|
15
|
+
- [frontend]: Added version information for Matterbridge (Click on the version badge).
|
|
16
|
+
- [frontend]: Added help badge for Matterbridge.
|
|
17
|
+
- [frontend]: Added version information badge for Matterbridge.
|
|
18
|
+
|
|
19
|
+
<a href="https://www.buymeacoffee.com/luligugithub">
|
|
20
|
+
<img src="./yellow-button.png" alt="Buy me a coffee" width="120">
|
|
21
|
+
</a>
|
|
22
|
+
|
|
5
23
|
## [1.2.15] - 2024-05-14
|
|
6
24
|
|
|
7
25
|
### Added
|
package/dist/matterbridge.d.ts
CHANGED
|
@@ -71,6 +71,7 @@ export declare class Matterbridge extends EventEmitter {
|
|
|
71
71
|
globalModulesDirectory: string;
|
|
72
72
|
matterbridgeVersion: string;
|
|
73
73
|
matterbridgeLatestVersion: string;
|
|
74
|
+
private checkUpdateInterval?;
|
|
74
75
|
bridgeMode: 'bridge' | 'childbridge' | 'controller' | '';
|
|
75
76
|
restartMode: 'service' | 'docker' | '';
|
|
76
77
|
debugEnabled: boolean;
|
|
@@ -418,6 +419,23 @@ export declare class Matterbridge extends EventEmitter {
|
|
|
418
419
|
* Logs the node and system information.
|
|
419
420
|
*/
|
|
420
421
|
private logNodeAndSystemInfo;
|
|
422
|
+
/**
|
|
423
|
+
* Retrieves the latest version of Matterbridge and performs necessary actions based on the version comparison.
|
|
424
|
+
* @private
|
|
425
|
+
* @returns {Promise<void>} A promise that resolves when the latest version is retrieved and actions are performed.
|
|
426
|
+
*/
|
|
427
|
+
private getMatterbridgeLatestVersion;
|
|
428
|
+
/**
|
|
429
|
+
* Retrieves the latest version of a plugin and updates the plugin's latestVersion property.
|
|
430
|
+
* If the plugin's version is different from the latest version, logs a warning message.
|
|
431
|
+
* If the plugin's version is the same as the latest version, logs an info message.
|
|
432
|
+
* If there is an error retrieving the latest version, logs an error message.
|
|
433
|
+
*
|
|
434
|
+
* @private
|
|
435
|
+
* @param {RegisteredPlugin} plugin - The plugin for which to retrieve the latest version.
|
|
436
|
+
* @returns {Promise<void>} A promise that resolves when the latest version is retrieved and actions are performed.
|
|
437
|
+
*/
|
|
438
|
+
private getPluginLatestVersion;
|
|
421
439
|
/**
|
|
422
440
|
* Retrieves an array of base registered plugins.
|
|
423
441
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matterbridge.d.ts","sourceRoot":"","sources":["../src/matterbridge.ts"],"names":[],"mappings":"A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AO,CAAC,IAAI,CAAC;IAkc5D;;;;OAIG;IACH,OAAO,CAAC,wBAAwB;CAkCjC"}
|
package/dist/matterbridge.js
CHANGED
|
@@ -34,7 +34,7 @@ import path from 'path';
|
|
|
34
34
|
import WebSocket, { WebSocketServer } from 'ws';
|
|
35
35
|
import { BridgedDeviceBasicInformation, BridgedDeviceBasicInformationCluster } from './BridgedDeviceBasicInformationCluster.js';
|
|
36
36
|
import { CommissioningController, CommissioningServer, MatterServer } from '@project-chip/matter-node.js';
|
|
37
|
-
import { BasicInformationCluster, ClusterServer, FixedLabelCluster, GeneralCommissioning,
|
|
37
|
+
import { BasicInformationCluster, ClusterServer, FixedLabelCluster, GeneralCommissioning, PowerSourceCluster, ThreadNetworkDiagnosticsCluster, getClusterNameById } from '@project-chip/matter-node.js/cluster';
|
|
38
38
|
import { DeviceTypeId, VendorId } from '@project-chip/matter-node.js/datatype';
|
|
39
39
|
import { Aggregator, DeviceTypes, NodeStateInformation } from '@project-chip/matter-node.js/device';
|
|
40
40
|
import { Format, Level, Logger } from '@project-chip/matter-node.js/log';
|
|
@@ -84,6 +84,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
84
84
|
globalModulesDirectory = '';
|
|
85
85
|
matterbridgeVersion = '';
|
|
86
86
|
matterbridgeLatestVersion = '';
|
|
87
|
+
checkUpdateInterval; // = 24 * 60 * 60 * 1000; // 24 hours
|
|
87
88
|
bridgeMode = '';
|
|
88
89
|
restartMode = '';
|
|
89
90
|
debugEnabled = false;
|
|
@@ -285,12 +286,6 @@ export class Matterbridge extends EventEmitter {
|
|
|
285
286
|
await plugin.nodeContext.set('description', plugin.description);
|
|
286
287
|
await plugin.nodeContext.set('author', plugin.author);
|
|
287
288
|
}
|
|
288
|
-
if (hasParameter('logstorage')) {
|
|
289
|
-
await this.nodeContext.logStorage();
|
|
290
|
-
for (const plugin of this.registeredPlugins) {
|
|
291
|
-
await plugin.nodeContext?.logStorage();
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
289
|
// Log system info and create .matterbridge directory
|
|
295
290
|
await this.logNodeAndSystemInfo();
|
|
296
291
|
this.log.info(
|
|
@@ -340,6 +335,16 @@ export class Matterbridge extends EventEmitter {
|
|
|
340
335
|
this.emit('shutdown');
|
|
341
336
|
process.exit(0);
|
|
342
337
|
}
|
|
338
|
+
if (hasParameter('logstorage')) {
|
|
339
|
+
this.log.info(`${plg}matterbridge${nf} storage log`);
|
|
340
|
+
await this.nodeContext?.logStorage();
|
|
341
|
+
for (const plugin of this.registeredPlugins) {
|
|
342
|
+
this.log.info(`${plg}${plugin.name}${nf} storage log`);
|
|
343
|
+
await plugin.nodeContext?.logStorage();
|
|
344
|
+
}
|
|
345
|
+
this.emit('shutdown');
|
|
346
|
+
process.exit(0);
|
|
347
|
+
}
|
|
343
348
|
if (getParameter('add')) {
|
|
344
349
|
this.log.debug(`Registering plugin ${getParameter('add')}`);
|
|
345
350
|
await this.executeCommandLine(getParameter('add'), 'add');
|
|
@@ -393,6 +398,12 @@ export class Matterbridge extends EventEmitter {
|
|
|
393
398
|
}
|
|
394
399
|
// Initialize frontend
|
|
395
400
|
await this.initializeFrontend(getIntParameter('frontend'));
|
|
401
|
+
this.checkUpdateInterval = setInterval(() => {
|
|
402
|
+
this.getMatterbridgeLatestVersion();
|
|
403
|
+
this.registeredPlugins.forEach((plugin) => {
|
|
404
|
+
this.getPluginLatestVersion(plugin);
|
|
405
|
+
});
|
|
406
|
+
}, 60 * 60 * 1000);
|
|
396
407
|
if (hasParameter('test')) {
|
|
397
408
|
this.bridgeMode = 'childbridge';
|
|
398
409
|
MatterbridgeDevice.bridgeMode = 'childbridge';
|
|
@@ -650,6 +661,8 @@ export class Matterbridge extends EventEmitter {
|
|
|
650
661
|
process.removeAllListeners('SIGINT');
|
|
651
662
|
process.removeAllListeners('SIGTERM');
|
|
652
663
|
this.log.debug('All listeners removed');
|
|
664
|
+
this.checkUpdateInterval && clearInterval(this.checkUpdateInterval);
|
|
665
|
+
this.checkUpdateInterval = undefined;
|
|
653
666
|
// Calling the shutdown functions with a reason
|
|
654
667
|
for (const plugin of this.registeredPlugins) {
|
|
655
668
|
if (!plugin.enabled || plugin.error)
|
|
@@ -1423,18 +1436,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
1423
1436
|
plugin.registeredDevices = 0;
|
|
1424
1437
|
plugin.addedDevices = 0;
|
|
1425
1438
|
await this.nodeContext?.set('plugins', await this.getBaseRegisteredPlugins());
|
|
1426
|
-
this.
|
|
1427
|
-
.then(async (latestVersion) => {
|
|
1428
|
-
plugin.latestVersion = latestVersion;
|
|
1429
|
-
await this.nodeContext?.set('plugins', await this.getBaseRegisteredPlugins());
|
|
1430
|
-
if (plugin.version !== latestVersion)
|
|
1431
|
-
this.log.warn(`The plugin ${plg}${plugin.name}${wr} is out of date. Current version: ${plugin.version}, Latest version: ${latestVersion}`);
|
|
1432
|
-
else
|
|
1433
|
-
this.log.info(`The plugin ${plg}${plugin.name}${nf} is up to date. Current version: ${plugin.version}, Latest version: ${latestVersion}`);
|
|
1434
|
-
})
|
|
1435
|
-
.catch((error) => {
|
|
1436
|
-
this.log.error(`Error getting ${plugin.name} latest version: ${error}`);
|
|
1437
|
-
});
|
|
1439
|
+
await this.getPluginLatestVersion(plugin);
|
|
1438
1440
|
this.log.info(`Loaded plugin ${plg}${plugin.name}${nf} type ${typ}${platform.type} ${db}(entrypoint ${UNDERLINE}${pluginEntry}${UNDERLINEOFF})`);
|
|
1439
1441
|
if (start)
|
|
1440
1442
|
this.startPlugin(plugin, message); // No await do it asyncronously
|
|
@@ -1805,6 +1807,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
1805
1807
|
this.log.debug('Starting matter server...');
|
|
1806
1808
|
await this.matterServer.start();
|
|
1807
1809
|
this.log.debug('Started matter server');
|
|
1810
|
+
//this.commissioningServer?.getRootEndpoint() && logEndpoint(this.commissioningServer?.getRootEndpoint());
|
|
1808
1811
|
}
|
|
1809
1812
|
/**
|
|
1810
1813
|
* Imports the commissioning server context for a specific plugin and device.
|
|
@@ -2159,48 +2162,48 @@ export class Matterbridge extends EventEmitter {
|
|
|
2159
2162
|
}
|
|
2160
2163
|
},
|
|
2161
2164
|
});
|
|
2165
|
+
/*
|
|
2162
2166
|
const gdcCluster = commissioningServer.getRootClusterServer(GeneralDiagnosticsCluster);
|
|
2163
2167
|
if (gdcCluster) {
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
}
|
|
2202
|
-
|
|
2203
|
-
this.log.warn(`*GeneralDiagnosticsCluster not found for ${plg}${pluginName}${wr}`);
|
|
2168
|
+
// console.log('GeneralDiagnosticsCluster found for', plg, pluginName, db);
|
|
2169
|
+
// console.log('GeneralDiagnosticsCluster', gdcCluster);
|
|
2170
|
+
// We have like "30:f6:ef:69:2b:c5" in this.systemInformation.macAddress
|
|
2171
|
+
const macArray = this.systemInformation.macAddress.split(':').map((hex) => parseInt(hex, 16));
|
|
2172
|
+
let hardwareAddress = new Uint8Array(macArray);
|
|
2173
|
+
if (hardwareAddress.length === 6) hardwareAddress = Uint8Array.from([0, 0, ...hardwareAddress]);
|
|
2174
|
+
// We have like "192.168.1.189" in this.systemInformation.ipv4Address
|
|
2175
|
+
const ipv4Array = this.systemInformation.ipv4Address.split('.').map((num) => parseInt(num));
|
|
2176
|
+
const iPv4Address = new Uint8Array(ipv4Array);
|
|
2177
|
+
// We have like "fd78:cbf8:4939:746:d555:85a9:74f6:9c6" in this.systemInformation.ipv6Address
|
|
2178
|
+
const ipv6Groups = this.systemInformation.ipv6Address.split(':');
|
|
2179
|
+
const ipv6Array = [];
|
|
2180
|
+
for (const group of ipv6Groups) {
|
|
2181
|
+
const decimal = parseInt(group, 16);
|
|
2182
|
+
ipv6Array.push(decimal >> 8); // High byte
|
|
2183
|
+
ipv6Array.push(decimal & 0xff); // Low byte
|
|
2184
|
+
}
|
|
2185
|
+
const iPv6Address = new Uint8Array(ipv6Array);
|
|
2186
|
+
this.log.debug(`GeneralDiagnosticsCluster for ${plg}${pluginName}${db} hardwareAddress ${this.systemInformation.macAddress} => ${debugStringify(hardwareAddress)}`);
|
|
2187
|
+
this.log.debug(`GeneralDiagnosticsCluster for ${plg}${pluginName}${db} iPv4Address ${this.systemInformation.ipv4Address} => ${debugStringify(iPv4Address)}`);
|
|
2188
|
+
this.log.debug(`GeneralDiagnosticsCluster for ${plg}${pluginName}${db} iPv6Address ${this.systemInformation.ipv6Address} => ${debugStringify(iPv6Address)}`);
|
|
2189
|
+
try {
|
|
2190
|
+
gdcCluster.setNetworkInterfacesAttribute([
|
|
2191
|
+
{
|
|
2192
|
+
name: 'eth0',
|
|
2193
|
+
isOperational: true,
|
|
2194
|
+
offPremiseServicesReachableIPv4: null,
|
|
2195
|
+
offPremiseServicesReachableIPv6: null,
|
|
2196
|
+
hardwareAddress,
|
|
2197
|
+
iPv4Addresses: [iPv4Address],
|
|
2198
|
+
iPv6Addresses: [iPv6Address],
|
|
2199
|
+
type: GeneralDiagnostics.InterfaceType.Ethernet,
|
|
2200
|
+
},
|
|
2201
|
+
]);
|
|
2202
|
+
} catch (error) {
|
|
2203
|
+
this.log.error(`GeneralDiagnosticsCluster.setNetworkInterfacesAttribute for ${plg}${pluginName}${er} error:`, error);
|
|
2204
|
+
}
|
|
2205
|
+
} else this.log.warn(`*GeneralDiagnosticsCluster not found for ${plg}${pluginName}${wr}`);
|
|
2206
|
+
*/
|
|
2204
2207
|
commissioningServer.addCommandHandler('testEventTrigger', async ({ request: { enableKey, eventTrigger } }) => this.log.info(`testEventTrigger called on GeneralDiagnostic cluster: ${enableKey} ${eventTrigger}`));
|
|
2205
2208
|
return commissioningServer;
|
|
2206
2209
|
}
|
|
@@ -2439,6 +2442,20 @@ export class Matterbridge extends EventEmitter {
|
|
|
2439
2442
|
if (this.nodeContext)
|
|
2440
2443
|
this.matterbridgeLatestVersion = await this.nodeContext.get('matterbridgeLatestVersion', '');
|
|
2441
2444
|
this.log.debug(`Matterbridge Latest Version: ${this.matterbridgeLatestVersion}`);
|
|
2445
|
+
await this.getMatterbridgeLatestVersion();
|
|
2446
|
+
// Current working directory
|
|
2447
|
+
const currentDir = process.cwd();
|
|
2448
|
+
this.log.debug(`Current Working Directory: ${currentDir}`);
|
|
2449
|
+
// Command line arguments (excluding 'node' and the script name)
|
|
2450
|
+
const cmdArgs = process.argv.slice(2).join(' ');
|
|
2451
|
+
this.log.debug(`Command Line Arguments: ${cmdArgs}`);
|
|
2452
|
+
}
|
|
2453
|
+
/**
|
|
2454
|
+
* Retrieves the latest version of Matterbridge and performs necessary actions based on the version comparison.
|
|
2455
|
+
* @private
|
|
2456
|
+
* @returns {Promise<void>} A promise that resolves when the latest version is retrieved and actions are performed.
|
|
2457
|
+
*/
|
|
2458
|
+
async getMatterbridgeLatestVersion() {
|
|
2442
2459
|
this.getLatestVersion('matterbridge')
|
|
2443
2460
|
.then(async (matterbridgeLatestVersion) => {
|
|
2444
2461
|
this.matterbridgeLatestVersion = matterbridgeLatestVersion;
|
|
@@ -2450,14 +2467,34 @@ export class Matterbridge extends EventEmitter {
|
|
|
2450
2467
|
}
|
|
2451
2468
|
})
|
|
2452
2469
|
.catch((error) => {
|
|
2453
|
-
this.log.error(`Error getting Matterbridge latest version: ${error}`);
|
|
2470
|
+
this.log.error(`Error getting Matterbridge latest version: ${error.message}`);
|
|
2471
|
+
error.stack && this.log.debug(error.stack);
|
|
2472
|
+
});
|
|
2473
|
+
}
|
|
2474
|
+
/**
|
|
2475
|
+
* Retrieves the latest version of a plugin and updates the plugin's latestVersion property.
|
|
2476
|
+
* If the plugin's version is different from the latest version, logs a warning message.
|
|
2477
|
+
* If the plugin's version is the same as the latest version, logs an info message.
|
|
2478
|
+
* If there is an error retrieving the latest version, logs an error message.
|
|
2479
|
+
*
|
|
2480
|
+
* @private
|
|
2481
|
+
* @param {RegisteredPlugin} plugin - The plugin for which to retrieve the latest version.
|
|
2482
|
+
* @returns {Promise<void>} A promise that resolves when the latest version is retrieved and actions are performed.
|
|
2483
|
+
*/
|
|
2484
|
+
async getPluginLatestVersion(plugin) {
|
|
2485
|
+
this.getLatestVersion(plugin.name)
|
|
2486
|
+
.then(async (latestVersion) => {
|
|
2487
|
+
plugin.latestVersion = latestVersion;
|
|
2488
|
+
await this.nodeContext?.set('plugins', await this.getBaseRegisteredPlugins());
|
|
2489
|
+
if (plugin.version !== latestVersion)
|
|
2490
|
+
this.log.warn(`The plugin ${plg}${plugin.name}${wr} is out of date. Current version: ${plugin.version}, Latest version: ${latestVersion}`);
|
|
2491
|
+
else
|
|
2492
|
+
this.log.info(`The plugin ${plg}${plugin.name}${nf} is up to date. Current version: ${plugin.version}, Latest version: ${latestVersion}`);
|
|
2493
|
+
})
|
|
2494
|
+
.catch((error) => {
|
|
2495
|
+
this.log.error(`Error getting ${plugin.name} latest version: ${error.message}`);
|
|
2496
|
+
error.stack && this.log.debug(error.stack);
|
|
2454
2497
|
});
|
|
2455
|
-
// Current working directory
|
|
2456
|
-
const currentDir = process.cwd();
|
|
2457
|
-
this.log.debug(`Current Working Directory: ${currentDir}`);
|
|
2458
|
-
// Command line arguments (excluding 'node' and the script name)
|
|
2459
|
-
const cmdArgs = process.argv.slice(2).join(' ');
|
|
2460
|
-
this.log.debug(`Command Line Arguments: ${cmdArgs}`);
|
|
2461
2498
|
}
|
|
2462
2499
|
/**
|
|
2463
2500
|
* Retrieves an array of base registered plugins.
|