matterbridge 1.6.8-dev.15 → 1.6.8-dev.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/CHANGELOG.md +8 -4
  2. package/README-EDGE.md +3 -3
  3. package/dist/cli.d.ts.map +1 -0
  4. package/dist/cli.js +26 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/cluster/export.d.ts.map +1 -0
  7. package/dist/cluster/export.js +2 -0
  8. package/dist/cluster/export.js.map +1 -0
  9. package/dist/defaultConfigSchema.d.ts.map +1 -0
  10. package/dist/defaultConfigSchema.js +23 -0
  11. package/dist/defaultConfigSchema.js.map +1 -0
  12. package/dist/deviceManager.d.ts +46 -0
  13. package/dist/deviceManager.d.ts.map +1 -0
  14. package/dist/deviceManager.js +26 -1
  15. package/dist/deviceManager.js.map +1 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +30 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/logger/export.d.ts.map +1 -0
  20. package/dist/logger/export.js +1 -0
  21. package/dist/logger/export.js.map +1 -0
  22. package/dist/matter/export.d.ts.map +1 -0
  23. package/dist/matter/export.js +1 -0
  24. package/dist/matter/export.js.map +1 -0
  25. package/dist/matterbridge.d.ts +483 -0
  26. package/dist/matterbridge.d.ts.map +1 -0
  27. package/dist/matterbridge.js +758 -80
  28. package/dist/matterbridge.js.map +1 -0
  29. package/dist/matterbridgeAccessoryPlatform.d.ts.map +1 -0
  30. package/dist/matterbridgeAccessoryPlatform.js +33 -0
  31. package/dist/matterbridgeAccessoryPlatform.js.map +1 -0
  32. package/dist/matterbridgeBehaviors.d.ts +116 -0
  33. package/dist/matterbridgeBehaviors.d.ts.map +1 -0
  34. package/dist/matterbridgeBehaviors.js +29 -1
  35. package/dist/matterbridgeBehaviors.js.map +1 -0
  36. package/dist/matterbridgeDevice.d.ts +1100 -0
  37. package/dist/matterbridgeDevice.d.ts.map +1 -0
  38. package/dist/matterbridgeDevice.js +997 -10
  39. package/dist/matterbridgeDevice.js.map +1 -0
  40. package/dist/matterbridgeDeviceTypes.d.ts +108 -0
  41. package/dist/matterbridgeDeviceTypes.d.ts.map +1 -0
  42. package/dist/matterbridgeDeviceTypes.js +82 -11
  43. package/dist/matterbridgeDeviceTypes.js.map +1 -0
  44. package/dist/matterbridgeDynamicPlatform.d.ts.map +1 -0
  45. package/dist/matterbridgeDynamicPlatform.js +33 -0
  46. package/dist/matterbridgeDynamicPlatform.js.map +1 -0
  47. package/dist/matterbridgeEdge.d.ts +90 -0
  48. package/dist/matterbridgeEdge.d.ts.map +1 -0
  49. package/dist/matterbridgeEdge.js +529 -0
  50. package/dist/matterbridgeEdge.js.map +1 -0
  51. package/dist/matterbridgeEndpoint.d.ts +1134 -0
  52. package/dist/matterbridgeEndpoint.d.ts.map +1 -0
  53. package/dist/matterbridgeEndpoint.js +1121 -12
  54. package/dist/matterbridgeEndpoint.js.map +1 -0
  55. package/dist/matterbridgePlatform.d.ts +136 -0
  56. package/dist/matterbridgePlatform.d.ts.map +1 -0
  57. package/dist/matterbridgePlatform.js +111 -3
  58. package/dist/matterbridgePlatform.js.map +1 -0
  59. package/dist/matterbridgeTypes.d.ts.map +1 -0
  60. package/dist/matterbridgeTypes.js +24 -0
  61. package/dist/matterbridgeTypes.js.map +1 -0
  62. package/dist/matterbridgeWebsocket.d.ts.map +1 -0
  63. package/dist/matterbridgeWebsocket.js +45 -0
  64. package/dist/matterbridgeWebsocket.js.map +1 -0
  65. package/dist/pluginManager.d.ts +238 -0
  66. package/dist/pluginManager.d.ts.map +1 -0
  67. package/dist/pluginManager.js +238 -3
  68. package/dist/pluginManager.js.map +1 -0
  69. package/dist/storage/export.d.ts.map +1 -0
  70. package/dist/storage/export.js +1 -0
  71. package/dist/storage/export.js.map +1 -0
  72. package/dist/utils/colorUtils.d.ts.map +1 -0
  73. package/dist/utils/colorUtils.js +205 -2
  74. package/dist/utils/colorUtils.js.map +1 -0
  75. package/dist/utils/export.d.ts.map +1 -0
  76. package/dist/utils/export.js +1 -0
  77. package/dist/utils/export.js.map +1 -0
  78. package/dist/utils/utils.d.ts +221 -0
  79. package/dist/utils/utils.d.ts.map +1 -0
  80. package/dist/utils/utils.js +253 -8
  81. package/dist/utils/utils.js.map +1 -0
  82. package/frontend/build/asset-manifest.json +6 -6
  83. package/frontend/build/index.html +1 -1
  84. package/frontend/build/static/css/{main.f44a67b7.css → main.0f9899a6.css} +2 -2
  85. package/frontend/build/static/css/main.0f9899a6.css.map +1 -0
  86. package/frontend/build/static/js/{main.b45edfff.js → main.4087dcdb.js} +3 -3
  87. package/frontend/build/static/js/main.4087dcdb.js.map +1 -0
  88. package/npm-shrinkwrap.json +2 -2
  89. package/package.json +1 -1
  90. package/frontend/build/static/css/main.f44a67b7.css.map +0 -1
  91. package/frontend/build/static/js/main.b45edfff.js.map +0 -1
  92. /package/frontend/build/static/js/{main.b45edfff.js.LICENSE.txt → main.4087dcdb.js.LICENSE.txt} +0 -0
