matterbridge 2.1.5-dev.7 → 2.1.5

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 (112) hide show
  1. package/CHANGELOG.md +4 -2
  2. package/README-DOCKER.md +6 -0
  3. package/dist/cli.d.ts +25 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +26 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/cluster/export.d.ts +2 -0
  8. package/dist/cluster/export.d.ts.map +1 -0
  9. package/dist/cluster/export.js +2 -0
  10. package/dist/cluster/export.js.map +1 -0
  11. package/dist/defaultConfigSchema.d.ts +27 -0
  12. package/dist/defaultConfigSchema.d.ts.map +1 -0
  13. package/dist/defaultConfigSchema.js +23 -0
  14. package/dist/defaultConfigSchema.js.map +1 -0
  15. package/dist/deviceManager.d.ts +114 -0
  16. package/dist/deviceManager.d.ts.map +1 -0
  17. package/dist/deviceManager.js +94 -1
  18. package/dist/deviceManager.js.map +1 -0
  19. package/dist/frontend.d.ts +143 -0
  20. package/dist/frontend.d.ts.map +1 -0
  21. package/dist/frontend.js +270 -24
  22. package/dist/frontend.js.map +1 -0
  23. package/dist/index.d.ts +35 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +28 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/logger/export.d.ts +2 -0
  28. package/dist/logger/export.d.ts.map +1 -0
  29. package/dist/logger/export.js +1 -0
  30. package/dist/logger/export.js.map +1 -0
  31. package/dist/matter/behaviors.d.ts +2 -0
  32. package/dist/matter/behaviors.d.ts.map +1 -0
  33. package/dist/matter/behaviors.js +2 -0
  34. package/dist/matter/behaviors.js.map +1 -0
  35. package/dist/matter/clusters.d.ts +2 -0
  36. package/dist/matter/clusters.d.ts.map +1 -0
  37. package/dist/matter/clusters.js +2 -0
  38. package/dist/matter/clusters.js.map +1 -0
  39. package/dist/matter/devices.d.ts +2 -0
  40. package/dist/matter/devices.d.ts.map +1 -0
  41. package/dist/matter/devices.js +2 -0
  42. package/dist/matter/devices.js.map +1 -0
  43. package/dist/matter/endpoints.d.ts +2 -0
  44. package/dist/matter/endpoints.d.ts.map +1 -0
  45. package/dist/matter/endpoints.js +2 -0
  46. package/dist/matter/endpoints.js.map +1 -0
  47. package/dist/matter/export.d.ts +5 -0
  48. package/dist/matter/export.d.ts.map +1 -0
  49. package/dist/matter/export.js +2 -0
  50. package/dist/matter/export.js.map +1 -0
  51. package/dist/matter/types.d.ts +3 -0
  52. package/dist/matter/types.d.ts.map +1 -0
  53. package/dist/matter/types.js +2 -0
  54. package/dist/matter/types.js.map +1 -0
  55. package/dist/matterbridge.d.ts +409 -0
  56. package/dist/matterbridge.d.ts.map +1 -0
  57. package/dist/matterbridge.js +750 -41
  58. package/dist/matterbridge.js.map +1 -0
  59. package/dist/matterbridgeAccessoryPlatform.d.ts +39 -0
  60. package/dist/matterbridgeAccessoryPlatform.d.ts.map +1 -0
  61. package/dist/matterbridgeAccessoryPlatform.js +33 -0
  62. package/dist/matterbridgeAccessoryPlatform.js.map +1 -0
  63. package/dist/matterbridgeBehaviors.d.ts +1056 -0
  64. package/dist/matterbridgeBehaviors.d.ts.map +1 -0
  65. package/dist/matterbridgeBehaviors.js +32 -1
  66. package/dist/matterbridgeBehaviors.js.map +1 -0
  67. package/dist/matterbridgeDeviceTypes.d.ts +177 -0
  68. package/dist/matterbridgeDeviceTypes.d.ts.map +1 -0
  69. package/dist/matterbridgeDeviceTypes.js +112 -11
  70. package/dist/matterbridgeDeviceTypes.js.map +1 -0
  71. package/dist/matterbridgeDynamicPlatform.d.ts +39 -0
  72. package/dist/matterbridgeDynamicPlatform.d.ts.map +1 -0
  73. package/dist/matterbridgeDynamicPlatform.js +33 -0
  74. package/dist/matterbridgeDynamicPlatform.js.map +1 -0
  75. package/dist/matterbridgeEndpoint.d.ts +835 -0
  76. package/dist/matterbridgeEndpoint.d.ts.map +1 -0
  77. package/dist/matterbridgeEndpoint.js +690 -6
  78. package/dist/matterbridgeEndpoint.js.map +1 -0
  79. package/dist/matterbridgeEndpointHelpers.d.ts +2275 -0
  80. package/dist/matterbridgeEndpointHelpers.d.ts.map +1 -0
  81. package/dist/matterbridgeEndpointHelpers.js +117 -9
  82. package/dist/matterbridgeEndpointHelpers.js.map +1 -0
  83. package/dist/matterbridgePlatform.d.ts +159 -0
  84. package/dist/matterbridgePlatform.d.ts.map +1 -0
  85. package/dist/matterbridgePlatform.js +121 -5
  86. package/dist/matterbridgePlatform.js.map +1 -0
  87. package/dist/matterbridgeTypes.d.ts +169 -0
  88. package/dist/matterbridgeTypes.d.ts.map +1 -0
  89. package/dist/matterbridgeTypes.js +24 -0
  90. package/dist/matterbridgeTypes.js.map +1 -0
  91. package/dist/pluginManager.d.ts +236 -0
  92. package/dist/pluginManager.d.ts.map +1 -0
  93. package/dist/pluginManager.js +231 -4
  94. package/dist/pluginManager.js.map +1 -0
  95. package/dist/storage/export.d.ts +2 -0
  96. package/dist/storage/export.d.ts.map +1 -0
  97. package/dist/storage/export.js +1 -0
  98. package/dist/storage/export.js.map +1 -0
  99. package/dist/utils/colorUtils.d.ts +61 -0
  100. package/dist/utils/colorUtils.d.ts.map +1 -0
  101. package/dist/utils/colorUtils.js +205 -2
  102. package/dist/utils/colorUtils.js.map +1 -0
  103. package/dist/utils/export.d.ts +3 -0
  104. package/dist/utils/export.d.ts.map +1 -0
  105. package/dist/utils/export.js +1 -0
  106. package/dist/utils/export.js.map +1 -0
  107. package/dist/utils/utils.d.ts +231 -0
  108. package/dist/utils/utils.d.ts.map +1 -0
  109. package/dist/utils/utils.js +264 -10
  110. package/dist/utils/utils.js.map +1 -0
  111. package/npm-shrinkwrap.json +2 -2
  112. package/package.json +2 -1
