matterbridge 1.5.9 → 1.6.0

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.
Files changed (51) hide show
  1. package/CHANGELOG.md +36 -3
  2. package/README-DEV.md +10 -6
  3. package/README-PODMAN.md +2 -0
  4. package/README-SERVICE.md +44 -6
  5. package/README.md +53 -7
  6. package/dist/cluster/export.js +1 -1
  7. package/dist/cluster/export.js.map +1 -1
  8. package/dist/defaultConfigSchema.d.ts.map +1 -1
  9. package/dist/defaultConfigSchema.js +9 -1
  10. package/dist/defaultConfigSchema.js.map +1 -1
  11. package/dist/matterbridge.d.ts +72 -48
  12. package/dist/matterbridge.d.ts.map +1 -1
  13. package/dist/matterbridge.js +174 -173
  14. package/dist/matterbridge.js.map +1 -1
  15. package/dist/matterbridgeDevice.d.ts +140 -1042
  16. package/dist/matterbridgeDevice.d.ts.map +1 -1
  17. package/dist/matterbridgeDevice.js +57 -363
  18. package/dist/matterbridgeDevice.js.map +1 -1
  19. package/dist/matterbridgeEdge.d.ts +90 -0
  20. package/dist/matterbridgeEdge.d.ts.map +1 -0
  21. package/dist/matterbridgeEdge.js +555 -0
  22. package/dist/matterbridgeEdge.js.map +1 -0
  23. package/dist/matterbridgeEndpoint.d.ts +5195 -0
  24. package/dist/matterbridgeEndpoint.d.ts.map +1 -0
  25. package/dist/matterbridgeEndpoint.js +2196 -0
  26. package/dist/matterbridgeEndpoint.js.map +1 -0
  27. package/dist/matterbridgeTypes.d.ts +6 -5
  28. package/dist/matterbridgeTypes.d.ts.map +1 -1
  29. package/dist/matterbridgeTypes.js +1 -1
  30. package/dist/matterbridgeTypes.js.map +1 -1
  31. package/dist/matterbridgeWebsocket.d.ts +49 -0
  32. package/dist/matterbridgeWebsocket.d.ts.map +1 -0
  33. package/dist/matterbridgeWebsocket.js +145 -0
  34. package/dist/matterbridgeWebsocket.js.map +1 -0
  35. package/dist/pluginManager.d.ts +134 -1
  36. package/dist/pluginManager.d.ts.map +1 -1
  37. package/dist/pluginManager.js +167 -14
  38. package/dist/pluginManager.js.map +1 -1
  39. package/frontend/build/asset-manifest.json +3 -3
  40. package/frontend/build/index.html +1 -1
  41. package/frontend/build/static/js/{main.96d6324b.js → main.045d08f7.js} +3 -3
  42. package/frontend/build/static/js/main.045d08f7.js.map +1 -0
  43. package/npm-shrinkwrap.json +838 -6222
  44. package/package.json +3 -78
  45. package/CODEOWNERS +0 -1
  46. package/dist/history/export.d.ts +0 -2
  47. package/dist/history/export.d.ts.map +0 -1
  48. package/dist/history/export.js +0 -2
  49. package/dist/history/export.js.map +0 -1
  50. package/frontend/build/static/js/main.96d6324b.js.map +0 -1
  51. /package/frontend/build/static/js/{main.96d6324b.js.LICENSE.txt → main.045d08f7.js.LICENSE.txt} +0 -0
package/CHANGELOG.md CHANGED
@@ -7,7 +7,8 @@ If you like this project and find it useful, please consider giving it a star on
7
7
  ### Home Assistant Community Add-ons
8
8
 
9
9
  The Home Assistant Community Add-ons and plugins are not verified to work with Matterbridge. I strongly advise against using them. If you do use them and encounter an issue (which is likely because some do not meet the Matterbridge guidelines), please do not open an issue in the Matterbridge repository.
10
- If you want to run Matterbridge in Home Assistant please use the official add-on https://github.com/Luligu/matterbridge-home-assistant-addon.
10
+
11
+ If you want to run Matterbridge in Home Assistant please use the official add-on https://github.com/Luligu/matterbridge-home-assistant-addon that also has Ingress and side panel.
11
12
 
12
13
  ### New Apple firmware v. 18.0
13
14
 
@@ -15,9 +16,41 @@ Please read this: https://github.com/Luligu/matterbridge/discussions/135
15
16
 
16
17
  ### Discord