@@ -0,0 +1,483 @@
1
+ /**
2
+ * This file contains the class Matterbridge.
3
+ *
4
+ * @file matterbridge.ts
5
+ * @author Luca Liguori
6
+ * @date 2023-12-29
7
+ * @version 1.5.2
8
+ *
9
+ * Copyright 2023, 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 EventEmitter from 'events';
24
+ import WebSocket from 'ws';
25
+ import { NodeStorageManager, NodeStorage } from 'node-persist-manager';
26
+ import { AnsiLogger } from 'node-ansi-logger';
27
+ import { MatterbridgeDevice } from './matterbridgeDevice.js';
28
+ import { BaseRegisteredPlugin, MatterbridgeInformation, RegisteredPlugin, SanitizedExposedFabricInformation, SanitizedSessionInformation, SessionInformation, SystemInformation } from './matterbridgeTypes.js';
29
+ import { PluginManager } from './pluginManager.js';
30
+ import { DeviceManager } from './deviceManager.js';
31
+ import { MatterbridgeEndpoint } from './matterbridgeEndpoint.js';
32
+ import { DeviceTypeId, VendorId, StorageContext, StorageManager } from '@matter/main';
33
+ import { ExposedFabricInformation } from '@matter/main/protocol';
34
+ import { CommissioningController, CommissioningServer, MatterServer } from '@project-chip/matter.js';
35
+ import { Aggregator } from '@project-chip/matter.js/device';
36
+ /**
37
+ * Represents the Matterbridge application.
38
+ */
39
+ export declare class Matterbridge extends EventEmitter {
40
+ systemInformation: SystemInformation;
41
+ matterbridgeInformation: MatterbridgeInformation;
42
+ homeDirectory: string;
43
+ rootDirectory: string;
44
+ matterbridgeDirectory: string;
45
+ matterbridgePluginDirectory: string;
46
+ globalModulesDirectory: string;
47
+ matterbridgeVersion: string;
48
+ matterbridgeLatestVersion: string;
49
+ matterbridgeQrPairingCode: string | undefined;
50
+ matterbridgeManualPairingCode: string | undefined;
51
+ matterbridgeFabricInformations: SanitizedExposedFabricInformation[];
52
+ matterbridgeSessionInformations: SanitizedSessionInformation[];
53
+ matterbridgePaired: boolean;
54
+ matterbridgeConnected: boolean;
55
+ bridgeMode: 'bridge' | 'childbridge' | 'controller' | '';
56
+ restartMode: 'service' | 'docker' | '';
57
+ profile: string | undefined;
58
+ edge: boolean;
59
+ log: AnsiLogger;
60
+ protected matterbrideLoggerFile: string;
61
+ protected matterLoggerFile: string;
62
+ protected plugins: PluginManager;
63
+ protected devices: DeviceManager;
64
+ protected nodeStorage: NodeStorageManager | undefined;
65
+ protected nodeContext: NodeStorage | undefined;
66
+ protected matterStorageName: string;
67
+ protected nodeStorageName: string;
68
+ private hasCleanupStarted;
69
+ private initialized;
70
+ private execRunningCount;
71
+ private startMatterInterval;
72
+ private checkUpdateInterval;
73
+ private configureTimeout;
74
+ private reachabilityTimeout;
75
+ private sigintHandler;
76
+ private sigtermHandler;
77
+ private exceptionHandler;
78
+ private rejectionHandler;
79
+ private expressApp;
80
+ private httpServer;
81
+ private httpsServer;
82
+ private webSocketServer;
83
+ protected mdnsInterface: string | undefined;
84
+ protected ipv4address: string | undefined;
85
+ protected ipv6address: string | undefined;
86
+ protected port: number;
87
+ protected passcode?: number;
88
+ protected discriminator?: number;
89
+ protected storageManager: StorageManager | undefined;
90
+ protected matterbridgeContext: StorageContext | undefined;
91
+ protected mattercontrollerContext: StorageContext | undefined;
92
+ protected matterServer: MatterServer | undefined;
93
+ protected matterAggregator: Aggregator | undefined;
94
+ protected commissioningServer: CommissioningServer | undefined;
95
+ protected commissioningController: CommissioningController | undefined;
96
+ protected aggregatorVendorId: VendorId;
97
+ protected aggregatorProductId: number;
98
+ protected static instance: Matterbridge | undefined;
99
+ protected constructor();
100
+ /**
101
+ * Retrieves the list of Matterbridge devices.
102
+ * @returns {MatterbridgeDevice[]} An array of MatterbridgeDevice objects.
103
+ */
104
+ getDevices(): MatterbridgeDevice[];
105
+ /**
106
+ * Retrieves the list of registered plugins.
107
+ * @returns {RegisteredPlugin[]} An array of RegisteredPlugin objects.
108
+ */
109
+ getPlugins(): RegisteredPlugin[];
110
+ matterbridgeMessageHandler: (client: WebSocket, message: WebSocket.RawData) => Promise<void>;
111
+ /** ***********************************************************************************************************************************/
112
+ /** loadInstance() and cleanup() methods */
113
+ /** ***********************************************************************************************************************************/
114
+ /**
115
+ * Loads an instance of the Matterbridge class.
116
+ * If an instance already exists, return that instance.
117
+ *
118
+ * @param initialize - Whether to initialize the Matterbridge instance after loading.
119
+ * @returns The loaded Matterbridge instance.
120
+ */
121
+ static loadInstance(initialize?: boolean): unknown;
122
+ /**
123
+ * Call cleanup().
124
+ * @deprecated This method is deprecated and is only used for jest tests.
125
+ *
126
+ */
127
+ destroyInstance(): any;
128
+ /**
129
+ * Initializes the Matterbridge application.
130
+ *
131
+ * @remarks
132
+ * This method performs the necessary setup and initialization steps for the Matterbridge application.
133
+ * It displays the help information if the 'help' parameter is provided, sets up the logger, checks the
134
+ * node version, registers signal handlers, initializes storage, and parses the command line.
135
+ *
136
+ * @returns A Promise that resolves when the initialization is complete.
137
+ */
138
+ initialize(): any;
139
+ /**
140
+ * Parses the command line arguments and performs the corresponding actions.
141
+ * @private
142
+ * @returns {Promise<void>} A promise that resolves when the command line arguments have been processed, or the process exits.
143
+ */
144
+ private parseCommandLine;
145
+ /**
146
+ * Asynchronously loads and starts the registered plugins.
147
+ *
148
+ * This method is responsible for initializing and staarting all enabled plugins.
149
+ * It ensures that each plugin is properly loaded and started before the ridge starts.
150
+ *
151
+ * @returns {Promise<void>} A promise that resolves when all plugins have been loaded and started.
152
+ */
153
+ private startPlugins;
154
+ /**
155
+ * Registers the process handlers for uncaughtException, unhandledRejection, SIGINT and SIGTERM.
156
+ * When either of these signals are received, the cleanup method is called with an appropriate message.
157
+ */
158
+ private registerProcessHandlers;
159
+ /**
160
+ * Deregisters the process uncaughtException, unhandledRejection, SIGINT and SIGTERM signal handlers.
161
+ */
162
+ private deregisterProcesslHandlers;
163
+ /**
164
+ * Logs the node and system information.
165
+ */
166
+ private logNodeAndSystemInfo;
167
+ /**
168
+ * Retrieves the latest version of a package from the npm registry.
169
+ * @param packageName - The name of the package.
170
+ * @returns A Promise that resolves to the latest version of the package.
171
+ */
172
+ private getLatestVersion;
173
+ /**
174
+ * Retrieves the path to the global Node.js modules directory.
175
+ * @returns A promise that resolves to the path of the global Node.js modules directory.
176
+ */
177
+ private getGlobalNodeModules;
178
+ /**
179
+ * Retrieves the latest version of Matterbridge and performs necessary actions based on the version comparison.
180
+ * @private
181
+ * @returns {Promise<void>} A promise that resolves when the latest version is retrieved and actions are performed.
182
+ */
183
+ private getMatterbridgeLatestVersion;
184
+ /**
185
+ * Retrieves the latest version of a plugin and updates the plugin's latestVersion property.
186
+ * If the plugin's version is different from the latest version, logs a warning message.
187
+ * If the plugin's version is the same as the latest version, logs an info message.
188
+ * If there is an error retrieving the latest version, logs an error message.
189
+ *
190
+ * @private
191
+ * @param {RegisteredPlugin} plugin - The plugin for which to retrieve the latest version.
192
+ * @returns {Promise<void>} A promise that resolves when the latest version is retrieved and actions are performed.
193
+ */
194
+ private getPluginLatestVersion;
195
+ /**
196
+ * Creates a MatterLogger function to show the matter.js log messages in AnsiLogger (for the frontend).
197
+ *
198
+ * @returns {Function} The MatterLogger function.
199
+ */
200
+ private createMatterLogger;
201
+ /**
202
+ * Creates a Matter File Logger.
203
+ *
204
+ * @param {string} filePath - The path to the log file.
205
+ * @param {boolean} [unlink=false] - Whether to unlink the log file before creating a new one.
206
+ * @returns {Function} - A function that logs formatted messages to the log file.
207
+ */
208
+ private createMatterFileLogger;
209
+ /**
210
+ * Update matterbridge and cleanup.
211
+ */
212
+ protected updateProcess(): any;
213
+ /**
214
+ * Restarts the process by spawning a new process and exiting the current process.
215
+ */
216
+ protected restartProcess(): any;
217
+ /**
218
+ * Shut down the process by exiting the current process.
219
+ */
220
+ protected shutdownProcess(): any;
221
+ /**
222
+ * Shut down the process and reset.
223
+ */
224
+ private unregisterAndShutdownProcess;
225
+ /**
226
+ * Shut down the process and reset.
227
+ */
228
+ private shutdownProcessAndReset;
229
+ /**
230
+ * Shut down the process and factory reset.
231
+ */
232
+ private shutdownProcessAndFactoryReset;
233
+ /**
234
+ * Cleans up the Matterbridge instance.
235
+ * @param message - The cleanup message.
236
+ * @param restart - Indicates whether to restart the instance after cleanup. Default is `false`.
237
+ * @returns A promise that resolves when the cleanup is completed.
238
+ */
239
+ protected cleanup(message: string, restart?: boolean): any;
240
+ addBridgedEndpoint(pluginName: string, device: MatterbridgeEndpoint): Promise<void>;
241
+ removeBridgedEndpoint(pluginName: string, device: MatterbridgeEndpoint): Promise<void>;
242
+ removeAllBridgedEndpoints(pluginName: string): Promise<void>;
243
+ /**
244
+ * Adds a bridged device to the Matterbridge.
245
+ * @param pluginName - The name of the plugin.
246
+ * @param device - The bridged device to add.
247
+ * @returns {Promise<void>} - A promise that resolves when the device is added.
248
+ */
249
+ addBridgedDevice(pluginName: string, device: MatterbridgeDevice): Promise<void>;
250
+ /**
251
+ * Removes a bridged device from the Matterbridge.
252
+ * @param pluginName - The name of the plugin.
253
+ * @param device - The device to be removed.
254
+ * @returns A Promise that resolves when the device is successfully removed.
255
+ */
256
+ removeBridgedDevice(pluginName: string, device: MatterbridgeDevice): Promise<void>;
257
+ /**
258
+ * Removes all bridged devices associated with a specific plugin.
259
+ *
260
+ * @param pluginName - The name of the plugin.
261
+ * @returns A promise that resolves when all devices have been removed.
262
+ */
263
+ removeAllBridgedDevices(pluginName: string): Promise<void>;
264
+ /**
265
+ * Starts the Matterbridge in bridge mode.
266
+ * @private
267
+ * @returns {Promise<void>} A promise that resolves when the Matterbridge is started.
268
+ */
269
+ protected startBridge(): Promise<void>;
270
+ /**
271
+ * Starts the Matterbridge in childbridge mode.
272
+ * @private
273
+ * @returns {Promise<void>} A promise that resolves when the Matterbridge is started.
274
+ */
275
+ protected startChildbridge(): Promise<void>;
276
+ /**
277
+ * Starts the Matterbridge controller.
278
+ * @private
279
+ * @returns {Promise<void>} A promise that resolves when the Matterbridge is started.
280
+ */
281
+ protected startController(): Promise<void>;
282
+ /** ***********************************************************************************************************************************/
283
+ /** Matter.js methods */
284
+ /** ***********************************************************************************************************************************/
285
+ /**
286
+ * Starts the matter storage process based on the specified storage type and name.
287
+ * @param {string} storageType - The type of storage to start (e.g., 'disk', 'json').
288
+ * @param {string} storageName - The name of the storage file.
289
+ * @returns {Promise<void>} - A promise that resolves when the storage process is started.
290
+ */
291
+ protected startMatterStorage(storageType: string, storageName: string): Promise<void>;
292
+ /**
293
+ * Convert the old API matter storage to the new API format.
294
+ * @param {StorageContext} context - The context of Matterbridge or of the plugin.
295
+ * @param {string} pluginName - The name of the plugin or Matterbridge.
296
+ * @returns {Promise<void>} - A promise that resolves when the storage process is started.
297
+ */
298
+ convertStorage(context: StorageContext, pluginName: string): any;
299
+ /**
300
+ * Makes a backup copy of the specified matter JSON storage file.
301
+ *
302
+ * @param storageName - The name of the JSON storage file to be backed up.
303
+ * @param backupName - The name of the backup file to be created.
304
+ */
305
+ protected backupMatterStorage(storageName: string, backupName: string): Promise<void>;
306
+ /**
307
+ * Restore the specified matter JSON storage file.
308
+ *
309
+ * @param backupName - The name of the backup file to restore from.
310
+ * @param storageName - The name of the JSON storage file to restored.
311
+ */
312
+ protected restoreMatterStorage(backupName: string, storageName: string): Promise<void>;
313
+ /**
314
+ * Stops the matter storage.
315
+ * @returns {Promise<void>} A promise that resolves when the storage is stopped.
316
+ */
317
+ protected stopMatterStorage(): Promise<void>;
318
+ /**
319
+ * Creates a Matter server using the provided storage manager and the provided mdnsInterface.
320
+ * @param storageManager The storage manager to be used by the Matter server.
321
+ *
322
+ */
323
+ protected createMatterServer(storageManager: StorageManager): MatterServer;
324
+ /**
325
+ * Starts the Matter server.
326
+ * If the Matter server is not initialized, it logs an error and performs cleanup.
327
+ */
328
+ protected startMatterServer(): any;
329
+ /**
330
+ * Stops the Matter server, commissioningServer and commissioningController.
331
+ */
332
+ protected stopMatterServer(): any;
333
+ /**
334
+ * Creates a Matter Aggregator.
335
+ * @param {StorageContext} context - The storage context.
336
+ * @returns {Aggregator} - The created Matter Aggregator.
337
+ */
338
+ protected createMatterAggregator(context: StorageContext, pluginName: string): Promise<Aggregator>;
339
+ /**
340
+ * Creates a matter commissioning server.
341
+ *
342
+ * @param {StorageContext} context - The storage context.
343
+ * @param {string} pluginName - The name of the commissioning server.
344
+ * @returns {CommissioningServer} The created commissioning server.
345
+ */
346
+ protected createCommisioningServer(context: StorageContext, pluginName: string): Promise<CommissioningServer>;
347
+ /**
348
+ * Creates a commissioning server storage context.
349
+ *
350
+ * @param pluginName - The name of the plugin.
351
+ * @param deviceName - The name of the device.
352
+ * @param deviceType - The type of the device.
353
+ * @param vendorId - The vendor ID.
354
+ * @param vendorName - The vendor name.
355
+ * @param productId - The product ID.
356
+ * @param productName - The product name.
357
+ * @param serialNumber - The serial number of the device (optional).
358
+ * @param uniqueId - The unique ID of the device (optional).
359
+ * @param softwareVersion - The software version of the device (optional).
360
+ * @param softwareVersionString - The software version string of the device (optional).
361
+ * @param hardwareVersion - The hardware version of the device (optional).
362
+ * @param hardwareVersionString - The hardware version string of the device (optional).
363
+ * @returns The storage context for the commissioning server.
364
+ */
365
+ protected createCommissioningServerContext(pluginName: string, deviceName: string, deviceType: DeviceTypeId, vendorId: number, vendorName: string, productId: number, productName: string): Promise<StorageContext>;
366
+ /**
367
+ * Imports the commissioning server context for a specific plugin and device.
368
+ * @param pluginName - The name of the plugin.
369
+ * @param device - The MatterbridgeDevice object representing the device.
370
+ * @returns The commissioning server context.
371
+ * @throws Error if the BasicInformationCluster is not found.
372
+ */
373
+ protected importCommissioningServerContext(pluginName: string, device: MatterbridgeDevice): Promise<StorageContext>;
374
+ /**
375
+ * Shows the commissioning server QR code for a given plugin.
376
+ * @param {CommissioningServer} commissioningServer - The commissioning server instance.
377
+ * @param {StorageContext} storageContext - The storage context instance.
378
+ * @param {NodeStorage} nodeContext - The node storage instance.
379
+ * @param {string} pluginName - The name of the plugin of Matterbridge in bridge mode.
380
+ * @returns {Promise<void>} - A promise that resolves when the QR code is shown.
381
+ */
382
+ protected showCommissioningQRCode(commissioningServer: CommissioningServer | undefined, storageContext: StorageContext | undefined, nodeContext: NodeStorage | undefined, pluginName: string): any;
383
+ /**
384
+ * Sanitizes the fabric information by converting bigint properties to string cause res.json doesn't know bigint.
385
+ *
386
+ * @param fabricInfo - The array of exposed fabric information objects.
387
+ * @returns An array of sanitized exposed fabric information objects.
388
+ */
389
+ protected sanitizeFabricInformations(fabricInfo: ExposedFabricInformation[]): any;
390
+ /**
391
+ * Sanitizes the session information by converting bigint properties to string.
392
+ *
393
+ * @param sessionInfo - The array of session information objects.
394
+ * @returns An array of sanitized session information objects.
395
+ */
396
+ protected sanitizeSessionInformation(sessionInfo: SessionInformation[]): any;
397
+ /**
398
+ * Sets the reachability of a commissioning server and trigger.
399
+ *
400
+ * @param {CommissioningServer} commissioningServer - The commissioning server to set the reachability for.
401
+ * @param {boolean} reachable - The new reachability status.
402
+ */
403
+ protected setCommissioningServerReachability(commissioningServer: CommissioningServer, reachable: boolean): void;
404
+ /**
405
+ * Sets the reachability of the specified matter aggregator and its bridged devices and trigger.
406
+ * @param {Aggregator} matterAggregator - The matter aggregator to set the reachability for.
407
+ * @param {boolean} reachable - A boolean indicating the reachability status to set.
408
+ */
409
+ protected setAggregatorReachability(matterAggregator: Aggregator, reachable: boolean): void;
410
+ /**
411
+ * Sets the reachability of a device and trigger.
412
+ *
413
+ * @param {MatterbridgeDevice} device - The device to set the reachability for.
414
+ * @param {boolean} reachable - The new reachability status of the device.
415
+ */
416
+ protected setDeviceReachability(device: MatterbridgeDevice, reachable: boolean): void;
417
+ private getVendorIdName;
418
+ /**
419
+ * Retrieves the base registered plugins sanitized for res.json().
420
+ * @returns {BaseRegisteredPlugin[]} A promise that resolves to an array of BaseRegisteredPlugin objects.
421
+ */
422
+ protected getBaseRegisteredPlugins(): Promise<BaseRegisteredPlugin[]>;
423
+ /**
424
+ * Spawns a child process with the given command and arguments.
425
+ * @param {string} command - The command to execute.
426
+ * @param {string[]} args - The arguments to pass to the command (default: []).
427
+ * @returns {Promise<boolean>} A promise that resolves when the child process exits successfully, or rejects if there is an error.
428
+ */
429
+ protected spawnCommand(command: string, args?: string[]): Promise<boolean>;
430
+ /**
431
+ * Sends a WebSocket message to all connected clients.
432
+ *
433
+ * @param {string} level - The logger level of the message: debug info notice warn error fatal...
434
+ * @param {string} time - The time string of the message
435
+ * @param {string} name - The logger name of the message
436
+ * @param {string} message - The content of the message.
437
+ */
438
+ private wssSendMessage;
439
+ /**
440
+ * Sends a need to refresh WebSocket message to all connected clients.
441
+ *
442
+ */
443
+ private wssSendRefreshRequired;
444
+ /**
445
+ * Sends a need to restart WebSocket message to all connected clients.
446
+ *
447
+ */
448
+ private wssSendRestartRequired;
449
+ /**
450
+ * Initializes the frontend of Matterbridge.
451
+ *
452
+ * @param port The port number to run the frontend server on. Default is 8283.
453
+ */
454
+ initializeFrontend(port?: number): Promise<void>;
455
+ /**
456
+ * Retrieves the cluster text description from a given device.
457
+ * @param {MatterbridgeDevice} device - The MatterbridgeDevice object.
458
+ * @returns {string} The attributes description of the cluster servers in the device.
459
+ */
460
+ protected getClusterTextFromDevice(device: MatterbridgeDevice): string;
461
+ /**
462
+ * Initializes the Matterbridge instance as extension for zigbee2mqtt.
463
+ * @deprecated This method is deprecated and will be removed in a future version.
464
+ *
465
+ * @returns A Promise that resolves when the initialization is complete.
466
+ */
467
+ startExtension(dataPath: string, extensionVersion: string, port?: number): Promise<boolean>;
468
+ /**
469
+ * Close the Matterbridge instance as extension for zigbee2mqtt.
470
+ * @deprecated This method is deprecated and will be removed in a future version.
471
+ *
472
+ * @returns A Promise that resolves when the initialization is complete.
473
+ */
474
+ stopExtension(): any;
475
+ /**
476
+ * Checks if the extension is commissioned.
477
+ * @deprecated This method is deprecated and will be removed in a future version.
478
+ *
479
+ * @returns {boolean} Returns true if the extension is commissioned, false otherwise.
480
+ */
481
+ isExtensionCommissioned(): boolean;
482
+ }
483
+ //# sourceMappingURL=matterbridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matterbridge.d.ts","sourceRoot":"","sources":["../src/matterbridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAQH,OAAO,YAAY,MAAM,QAAQ,CAAC;AAQlC,OAAO,SAA8B,MAAM,IAAI,CAAC;AAGhD,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAyK,MAAM,kBAAkB,CAAC;AAGrN,OAAO,EAAE,kBAAkB,EAAgC,MAAM,yBAAyB,CAAC;AAG3F,OAAO,EAAc,oBAAoB,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,iCAA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