@@ -1,4 +1,28 @@
1
+ /**
2
+ * This file contains the Plugins class.
3
+ *
4
+ * @file plugins.ts
5
+ * @author Luca Liguori
6
+ * @date 2024-07-14
7
+ * @version 1.1.0
8
+ *
9
+ * Copyright 2024, 2025, 2026 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
+ // NodeStorage and AnsiLogger modules
1
24
  import { AnsiLogger, BLUE, db, er, nf, nt, rs, UNDERLINE, UNDERLINEOFF, wr } from './logger/export.js';
25
+ // Node.js modules
2
26
  import path from 'path';
3
27
  import { promises as fs } from 'fs';
4
28
  import { pathToFileURL } from 'url';
@@ -12,8 +36,9 @@ export class PluginManager {
12
36
  log;
13
37
  constructor(matterbridge) {
14
38
  this.matterbridge = matterbridge;
39
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
40
  this.nodeContext = matterbridge.nodeContext;
16
- this.log = new AnsiLogger({ logName: 'PluginManager', logTimestampFormat: 4, logLevel: matterbridge.log.logLevel });
41
+ this.log = new AnsiLogger({ logName: 'PluginManager', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: matterbridge.log.logLevel });
17
42
  this.log.debug('Matterbridge plugin manager starting...');
18
43
  }
19
44
  get length() {
@@ -50,6 +75,7 @@ export class PluginManager {
50
75
  }
51
76
  catch (error) {
52
77
  this.log.error(`Error processing forEach plugin ${plg}${plugin.name}${er}:`, error);
78
+ // throw error;
53
79
  }
54
80
  });
55
81
  await Promise.all(tasks);
@@ -57,13 +83,31 @@ export class PluginManager {
57
83
  set logLevel(logLevel) {
58
84
  this.log.logLevel = logLevel;
59
85
  }
86
+ /**
87
+ * Loads registered plugins from storage.
88
+ *
89
+ * This method retrieves an array of registered plugins from the storage and converts it
90
+ * into a map where the plugin names are the keys and the plugin objects are the values.
91
+ *
92
+ * @returns {Promise<RegisteredPlugin[]>} A promise that resolves to an array of registered plugins.
93
+ */
60
94
  async loadFromStorage() {
95
+ // Load the array from storage and convert it to a map
61
96
  const pluginsArray = await this.nodeContext.get('plugins', []);
62
97
  for (const plugin of pluginsArray)
63
98
  this._plugins.set(plugin.name, plugin);
64
99
  return pluginsArray;
65
100
  }
