matterbridge 1.3.28 → 1.4.1
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 +19 -3
- package/README.md +7 -4
- package/dist/deviceManager.d.ts +46 -0
- package/dist/deviceManager.d.ts.map +1 -0
- package/dist/deviceManager.js +92 -0
- package/dist/deviceManager.js.map +1 -0
- package/dist/matterbridge.d.ts +18 -76
- package/dist/matterbridge.d.ts.map +1 -1
- package/dist/matterbridge.js +218 -440
- package/dist/matterbridge.js.map +1 -1
- package/dist/matterbridgeDevice.d.ts +18 -5
- package/dist/matterbridgeDevice.d.ts.map +1 -1
- package/dist/matterbridgeDevice.js +9 -5
- package/dist/matterbridgeDevice.js.map +1 -1
- package/dist/matterbridgePlatform.d.ts +6 -1
- package/dist/matterbridgePlatform.d.ts.map +1 -1
- package/dist/matterbridgePlatform.js +8 -0
- package/dist/matterbridgePlatform.js.map +1 -1
- package/dist/matterbridgeTypes.d.ts +28 -1
- package/dist/matterbridgeTypes.d.ts.map +1 -1
- package/dist/matterbridgeTypes.js +26 -1
- package/dist/matterbridgeTypes.js.map +1 -1
- package/dist/{plugins.d.ts → pluginManager.d.ts} +6 -3
- package/dist/pluginManager.d.ts.map +1 -0
- package/dist/{plugins.js → pluginManager.js} +26 -16
- package/dist/pluginManager.js.map +1 -0
- package/frontend/build/asset-manifest.json +6 -6
- package/frontend/build/index.html +1 -1
- package/frontend/build/static/css/{main.df840158.css → main.5174e68c.css} +2 -2
- package/frontend/build/static/css/{main.df840158.css.map → main.5174e68c.css.map} +1 -1
- package/frontend/build/static/js/{main.2a46688a.js → main.fd6f85a1.js} +3 -3
- package/frontend/build/static/js/main.fd6f85a1.js.map +1 -0
- package/package.json +12 -11
- package/dist/plugins.d.ts.map +0 -1
- package/dist/plugins.js.map +0 -1
- package/frontend/build/static/js/main.2a46688a.js.map +0 -1
- /package/frontend/build/static/js/{main.2a46688a.js.LICENSE.txt → main.fd6f85a1.js.LICENSE.txt} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
If you like this project and find it useful, please consider giving it a star on GitHub at https://github.com/Luligu/matterbridge and sponsoring it.
|
|
6
6
|
|
|
7
|
+
## [1.4.1] - 2024-07-28
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- [matterbridge]: Added logger levels: debug, info, notice, warn, error, fatal (parameter -logger with default info)
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- [package]: Update dependencies.
|
|
16
|
+
- [logger]: Update node-ansi-logger to 2.0.6.
|
|
17
|
+
- [storage]: Update node-persist-manager to 1.0.8.
|
|
18
|
+
- [matter]: Update matter.js to 0.9.4.
|
|
19
|
+
|
|
20
|
+
<a href="https://www.buymeacoffee.com/luligugithub">
|
|
21
|
+
<img src="./yellow-button.png" alt="Buy me a coffee" width="120">
|
|
22
|
+
</a>
|
|
23
|
+
|
|
7
24
|
## [1.4.0] - 2024-07-23
|
|
8
25
|
|
|
9
26
|
### Added
|
|
@@ -11,15 +28,14 @@ If you like this project and find it useful, please consider giving it a star on
|
|
|
11
28
|
### Changed
|
|
12
29
|
|
|
13
30
|
- [package]: Update dependencies.
|
|
14
|
-
- [matterbridge]: Added PluginsManager.
|
|
15
|
-
- [matterbridge]: Removed timeout on cleanup
|
|
31
|
+
- [matterbridge]: Added PluginsManager.ts.
|
|
32
|
+
- [matterbridge]: Removed timeout on cleanup.
|
|
16
33
|
- [matterbridge]: Removed write cache and expired interval for node storage.
|
|
17
34
|
- [matterbridge]: Added matterbridgeTypes.ts
|
|
18
35
|
- [frontend]: The frontend reconnects to WebSocket when the connection is closed.
|
|
19
36
|
- [frontend]: Removed QR button for plugins in error and not enabled.
|
|
20
37
|
- [frontend]: The Logs page and the log in the Home page persist till you close or reload the frontend (the last 1000 lines are available).
|
|
21
38
|
|
|
22
|
-
|
|
23
39
|
### Fixed
|
|
24
40
|
|
|
25
41
|
- [matterbridge]: Fixed utils export
|
package/README.md
CHANGED
|
@@ -64,7 +64,7 @@ Test the installation with:
|
|
|
64
64
|
matterbridge -bridge
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
Now it is possible to open the frontend at the link provided (default: http://localhost:8283)
|
|
67
|
+
Now it is possible to open the frontend at the link provided in the log (default: http://localhost:8283)
|
|
68
68
|
|
|
69
69
|
## Usage
|
|
70
70
|
|
|
@@ -94,7 +94,7 @@ matterbridge -help
|
|
|
94
94
|
|
|
95
95
|
Matterbridge has a frontend available on http://localhost:8283
|
|
96
96
|
|
|
97
|
-
You can change the default port by adding the frontend parameter when you
|
|
97
|
+
You can change the default port by adding the frontend parameter when you run it.
|
|
98
98
|
|
|
99
99
|
Here's how to specify a different port number:
|
|
100
100
|
|
|
@@ -357,6 +357,8 @@ sudo nano /etc/systemd/system/matterbridge.service
|
|
|
357
357
|
|
|
358
358
|
Add the following to this file, replacing twice (!) USER with your user name (e.g. WorkingDirectory=/home/pi/Matterbridge and User=pi):
|
|
359
359
|
|
|
360
|
+
ExecStart on some linux distribution can also be ExecStart==/usr/bin/matterbridge -bridge -service
|
|
361
|
+
|
|
360
362
|
```
|
|
361
363
|
[Unit]
|
|
362
364
|
Description=matterbridge
|
|
@@ -364,7 +366,7 @@ After=network-online.target
|
|
|
364
366
|
|
|
365
367
|
[Service]
|
|
366
368
|
Type=simple
|
|
367
|
-
ExecStart
|
|
369
|
+
ExecStart=matterbridge -bridge -service
|
|
368
370
|
WorkingDirectory=/home/<USER>/Matterbridge
|
|
369
371
|
StandardOutput=inherit
|
|
370
372
|
StandardError=inherit
|
|
@@ -377,6 +379,7 @@ User=<USER>
|
|
|
377
379
|
WantedBy=multi-user.target
|
|
378
380
|
```
|
|
379
381
|
|
|
382
|
+
|
|
380
383
|
If you modify it after, then run:
|
|
381
384
|
|
|
382
385
|
```
|
|
@@ -425,7 +428,7 @@ sudo systemctl enable matterbridge.service
|
|
|
425
428
|
sudo systemctl disable matterbridge.service
|
|
426
429
|
```
|
|
427
430
|
|
|
428
|
-
## Run matterbridge with docker
|
|
431
|
+
## Run matterbridge with docker
|
|
429
432
|
|
|
430
433
|
The Matterbridge Docker image, which includes a manifest list for the linux/amd64, linux/arm64 and linux/arm/v7 architectures, is published on Docker Hub.
|
|
431
434
|
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains the DeviceManager class.
|
|
3
|
+
*
|
|
4
|
+
* @file devices.ts
|
|
5
|
+
* @author Luca Liguori
|
|
6
|
+
* @date 2024-07-26
|
|
7
|
+
* @version 1.0.8
|
|
8
|
+
*
|
|
9
|
+
* Copyright 2024, 2025 Luca Liguori.
|
|
10
|
+
*
|
|
11
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
+
* you may not use this file except in compliance with the License.
|
|
13
|
+
* You may obtain a copy of the License at
|
|
14
|
+
*
|
|
15
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
+
* See the License for the specific language governing permissions and
|
|
21
|
+
* limitations under the License. *
|
|
22
|
+
*/
|
|
23
|
+
import { LogLevel } from 'node-ansi-logger';
|
|
24
|
+
import { Matterbridge } from './matterbridge.js';
|
|
25
|
+
import { NodeStorage } from 'node-persist-manager';
|
|
26
|
+
import { MatterbridgeDevice } from './matterbridgeDevice.js';
|
|
27
|
+
export declare class DeviceManager {
|
|
28
|
+
private readonly _devices;
|
|
29
|
+
private readonly matterbridge;
|
|
30
|
+
private readonly nodeContext;
|
|
31
|
+
private readonly log;
|
|
32
|
+
constructor(matterbridge: Matterbridge, nodeContext: NodeStorage);
|
|
33
|
+
get length(): number;
|
|
34
|
+
get size(): number;
|
|
35
|
+
has(uniqueId: string): boolean;
|
|
36
|
+
get(uniqueId: string): MatterbridgeDevice | undefined;
|
|
37
|
+
set(device: MatterbridgeDevice): MatterbridgeDevice;
|
|
38
|
+
remove(device: MatterbridgeDevice): boolean;
|
|
39
|
+
clear(): void;
|
|
40
|
+
array(): MatterbridgeDevice[];
|
|
41
|
+
[Symbol.iterator](): IterableIterator<MatterbridgeDevice>;
|
|
42
|
+
forEach(callback: (device: MatterbridgeDevice) => Promise<void>): Promise<void>;
|
|
43
|
+
get logLevel(): LogLevel;
|
|
44
|
+
set logLevel(logLevel: LogLevel);
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=deviceManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deviceManager.d.ts","sourceRoot":"","sources":["../src/deviceManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAA4B,QAAQ,EAAgE,MAAM,kBAAkB,CAAC;AACpI,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAgC,MAAM,yBAAyB,CAAC;AAG3F,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAyC;IAClE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IAC5C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAc;IAC1C,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAa;gBAErB,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW;IAOhE,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAI9B,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAIrD,GAAG,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB;IAOnD,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO;IAM3C,KAAK,IAAI,IAAI;IAIb,KAAK,IAAI,kBAAkB,EAAE;IAI7B,CAAC,MAAM,CAAC,QAAQ,CAAC;IAIX,OAAO,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAYrF,IAAI,QAAQ,IAAI,QAAQ,CAEvB;IAED,IAAI,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAE9B;CAgCF"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains the DeviceManager class.
|
|
3
|
+
*
|
|
4
|
+
* @file devices.ts
|
|
5
|
+
* @author Luca Liguori
|
|
6
|
+
* @date 2024-07-26
|
|
7
|
+
* @version 1.0.8
|
|
8
|
+
*
|
|
9
|
+
* Copyright 2024, 2025 Luca Liguori.
|
|
10
|
+
*
|
|
11
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
+
* you may not use this file except in compliance with the License.
|
|
13
|
+
* You may obtain a copy of the License at
|
|
14
|
+
*
|
|
15
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
+
* See the License for the specific language governing permissions and
|
|
21
|
+
* limitations under the License. *
|
|
22
|
+
*/
|
|
23
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
24
|
+
import { AnsiLogger, BLUE, er } from 'node-ansi-logger';
|
|
25
|
+
import { dev } from './matterbridgeTypes.js';
|
|
26
|
+
export class DeviceManager {
|
|
27
|
+
_devices = new Map();
|
|
28
|
+
matterbridge;
|
|
29
|
+
nodeContext;
|
|
30
|
+
log;
|
|
31
|
+
constructor(matterbridge, nodeContext) {
|
|
32
|
+
this.matterbridge = matterbridge;
|
|
33
|
+
this.nodeContext = nodeContext;
|
|
34
|
+
this.log = new AnsiLogger({ logName: 'DeviceManager', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: matterbridge.log.logLevel });
|
|
35
|
+
this.log.debug('Matterbridge device manager starting...');
|
|
36
|
+
}
|
|
37
|
+
get length() {
|
|
38
|
+
return this._devices.size;
|
|
39
|
+
}
|
|
40
|
+
get size() {
|
|
41
|
+
return this._devices.size;
|
|
42
|
+
}
|
|
43
|
+
has(uniqueId) {
|
|
44
|
+
return this._devices.has(uniqueId);
|
|
45
|
+
}
|
|
46
|
+
get(uniqueId) {
|
|
47
|
+
return this._devices.get(uniqueId);
|
|
48
|
+
}
|
|
49
|
+
set(device) {
|
|
50
|
+
if (!device.uniqueId)
|
|
51
|
+
throw new Error(`The device ${dev}${device.deviceName}${er} has not been initialized: uniqueId is required`);
|
|
52
|
+
if (this._devices.has(device.uniqueId))
|
|
53
|
+
this.log.error(`The device ${dev}${device.deviceName}${er} with uniqueId ${BLUE}${device.uniqueId}${er} serialNumber ${BLUE}${device.serialNumber}${er} is already in the device manager`);
|
|
54
|
+
this._devices.set(device.uniqueId, device);
|
|
55
|
+
return device;
|
|
56
|
+
}
|
|
57
|
+
remove(device) {
|
|
58
|
+
if (!device.uniqueId)
|
|
59
|
+
throw new Error(`The device ${dev}${device.deviceName}${er} has not been initialized: uniqueId is required`);
|
|
60
|
+
if (!this._devices.has(device.uniqueId))
|
|
61
|
+
this.log.error(`The device ${dev}${device.deviceName}${er} with uniqueId ${BLUE}${device.uniqueId}${er} serialNumber ${BLUE}${device.serialNumber}${er} is not registered in the device manager`);
|
|
62
|
+
return this._devices.delete(device.uniqueId);
|
|
63
|
+
}
|
|
64
|
+
clear() {
|
|
65
|
+
this._devices.clear();
|
|
66
|
+
}
|
|
67
|
+
array() {
|
|
68
|
+
return Array.from(this._devices.values());
|
|
69
|
+
}
|
|
70
|
+
[Symbol.iterator]() {
|
|
71
|
+
return this._devices.values();
|
|
72
|
+
}
|
|
73
|
+
async forEach(callback) {
|
|
74
|
+
const tasks = Array.from(this._devices.values()).map(async (device) => {
|
|
75
|
+
try {
|
|
76
|
+
await callback(device);
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
this.log.error(`Error processing forEach device ${dev}${device.deviceName}${er} serialNumber ${BLUE}${device.serialNumber}${er} uniqueId: ${BLUE}${device.uniqueId}${er}:`, error);
|
|
80
|
+
// throw error;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
await Promise.all(tasks);
|
|
84
|
+
}
|
|
85
|
+
get logLevel() {
|
|
86
|
+
return this.log.logLevel;
|
|
87
|
+
}
|
|
88
|
+
set logLevel(logLevel) {
|
|
89
|
+
this.log.logLevel = logLevel;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=deviceManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deviceManager.js","sourceRoot":"","sources":["../src/deviceManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,sDAAsD;AACtD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAM,EAAE,EAA0E,MAAM,kBAAkB,CAAC;AAIpI,OAAO,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAE7C,MAAM,OAAO,aAAa;IACP,QAAQ,GAAG,IAAI,GAAG,EAA8B,CAAC;IACjD,YAAY,CAAe;IAC3B,WAAW,CAAc;IACzB,GAAG,CAAa;IAEjC,YAAY,YAA0B,EAAE,WAAwB;QAC9D,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,GAAG,GAAG,IAAI,UAAU,CAAC,EAAE,OAAO,E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YACjB,CAAC;QACH,CAAC,CAAC,CAAC;QACH,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC3B,CAAC;IAED,IAAI,QAAQ,CAAC,QAAkB;QAC7B,IAAI,CAAC,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC/B,CAAC;CAgCF"}
|
package/dist/matterbridge.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @file matterbridge.ts
|
|
5
5
|
* @author Luca Liguori
|
|
6
6
|
* @date 2023-12-29
|
|
7
|
-
* @version 1.
|
|
7
|
+
* @version 1.4.0
|
|
8
8
|
*
|
|
9
9
|
* Copyright 2023, 2024 Luca Liguori.
|
|
10
10
|
*
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
* See the License for the specific language governing permissions and
|
|
21
21
|
* limitations under the License. *
|
|
22
22
|
*/
|
|
23
|
+
import { AnsiLogger } from 'node-ansi-logger';
|
|
23
24
|
import EventEmitter from 'events';
|
|
24
25
|
import { MatterbridgeDevice } from './matterbridgeDevice.js';
|
|
25
26
|
import { MatterbridgeInformation, SanitizedExposedFabricInformation, SanitizedSessionInformation, SystemInformation } from './matterbridgeTypes.js';
|
|
@@ -42,10 +43,10 @@ export declare class Matterbridge extends EventEmitter {
|
|
|
42
43
|
matterbridgeConnected: boolean;
|
|
43
44
|
bridgeMode: 'bridge' | 'childbridge' | 'controller' | '';
|
|
44
45
|
restartMode: 'service' | 'docker' | '';
|
|
45
|
-
debugEnabled: boolean;
|
|
46
46
|
profile: string | undefined;
|
|
47
|
-
|
|
47
|
+
log: AnsiLogger;
|
|
48
48
|
private plugins;
|
|
49
|
+
private devices;
|
|
49
50
|
private registeredDevices;
|
|
50
51
|
private nodeStorage;
|
|
51
52
|
private nodeContext;
|
|
@@ -205,65 +206,6 @@ export declare class Matterbridge extends EventEmitter {
|
|
|
205
206
|
* @returns A promise that resolves when all devices have been removed.
|
|
206
207
|
*/
|
|
207
208
|
removeAllBridgedDevices(pluginName: string): Promise<void>;
|
|
208
|
-
/**
|
|
209
|
-
* Loads the schema for a plugin.
|
|
210
|
-
* If the schema file exists in the plugin directory, it reads the file and returns the parsed JSON data and delete the schema form .matterbridge.
|
|
211
|
-
* If the schema file does not exist, it creates a new schema with the default configuration and returns it.
|
|
212
|
-
*
|
|
213
|
-
* @param plugin - The plugin for which to load the schema.
|
|
214
|
-
* @returns A promise that resolves to the loaded or created schema.
|
|
215
|
-
*/
|
|
216
|
-
private loadPluginSchema;
|
|
217
|
-
/**
|
|
218
|
-
* Loads the configuration for a plugin.
|
|
219
|
-
* If the configuration file exists, it reads the file and returns the parsed JSON data.
|
|
220
|
-
* If the configuration file does not exist, it creates a new file with default configuration and returns it.
|
|
221
|
-
* If any error occurs during file access or creation, it logs an error and return un empty config.
|
|
222
|
-
*
|
|
223
|
-
* @param plugin - The plugin for which to load the configuration.
|
|
224
|
-
* @returns A promise that resolves to the loaded or created configuration.
|
|
225
|
-
*/
|
|
226
|
-
private loadPluginConfig;
|
|
227
|
-
/**
|
|
228
|
-
* Saves the configuration of a registered plugin.
|
|
229
|
-
* @param {RegisteredPlugin} plugin - The plugin whose configuration needs to be saved.
|
|
230
|
-
* @returns {Promise<void>} - A promise that resolves when the configuration is successfully saved.
|
|
231
|
-
* @throws {Error} - If the plugin's configuration is not found or if there is an error while saving the configuration.
|
|
232
|
-
*/
|
|
233
|
-
private savePluginConfig;
|
|
234
|
-
/**
|
|
235
|
-
* Writes data to a file.
|
|
236
|
-
*
|
|
237
|
-
* @param {string} filePath - The path of the file to write to.
|
|
238
|
-
* @param {string} data - The data to write to the file.
|
|
239
|
-
* @returns {Promise<void>} - A promise that resolves when the data is successfully written to the file.
|
|
240
|
-
*/
|
|
241
|
-
private writeFile;
|
|
242
|
-
/**
|
|
243
|
-
* Loads a plugin and returns the corresponding MatterbridgePlatform instance.
|
|
244
|
-
* @param plugin - The plugin to load.
|
|
245
|
-
* @param start - Optional flag indicating whether to start the plugin after loading. Default is false.
|
|
246
|
-
* @param message - Optional message to pass to the plugin when starting.
|
|
247
|
-
* @returns A Promise that resolves to the loaded MatterbridgePlatform instance.
|
|
248
|
-
* @throws An error if the plugin is not enabled, already loaded, or fails to load.
|
|
249
|
-
*/
|
|
250
|
-
private loadPlugin;
|
|
251
|
-
/**
|
|
252
|
-
* Starts a plugin.
|
|
253
|
-
*
|
|
254
|
-
* @param {RegisteredPlugin} plugin - The plugin to start.
|
|
255
|
-
* @param {string} [message] - Optional message to pass to the plugin's onStart method.
|
|
256
|
-
* @param {boolean} [configure] - Indicates whether to configure the plugin after starting (default false).
|
|
257
|
-
* @returns {Promise<void>} A promise that resolves when the plugin is started successfully, or rejects with an error if starting the plugin fails.
|
|
258
|
-
*/
|
|
259
|
-
private startPlugin;
|
|
260
|
-
/**
|
|
261
|
-
* Configures a plugin.
|
|
262
|
-
*
|
|
263
|
-
* @param {RegisteredPlugin} plugin - The plugin to configure.
|
|
264
|
-
* @returns {Promise<void>} A promise that resolves when the plugin is configured successfully, or rejects with an error if configuration fails.
|
|
265
|
-
*/
|
|
266
|
-
private configurePlugin;
|
|
267
209
|
private startTest;
|
|
268
210
|
/**
|
|
269
211
|
* Starts the Matterbridge in bridge mode.
|
|
@@ -292,19 +234,19 @@ export declare class Matterbridge extends EventEmitter {
|
|
|
292
234
|
* @param {string} storageName - The name of the storage file.
|
|
293
235
|
* @returns {Promise<void>} - A promise that resolves when the storage process is started.
|
|
294
236
|
*/
|
|
295
|
-
private
|
|
237
|
+
private startMatterStorage;
|
|
296
238
|
/**
|
|
297
239
|
* Makes a backup copy of the specified matter JSON storage file.
|
|
298
240
|
*
|
|
299
241
|
* @param storageName - The name of the JSON storage file to be backed up.
|
|
300
242
|
* @param backupName - The name of the backup file to be created.
|
|
301
243
|
*/
|
|
302
|
-
private
|
|
244
|
+
private backupJsonMatterStorage;
|
|
303
245
|
/**
|
|
304
246
|
* Stops the matter storage.
|
|
305
247
|
* @returns {Promise<void>} A promise that resolves when the storage is stopped.
|
|
306
248
|
*/
|
|
307
|
-
private
|
|
249
|
+
private stopMatterStorage;
|
|
308
250
|
/**
|
|
309
251
|
* Creates a Matter server using the provided storage manager and the provided mdnsInterface.
|
|
310
252
|
* @param storageManager The storage manager to be used by the Matter server.
|
|
@@ -371,7 +313,7 @@ export declare class Matterbridge extends EventEmitter {
|
|
|
371
313
|
*/
|
|
372
314
|
private showCommissioningQRCode;
|
|
373
315
|
/**
|
|
374
|
-
* Sanitizes the fabric information by converting bigint properties to string cause res
|
|
316
|
+
* Sanitizes the fabric information by converting bigint properties to string cause res.json doesn't know bigint.
|
|
375
317
|
*
|
|
376
318
|
* @param fabricInfo - The array of exposed fabric information objects.
|
|
377
319
|
* @returns An array of sanitized exposed fabric information objects.
|
|
@@ -407,22 +349,22 @@ export declare class Matterbridge extends EventEmitter {
|
|
|
407
349
|
private getVendorIdName;
|
|
408
350
|
/**
|
|
409
351
|
* Retrieves the base registered plugins sanitized for res.json().
|
|
410
|
-
* @param {boolean} includeAll - Whether to include all information for each plugin.
|
|
411
352
|
* @returns {BaseRegisteredPlugin[]} A promise that resolves to an array of BaseRegisteredPlugin objects.
|
|
412
353
|
*/
|
|
413
354
|
private getBaseRegisteredPlugins;
|
|
414
355
|
/**
|
|
415
356
|
* Spawns a child process with the given command and arguments.
|
|
416
|
-
* @param command - The command to execute.
|
|
417
|
-
* @param args - The arguments to pass to the command (default: []).
|
|
418
|
-
* @returns A promise that resolves when the child process exits successfully, or rejects if there is an error.
|
|
357
|
+
* @param {string} command - The command to execute.
|
|
358
|
+
* @param {string[]} args - The arguments to pass to the command (default: []).
|
|
359
|
+
* @returns {Promise<void>} A promise that resolves when the child process exits successfully, or rejects if there is an error.
|
|
419
360
|
*/
|
|
420
361
|
private spawnCommand;
|
|
421
362
|
/**
|
|
422
363
|
* Sends a WebSocket message to all connected clients.
|
|
423
364
|
*
|
|
424
|
-
* @param {string}
|
|
425
|
-
* @param {string}
|
|
365
|
+
* @param {string} level - The logger level of the message: debug info notice warn error fatal...
|
|
366
|
+
* @param {string} time - The time string of the message
|
|
367
|
+
* @param {string} name - The logger name of the message
|
|
426
368
|
* @param {string} message - The content of the message.
|
|
427
369
|
*/
|
|
428
370
|
private wssSendMessage;
|
|
@@ -433,9 +375,9 @@ export declare class Matterbridge extends EventEmitter {
|
|
|
433
375
|
*/
|
|
434
376
|
initializeFrontend(port?: number): Promise<void>;
|
|
435
377
|
/**
|
|
436
|
-
* Retrieves the cluster text from a given device.
|
|
437
|
-
* @param device - The MatterbridgeDevice object.
|
|
438
|
-
* @returns The attributes of the cluster servers in the device.
|
|
378
|
+
* Retrieves the cluster text description from a given device.
|
|
379
|
+
* @param {MatterbridgeDevice} device - The MatterbridgeDevice object.
|
|
380
|
+
* @returns {string} The attributes description of the cluster servers in the device.
|
|
439
381
|
*/
|
|
440
382
|
private getClusterTextFromDevice;
|
|
441
383
|
/**
|
|
@@ -444,7 +386,7 @@ export declare class Matterbridge extends EventEmitter {
|
|
|
444
386
|
*
|
|
445
387
|
* @returns A Promise that resolves when the initialization is complete.
|
|
446
388
|
*/
|
|
447
|
-
startExtension(dataPath: string,
|
|
389
|
+
startExtension(dataPath: string, extensionVersion: string, port?: number): Promise<boolean>;
|
|
448
390
|
/**
|
|
449
391
|
* Close the Matterbridge instance as extension for zigbee2mqtt.
|
|
450
392
|
* @deprecated This method is deprecated and will be removed in a future version.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matterbridge.d.ts","sourceRoot":"","sources":["../src/matterbridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;
|
|
1
|
+
{"version":3,"file":"matterbridge.d.ts","sourceRoot":"","sources":["../src/matterbridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAE,UAAU,EAAyK,MAAM,kBA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