@matterbridge/core 3.6.2-dev-20260315-d23fd18 → 3.6.2-dev-20260316-21bfabd
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.
|
@@ -19,10 +19,8 @@ export function createNumberTemperatureControlClusterServer(endpoint, temperatur
|
|
|
19
19
|
}
|
|
20
20
|
export class MatterbridgeLevelTemperatureControlServer extends TemperatureControlServer.with(TemperatureControl.Feature.TemperatureLevel) {
|
|
21
21
|
initialize() {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
device.log.info(`MatterbridgeLevelTemperatureControlServer initialized with selectedTemperatureLevel ${this.state.selectedTemperatureLevel} and supportedTemperatureLevels: ${this.state.supportedTemperatureLevels.join(', ')}`);
|
|
25
|
-
}
|
|
22
|
+
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
23
|
+
device.log.info(`MatterbridgeLevelTemperatureControlServer initialized with selectedTemperatureLevel ${this.state.selectedTemperatureLevel} and supportedTemperatureLevels: ${this.state.supportedTemperatureLevels.join(', ')}`);
|
|
26
24
|
}
|
|
27
25
|
setTemperature(request) {
|
|
28
26
|
const device = this.endpoint.stateOf(MatterbridgeServer);
|
package/dist/frontend.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export declare class Frontend extends EventEmitter<FrontendEvents> {
|
|
|
22
22
|
private httpsServer;
|
|
23
23
|
private webSocketServer;
|
|
24
24
|
private readonly server;
|
|
25
|
+
private serverFetchTimeout;
|
|
25
26
|
private readonly debug;
|
|
26
27
|
private readonly verbose;
|
|
27
28
|
constructor(matterbridge: Matterbridge);
|
|
@@ -56,6 +57,7 @@ export declare class Frontend extends EventEmitter<FrontendEvents> {
|
|
|
56
57
|
wssSendCloseSnackbarMessage(message: string): void;
|
|
57
58
|
wssSendAttributeChangedMessage(plugin: string, serialNumber: string, uniqueId: string, number: EndpointNumber, id: string, cluster: string, attribute: string, value: number | string | boolean | null): void;
|
|
58
59
|
wssBroadcastMessage(msg: WsMessageBroadcast): void;
|
|
60
|
+
spawn(command: 'install' | 'uninstall', packageName: string): void;
|
|
59
61
|
zip(command: 'zip' | 'verify' | 'unzip', archivePath: string, sourcePaths: string[], destinationPath: string): void;
|
|
60
62
|
}
|
|
61
63
|
export {};
|
package/dist/frontend.js
CHANGED
|
@@ -32,6 +32,7 @@ export class Frontend extends EventEmitter {
|
|
|
32
32
|
httpsServer;
|
|
33
33
|
webSocketServer;
|
|
34
34
|
server;
|
|
35
|
+
serverFetchTimeout = 2000;
|
|
35
36
|
debug = hasParameter('debug') || hasParameter('verbose');
|
|
36
37
|
verbose = hasParameter('verbose');
|
|
37
38
|
constructor(matterbridge) {
|
|
@@ -1122,12 +1123,14 @@ export class Frontend extends EventEmitter {
|
|
|
1122
1123
|
}
|
|
1123
1124
|
return devices;
|
|
1124
1125
|
}
|
|
1125
|
-
getClusters(pluginName, endpointNumber) {
|
|
1126
|
+
getClusters(pluginName, endpointNumber, serialNumber, uniqueId) {
|
|
1126
1127
|
if (this.matterbridge.hasCleanupStarted)
|
|
1127
1128
|
return;
|
|
1128
|
-
const endpoint = this.matterbridge.devices
|
|
1129
|
+
const endpoint = this.matterbridge.devices
|
|
1130
|
+
.array()
|
|
1131
|
+
.find((d) => d.plugin === pluginName && d.maybeNumber === endpointNumber && (!serialNumber || d.serialNumber === serialNumber) && (!uniqueId || d.uniqueId === uniqueId));
|
|
1129
1132
|
if (!endpoint || !endpoint.plugin || !endpoint.maybeNumber || !endpoint.maybeId || !endpoint.deviceName || !endpoint.serialNumber) {
|
|
1130
|
-
this.log.error(`getClusters: no device found for plugin ${pluginName} and endpoint number ${endpointNumber}`);
|
|
1133
|
+
this.log.error(`getClusters: no device found for plugin ${pluginName} and endpoint number ${endpointNumber} (serial: ${serialNumber ?? 'N/A'}, uniqueId: ${uniqueId ?? 'N/A'})`);
|
|
1131
1134
|
return;
|
|
1132
1135
|
}
|
|
1133
1136
|
const deviceTypes = [];
|
|
@@ -1275,21 +1278,7 @@ export class Frontend extends EventEmitter {
|
|
|
1275
1278
|
else if (data.method === '/api/install') {
|
|
1276
1279
|
if (isValidString(data.params.packageName, 12) && isValidBoolean(data.params.restart)) {
|
|
1277
1280
|
this.wssSendSnackbarMessage(`Installing package ${data.params.packageName}...`, 0);
|
|
1278
|
-
this.
|
|
1279
|
-
type: 'manager_run',
|
|
1280
|
-
src: 'frontend',
|
|
1281
|
-
dst: 'manager',
|
|
1282
|
-
params: {
|
|
1283
|
-
name: 'SpawnCommand',
|
|
1284
|
-
workerData: {
|
|
1285
|
-
threadName: 'SpawnCommand',
|
|
1286
|
-
command: 'npm',
|
|
1287
|
-
args: ['install', '-g', data.params.packageName, '--omit=dev', '--verbose'],
|
|
1288
|
-
packageCommand: 'install',
|
|
1289
|
-
packageName: data.params.packageName,
|
|
1290
|
-
},
|
|
1291
|
-
},
|
|
1292
|
-
});
|
|
1281
|
+
this.spawn('install', data.params.packageName);
|
|
1293
1282
|
sendResponse({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, success: true });
|
|
1294
1283
|
}
|
|
1295
1284
|
else {
|
|
@@ -1299,21 +1288,7 @@ export class Frontend extends EventEmitter {
|
|
|
1299
1288
|
else if (data.method === '/api/uninstall') {
|
|
1300
1289
|
if (isValidString(data.params.packageName, 12)) {
|
|
1301
1290
|
this.wssSendSnackbarMessage(`Uninstalling package ${data.params.packageName}...`, 0);
|
|
1302
|
-
this.
|
|
1303
|
-
type: 'manager_run',
|
|
1304
|
-
src: 'frontend',
|
|
1305
|
-
dst: 'manager',
|
|
1306
|
-
params: {
|
|
1307
|
-
name: 'SpawnCommand',
|
|
1308
|
-
workerData: {
|
|
1309
|
-
threadName: 'SpawnCommand',
|
|
1310
|
-
command: 'npm',
|
|
1311
|
-
args: ['uninstall', '-g', data.params.packageName, '--omit=dev', '--verbose'],
|
|
1312
|
-
packageCommand: 'uninstall',
|
|
1313
|
-
packageName: data.params.packageName,
|
|
1314
|
-
},
|
|
1315
|
-
},
|
|
1316
|
-
});
|
|
1291
|
+
this.spawn('uninstall', data.params.packageName);
|
|
1317
1292
|
sendResponse({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, success: true });
|
|
1318
1293
|
}
|
|
1319
1294
|
else {
|
|
@@ -1327,26 +1302,24 @@ export class Frontend extends EventEmitter {
|
|
|
1327
1302
|
this.wssSendSnackbarMessage(`Plugin ${data.params.pluginNameOrPath} not added`, 10, 'error');
|
|
1328
1303
|
return;
|
|
1329
1304
|
}
|
|
1330
|
-
this.wssSendSnackbarMessage(`Adding plugin ${data.params.pluginNameOrPath}...`,
|
|
1305
|
+
this.wssSendSnackbarMessage(`Adding plugin ${data.params.pluginNameOrPath}...`, 0);
|
|
1331
1306
|
this.log.debug(`Adding plugin ${data.params.pluginNameOrPath}...`);
|
|
1332
1307
|
data.params.pluginNameOrPath = data.params.pluginNameOrPath.replace(/@.*$/, '');
|
|
1333
|
-
const plugin = await this.
|
|
1308
|
+
const plugin = (await this.server.fetch({ type: 'plugins_add', src: this.server.name, dst: 'plugins', params: { nameOrPath: data.params.pluginNameOrPath } }, this.serverFetchTimeout)).result.plugin;
|
|
1334
1309
|
if (plugin) {
|
|
1335
|
-
|
|
1310
|
+
this.wssSendCloseSnackbarMessage(`Adding plugin ${data.params.pluginNameOrPath}...`);
|
|
1336
1311
|
this.wssSendSnackbarMessage(`Added plugin ${data.params.pluginNameOrPath}`, 5, 'success');
|
|
1337
|
-
this.
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
return;
|
|
1344
|
-
})
|
|
1345
|
-
.catch((_error) => { });
|
|
1312
|
+
await this.server.fetch({ type: 'plugins_load', src: this.server.name, dst: 'plugins', params: { plugin: plugin.name } }, this.serverFetchTimeout);
|
|
1313
|
+
this.wssSendRestartRequired();
|
|
1314
|
+
this.wssSendRefreshRequired('plugins');
|
|
1315
|
+
this.wssSendRefreshRequired('devices');
|
|
1316
|
+
this.wssSendSnackbarMessage(`Loaded plugin ${localData.params.pluginNameOrPath}`, 5, 'success');
|
|
1317
|
+
sendResponse({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, success: true });
|
|
1346
1318
|
}
|
|
1347
1319
|
else {
|
|
1348
|
-
|
|
1320
|
+
this.wssSendCloseSnackbarMessage(`Adding plugin ${data.params.pluginNameOrPath}...`);
|
|
1349
1321
|
this.wssSendSnackbarMessage(`Plugin ${data.params.pluginNameOrPath} not added`, 10, 'error');
|
|
1322
|
+
sendResponse({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, error: `Plugin ${data.params.pluginNameOrPath} not added` });
|
|
1350
1323
|
}
|
|
1351
1324
|
}
|
|
1352
1325
|
else if (data.method === '/api/removeplugin') {
|
|
@@ -1354,11 +1327,17 @@ export class Frontend extends EventEmitter {
|
|
|
1354
1327
|
sendResponse({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, error: 'Wrong parameter pluginName in /api/removeplugin' });
|
|
1355
1328
|
return;
|
|
1356
1329
|
}
|
|
1357
|
-
this.wssSendSnackbarMessage(`Removing plugin ${data.params.pluginName}...`,
|
|
1330
|
+
this.wssSendSnackbarMessage(`Removing plugin ${data.params.pluginName}...`, 0);
|
|
1358
1331
|
this.log.debug(`Removing plugin ${data.params.pluginName}...`);
|
|
1359
|
-
const
|
|
1360
|
-
|
|
1361
|
-
|
|
1332
|
+
const devices = (await this.server.fetch({ type: 'devices_basearray', src: this.server.name, dst: 'devices', params: { pluginName: data.params.pluginName } }, this.serverFetchTimeout)).result.devices;
|
|
1333
|
+
for (const device of devices.filter((d) => d.mode === 'server')) {
|
|
1334
|
+
if (device.uniqueId)
|
|
1335
|
+
await this.server.fetch({ type: 'matterbridge_stop_device_server', src: this.server.name, dst: 'matterbridge', params: { deviceUniqueId: device.uniqueId } }, this.serverFetchTimeout);
|
|
1336
|
+
}
|
|
1337
|
+
await this.server.fetch({ type: 'plugins_shutdown', src: this.server.name, dst: 'plugins', params: { plugin: data.params.pluginName, reason: 'The plugin has been removed.', removeAllDevices: true, force: true } }, this.serverFetchTimeout);
|
|
1338
|
+
await this.server.fetch({ type: 'matterbridge_stop_plugin_server', src: this.server.name, dst: 'matterbridge', params: { pluginName: data.params.pluginName } }, this.serverFetchTimeout);
|
|
1339
|
+
await this.server.fetch({ type: 'plugins_remove', src: this.server.name, dst: 'plugins', params: { nameOrPath: data.params.pluginName } }, this.serverFetchTimeout);
|
|
1340
|
+
this.wssSendCloseSnackbarMessage(`Removing plugin ${data.params.pluginName}...`);
|
|
1362
1341
|
this.wssSendSnackbarMessage(`Removed plugin ${data.params.pluginName}`, 5, 'success');
|
|
1363
1342
|
this.wssSendRefreshRequired('plugins');
|
|
1364
1343
|
this.wssSendRefreshRequired('devices');
|
|
@@ -1370,44 +1349,35 @@ export class Frontend extends EventEmitter {
|
|
|
1370
1349
|
sendResponse({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, error: 'Wrong parameter pluginName in /api/enableplugin' });
|
|
1371
1350
|
return;
|
|
1372
1351
|
}
|
|
1373
|
-
|
|
1374
|
-
plugin.locked = undefined;
|
|
1375
|
-
plugin.error = undefined;
|
|
1376
|
-
plugin.loaded = undefined;
|
|
1377
|
-
plugin.started = undefined;
|
|
1378
|
-
plugin.configured = undefined;
|
|
1379
|
-
plugin.platform = undefined;
|
|
1380
|
-
plugin.registeredDevices = undefined;
|
|
1381
|
-
plugin.matter = undefined;
|
|
1382
|
-
await this.matterbridge.plugins.enable(data.params.pluginName);
|
|
1352
|
+
await this.server.fetch({ type: 'plugins_enable', src: this.server.name, dst: 'plugins', params: { nameOrPath: data.params.pluginName } }, this.serverFetchTimeout);
|
|
1383
1353
|
this.wssSendSnackbarMessage(`Enabled plugin ${data.params.pluginName}`, 5, 'success');
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1354
|
+
await this.server.fetch({ type: 'plugins_load', src: this.server.name, dst: 'plugins', params: { plugin: data.params.pluginName } }, this.serverFetchTimeout * 10);
|
|
1355
|
+
await this.server.fetch({ type: 'plugins_start', src: this.server.name, dst: 'plugins', params: { plugin: data.params.pluginName } }, this.serverFetchTimeout * 10);
|
|
1356
|
+
await this.server.fetch({ type: 'plugins_configure', src: this.server.name, dst: 'plugins', params: { plugin: data.params.pluginName } }, this.serverFetchTimeout * 10);
|
|
1357
|
+
await this.server.fetch({ type: 'matterbridge_start_plugin_server', src: this.server.name, dst: 'matterbridge', params: { pluginName: data.params.pluginName } }, this.serverFetchTimeout);
|
|
1358
|
+
const devices = (await this.server.fetch({ type: 'devices_basearray', src: this.server.name, dst: 'devices', params: { pluginName: data.params.pluginName } }, this.serverFetchTimeout)).result.devices;
|
|
1359
|
+
for (const device of devices.filter((d) => d.mode === 'server')) {
|
|
1360
|
+
if (device.uniqueId)
|
|
1361
|
+
await this.server.fetch({ type: 'matterbridge_start_device_server', src: this.server.name, dst: 'matterbridge', params: { deviceUniqueId: device.uniqueId } }, this.serverFetchTimeout);
|
|
1362
|
+
}
|
|
1363
|
+
this.wssSendSnackbarMessage(`Started plugin ${localData.params.pluginName}`, 5, 'success');
|
|
1364
|
+
this.wssSendRefreshRequired('plugins');
|
|
1365
|
+
this.wssSendRefreshRequired('devices');
|
|
1366
|
+
sendResponse({ id: localData.id, method: localData.method, src: 'Matterbridge', dst: localData.src, success: true });
|
|
1395
1367
|
}
|
|
1396
1368
|
else if (data.method === '/api/disableplugin') {
|
|
1397
1369
|
if (!isValidString(data.params.pluginName, 10) || !this.matterbridge.plugins.has(data.params.pluginName)) {
|
|
1398
1370
|
sendResponse({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, error: 'Wrong parameter pluginName in /api/disableplugin' });
|
|
1399
1371
|
return;
|
|
1400
1372
|
}
|
|
1401
|
-
const
|
|
1402
|
-
for (const device of
|
|
1403
|
-
|
|
1404
|
-
|
|
1373
|
+
const devices = (await this.server.fetch({ type: 'devices_basearray', src: this.server.name, dst: 'devices', params: { pluginName: data.params.pluginName } }, this.serverFetchTimeout)).result.devices;
|
|
1374
|
+
for (const device of devices.filter((d) => d.mode === 'server')) {
|
|
1375
|
+
if (device.uniqueId)
|
|
1376
|
+
await this.server.fetch({ type: 'matterbridge_stop_device_server', src: this.server.name, dst: 'matterbridge', params: { deviceUniqueId: device.uniqueId } }, this.serverFetchTimeout);
|
|
1405
1377
|
}
|
|
1406
|
-
await this.
|
|
1407
|
-
await this.
|
|
1408
|
-
|
|
1409
|
-
await this.matterbridge.stopServerNode(plugin.serverNode);
|
|
1410
|
-
plugin.serverNode = undefined;
|
|
1378
|
+
await this.server.fetch({ type: 'plugins_shutdown', src: this.server.name, dst: 'plugins', params: { plugin: data.params.pluginName, reason: 'The plugin has been disabled.', removeAllDevices: true, force: true } }, this.serverFetchTimeout * 10);
|
|
1379
|
+
await this.server.fetch({ type: 'matterbridge_stop_plugin_server', src: this.server.name, dst: 'matterbridge', params: { pluginName: data.params.pluginName } }, this.serverFetchTimeout);
|
|
1380
|
+
await this.server.fetch({ type: 'plugins_disable', src: this.server.name, dst: 'plugins', params: { nameOrPath: data.params.pluginName } }, this.serverFetchTimeout);
|
|
1411
1381
|
this.wssSendSnackbarMessage(`Disabled plugin ${data.params.pluginName}`, 5, 'success');
|
|
1412
1382
|
this.wssSendRefreshRequired('plugins');
|
|
1413
1383
|
this.wssSendRefreshRequired('devices');
|
|
@@ -1525,7 +1495,7 @@ export class Frontend extends EventEmitter {
|
|
|
1525
1495
|
else if (data.method === '/api/create-config-backup') {
|
|
1526
1496
|
this.wssSendSnackbarMessage('Creating config backup...', 0);
|
|
1527
1497
|
this.log.notice(`Creating config backup...`);
|
|
1528
|
-
const plugins = (await this.server.fetch({ type: 'plugins_storagepluginarray', src: this.server.name, dst: 'plugins' },
|
|
1498
|
+
const plugins = (await this.server.fetch({ type: 'plugins_storagepluginarray', src: this.server.name, dst: 'plugins' }, this.serverFetchTimeout)).result.plugins || [];
|
|
1529
1499
|
const pluginsPaths = plugins.map((p) => path.join(this.matterbridge.matterbridgeDirectory, p.name + '.config.json'));
|
|
1530
1500
|
this.zip('zip', path.join(os.tmpdir(), `matterbridge.pluginconfig.zip`), pluginsPaths, '');
|
|
1531
1501
|
sendResponse({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, success: true });
|
|
@@ -1624,7 +1594,7 @@ export class Frontend extends EventEmitter {
|
|
|
1624
1594
|
sendResponse({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, error: 'Wrong parameter endpoint in /api/clusters' });
|
|
1625
1595
|
return;
|
|
1626
1596
|
}
|
|
1627
|
-
const response = this.getClusters(data.params.plugin, data.params.endpoint);
|
|
1597
|
+
const response = this.getClusters(data.params.plugin, data.params.endpoint, data.params.serialNumber, data.params.uniqueId);
|
|
1628
1598
|
if (response) {
|
|
1629
1599
|
sendResponse({
|
|
1630
1600
|
id: data.id,
|
|
@@ -2152,6 +2122,23 @@ export class Frontend extends EventEmitter {
|
|
|
2152
2122
|
}
|
|
2153
2123
|
});
|
|
2154
2124
|
}
|
|
2125
|
+
spawn(command, packageName) {
|
|
2126
|
+
this.server.request({
|
|
2127
|
+
type: 'manager_run',
|
|
2128
|
+
src: 'frontend',
|
|
2129
|
+
dst: 'manager',
|
|
2130
|
+
params: {
|
|
2131
|
+
name: 'SpawnCommand',
|
|
2132
|
+
workerData: {
|
|
2133
|
+
threadName: 'SpawnCommand',
|
|
2134
|
+
command: 'npm',
|
|
2135
|
+
args: [command, '-g', packageName, '--omit=dev', '--verbose'],
|
|
2136
|
+
packageCommand: command,
|
|
2137
|
+
packageName: packageName,
|
|
2138
|
+
},
|
|
2139
|
+
},
|
|
2140
|
+
});
|
|
2141
|
+
}
|
|
2155
2142
|
zip(command, archivePath, sourcePaths, destinationPath) {
|
|
2156
2143
|
this.server.request({
|
|
2157
2144
|
type: 'manager_run',
|
package/dist/matterbridge.js
CHANGED
|
@@ -238,6 +238,42 @@ export class Matterbridge extends EventEmitter {
|
|
|
238
238
|
case 'matterbridge_shared':
|
|
239
239
|
this.server.respond({ ...msg, result: { data: this.getSharedMatterbridge(), success: true } });
|
|
240
240
|
break;
|
|
241
|
+
case 'matterbridge_start_plugin_server':
|
|
242
|
+
{
|
|
243
|
+
const plugin = this.plugins.get(msg.params.pluginName);
|
|
244
|
+
if (plugin && plugin.serverNode)
|
|
245
|
+
await this.startServerNode(plugin.serverNode);
|
|
246
|
+
this.server.respond({ ...msg, result: { success: true } });
|
|
247
|
+
}
|
|
248
|
+
break;
|
|
249
|
+
case 'matterbridge_stop_plugin_server':
|
|
250
|
+
{
|
|
251
|
+
const plugin = this.plugins.get(msg.params.pluginName);
|
|
252
|
+
if (plugin && plugin.serverNode)
|
|
253
|
+
await this.stopServerNode(plugin.serverNode);
|
|
254
|
+
if (plugin && plugin.serverNode)
|
|
255
|
+
plugin.serverNode = undefined;
|
|
256
|
+
this.server.respond({ ...msg, result: { success: true } });
|
|
257
|
+
}
|
|
258
|
+
break;
|
|
259
|
+
case 'matterbridge_start_device_server':
|
|
260
|
+
{
|
|
261
|
+
const device = this.devices.get(msg.params.deviceUniqueId);
|
|
262
|
+
if (device && device.serverNode)
|
|
263
|
+
await this.startServerNode(device.serverNode);
|
|
264
|
+
this.server.respond({ ...msg, result: { success: true } });
|
|
265
|
+
}
|
|
266
|
+
break;
|
|
267
|
+
case 'matterbridge_stop_device_server':
|
|
268
|
+
{
|
|
269
|
+
const device = this.devices.get(msg.params.deviceUniqueId);
|
|
270
|
+
if (device && device.serverNode)
|
|
271
|
+
await this.stopServerNode(device.serverNode);
|
|
272
|
+
if (device && device.serverNode)
|
|
273
|
+
device.serverNode = undefined;
|
|
274
|
+
this.server.respond({ ...msg, result: { success: true } });
|
|
275
|
+
}
|
|
276
|
+
break;
|
|
241
277
|
default:
|
|
242
278
|
if (this.verbose)
|
|
243
279
|
this.log.debug(`Unknown broadcast request ${CYAN}${msg.type}${db} from ${CYAN}${msg.src}${db}`);
|
|
@@ -25,6 +25,13 @@ import { Semtag } from '@matter/types/globals';
|
|
|
25
25
|
import { AnsiLogger, LogLevel } from 'node-ansi-logger';
|
|
26
26
|
import { DeviceTypeDefinition } from './matterbridgeDeviceTypes.js';
|
|
27
27
|
import { CommandHandlerFunction, MatterbridgeEndpointCommands, MatterbridgeEndpointOptions, SerializedMatterbridgeEndpoint } from './matterbridgeEndpointTypes.js';
|
|
28
|
+
type BehaviorCommandName<T extends Behavior.Type> = {
|
|
29
|
+
[K in keyof CommandsOfBehavior<T>]: K;
|
|
30
|
+
}[keyof CommandsOfBehavior<T>] & string;
|
|
31
|
+
type CommandsOfBehavior<T extends Behavior.Type> = {
|
|
32
|
+
[K in keyof InstanceType<T> as InstanceType<T>[K] extends (...args: infer _P) => infer _R ? K : never]: InstanceType<T>[K] extends (...args: infer P) => infer R ? (input: P[0], context?: ActionContext) => Promise<Awaited<R>> : never;
|
|
33
|
+
};
|
|
34
|
+
type BehaviorCommandParams<T extends Behavior.Type, C extends BehaviorCommandName<T>> = CommandsOfBehavior<T>[C] extends (input: infer P, context?: ActionContext) => Promise<unknown> ? P : never;
|
|
28
35
|
export declare function isMatterbridgeEndpoint(value: unknown): value is MatterbridgeEndpoint;
|
|
29
36
|
export declare function assertMatterbridgeEndpoint(value: unknown, context?: string): asserts value is MatterbridgeEndpoint;
|
|
30
37
|
export declare class MatterbridgeEndpoint extends Endpoint {
|
|
@@ -74,11 +81,7 @@ export declare class MatterbridgeEndpoint extends Endpoint {
|
|
|
74
81
|
addUserLabel(label: string, value: string): Promise<this>;
|
|
75
82
|
addCommandHandler(command: keyof MatterbridgeEndpointCommands, handler: CommandHandlerFunction): this;
|
|
76
83
|
executeCommandHandler(command: keyof MatterbridgeEndpointCommands, request?: Record<string, boolean | number | bigint | string | object | null>, cluster?: string, attributes?: Record<string, boolean | number | bigint | string | object | null>, endpoint?: MatterbridgeEndpoint): Promise<void>;
|
|
77
|
-
invokeBehaviorCommand<T extends Behavior.Type, C extends
|
|
78
|
-
[K in keyof InstanceType<T> as InstanceType<T>[K] extends (...args: unknown[]) => unknown ? K : never]: InstanceType<T>[K];
|
|
79
|
-
}>(cluster: T, command: C, params?: {
|
|
80
|
-
[K in keyof InstanceType<T> as InstanceType<T>[K] extends (...args: unknown[]) => unknown ? K : never]: InstanceType<T>[K];
|
|
81
|
-
}[C] extends (...args: infer P) => unknown ? P[0] : never): Promise<void>;
|
|
84
|
+
invokeBehaviorCommand<T extends Behavior.Type, C extends BehaviorCommandName<T>>(cluster: T, command: C, params?: BehaviorCommandParams<T, C>): Promise<void>;
|
|
82
85
|
invokeBehaviorCommand<T extends ClusterType, C extends keyof ClusterType.CommandsOf<T>>(cluster: T, command: C, params?: ClusterType.CommandsOf<T>[C] extends {
|
|
83
86
|
requestSchema: infer S extends import('@matter/types/tlv').TlvSchema<unknown>;
|
|
84
87
|
} ? import('@matter/types/tlv').TypeFromSchema<S> : never): Promise<void>;
|
|
@@ -191,3 +194,4 @@ export declare class MatterbridgeEndpoint extends Endpoint {
|
|
|
191
194
|
createDefaultRadonConcentrationMeasurementClusterServer(measuredValue?: number | null, measurementUnit?: ConcentrationMeasurement.MeasurementUnit, measurementMedium?: ConcentrationMeasurement.MeasurementMedium): this;
|
|
192
195
|
createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue?: number | null, measurementUnit?: ConcentrationMeasurement.MeasurementUnit, measurementMedium?: ConcentrationMeasurement.MeasurementMedium): this;
|
|
193
196
|
}
|
|
197
|
+
export {};
|
package/dist/pluginManager.js
CHANGED
|
@@ -132,10 +132,10 @@ export class PluginManager extends EventEmitter {
|
|
|
132
132
|
{
|
|
133
133
|
const plugin = await this.remove(msg.params.nameOrPath);
|
|
134
134
|
if (plugin) {
|
|
135
|
-
this.server.respond({ ...msg, result: {
|
|
135
|
+
this.server.respond({ ...msg, result: { success: true } });
|
|
136
136
|
}
|
|
137
137
|
else {
|
|
138
|
-
this.server.respond({ ...msg, result: {
|
|
138
|
+
this.server.respond({ ...msg, result: { success: false } });
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
break;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matterbridge/core",
|
|
3
|
-
"version": "3.6.2-dev-
|
|
3
|
+
"version": "3.6.2-dev-20260316-21bfabd",
|
|
4
4
|
"description": "Matterbridge core library",
|
|
5
5
|
"author": "https://github.com/Luligu",
|
|
6
6
|
"homepage": "https://matterbridge.io/",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
}
|
|
113
113
|
},
|
|
114
114
|
"engines": {
|
|
115
|
-
"node": ">=20.
|
|
115
|
+
"node": ">=20.19.0 <21.0.0 || >=22.13.0 <23.0.0 || >=24.0.0 <25.0.0"
|
|
116
116
|
},
|
|
117
117
|
"files": [
|
|
118
118
|
"bin",
|
|
@@ -122,10 +122,10 @@
|
|
|
122
122
|
],
|
|
123
123
|
"dependencies": {
|
|
124
124
|
"@matter/main": "0.16.10",
|
|
125
|
-
"@matterbridge/dgram": "3.6.2-dev-
|
|
126
|
-
"@matterbridge/thread": "3.6.2-dev-
|
|
127
|
-
"@matterbridge/types": "3.6.2-dev-
|
|
128
|
-
"@matterbridge/utils": "3.6.2-dev-
|
|
125
|
+
"@matterbridge/dgram": "3.6.2-dev-20260316-21bfabd",
|
|
126
|
+
"@matterbridge/thread": "3.6.2-dev-20260316-21bfabd",
|
|
127
|
+
"@matterbridge/types": "3.6.2-dev-20260316-21bfabd",
|
|
128
|
+
"@matterbridge/utils": "3.6.2-dev-20260316-21bfabd",
|
|
129
129
|
"express": "5.2.1",
|
|
130
130
|
"multer": "2.1.1",
|
|
131
131
|
"node-ansi-logger": "3.2.0",
|