101
+ /**
102
+ * Loads registered plugins from storage.
103
+ *
104
+ * This method retrieves an array of registered plugins from the storage and converts it
105
+ * into a map where the plugin names are the keys and the plugin objects are the values.
106
+ *
107
+ * @returns {Promise<RegisteredPlugin[]>} A promise that resolves to an array of registered plugins.
108
+ */
66
109
  async saveToStorage() {
110
+ // Convert the map to an array
67
111
  const plugins = [];
68
112
  const pluginArrayFromMap = Array.from(this._plugins.values());
69
113
  for (const plugin of pluginArrayFromMap) {
@@ -83,11 +127,18 @@ export class PluginManager {
83
127
  this.log.debug(`Saved ${BLUE}${plugins.length}${db} plugins to storage`);
84
128
  return plugins.length;
85
129
  }
130
+ /**
131
+ * Resolves the name of a plugin by loading and parsing its package.json file.
132
+ * @param pluginPath - The path to the plugin or the path to the plugin's package.json file.
133
+ * @returns The path to the resolved package.json file, or null if the package.json file is not found or does not contain a name.
134
+ */
86
135
  async resolve(pluginPath) {
87
136
  if (!pluginPath.endsWith('package.json'))
88
137
  pluginPath = path.join(pluginPath, 'package.json');
138
+ // Resolve the package.json of the plugin
89
139
  let packageJsonPath = path.resolve(pluginPath);
90
140
  this.log.debug(`Resolving plugin path ${plg}${packageJsonPath}${db}`);
141
+ // Check if the package.json file exists
91
142
  try {
92
143
  await fs.access(packageJsonPath);
93
144
  }
@@ -97,11 +148,13 @@ export class PluginManager {
97
148
  this.log.debug(`Trying at ${plg}${packageJsonPath}${db}`);
98
149
  }
99
150
  try {
151
+ // Load the package.json of the plugin
100
152
  const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf8'));
101
153
  if (!packageJson.name) {
102
154
  this.log.error(`Package.json name not found at ${packageJsonPath}`);
103
155
  return null;
104
156
  }
157
+ // Check for main issues
105
158
  if (!packageJson.type || packageJson.type !== 'module') {
106
159
  this.log.error(`Plugin at ${packageJsonPath} is not a module`);
107
160
  return null;
@@ -110,6 +163,7 @@ export class PluginManager {
110
163
  this.log.error(`Plugin at ${packageJsonPath} has no main entrypoint in package.json`);
111
164
  return null;
112
165
  }
166
+ // Check for @project-chip and @matter packages in dependencies and devDependencies
113
167
  const checkForProjectChipPackages = (dependencies) => {
114
168
  return Object.keys(dependencies).filter((pkg) => pkg.startsWith('@project-chip') || pkg.startsWith('@matter'));
115
169
  };
@@ -131,6 +185,7 @@ export class PluginManager {
131
185
  this.log.error(`Please open an issue on the plugin repository to remove them.`);
132
186
  return null;
133
187
  }
188
+ // Check for matterbridge package in dependencies and devDependencies
134
189
  const checkForMatterbridgePackage = (dependencies) => {
135
190
  return Object.keys(dependencies).filter((pkg) => pkg === 'matterbridge');
136
191
  };
@@ -160,6 +215,11 @@ export class PluginManager {
160
215
  return null;
161
216
  }
162
217
  }
218
+ /**
219
+ * Loads and parse the plugin package.json and returns it.
220
+ * @param plugin - The plugin to load the package from.
221
+ * @returns A Promise that resolves to the package.json object or undefined if the package.json could not be loaded.
222
+ */
163
223
  async parse(plugin) {
164
224
  this.log.debug(`Parsing package.json of plugin ${plg}${plugin.name}${db}`);
165
225
  try {
@@ -184,6 +244,7 @@ export class PluginManager {
184
244
  this.log.warn(`Plugin ${plg}${plugin.name}${wr} has no path`);
185
245
  if (!plugin.type)
186
246
  this.log.warn(`Plugin ${plg}${plugin.name}${wr} has no type`);
247
+ // Check for @project-chip and @matter packages in dependencies and devDependencies
187
248
  const checkForProjectChipPackages = (dependencies) => {
188
249
  return Object.keys(dependencies).filter((pkg) => pkg.startsWith('@project-chip') || pkg.startsWith('@matter'));
189
250
  };
@@ -205,6 +266,7 @@ export class PluginManager {
205
266
  this.log.error(`Please open an issue on the plugin repository to remove them.`);
206
267
  return null;
207
268
  }
269
+ // Check for matterbridge package in dependencies and devDependencies
208
270
  const checkForMatterbridgePackage = (dependencies) => {
209
271
  return Object.keys(dependencies).filter((pkg) => pkg === 'matterbridge');
210
272
  };
@@ -226,6 +288,7 @@ export class PluginManager {
226
288
  this.log.error(`Please open an issue on the plugin repository to remove them.`);
227
289
  return null;
228
290
  }
291
+ // await this.saveToStorage(); // No need to save the plugin to storage
229
292
  return packageJson;
230
293
  }
231
294
  catch (err) {
@@ -234,6 +297,16 @@ export class PluginManager {
234
297
  return null;
235
298
  }
236
299
  }
300
+ /**
301
+ * Enables a plugin by its name or path.
302
+ *
303
+ * This method enables a plugin by setting its `enabled` property to `true` and saving the updated
304
+ * plugin information to storage. It first checks if the plugin is already registered in the `_plugins` map.
305
+ * If not, it attempts to resolve the plugin's `package.json` file to retrieve its name and enable it.
306
+ *
307
+ * @param {string} nameOrPath - The name or path of the plugin to enable.
308
+ * @returns {Promise<RegisteredPlugin | null>} A promise that resolves to the enabled plugin object, or null if the plugin could not be enabled.
309
+ */
237
310
  async enable(nameOrPath) {
238
311
  if (!nameOrPath || nameOrPath === '')
239
312
  return null;
@@ -266,6 +339,16 @@ export class PluginManager {
266
339
  return null;
267
340
  }
268
341
  }
342
+ /**
343
+ * Enables a plugin by its name or path.
344
+ *
345
+ * This method enables a plugin by setting its `enabled` property to `true` and saving the updated
346
+ * plugin information to storage. It first checks if the plugin is already registered in the `_plugins` map.
347
+ * If not, it attempts to resolve the plugin's `package.json` file to retrieve its name and enable it.
348
+ *
349
+ * @param {string} nameOrPath - The name or path of the plugin to enable.
350
+ * @returns {Promise<RegisteredPlugin | null>} A promise that resolves to the enabled plugin object, or null if the plugin could not be enabled.
351
+ */
269
352
  async disable(nameOrPath) {
270
353
  if (!nameOrPath || nameOrPath === '')
271
354
  return null;
@@ -298,6 +381,16 @@ export class PluginManager {
298
381
  return null;
299
382
  }
300
383
  }
384
+ /**
385
+ * Removes a plugin by its name or path.
386
+ *
387
+ * This method removes a plugin from the `_plugins` map and saves the updated plugin information to storage.
388
+ * It first checks if the plugin is already registered in the `_plugins` map. If not, it attempts to resolve
389
+ * the plugin's `package.json` file to retrieve its name and remove it.
390
+ *
391
+ * @param {string} nameOrPath - The name or path of the plugin to remove.
392
+ * @returns {Promise<RegisteredPlugin | null>} A promise that resolves to the removed plugin object, or null if the plugin could not be removed.
393
+ */
301
394
  async remove(nameOrPath) {
302
395
  if (!nameOrPath || nameOrPath === '')
303
396
  return null;
@@ -330,6 +423,17 @@ export class PluginManager {
330
423
  return null;
331
424
  }
332
425
  }
426
+ /**
427
+ * Adds a plugin by its name or path.
428
+ *
429
+ * This method adds a plugin to the `_plugins` map and saves the updated plugin information to storage.
430
+ * It first resolves the plugin's `package.json` file to retrieve its details. If the plugin is already
431
+ * registered, it logs an info message and returns null. Otherwise, it registers the plugin, enables it,
432
+ * and saves the updated plugin information to storage.
433
+ *
434
+ * @param {string} nameOrPath - The name or path of the plugin to add.
435
+ * @returns {Promise<RegisteredPlugin | null>} A promise that resolves to the added plugin object, or null if the plugin could not be added.
436
+ */
333
437
  async add(nameOrPath) {
334
438
  if (!nameOrPath || nameOrPath === '')
335
439
  return null;
@@ -355,9 +459,19 @@ export class PluginManager {
355
459
  return null;
356
460
  }
357
461
  }
462
+ /**
463
+ * Installs a plugin by its name.
464
+ *
465
+ * This method first uninstalls any existing version of the plugin, then installs the plugin globally using npm.
466
+ * It logs the installation process and retrieves the installed version of the plugin.
467
+ *
468
+ * @param {string} name - The name of the plugin to install.
469
+ * @returns {Promise<string | undefined>} A promise that resolves to the installed version of the plugin, or undefined if the installation failed.
470
+ */
358
471
  async install(name) {
359
472
  await this.uninstall(name);
360
473
  this.log.info(`Installing plugin ${plg}${name}${nf}`);
474
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
361
475
  return new Promise((resolve, reject) => {
362
476
  exec(`npm install -g ${name} --omit=dev --force`, (error, stdout, stderr) => {
363
477
  if (error) {
@@ -368,11 +482,14 @@ export class PluginManager {
368
482
  else {
369
483
  this.log.info(`Installed plugin ${plg}${name}${nf}`);
370
484
  this.log.debug(`Installed plugin ${plg}${name}${db}: ${stdout}`);
485
+ // Get the installed version
486
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
371
487
  exec(`npm list -g ${name} --depth=0`, (listError, listStdout, listStderr) => {
372
488
  if (listError) {
373
489
  this.log.error(`List error: ${listError}`);
374
490
  resolve(undefined);
375
491
  }
492
+ // Clean the output to get only the package name and version
376
493
  const lines = listStdout.split('\n');
377
494
  const versionLine = lines.find((line) => line.includes(`${name}@`));
378
495
  if (versionLine) {
@@ -388,8 +505,18 @@ export class PluginManager {
388
505
  });
389
506
  });
390
507
  }
508
+ /**
509
+ * Uninstalls a plugin by its name.
510
+ *
511
+ * This method uninstalls a globally installed plugin using npm. It logs the uninstallation process
512
+ * and returns the name of the uninstalled plugin if successful, or undefined if the uninstallation failed.
513
+ *
514
+ * @param {string} name - The name of the plugin to uninstall.
515
+ * @returns {Promise<string | undefined>} A promise that resolves to the name of the uninstalled plugin, or undefined if the uninstallation failed.
516
+ */
391
517
  async uninstall(name) {
392
518
  this.log.info(`Uninstalling plugin ${plg}${name}${nf}`);
519
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
393
520
  return new Promise((resolve, reject) => {
394
521
  exec(`npm uninstall -g ${name} --force`, (error, stdout, stderr) => {
395
522
  if (error) {
@@ -405,6 +532,14 @@ export class PluginManager {
405
532
  });
406
533
  });
407
534
  }
535
+ /**
536
+ * Loads a plugin and returns the corresponding MatterbridgePlatform instance.
537
+ * @param plugin - The plugin to load.
538
+ * @param start - Optional flag indicating whether to start the plugin after loading. Default is false.
539
+ * @param message - Optional message to pass to the plugin when starting.
540
+ * @returns A Promise that resolves to the loaded MatterbridgePlatform instance.
541
+ * @throws An error if the plugin is not enabled, already loaded, or fails to load.
542
+ */
408
543
  async load(plugin, start = false, message = '', configure = false) {
409
544
  if (!plugin.enabled) {
410
545
  this.log.error(`Plugin ${plg}${plugin.name}${er} not enabled`);
@@ -416,14 +551,19 @@ export class PluginManager {
416
551
  }
417
552
  this.log.info(`Loading plugin ${plg}${plugin.name}${nf} type ${typ}${plugin.type}${nf}`);
418
553
  try {
554
+ // Load the package.json of the plugin
419
555
  const packageJson = JSON.parse(await fs.readFile(plugin.path, 'utf8'));
556
+ // Resolve the main module path relative to package.json
420
557
  const pluginEntry = path.resolve(path.dirname(plugin.path), packageJson.main);
558
+ // Dynamically import the plugin
421
559
  const pluginUrl = pathToFileURL(pluginEntry);
422
560
  this.log.debug(`Importing plugin ${plg}${plugin.name}${db} from ${pluginUrl.href}`);
423
561
  const pluginInstance = await import(pluginUrl.href);
424
562
  this.log.debug(`Imported plugin ${plg}${plugin.name}${db} from ${pluginUrl.href}`);
563
+ // Call the default export function of the plugin, passing this MatterBridge instance, the log and the config
425
564
  if (pluginInstance.default) {
426
565
  const config = await this.loadConfig(plugin);
566
+ // Preset the plugin properties here in case the plugin throws an error during loading. In this case the user can change the config and restart the plugin.
427
567
  plugin.name = packageJson.name;
428
568
  plugin.description = packageJson.description ?? 'No description';
429
569
  plugin.version = packageJson.version;
@@ -432,7 +572,7 @@ export class PluginManager {
432
572
  plugin.schemaJson = await this.loadSchema(plugin);
433
573
  config.name = plugin.name;
434
574
  config.version = packageJson.version;
435
- const log = new AnsiLogger({ logName: plugin.description ?? 'No description', logTimestampFormat: 4, logLevel: config.debug ? "debug" : this.matterbridge.log.logLevel });
575
+ const log = new AnsiLogger({ logName: plugin.description ?? 'No description', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: config.debug ? "debug" /* LogLevel.DEBUG */ : this.matterbridge.log.logLevel });
436
576
  const platform = pluginInstance.default(this.matterbridge, log, config);
437
577
  config.type = platform.type;
438
578
  platform.name = packageJson.name;
@@ -449,8 +589,8 @@ export class PluginManager {
449
589
  plugin.addedDevices = 0;
450
590
  plugin.configJson = config;
451
591
  plugin.schemaJson = await this.loadSchema(plugin);
452
- await this.saveToStorage();
453
- this.log.notice(`Loaded plugin ${plg}${plugin.name}${nf} type ${typ}${platform.type}${db} (entrypoint ${UNDERLINE}${pluginEntry}${UNDERLINEOFF})`);
592
+ await this.saveToStorage(); // Save the plugin to storage
593
+ this.log.notice(`Loaded plugin ${plg}${plugin.name}${nt} type ${typ}${platform.type}${nt} (entrypoint ${UNDERLINE}${pluginEntry}${UNDERLINEOFF})`);
454
594
  if (start)
455
595
  await this.start(plugin, message, false);
456
596
  if (configure)
@@ -468,6 +608,14 @@ export class PluginManager {
468
608
  }
469
609
  return undefined;
470
610
  }
611
+ /**
612
+ * Starts a plugin.
613
+ *
614
+ * @param {RegisteredPlugin} plugin - The plugin to start.
615
+ * @param {string} [message] - Optional message to pass to the plugin's onStart method.
616
+ * @param {boolean} [configure] - Indicates whether to configure the plugin after starting (default false).
617
+ * @returns {Promise<RegisteredPlugin | undefined>} A promise that resolves when the plugin is started successfully, or rejects with an error if starting the plugin fails.
618
+ */
471
619
  async start(plugin, message, configure = false) {
472
620
  if (!plugin.loaded) {
473
621
  this.log.error(`Plugin ${plg}${plugin.name}${er} not loaded`);
@@ -497,6 +645,12 @@ export class PluginManager {
497
645
  }
498
646
  return undefined;
499
647
  }
648
+ /**
649
+ * Configures a plugin.
650
+ *
651
+ * @param {RegisteredPlugin} plugin - The plugin to configure.
652
+ * @returns {Promise<void>} A promise that resolves when the plugin is configured successfully, or rejects with an error if configuration fails.
653
+ */
500
654
  async configure(plugin) {
501
655
  if (!plugin.loaded) {
502
656
  this.log.error(`Plugin ${plg}${plugin.name}${er} not loaded`);
@@ -527,6 +681,18 @@ export class PluginManager {
527
681
  }
528
682
  return undefined;
529
683
  }
684
+ /**
685
+ * Shuts down a plugin.
686
+ *
687
+ * This method shuts down a plugin by calling its `onShutdown` method and resetting its state.
688
+ * It logs the shutdown process and optionally removes all devices associated with the plugin.
689
+ *
690
+ * @param {RegisteredPlugin} plugin - The plugin to shut down.
691
+ * @param {string} [reason] - The reason for shutting down the plugin.
692
+ * @param {boolean} [removeAllDevices=false] - Whether to remove all devices associated with the plugin.
693
+ * @param {boolean} [force=false] - Whether to force the shutdown even if the plugin is not loaded or started.
694
+ * @returns {Promise<RegisteredPlugin | undefined>} A promise that resolves to the shut down plugin object, or undefined if the shutdown failed.
695
+ */
530
696
  async shutdown(plugin, reason, removeAllDevices = false, force = false) {
531
697
  this.log.debug(`Shutting down plugin ${plg}${plugin.name}${db}`);
532
698
  if (!plugin.loaded) {
@@ -569,6 +735,15 @@ export class PluginManager {
569
735
  }
570
736
  return undefined;
571
737
  }
738
+ /**
739
+ * Loads the configuration for a plugin.
740
+ * If the configuration file exists, it reads the file and returns the parsed JSON data.
741
+ * If the configuration file does not exist, it creates a new file with default configuration and returns it.
742
+ * If any error occurs during file access or creation, it logs an error and return un empty config.
743
+ *
744
+ * @param plugin - The plugin for which to load the configuration.
745
+ * @returns A promise that resolves to the loaded or created configuration.
746
+ */
572
747
  async loadConfig(plugin) {
573
748
  const configFile = path.join(this.matterbridge.matterbridgeDirectory, `${plugin.name}.config.json`);
574
749
  try {
@@ -576,6 +751,8 @@ export class PluginManager {
576
751
  const data = await fs.readFile(configFile, 'utf8');
577
752
  const config = JSON.parse(data);
578
753
  this.log.debug(`Loaded config file ${configFile} for plugin ${plg}${plugin.name}${db}.`);
754
+ // this.log.debug(`Loaded config file ${configFile} for plugin ${plg}${plugin.name}${db}.\nConfig:${rs}\n`, config);
755
+ // The first time a plugin is added to the system, the config file is created with the plugin name and type "AnyPlatform".
579
756
  config.name = plugin.name;
580
757
  config.type = plugin.type;
581
758
  if (config.debug === undefined)
@@ -600,6 +777,7 @@ export class PluginManager {
600
777
  try {
601
778
  await fs.writeFile(configFile, JSON.stringify(config, null, 2), 'utf8');
602
779
  this.log.debug(`Created config file ${configFile} for plugin ${plg}${plugin.name}${db}.`);
780
+ // this.log.debug(`Created config file ${configFile} for plugin ${plg}${plugin.name}${db}.\nConfig:${rs}\n`, config);
603
781
  return config;
604
782
  }
605
783
  catch (err) {
@@ -616,6 +794,18 @@ export class PluginManager {
616
794
  return { name: plugin.name, type: plugin.type, debug: false, unregisterOnShutdown: false };
617
795
  }
618
796
  }
797
+ /**
798
+ * Saves the configuration of a plugin to a file.
799
+ *
800
+ * This method saves the configuration of the specified plugin to a JSON file in the matterbridge directory.
801
+ * If the plugin's configuration is not found, it logs an error and rejects the promise. If the configuration
802
+ * is successfully saved, it logs a debug message. If an error occurs during the file write operation, it logs
803
+ * the error and rejects the promise.
804
+ *
805
+ * @param {RegisteredPlugin} plugin - The plugin whose configuration is to be saved.
806
+ * @returns {Promise<void>} A promise that resolves when the configuration is successfully saved, or rejects if an error occurs.
807
+ * @throws {Error} If the plugin's configuration is not found.
808
+ */
619
809
  async saveConfigFromPlugin(plugin) {
620
810
  if (!plugin.platform?.config) {
621
811
  this.log.error(`Error saving config file for plugin ${plg}${plugin.name}${er}: config not found`);
@@ -625,6 +815,7 @@ export class PluginManager {
625
815
  try {
626
816
  await fs.writeFile(configFile, JSON.stringify(plugin.platform.config, null, 2), 'utf8');
627
817
  this.log.debug(`Saved config file ${configFile} for plugin ${plg}${plugin.name}${db}`);
818
+ // this.log.debug(`Saved config file ${configFile} for plugin ${plg}${plugin.name}${db}.\nConfig:${rs}\n`, plugin.platform.config);
628
819
  return Promise.resolve();
629
820
  }
630
821
  catch (err) {
@@ -632,6 +823,19 @@ export class PluginManager {
632
823
  return Promise.reject(err);
633
824
  }
634
825
  }
826
+ /**
827
+ * Saves the configuration of a plugin from a JSON object to a file.
828
+ *
829
+ * This method saves the provided configuration of the specified plugin to a JSON file in the matterbridge directory.
830
+ * It first checks if the configuration data is valid by ensuring it contains the correct name and type, and matches
831
+ * the plugin's name. If the configuration data is invalid, it logs an error and returns. If the configuration is
832
+ * successfully saved, it updates the plugin's `configJson` property and logs a debug message. If an error occurs
833
+ * during the file write operation, it logs the error and returns.
834
+ *
835
+ * @param {RegisteredPlugin} plugin - The plugin whose configuration is to be saved.
836
+ * @param {PlatformConfig} config - The configuration data to be saved.
837
+ * @returns {Promise<void>} A promise that resolves when the configuration is successfully saved, or returns if an error occurs.
838
+ */
635
839
  async saveConfigFromJson(plugin, config) {
636
840
  if (!config.name || !config.type || config.name !== plugin.name) {
637
841
  this.log.error(`Error saving config file for plugin ${plg}${plugin.name}${er}. Wrong config data content:${rs}\n`, config);
@@ -642,12 +846,23 @@ export class PluginManager {
642
846
  await fs.writeFile(configFile, JSON.stringify(config, null, 2), 'utf8');
643
847
  plugin.configJson = config;
644
848
  this.log.debug(`Saved config file ${configFile} for plugin ${plg}${plugin.name}${db}`);
849
+ // this.log.debug(`Saved config file ${configFile} for plugin ${plg}${plugin.name}${db}.\nConfig:${rs}\n`, config);
645
850
  }
646
851
  catch (err) {
647
852
  this.log.error(`Error saving config file ${configFile} for plugin ${plg}${plugin.name}${er}: ${err}`);
648
853
  return;
649
854
  }
650
855
  }
856
+ /**
857
+ * Loads the schema for a plugin.
858
+ *
859
+ * This method attempts to load the schema file for the specified plugin. If the schema file is found,
860
+ * it reads and parses the file, updates the schema's title and description, and logs the process.
861
+ * If the schema file is not found, it logs the event and loads a default schema for the plugin.
862
+ *
863
+ * @param {RegisteredPlugin} plugin - The plugin whose schema is to be loaded.
864
+ * @returns {Promise<PlatformSchema>} A promise that resolves to the loaded schema object, or the default schema if the schema file is not found.
865
+ */
651
866
  async loadSchema(plugin) {
652
867
  const schemaFile = plugin.path.replace('package.json', `${plugin.name}.schema.json`);
653
868
  try {
@@ -657,6 +872,7 @@ export class PluginManager {
657
872
  schema.title = plugin.description;
658
873
  schema.description = plugin.name + ' v. ' + plugin.version + ' by ' + plugin.author;
659
874
  this.log.debug(`Loaded schema file ${schemaFile} for plugin ${plg}${plugin.name}${db}.`);
875
+ // this.log.debug(`Loaded schema file ${schemaFile} for plugin ${plg}${plugin.name}${db}.\nSchema:${rs}\n`, schema);
660
876
  return schema;
661
877
  }
662
878
  catch (error) {
@@ -664,6 +880,16 @@ export class PluginManager {
664
880
  return this.getDefaultSchema(plugin);
665
881
  }
666
882
  }
883
+ /**
884
+ * Returns the default schema for a plugin.
885
+ *
886
+ * This method generates a default schema object for the specified plugin. The schema includes
887
+ * metadata such as the plugin's title, description, version, and author. It also defines the
888
+ * properties of the schema, including the plugin's name, type, debug flag, and unregisterOnShutdown flag.
889
+ *
890
+ * @param {RegisteredPlugin} plugin - The plugin for which the default schema is to be generated.
891
+ * @returns {PlatformSchema} The default schema object for the plugin.
892
+ */
667
893
  getDefaultSchema(plugin) {
668
894
  return {
669
895
  title: plugin.description,
@@ -694,3 +920,4 @@ export class PluginManager {
694
920
  };
695
921
  }
696
922
  }
923
+ //# sourceMappingURL=pluginManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluginManager.js","sourceRoot":"","sources":["../src/pluginManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,qCAAqC;AACrC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAY,EAAE,EAAE,EAAE,EAAE,EAAE,EAAmB,SAAS,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAGlI,kBAAkB;AAClB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,IAAI,EAAiB,MAAM,eAAe,CAAC;AAIpD,OAAO,EAAE,GAAG,EAAoB,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAEpE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEjG,MAAM,OAAO,aAAa;IAChB,QAAQ,GAAG,IAAI,GAAG,EAA4B,CAAC;IAC/C,WAAW,CAAc;IACzB,YAAY,CAAe;IAC3B,GAAG,CAAa;IAExB,YAAY,YAA0B;QACpC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,8DAA8D;QAC9D,IAAI,CAAC,WAAW,GAAI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EAAE,SAAS;oBACf,OAAO,EAAE,KAAK;iBACf;aACF;SACF,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export * from 'node-persist-manager';
2
+ //# sourceMappingURL=export.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../src/storage/export.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
@@ -1 +1,2 @@
1
1
  export * from 'node-persist-manager';
2
+ //# sourceMappingURL=export.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export.js","sourceRoot":"","sources":["../../src/storage/export.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * This file contains the color utilities.
3
+ *
4
+ * @file colorUtils.ts
5
+ * @author Luca Liguori
6
+ * @date 2023-10-05
7
+ * @version 1.3.0
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
+ export interface RGB {
24
+ r: number;
25
+ g: number;
26
+ b: number;
27
+ }
28
+ export interface XY {
29
+ x: number;
30
+ y: number;
31
+ }
32
+ export interface HSL {
33
+ h: number;
34
+ s: number;
35
+ l: number;
36
+ }
37
+ export declare function hslColorToRgbColor(hue: number, saturation: number, luminance: number): RGB;
38
+ export declare function rgbColorToXYColor(rgb: RGB): XY;
39
+ export declare function xyColorToRgbColor(x: number, y: number, brightness?: number): RGB;
40
+ export declare function rgbColorToHslColor(rgb: RGB): HSL;
41
+ export declare function xyToHsl(x: number, y: number): HSL;
42
+ export declare function miredToKelvin(mired: number): number;
43
+ export declare function kelvinToMired(kelvin: number): number;
44
+ export declare function kelvinToRGB(kelvin: number): RGB;
45
+ /**
46
+ * Converts CIE color space to RGB color space
47
+ * @param {Number} x
48
+ * @param {Number} y
49
+ * @param {Number} brightness - Ranges from 1 to 254
50
+ * @return {Array} Array that contains the color values for red, green and blue
51
+ * From: https://github.com/usolved/cie-rgb-converter/blob/master/cie_rgb_converter.js
52
+ */
53
+ /**
54
+ * Converts RGB color space to CIE color space
55
+ * @param {Number} red
56
+ * @param {Number} green
57
+ * @param {Number} blue
58
+ * @return {Array} Array that contains the CIE color values for x and y
59
+ * From: https://github.com/usolved/cie-rgb-converter/blob/master/cie_rgb_converter.js
60
+ */
61
+ //# sourceMappingURL=colorUtils.d.ts.map