matterbridge 1.2.12 → 1.2.13
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 +16 -0
- package/README.md +6 -1
- package/dist/BridgedDeviceBasicInformationCluster.d.ts +223 -0
- package/dist/BridgedDeviceBasicInformationCluster.d.ts.map +1 -0
- package/dist/BridgedDeviceBasicInformationCluster.js +176 -0
- package/dist/BridgedDeviceBasicInformationCluster.js.map +1 -0
- package/dist/matterbridge.d.ts.map +1 -1
- package/dist/matterbridge.js +53 -11
- package/dist/matterbridge.js.map +1 -1
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +1 -1
- package/dist/matterbridgeAccessoryPlatform.js.map +1 -1
- package/dist/matterbridgeDevice.d.ts +50 -13
- package/dist/matterbridgeDevice.d.ts.map +1 -1
- package/dist/matterbridgeDevice.js +5 -1
- package/dist/matterbridgeDevice.js.map +1 -1
- package/dist/matterbridgePlatform.d.ts +1 -0
- package/dist/matterbridgePlatform.d.ts.map +1 -1
- package/dist/matterbridgePlatform.js +1 -0
- package/dist/matterbridgePlatform.js.map +1 -1
- package/frontend/build/asset-manifest.json +6 -6
- package/frontend/build/index.html +1 -1
- package/frontend/build/static/css/main.979e07d2.css +2 -0
- package/frontend/build/static/css/main.979e07d2.css.map +1 -0
- package/frontend/build/static/js/main.742e4290.js +3 -0
- package/frontend/build/static/js/{main.0c70c26b.js.LICENSE.txt → main.742e4290.js.LICENSE.txt} +0 -2
- package/frontend/build/static/js/main.742e4290.js.map +1 -0
- package/package.json +2 -2
- package/frontend/build/static/css/main.1880392b.css +0 -2
- package/frontend/build/static/css/main.1880392b.css.map +0 -1
- package/frontend/build/static/js/main.0c70c26b.js +0 -3
- package/frontend/build/static/js/main.0c70c26b.js.map +0 -1
package/dist/matterbridge.js
CHANGED
|
@@ -32,8 +32,9 @@ import express from 'express';
|
|
|
32
32
|
import os from 'os';
|
|
33
33
|
import path from 'path';
|
|
34
34
|
import WebSocket, { WebSocketServer } from 'ws';
|
|
35
|
+
import { BridgedDeviceBasicInformation, BridgedDeviceBasicInformationCluster } from './BridgedDeviceBasicInformationCluster.js';
|
|
35
36
|
import { CommissioningController, CommissioningServer, MatterServer } from '@project-chip/matter-node.js';
|
|
36
|
-
import { BasicInformationCluster, BooleanStateCluster,
|
|
37
|
+
import { BasicInformationCluster, BooleanStateCluster, ClusterServer, FixedLabelCluster, GeneralCommissioning, GeneralDiagnostics, GeneralDiagnosticsCluster, PowerSourceCluster, ThreadNetworkDiagnosticsCluster, getClusterNameById, } from '@project-chip/matter-node.js/cluster';
|
|
37
38
|
import { DeviceTypeId, VendorId } from '@project-chip/matter-node.js/datatype';
|
|
38
39
|
import { Aggregator, DeviceTypes, NodeStateInformation } from '@project-chip/matter-node.js/device';
|
|
39
40
|
import { Format, Level, Logger } from '@project-chip/matter-node.js/log';
|
|
@@ -655,7 +656,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
655
656
|
if (plugin.platform) {
|
|
656
657
|
try {
|
|
657
658
|
await plugin.platform.onShutdown('Matterbridge is closing: ' + message);
|
|
658
|
-
await this.savePluginConfig(plugin);
|
|
659
|
+
// await this.savePluginConfig(plugin);
|
|
659
660
|
}
|
|
660
661
|
catch (error) {
|
|
661
662
|
this.log.error(`Plugin ${plg}${plugin.name}${er} shutting down error: ${error}`);
|
|
@@ -1266,6 +1267,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
1266
1267
|
.then(() => {
|
|
1267
1268
|
plugin.configured = true;
|
|
1268
1269
|
this.log.info(`Configured plugin ${plg}${plugin.name}${db} type ${typ}${plugin.type}${db}`);
|
|
1270
|
+
this.savePluginConfig(plugin);
|
|
1269
1271
|
return Promise.resolve();
|
|
1270
1272
|
})
|
|
1271
1273
|
.catch((err) => {
|
|
@@ -1297,7 +1299,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
1297
1299
|
this.log.error(`Plugin ${plg}${plugin.name}${er} already loaded`);
|
|
1298
1300
|
return Promise.resolve(plugin.platform);
|
|
1299
1301
|
}
|
|
1300
|
-
this.log.info(`Loading plugin ${plg}${plugin.name}${
|
|
1302
|
+
this.log.info(`Loading plugin ${plg}${plugin.name}${nf} type ${typ}${plugin.type}${nf}`);
|
|
1301
1303
|
try {
|
|
1302
1304
|
// Load the package.json of the plugin
|
|
1303
1305
|
const packageJson = JSON.parse(await fs.readFile(plugin.path, 'utf8'));
|
|
@@ -1316,6 +1318,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
1316
1318
|
const platform = pluginInstance.default(this, log, config);
|
|
1317
1319
|
platform.name = packageJson.name;
|
|
1318
1320
|
platform.config = config;
|
|
1321
|
+
platform.version = packageJson.version;
|
|
1319
1322
|
plugin.name = packageJson.name;
|
|
1320
1323
|
plugin.description = packageJson.description;
|
|
1321
1324
|
plugin.version = packageJson.version;
|
|
@@ -1326,7 +1329,19 @@ export class Matterbridge extends EventEmitter {
|
|
|
1326
1329
|
plugin.registeredDevices = 0;
|
|
1327
1330
|
plugin.addedDevices = 0;
|
|
1328
1331
|
await this.nodeContext?.set('plugins', this.getBaseRegisteredPlugins());
|
|
1329
|
-
this.
|
|
1332
|
+
this.getLatestVersion(plugin.name)
|
|
1333
|
+
.then(async (latestVersion) => {
|
|
1334
|
+
plugin.latestVersion = latestVersion;
|
|
1335
|
+
await this.nodeContext?.set('plugins', this.getBaseRegisteredPlugins());
|
|
1336
|
+
if (plugin.version !== latestVersion)
|
|
1337
|
+
this.log.warn(`The plugin ${plg}${plugin.name}${wr} is out of date. Current version: ${plugin.version}, Latest version: ${latestVersion}`);
|
|
1338
|
+
else
|
|
1339
|
+
this.log.info(`The plugin ${plg}${plugin.name}${nf} is up to date. Current version: ${plugin.version}, Latest version: ${latestVersion}`);
|
|
1340
|
+
})
|
|
1341
|
+
.catch((error) => {
|
|
1342
|
+
this.log.error(`Error getting ${plugin.name} latest version: ${error}`);
|
|
1343
|
+
});
|
|
1344
|
+
this.log.info(`Loaded plugin ${plg}${plugin.name}${nf} type ${typ}${platform.type} ${db}(entrypoint ${UNDERLINE}${pluginEntry}${UNDERLINEOFF})`);
|
|
1330
1345
|
if (start)
|
|
1331
1346
|
this.startPlugin(plugin, message); // No await do it asyncronously
|
|
1332
1347
|
return Promise.resolve(platform);
|
|
@@ -1568,6 +1583,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
1568
1583
|
await this.startMatterServer();
|
|
1569
1584
|
this.log.info('Matter server started');
|
|
1570
1585
|
await this.showCommissioningQRCode(this.commissioningServer, this.matterbridgeContext, this.nodeContext, 'Matterbridge');
|
|
1586
|
+
// logEndpoint(this.commissioningServer.getRootEndpoint());
|
|
1571
1587
|
//if (hasParameter('advertise')) await this.commissioningServer.advertise();
|
|
1572
1588
|
setTimeout(() => {
|
|
1573
1589
|
this.log.info(`Setting reachability to true for ${plg}Matterbridge${db}`);
|
|
@@ -1773,14 +1789,14 @@ export class Matterbridge extends EventEmitter {
|
|
|
1773
1789
|
if (!commissioningServer || !storageContext || !pluginName)
|
|
1774
1790
|
return;
|
|
1775
1791
|
if (!commissioningServer.isCommissioned()) {
|
|
1776
|
-
this.log.info(`***The commissioning server on port ${commissioningServer.getPort()} for ${plg}${pluginName}${nf} is not commissioned. Pair it scanning the QR code ...`);
|
|
1777
1792
|
const { qrPairingCode, manualPairingCode } = commissioningServer.getPairingCode();
|
|
1778
1793
|
await storageContext.set('qrPairingCode', qrPairingCode);
|
|
1779
1794
|
await storageContext.set('manualPairingCode', manualPairingCode);
|
|
1780
1795
|
await nodeContext.set('qrPairingCode', qrPairingCode);
|
|
1781
1796
|
await nodeContext.set('manualPairingCode', manualPairingCode);
|
|
1782
1797
|
const QrCode = new QrCodeSchema();
|
|
1783
|
-
this.log.info(
|
|
1798
|
+
this.log.info(`***The commissioning server on port ${commissioningServer.getPort()} for ${plg}${pluginName}${nf} is not commissioned. Pair it scanning the QR code:\n\n` +
|
|
1799
|
+
`${QrCode.encode(qrPairingCode)}\n${plg}${pluginName}${nf}\n\nqrPairingCode: ${qrPairingCode}\n\nManual pairing code: ${manualPairingCode}\n`);
|
|
1784
1800
|
if (pluginName !== 'Matterbridge') {
|
|
1785
1801
|
const plugin = this.findPlugin(pluginName);
|
|
1786
1802
|
if (plugin) {
|
|
@@ -1875,6 +1891,9 @@ export class Matterbridge extends EventEmitter {
|
|
|
1875
1891
|
case 4937:
|
|
1876
1892
|
vendorName = '(AppleHome)';
|
|
1877
1893
|
break;
|
|
1894
|
+
case 4996:
|
|
1895
|
+
vendorName = '(AppleKeyChain)';
|
|
1896
|
+
break;
|
|
1878
1897
|
case 4362:
|
|
1879
1898
|
vendorName = '(SmartThings)';
|
|
1880
1899
|
break;
|
|
@@ -1996,7 +2015,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
1996
2015
|
}
|
|
1997
2016
|
Logger.defaultLogLevel = this.debugEnabled ? Level.DEBUG : Level.INFO;
|
|
1998
2017
|
}
|
|
1999
|
-
//logEndpoint(commissioningServer.getRootEndpoint());
|
|
2018
|
+
// logEndpoint(commissioningServer.getRootEndpoint());
|
|
2000
2019
|
}, 2000);
|
|
2001
2020
|
}
|
|
2002
2021
|
},
|
|
@@ -2023,6 +2042,23 @@ export class Matterbridge extends EventEmitter {
|
|
|
2023
2042
|
}
|
|
2024
2043
|
},
|
|
2025
2044
|
});
|
|
2045
|
+
const gdcCluster = commissioningServer.getRootClusterServer(GeneralDiagnosticsCluster);
|
|
2046
|
+
if (gdcCluster) {
|
|
2047
|
+
gdcCluster.setNetworkInterfacesAttribute([
|
|
2048
|
+
{
|
|
2049
|
+
name: 'eth0',
|
|
2050
|
+
isOperational: true,
|
|
2051
|
+
offPremiseServicesReachableIPv4: null,
|
|
2052
|
+
offPremiseServicesReachableIPv6: null,
|
|
2053
|
+
hardwareAddress: Uint8Array.fromString('00000000'),
|
|
2054
|
+
iPv4Addresses: [Uint8Array.fromString('0000')],
|
|
2055
|
+
iPv6Addresses: [Uint8Array.fromString('0000000000000000')],
|
|
2056
|
+
type: GeneralDiagnostics.InterfaceType.Ethernet,
|
|
2057
|
+
},
|
|
2058
|
+
]);
|
|
2059
|
+
}
|
|
2060
|
+
else
|
|
2061
|
+
this.log.warn(`*GeneralDiagnosticsCluster not found for ${plg}${pluginName}${wr}`);
|
|
2026
2062
|
commissioningServer.addCommandHandler('testEventTrigger', async ({ request: { enableKey, eventTrigger } }) => this.log.info(`testEventTrigger called on GeneralDiagnostic cluster: ${enableKey} ${eventTrigger}`));
|
|
2027
2063
|
return commissioningServer;
|
|
2028
2064
|
}
|
|
@@ -2049,7 +2085,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
2049
2085
|
const matterAggregator = new Aggregator();
|
|
2050
2086
|
matterAggregator.addClusterServer(ClusterServer(BasicInformationCluster, {
|
|
2051
2087
|
dataModelRevision: 1,
|
|
2052
|
-
location: '
|
|
2088
|
+
location: 'FR',
|
|
2053
2089
|
vendorId: VendorId(0xfff1),
|
|
2054
2090
|
vendorName: 'Matterbridge',
|
|
2055
2091
|
productId: 0x8000,
|
|
@@ -2286,6 +2322,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
2286
2322
|
type: plugin.type,
|
|
2287
2323
|
name: plugin.name,
|
|
2288
2324
|
version: plugin.version,
|
|
2325
|
+
latestVersion: plugin.latestVersion,
|
|
2289
2326
|
description: plugin.description,
|
|
2290
2327
|
author: plugin.author,
|
|
2291
2328
|
enabled: plugin.enabled,
|
|
@@ -2657,6 +2694,11 @@ export class Matterbridge extends EventEmitter {
|
|
|
2657
2694
|
this.debugEnabled = false;
|
|
2658
2695
|
Logger.defaultLogLevel = Level.WARN;
|
|
2659
2696
|
}
|
|
2697
|
+
else if (param === 'Error') {
|
|
2698
|
+
this.log.setLogDebug(false);
|
|
2699
|
+
this.debugEnabled = false;
|
|
2700
|
+
Logger.defaultLogLevel = Level.ERROR;
|
|
2701
|
+
}
|
|
2660
2702
|
this.registeredPlugins.forEach((plugin) => {
|
|
2661
2703
|
plugin.platform?.log.setLogDebug(this.debugEnabled);
|
|
2662
2704
|
});
|
|
@@ -2710,7 +2752,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
2710
2752
|
}
|
|
2711
2753
|
}
|
|
2712
2754
|
// Handle the command addplugin from Home
|
|
2713
|
-
if (command === 'addplugin') {
|
|
2755
|
+
if (command === 'addplugin' || command === 'installplugin') {
|
|
2714
2756
|
param = param.replace(/\*/g, '\\');
|
|
2715
2757
|
if (this.registeredPlugins.find((plugin) => plugin.name === param)) {
|
|
2716
2758
|
this.log.warn(`Plugin ${plg}${param}${wr} already added to matterbridge`);
|
|
@@ -2749,7 +2791,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
2749
2791
|
if (index !== -1) {
|
|
2750
2792
|
if (this.registeredPlugins[index].platform) {
|
|
2751
2793
|
await this.registeredPlugins[index].platform?.onShutdown('The plugin has been removed.');
|
|
2752
|
-
await this.savePluginConfig(this.registeredPlugins[index]);
|
|
2794
|
+
// await this.savePluginConfig(this.registeredPlugins[index]);
|
|
2753
2795
|
}
|
|
2754
2796
|
this.registeredPlugins.splice(index, 1);
|
|
2755
2797
|
await this.nodeContext?.set('plugins', this.getBaseRegisteredPlugins());
|
|
@@ -2799,7 +2841,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
2799
2841
|
if (pluginToDisable) {
|
|
2800
2842
|
if (pluginToDisable.platform) {
|
|
2801
2843
|
await pluginToDisable.platform.onShutdown('The plugin has been removed.');
|
|
2802
|
-
await this.savePluginConfig(pluginToDisable);
|
|
2844
|
+
// await this.savePluginConfig(pluginToDisable);
|
|
2803
2845
|
}
|
|
2804
2846
|
pluginToDisable.enabled = false;
|
|
2805
2847
|
pluginToDisable.error = undefined;
|