17
18
 
18
- Tamer (https://github.com/tammeryousef1006) has created the Matterbridge Discord group: https://discord.gg/raWywpD4.
19
+ Tamer (https://github.com/tammeryousef1006) has created the Matterbridge Discord group: https://discord.gg/QX58CDe6hd.
20
+
21
+ Feel free to join (the link is now permanent)!
22
+
23
+ ## [1.6.0] - 2024-10-28
24
+
25
+ ### Added
26
+
27
+ - [matterbridge]: Added WebSocket for the Matetrbridge cockpit dashboard (Shelly gateway).
28
+
29
+ ### Changed
30
+
31
+ - [discord]: Discord group link: https://discord.gg/QX58CDe6hd.
32
+ - [matterbridge]: Completed phase 1 of transition to edge (matter.js new API).
33
+ - [matterbridgeDevice]: Refactor Thermostat cluster method to accept minHeatSetpointLimit, maxHeatSetpointLimit, minCoolSetpointLimit and maxCoolSetpointLimit.
34
+ - [config]: The plugins config is rewritten only after onStart and no more after onConfigure (after the plugin starts is possible to change the plugins config and it will not be rewritten after the plugin configuration).
35
+ - [matterbridgeDevice]: Removed deprecated methods of ColorControl cluster.
36
+ - [package]: Removed EveHistory (it will be used only by single plugins).
37
+ - [package]: Update dependencies.
38
+
39
+ <a href="https://www.buymeacoffee.com/luligugithub">
40
+ <img src="./yellow-button.png" alt="Buy me a coffee" width="120">
41
+ </a>
42
+
43
+ ## [1.5.10] - 2024-10-01
44
+
45
+ ### Changed
19
46
 
20
- Feel free to join!
47
+ - [matterbridge]: Added '--omit=dev' to all install commands to save space and time on low powered devices.
48
+ - [matterbridge]: Integrated the DeviceManager class and removed the old array.
49
+ - [package]: Update dependencies.
50
+
51
+ <a href="https://www.buymeacoffee.com/luligugithub">
52
+ <img src="./yellow-button.png" alt="Buy me a coffee" width="120">
53
+ </a>
21
54
 
22
55
  ## [1.5.9] - 2024-09-23
23
56
 
package/README-DEV.md CHANGED
@@ -43,23 +43,27 @@ Matterbridge exports from:
43
43
 
44
44
  - NodeStorage classes.
45
45
 
46
- # ****\*\*****
46
+ # \***\*\*\*\*\***
47
47
 
48
- A plugin must never install or import from `matter-node.js` or `matter.js` directly, as this leads to a second instance of `matter.js`, causing instability and unpredictable errors such as "The only instance is Endpoint". Additionally, when Matterbridge updates the `matter.js` version, it should be consistent across all plugins.
48
+ A plugin must never install or import from `matter-node.js` or `matter.js` directly (neither as a dependency, devDependency, nor peerDependency), as this leads to a second instance of `matter.js`, causing instability and unpredictable errors such as "The only instance is Endpoint".
49
49
 
50
- # ****\*\*****
50
+ Additionally, when Matterbridge updates the `matter.js` version, it should be consistent across all plugins.
51
51
 
52
- A plugin must never install Matterbridge (neither as dependencies nor as devDependencies). Matterbridge must be linked to the plugin:
52
+ # \***\*\*\*\*\***
53
+
54
+ A plugin must never install Matterbridge (neither as a dependency, devDependency, nor peerDependency).
55
+
56
+ Matterbridge must be linked to the plugin in development only.
53
57
 
54
58
  ```json
55
59
  "scripts": {
56
60
  '''
57
- "install": "node link-matterbridge-script.js",
61
+ "dev:link": "npm link matterbridge",
58
62
  '''
59
63
  }
60
64
  ```
61
65
 
62
- # ****\*\*****
66
+ # \***\*\*\*\*\***
63
67
 
64
68
  In the next releases I will remove the duplicated exports so please update your plugins.
65
69
 
package/README-PODMAN.md CHANGED
@@ -41,6 +41,7 @@ sudo chown -R $USER:$USER ./Matterbridge ./.matterbridge
41
41
  ```
42
42
 
43
43
  You may need to adapt the script to your setup:
44
+
44
45
  - ./Matterbridge is the position outside of the container of your matterbridge plugin directory (inside your home directory).
45
46
  - ./.matterbridge is the position outside of the container of your matterbridge storage directory (inside your home directory).
46
47
 
@@ -56,6 +57,7 @@ podman run --name matterbridge \
56
57
  ```
57
58
 
58
59
  You may need to adapt the script to your setup:
60
+
59
61
  - ~/Matterbridge is the position outside of the container of your matterbridge plugin directory.
60
62
  - ~/.matterbridge is the position outside of the container of your matterbridge storage directory.
61
63
 
package/README-SERVICE.md CHANGED
@@ -100,53 +100,91 @@ sudo systemctl disable matterbridge.service
100
100
  ### View the log of Matterbridge in real time (this will show the log with colors)
101
101
 
102
102
  ```
103
- sudo journalctl -u matterbridge.service -f --output cat
103
+ sudo journalctl -u matterbridge.service -n 1000 -f --output cat
104
104
  ```
105
105
 
106
106
  ### Delete the logs older then 3 days (all of them not only the ones of Matterbridge!)
107
107
 
108
+ Check the space used
109
+
110
+ ```
111
+ sudo journalctl --disk-usage
112
+ ```
113
+
114
+ remove all log older then 3 days
115
+
108
116
  ```
117
+ sudo journalctl --rotate
109
118
  sudo journalctl --vacuum-time=3d
110
119
  ```
111
120
 
112
- If you want to make the setting permanent edit
121
+ ## Prevent the journal logs to grow
122
+
123
+ If you want to make the setting permanent to prevent the journal logs to grow too much, run
124
+
113
125
  ```
114
126
  sudo nano /etc/systemd/journald.conf
115
127
  ```
128
+
116
129
  add
130
+
117
131
  ```
118
- SystemMaxUse=3d
132
+ Compress=yes # Compress logs
133
+ MaxRetentionSec=3days # Keep logs for a maximum of 3 days.
134
+ MaxFileSec=1day # Rotate logs daily within the 3-day retention period.
135
+ ForwardToSyslog=no # Disable forwarding to syslog to prevent duplicate logging.
136
+ SystemMaxUse=100M # Limit persistent logs in /var/log/journal to 100 MB.
137
+ RuntimeMaxUse=100M # Limit runtime logs in /run/log/journal to 100 MB.
119
138
  ```
139
+
120
140
  save it and run
141
+
121
142
  ```
122
143
  sudo systemctl restart systemd-journald
123
144
  ```
124
145
 
125
- ### Verify that with your distro you can run sudo npm install -g matterbridge without the password
146
+ ## Verify that with your distro you can run sudo npm install -g matterbridge without the password
126
147
 
127
148
  Run the following command to verify if you can install Matterbridge globally without being prompted for a password:
128
149
 
129
150
  ```
130
151
  sudo npm install -g matterbridge
131
152
  ```
153
+
132
154
  If you are not prompted for a password, no further action is required.
133
155
 
134
156
  If that is not the case, open the sudoers file for editing using visudo
157
+
135
158
  ```
136
159
  sudo visudo
137
160
  ```
138
161
 
162
+ verify the presence of of a line
163
+
164
+ ```
165
+ @includedir /etc/sudoers.d
166
+ ```
167
+
168
+ exit and create a configuration file for sudoers
169
+
170
+ ```
171
+ sudo nano /etc/sudoers.d/matterbridge
172
+ ```
173
+
139
174
  add this line replacing USER with your user name (e.g. radxa ALL=(ALL) NOPASSWD: ALL)
140
175
 
141
176
  ```
142
177
  <USER> ALL=(ALL) NOPASSWD: ALL
143
178
  ```
144
179
 
145
- or if you prefers to only give access to npm without password try (e.g. radxa ALL=(ALL) NOPASSWD: /usr/bin/npm)
180
+ or if you prefers to only give access to npm without password try with (e.g. radxa ALL=(ALL) NOPASSWD: /usr/bin/npm)
146
181
 
147
182
  ```
148
183
  <USER> ALL=(ALL) NOPASSWD: /usr/bin/npm
149
184
  ```
150
185
 
151
- save the file and restart the system.
186
+ save the file and reload the settings with:
152
187
 
188
+ ```
189
+ sudo visudo -c
190
+ ```
package/README.md CHANGED
@@ -51,13 +51,13 @@ To run Matterbridge, you need either a [Node.js](https://nodejs.org/en/download/
51
51
  Follow these steps to install Matterbridge:
52
52
 
53
53
  ```
54
- npm install -g matterbridge
54
+ npm install -g matterbridge --omit=dev
55
55
  ```
56
56
 
57
57
  on Linux you may need the necessary permissions:
58
58
 
59
59
  ```
60
- sudo npm install -g matterbridge
60
+ sudo npm install -g matterbridge --omit=dev
61
61
  ```
62
62
 
63
63
  Test the installation with:
@@ -68,7 +68,7 @@ matterbridge
68
68
 
69
69
  Now it is possible to open the frontend at the link provided in the log (e.g. http://MATTERBIDGE-IPV4-ADDRESS:8283).
70
70
 
71
- You can then change the bridge mode from the frontend.
71
+ You can then change the bridge mode and other parameters from the frontend.
72
72
 
73
73
  ## Usage
74
74
 
@@ -128,19 +128,19 @@ Config editor:
128
128
 
129
129
  ### Run matterbridge as a daemon with systemctl (Linux only)
130
130
 
131
- [Advanced configurations](https://github.com/Luligu/matterbridge/blob/main/README-SERVICE.md)
131
+ [Service configurations](https://github.com/Luligu/matterbridge/blob/main/README-SERVICE.md)
132
132
 
133
133
  ### Run matterbridge with docker and docker compose
134
134
 
135
- [Advanced configurations](https://github.com/Luligu/matterbridge/blob/main/README-DOCKER.md)
135
+ [Docker configurations](https://github.com/Luligu/matterbridge/blob/main/README-DOCKER.md)
136
136
 
137
137
  ### Run matterbridge with podman
138
138
 
139
- [Advanced configurations](https://github.com/Luligu/matterbridge/blob/main/README-PODMAN.md)
139
+ [Podman configurations](https://github.com/Luligu/matterbridge/blob/main/README-PODMAN.md)
140
140
 
141
141
  ### Run matterbridge as an home assistant add-on with the official add-on
142
142
 
143
- [Advanced configurations](https://github.com/Luligu/matterbridge-home-assistant-addon)
143
+ [Home assistant add-on configurations](https://github.com/Luligu/matterbridge-home-assistant-addon)
144
144
 
145
145
  ### Other Home Assistant Community Add-ons
146
146
 
@@ -320,6 +320,52 @@ matterbridge -factoryreset
320
320
 
321
321
  This will reset the internal storages. All commissioning informations will be lost. All plugins will be unregistered.
322
322
 
323
+ # Frequently asked questions
324
+
325
+ ## How to enable HTTPS for the frontend
326
+
327
+ ### Provide your own certificates
328
+
329
+ Place your own certificates in the `.matterbridge/cert` directory:
330
+
331
+ - `cert.pem`
332
+ - `key.pem`
333
+ - `ca.pem` (optional)
334
+
335
+ ![image](https://github.com/user-attachments/assets/846785ca-6f5c-458b-b786-a6417a4da319)
336
+
337
+ ### Change the command line
338
+
339
+ Add the **-ssl** parameter to the command line. If desired, you can also change the frontend port with **-frontend 443**.
340
+
341
+ ```sh
342
+ matterbridge -ssl -frontend 443
343
+ ```
344
+
345
+ ### Restart
346
+
347
+ If the certificate are correctly configured, you will be able to connect with https to the frontend.
348
+
349
+ ![image](https://github.com/user-attachments/assets/9c38776d-064f-4d91-9359-a2cd3319b1ff)
350
+
351
+ ## How to send the debug log files
352
+
353
+ ### Enable debug and log on file
354
+
355
+ In the frontend, go to settings and enable debug mode as shown below:
356
+
357
+ ![Debug Matterbridge Settings](https://github.com/user-attachments/assets/83181dc2-969a-4b71-aff4-f1498fa1d665)
358
+
359
+ ![Debug Matter Settings](https://github.com/user-attachments/assets/617961a9-7cb0-46cf-9878-981f61738f8c)
360
+
361
+ ### Restart
362
+
363
+ Wait a few minutes to allow the logs to to accumulate.
364
+
365
+ Then, from the dots menu in the frontend, download the `matterbridge.log` and `matter.log` files.
366
+
367
+ ![image](https://github.com/user-attachments/assets/04ba65f6-594a-4ff8-9732-3df049f5a33e)
368
+
323
369
  # Known general issues
324
370
 
325
371
  ## Session XYZ does not exist
@@ -1,3 +1,3 @@
1
1
  export {};
2
- // Nothing to export
2
+ // Nothing to export right now
3
3
  //# sourceMappingURL=export.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"export.js","sourceRoot":"","sources":["../../src/cluster/export.ts"],"names":[],"mappings":";AAAA,oBAAoB"}
1
+ {"version":3,"file":"export.js","sourceRoot":"","sources":["../../src/cluster/export.ts"],"names":[],"mappings":";AAAA,8BAA8B"}
@@ -1 +1 @@
1
- {"version":3,"file":"defaultConfigSchema.d.ts","sourceRoot":"","sources":["../src/defaultConfigSchema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,eAAO,MAAM,kBAAkB,EAAE,cAiBhC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,cAWhC,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,cAwB3B,CAAC"}
1
+ {"version":3,"file":"defaultConfigSchema.d.ts","sourceRoot":"","sources":["../src/defaultConfigSchema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,eAAO,MAAM,kBAAkB,EAAE,cAiBhC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,cAWhC,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,cAgC3B,CAAC"}
@@ -56,11 +56,19 @@ export const shelly_config = {
56
56
  username: '',
57
57
  password: '',
58
58
  exposeSwitch: 'switch',
59
+ switchList: [],
60
+ lightList: [],
61
+ outletList: [],
59
62
  exposeInput: 'momentary',
63
+ inputContactList: [],
64
+ inputMomentaryList: [],
65
+ inputLatchingList: [],
60
66
  exposeInputEvent: 'momentary',
61
- exposePowerMeter: 'disabled',
67
+ inputEventList: [],
68
+ exposePowerMeter: 'matter13',
62
69
  blackList: [],
63
70
  whiteList: [],
71
+ nocacheList: [],
64
72
  deviceIp: {},
65
73
  enableMdnsDiscover: true,
66
74
  enableStorageDiscover: true,
@@ -1 +1 @@
1
- {"version":3,"file":"defaultConfigSchema.js","sourceRoot":"","sources":["../src/def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;IACZ,YAAY,EAAE,QAAQ;IACtB,UAAU,EAAE,EAAE;IACd,SAAS,EAAE,EAAE;IACb,UAAU,EAAE,EAAE;IACd,WAAW,EAAE,WAAW;IACxB,gBAAgB,EAAE,EAAE;IACpB,kBAAkB,EAAE,EAAE;IACtB,iBAAiB,EAAE,EAAE;IACrB,gBAAgB,EAAE,WAAW;IAC7B,cAAc,EAAE,EAAE;IAClB,gBAAgB,EAAE,UAAU;IAC5B,SAAS,EAAE,EAAE;IACb,SAAS,EAAE,EAAE;IACb,WAAW,EAAE,EAAE;IACf,QAAQ,EAAE,EAAE;IACZ,kBAAkB,EAAE,IAAI;IACxB,qBAAqB,EAAE,IAAI;IAC3B,oBAAoB,EAAE,KAAK;IAC3B,oBAAoB,EAAE,KAAK;IAC3B,iBAAiB,EAAE,IAAI;IACvB,aAAa,EAAE,CAAC;IAChB,OAAO,EAAE,EAAE;IACX,KAAK,EAAE,KAAK;IACZ,SAAS,EAAE,KAAK;IAChB,SAAS,EAAE,KAAK;IAChB,OAAO,EAAE,KAAK;IACd,oBAAoB,EAAE,KAAK;CAC5B,CAAC"}
@@ -21,9 +21,17 @@
21
21
  * limitations under the License. *
22
22
  */
23
23
  import EventEmitter from 'events';
24
+ import WebSocket from 'ws';
25
+ import { NodeStorageManager, NodeStorage } from 'node-persist-manager';
24
26
  import { AnsiLogger } from 'node-ansi-logger';
25
27
  import { MatterbridgeDevice } from './matterbridgeDevice.js';
26
- import { MatterbridgeInformation, SanitizedExposedFabricInformation, SanitizedSessionInformation, SystemInformation } from './matterbridgeTypes.js';
28
+ import { BaseRegisteredPlugin, MatterbridgeInformation, SanitizedExposedFabricInformation, SanitizedSessionInformation, SystemInformation } from './matterbridgeTypes.js';
29
+ import { PluginManager } from './pluginManager.js';
30
+ import { DeviceManager } from './deviceManager.js';
31
+ import { CommissioningController, CommissioningServer, MatterServer } from '@project-chip/matter-node.js';
32
+ import { DeviceTypeId } from '@project-chip/matter-node.js/datatype';
33
+ import { Aggregator } from '@project-chip/matter-node.js/device';
34
+ import { StorageContext, StorageManager } from '@project-chip/matter-node.js/storage';
27
35
  /**
28
36
  * Represents the Matterbridge application.
29
37
  */
@@ -47,21 +55,18 @@ export declare class Matterbridge extends EventEmitter {
47
55
  restartMode: 'service' | 'docker' | '';
48
56
  profile: string | undefined;
49
57
  log: AnsiLogger;
50
- private matterbrideLoggerFile;
51
- private matterLoggerFile;
52
- private plugins;
53
- private devices;
54
- private registeredDevices;
55
- private nodeStorage;
56
- private nodeContext;
57
- private matterStorageName;
58
- private nodeStorageName;
58
+ protected matterbrideLoggerFile: string;
59
+ protected matterLoggerFile: string;
60
+ protected plugins: PluginManager;
61
+ protected devices: DeviceManager;
62
+ protected nodeStorage: NodeStorageManager | undefined;
63
+ protected nodeContext: NodeStorage | undefined;
64
+ protected matterStorageName: string;
65
+ protected nodeStorageName: string;
59
66
  private hasCleanupStarted;
60
67
  private initialized;
61
68
  private execRunningCount;
62
69
  private startMatterInterval;
63
- private cleanupTimeout1;
64
- private cleanupTimeout2;
65
70
  private checkUpdateInterval;
66
71
  private configureTimeout;
67
72
  private reachabilityTimeout;
@@ -71,21 +76,22 @@ export declare class Matterbridge extends EventEmitter {
71
76
  private httpServer;
72
77
  private httpsServer;
73
78
  private webSocketServer;
74
- private mdnsInterface;
75
- private ipv4address;
76
- private ipv6address;
77
- private port;
78
- private passcode?;
79
- private discriminator?;
80
- private storageManager;
81
- private matterbridgeContext;
82
- private mattercontrollerContext;
83
- private matterServer;
84
- private matterAggregator;
85
- private commissioningServer;
86
- private commissioningController;
87
- private static instance;
88
- private constructor();
79
+ protected mdnsInterface: string | undefined;
80
+ protected ipv4address: string | undefined;
81
+ protected ipv6address: string | undefined;
82
+ protected port: number;
83
+ protected passcode?: number;
84
+ protected discriminator?: number;
85
+ protected storageManager: StorageManager | undefined;
86
+ protected matterbridgeContext: StorageContext | undefined;
87
+ protected mattercontrollerContext: StorageContext | undefined;
88
+ protected matterServer: MatterServer | undefined;
89
+ protected matterAggregator: Aggregator | undefined;
90
+ protected commissioningServer: CommissioningServer | undefined;
91
+ protected commissioningController: CommissioningController | undefined;
92
+ protected static instance: Matterbridge | undefined;
93
+ protected constructor();
94
+ matterbridgeMessageHandler: (client: WebSocket, message: WebSocket.RawData) => Promise<void>;
89
95
  /** ***********************************************************************************************************************************/
90
96
  /** loadInstance() and cleanup() methods */
91
97
  /** ***********************************************************************************************************************************/
@@ -120,6 +126,15 @@ export declare class Matterbridge extends EventEmitter {
120
126
  * @returns {Promise<void>} A promise that resolves when the command line arguments have been processed, or the process exits.
121
127
  */
122
128
  private parseCommandLine;
129
+ /**
130
+ * Asynchronously loads and starts the registered plugins.
131
+ *
132
+ * This method is responsible for initializing and staarting all enabled plugins.
133
+ * It ensures that each plugin is properly loaded and started before the ridge starts.
134
+ *
135
+ * @returns {Promise<void>} A promise that resolves when all plugins have been loaded and started.
136
+ */
137
+ private startPlugins;
123
138
  /**
124
139
  * Registers the signal handlers for SIGINT and SIGTERM.
125
140
  * When either of these signals are received, the cleanup method is called with an appropriate message.
@@ -205,7 +220,7 @@ export declare class Matterbridge extends EventEmitter {
205
220
  * @param restart - Indicates whether to restart the instance after cleanup. Default is `false`.
206
221
  * @returns A promise that resolves when the cleanup is completed.
207
222
  */
208
- private cleanup;
223
+ protected cleanup(message: string, restart?: boolean): Promise<void>;
209
224
  /**
210
225
  * Adds a bridged device to the Matterbridge.
211
226
  * @param pluginName - The name of the plugin.
@@ -227,25 +242,24 @@ export declare class Matterbridge extends EventEmitter {
227
242
  * @returns A promise that resolves when all devices have been removed.
228
243
  */
229
244
  removeAllBridgedDevices(pluginName: string): Promise<void>;
230
- private startTest;
231
245
  /**
232
246
  * Starts the Matterbridge in bridge mode.
233
247
  * @private
234
248
  * @returns {Promise<void>} A promise that resolves when the Matterbridge is started.
235
249
  */
236
- private startBridge;
250
+ protected startBridge(): Promise<void>;
237
251
  /**
238
252
  * Starts the Matterbridge in childbridge mode.
239
253
  * @private
240
254
  * @returns {Promise<void>} A promise that resolves when the Matterbridge is started.
241
255
  */
242
- private startChildbridge;
256
+ protected startChildbridge(): Promise<void>;
243
257
  /**
244
258
  * Starts the Matterbridge controller.
245
259
  * @private
246
260
  * @returns {Promise<void>} A promise that resolves when the Matterbridge is started.
247
261
  */
248
- private startController;
262
+ protected startController(): Promise<void>;
249
263
  /** ***********************************************************************************************************************************/
250
264
  /** Matter.js methods */
251
265
  /** ***********************************************************************************************************************************/
@@ -255,40 +269,40 @@ export declare class Matterbridge extends EventEmitter {
255
269
  * @param {string} storageName - The name of the storage file.
256
270
  * @returns {Promise<void>} - A promise that resolves when the storage process is started.
257
271
  */
258
- private startMatterStorage;
272
+ protected startMatterStorage(storageType: string, storageName: string): Promise<void>;
259
273
  /**
260
274
  * Makes a backup copy of the specified matter JSON storage file.
261
275
  *
262
276
  * @param storageName - The name of the JSON storage file to be backed up.
263
277
  * @param backupName - The name of the backup file to be created.
264
278
  */
265
- private backupJsonMatterStorage;
279
+ protected backupMatterStorage(storageName: string, backupName: string): Promise<void>;
266
280
  /**
267
281
  * Stops the matter storage.
268
282
  * @returns {Promise<void>} A promise that resolves when the storage is stopped.
269
283
  */
270
- private stopMatterStorage;
284
+ protected stopMatterStorage(): Promise<void>;
271
285
  /**
272
286
  * Creates a Matter server using the provided storage manager and the provided mdnsInterface.
273
287
  * @param storageManager The storage manager to be used by the Matter server.
274
288
  *
275
289
  */
276
- private createMatterServer;
290
+ protected createMatterServer(storageManager: StorageManager): MatterServer;
277
291
  /**
278
292
  * Starts the Matter server.
279
293
  * If the Matter server is not initialized, it logs an error and performs cleanup.
280
294
  */
281
- private startMatterServer;
295
+ protected startMatterServer(): Promise<void>;
282
296
  /**
283
297
  * Stops the Matter server, commissioningServer and commissioningController.
284
298
  */
285
- private stopMatterServer;
299
+ protected stopMatterServer(): Promise<void>;
286
300
  /**
287
301
  * Creates a Matter Aggregator.
288
302
  * @param {StorageContext} context - The storage context.
289
303
  * @returns {Aggregator} - The created Matter Aggregator.
290
304
  */
291
- private createMatterAggregator;
305
+ protected createMatterAggregator(context: StorageContext, pluginName: string): Promise<Aggregator>;
292
306
  /**
293
307
  * Creates a matter commissioning server.
294
308
  *
@@ -296,7 +310,7 @@ export declare class Matterbridge extends EventEmitter {
296
310
  * @param {string} pluginName - The name of the commissioning server.
297
311
  * @returns {CommissioningServer} The created commissioning server.
298
312
  */
299
- private createCommisioningServer;
313
+ protected createCommisioningServer(context: StorageContext, pluginName: string): Promise<CommissioningServer>;
300
314
  /**
301
315
  * Creates a commissioning server storage context.
302
316
  *
@@ -315,7 +329,7 @@ export declare class Matterbridge extends EventEmitter {
315
329
  * @param hardwareVersionString - The hardware version string of the device (optional).
316
330
  * @returns The storage context for the commissioning server.
317
331
  */
318
- private createCommissioningServerContext;
332
+ protected createCommissioningServerContext(pluginName: string, deviceName: string, deviceType: DeviceTypeId, vendorId: number, vendorName: string, productId: number, productName: string): Promise<StorageContext>;
319
333
  /**
320
334
  * Imports the commissioning server context for a specific plugin and device.
321
335
  * @param pluginName - The name of the plugin.
@@ -323,7 +337,7 @@ export declare class Matterbridge extends EventEmitter {
323
337
  * @returns The commissioning server context.
324
338
  * @throws Error if the BasicInformationCluster is not found.
325
339
  */
326
- private importCommissioningServerContext;
340
+ protected importCommissioningServerContext(pluginName: string, device: MatterbridgeDevice): Promise<StorageContext>;
327
341
  /**
328
342
  * Shows the commissioning server QR code for a given plugin.
329
343
  * @param {CommissioningServer} commissioningServer - The commissioning server instance.
@@ -332,7 +346,7 @@ export declare class Matterbridge extends EventEmitter {
332
346
  * @param {string} pluginName - The name of the plugin of Matterbridge in bridge mode.
333
347
  * @returns {Promise<void>} - A promise that resolves when the QR code is shown.
334
348
  */
335
- private showCommissioningQRCode;
349
+ protected showCommissioningQRCode(commissioningServer: CommissioningServer | undefined, storageContext: StorageContext | undefined, nodeContext: NodeStorage | undefined, pluginName: string): Promise<void>;
336
350
  /**
337
351
  * Sanitizes the fabric information by converting bigint properties to string cause res.json doesn't know bigint.
338
352
  *
@@ -353,26 +367,26 @@ export declare class Matterbridge extends EventEmitter {
353
367
  * @param {CommissioningServer} commissioningServer - The commissioning server to set the reachability for.
354
368
  * @param {boolean} reachable - The new reachability status.
355
369
  */
356
- private setCommissioningServerReachability;
370
+ protected setCommissioningServerReachability(commissioningServer: CommissioningServer, reachable: boolean): void;
357
371
  /**
358
372
  * Sets the reachability of the specified matter aggregator and its bridged devices and trigger.
359
373
  * @param {Aggregator} matterAggregator - The matter aggregator to set the reachability for.
360
374
  * @param {boolean} reachable - A boolean indicating the reachability status to set.
361
375
  */
362
- private setAggregatorReachability;
376
+ protected setAggregatorReachability(matterAggregator: Aggregator, reachable: boolean): void;
363
377
  /**
364
378
  * Sets the reachability of a device and trigger.
365
379
  *
366
380
  * @param {MatterbridgeDevice} device - The device to set the reachability for.
367
381
  * @param {boolean} reachable - The new reachability status of the device.
368
382
  */
369
- private setDeviceReachability;
383
+ protected setDeviceReachability(device: MatterbridgeDevice, reachable: boolean): void;
370
384
  private getVendorIdName;
371
385
  /**
372
386
  * Retrieves the base registered plugins sanitized for res.json().
373
387
  * @returns {BaseRegisteredPlugin[]} A promise that resolves to an array of BaseRegisteredPlugin objects.
374
388
  */
375
- private getBaseRegisteredPlugins;
389
+ protected getBaseRegisteredPlugins(): Promise<BaseRegisteredPlugin[]>;
376
390
  /**
377
391
  * Spawns a child process with the given command and arguments.
378
392
  * @param {string} command - The command to execute.
@@ -389,6 +403,16 @@ export declare class Matterbridge extends EventEmitter {
389
403
  * @param {string} message - The content of the message.
390
404
  */
391
405
  private wssSendMessage;
406
+ /**
407
+ * Sends a need to refresh WebSocket message to all connected clients.
408
+ *
409
+ */
410
+ private wssSendRefreshRequired;
411
+ /**
412
+ * Sends a need to restart WebSocket message to all connected clients.
413
+ *
414
+ */
415
+ private wssSendRestartRequired;
392
416
  /**
393
417
  * Initializes the frontend of Matterbridge.
394
418
  *
@@ -400,7 +424,7 @@ export declare class Matterbridge extends EventEmitter {
400
424
  * @param {MatterbridgeDevice} device - The MatterbridgeDevice object.
401
425
  * @returns {string} The attributes description of the cluster servers in the device.
402
426
  */
403
- private getClusterTextFromDevice;
427
+ protected getClusterTextFromDevice(device: MatterbridgeDevice): string;
404
428
  /**
405
429
  * Initializes the Matterbridge instance as extension for zigbee2mqtt.
406
430
  * @deprecated This method is deprecated and will be removed in a future version.