matterbridge 3.0.6 → 3.0.7-dev-20250615-2a6da14

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 (187) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README-DEV.md +66 -35
  3. package/README.md +1 -1
  4. package/dist/cli.js +2 -62
  5. package/dist/clusters/export.js +1 -0
  6. package/dist/defaultConfigSchema.js +0 -23
  7. package/dist/deviceManager.js +1 -94
  8. package/dist/devices/export.js +4 -0
  9. package/dist/evse.js +9 -65
  10. package/dist/frontend.js +16 -374
  11. package/dist/globalMatterbridge.js +0 -20
  12. package/dist/helpers.js +0 -51
  13. package/dist/index.js +1 -28
  14. package/dist/laundryWasher.js +7 -92
  15. package/dist/logger/export.js +0 -1
  16. package/dist/matter/behaviors.js +0 -2
  17. package/dist/matter/clusters.js +0 -2
  18. package/dist/matter/devices.js +0 -2
  19. package/dist/matter/endpoints.js +0 -2
  20. package/dist/matter/export.js +0 -2
  21. package/dist/matter/types.js +0 -2
  22. package/dist/matterbridge.js +46 -748
  23. package/dist/matterbridgeAccessoryPlatform.js +0 -34
  24. package/dist/matterbridgeBehaviors.js +1 -54
  25. package/dist/matterbridgeDeviceTypes.js +15 -578
  26. package/dist/matterbridgeDynamicPlatform.js +0 -34
  27. package/dist/matterbridgeEndpoint.js +43 -997
  28. package/dist/matterbridgeEndpointHelpers.js +10 -204
  29. package/dist/matterbridgePlatform.js +7 -225
  30. package/dist/matterbridgeTypes.js +0 -24
  31. package/dist/pluginManager.js +3 -269
  32. package/dist/roboticVacuumCleaner.js +6 -81
  33. package/dist/shelly.js +7 -155
  34. package/dist/storage/export.js +0 -1
  35. package/dist/update.js +0 -53
  36. package/dist/utils/colorUtils.js +2 -205
  37. package/dist/utils/commandLine.js +0 -53
  38. package/dist/utils/copyDirectory.js +1 -37
  39. package/dist/utils/createDirectory.js +0 -31
  40. package/dist/utils/createZip.js +2 -42
  41. package/dist/utils/deepCopy.js +0 -38
  42. package/dist/utils/deepEqual.js +1 -71
  43. package/dist/utils/export.js +0 -1
  44. package/dist/utils/hex.js +0 -57
  45. package/dist/utils/isvalid.js +0 -100
  46. package/dist/utils/network.js +5 -76
  47. package/dist/utils/spawn.js +0 -16
  48. package/dist/utils/wait.js +9 -58
  49. package/dist/waterHeater.js +2 -62
  50. package/npm-shrinkwrap.json +41 -29
  51. package/package.json +23 -20
  52. package/dist/cli.d.ts +0 -29
  53. package/dist/cli.d.ts.map +0 -1
  54. package/dist/cli.js.map +0 -1
  55. package/dist/cluster/export.d.ts +0 -2
  56. package/dist/cluster/export.d.ts.map +0 -1
  57. package/dist/cluster/export.js +0 -3
  58. package/dist/cluster/export.js.map +0 -1
  59. package/dist/defaultConfigSchema.d.ts +0 -27
  60. package/dist/defaultConfigSchema.d.ts.map +0 -1
  61. package/dist/defaultConfigSchema.js.map +0 -1
  62. package/dist/deviceManager.d.ts +0 -114
  63. package/dist/deviceManager.d.ts.map +0 -1
  64. package/dist/deviceManager.js.map +0 -1
  65. package/dist/evse.d.ts +0 -67
  66. package/dist/evse.d.ts.map +0 -1
  67. package/dist/evse.js.map +0 -1
  68. package/dist/frontend.d.ts +0 -256
  69. package/dist/frontend.d.ts.map +0 -1
  70. package/dist/frontend.js.map +0 -1
  71. package/dist/globalMatterbridge.d.ts +0 -32
  72. package/dist/globalMatterbridge.d.ts.map +0 -1
  73. package/dist/globalMatterbridge.js.map +0 -1
  74. package/dist/helpers.d.ts +0 -47
  75. package/dist/helpers.d.ts.map +0 -1
  76. package/dist/helpers.js.map +0 -1
  77. package/dist/index.d.ts +0 -37
  78. package/dist/index.d.ts.map +0 -1
  79. package/dist/index.js.map +0 -1
  80. package/dist/laundryWasher.d.ts +0 -243
  81. package/dist/laundryWasher.d.ts.map +0 -1
  82. package/dist/laundryWasher.js.map +0 -1
  83. package/dist/logger/export.d.ts +0 -2
  84. package/dist/logger/export.d.ts.map +0 -1
  85. package/dist/logger/export.js.map +0 -1
  86. package/dist/matter/behaviors.d.ts +0 -2
  87. package/dist/matter/behaviors.d.ts.map +0 -1
  88. package/dist/matter/behaviors.js.map +0 -1
  89. package/dist/matter/clusters.d.ts +0 -2
  90. package/dist/matter/clusters.d.ts.map +0 -1
  91. package/dist/matter/clusters.js.map +0 -1
  92. package/dist/matter/devices.d.ts +0 -2
  93. package/dist/matter/devices.d.ts.map +0 -1
  94. package/dist/matter/devices.js.map +0 -1
  95. package/dist/matter/endpoints.d.ts +0 -2
  96. package/dist/matter/endpoints.d.ts.map +0 -1
  97. package/dist/matter/endpoints.js.map +0 -1
  98. package/dist/matter/export.d.ts +0 -5
  99. package/dist/matter/export.d.ts.map +0 -1
  100. package/dist/matter/export.js.map +0 -1
  101. package/dist/matter/types.d.ts +0 -3
  102. package/dist/matter/types.d.ts.map +0 -1
  103. package/dist/matter/types.js.map +0 -1
  104. package/dist/matterbridge.d.ts +0 -445
  105. package/dist/matterbridge.d.ts.map +0 -1
  106. package/dist/matterbridge.js.map +0 -1
  107. package/dist/matterbridgeAccessoryPlatform.d.ts +0 -40
  108. package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
  109. package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
  110. package/dist/matterbridgeBehaviors.d.ts +0 -1333
  111. package/dist/matterbridgeBehaviors.d.ts.map +0 -1
  112. package/dist/matterbridgeBehaviors.js.map +0 -1
  113. package/dist/matterbridgeDeviceTypes.d.ts +0 -644
  114. package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
  115. package/dist/matterbridgeDeviceTypes.js.map +0 -1
  116. package/dist/matterbridgeDynamicPlatform.d.ts +0 -40
  117. package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
  118. package/dist/matterbridgeDynamicPlatform.js.map +0 -1
  119. package/dist/matterbridgeEndpoint.d.ts +0 -1144
  120. package/dist/matterbridgeEndpoint.d.ts.map +0 -1
  121. package/dist/matterbridgeEndpoint.js.map +0 -1
  122. package/dist/matterbridgeEndpointHelpers.d.ts +0 -3083
  123. package/dist/matterbridgeEndpointHelpers.d.ts.map +0 -1
  124. package/dist/matterbridgeEndpointHelpers.js.map +0 -1
  125. package/dist/matterbridgePlatform.d.ts +0 -294
  126. package/dist/matterbridgePlatform.d.ts.map +0 -1
  127. package/dist/matterbridgePlatform.js.map +0 -1
  128. package/dist/matterbridgeTypes.d.ts +0 -196
  129. package/dist/matterbridgeTypes.d.ts.map +0 -1
  130. package/dist/matterbridgeTypes.js.map +0 -1
  131. package/dist/pluginManager.d.ts +0 -273
  132. package/dist/pluginManager.d.ts.map +0 -1
  133. package/dist/pluginManager.js.map +0 -1
  134. package/dist/roboticVacuumCleaner.d.ts +0 -102
  135. package/dist/roboticVacuumCleaner.d.ts.map +0 -1
  136. package/dist/roboticVacuumCleaner.js.map +0 -1
  137. package/dist/shelly.d.ts +0 -161
  138. package/dist/shelly.d.ts.map +0 -1
  139. package/dist/shelly.js.map +0 -1
  140. package/dist/storage/export.d.ts +0 -2
  141. package/dist/storage/export.d.ts.map +0 -1
  142. package/dist/storage/export.js.map +0 -1
  143. package/dist/update.d.ts +0 -58
  144. package/dist/update.d.ts.map +0 -1
  145. package/dist/update.js.map +0 -1
  146. package/dist/utils/colorUtils.d.ts +0 -61
  147. package/dist/utils/colorUtils.d.ts.map +0 -1
  148. package/dist/utils/colorUtils.js.map +0 -1
  149. package/dist/utils/commandLine.d.ts +0 -58
  150. package/dist/utils/commandLine.d.ts.map +0 -1
  151. package/dist/utils/commandLine.js.map +0 -1
  152. package/dist/utils/copyDirectory.d.ts +0 -32
  153. package/dist/utils/copyDirectory.d.ts.map +0 -1
  154. package/dist/utils/copyDirectory.js.map +0 -1
  155. package/dist/utils/createDirectory.d.ts +0 -32
  156. package/dist/utils/createDirectory.d.ts.map +0 -1
  157. package/dist/utils/createDirectory.js.map +0 -1
  158. package/dist/utils/createZip.d.ts +0 -38
  159. package/dist/utils/createZip.d.ts.map +0 -1
  160. package/dist/utils/createZip.js.map +0 -1
  161. package/dist/utils/deepCopy.d.ts +0 -31
  162. package/dist/utils/deepCopy.d.ts.map +0 -1
  163. package/dist/utils/deepCopy.js.map +0 -1
  164. package/dist/utils/deepEqual.d.ts +0 -53
  165. package/dist/utils/deepEqual.d.ts.map +0 -1
  166. package/dist/utils/deepEqual.js.map +0 -1
  167. package/dist/utils/export.d.ts +0 -12
  168. package/dist/utils/export.d.ts.map +0 -1
  169. package/dist/utils/export.js.map +0 -1
  170. package/dist/utils/hex.d.ts +0 -48
  171. package/dist/utils/hex.d.ts.map +0 -1
  172. package/dist/utils/hex.js.map +0 -1
  173. package/dist/utils/isvalid.d.ts +0 -102
  174. package/dist/utils/isvalid.d.ts.map +0 -1
  175. package/dist/utils/isvalid.js.map +0 -1
  176. package/dist/utils/network.d.ts +0 -69
  177. package/dist/utils/network.d.ts.map +0 -1
  178. package/dist/utils/network.js.map +0 -1
  179. package/dist/utils/spawn.d.ts +0 -12
  180. package/dist/utils/spawn.d.ts.map +0 -1
  181. package/dist/utils/spawn.js.map +0 -1
  182. package/dist/utils/wait.d.ts +0 -52
  183. package/dist/utils/wait.d.ts.map +0 -1
  184. package/dist/utils/wait.js.map +0 -1
  185. package/dist/waterHeater.d.ts +0 -90
  186. package/dist/waterHeater.d.ts.map +0 -1
  187. package/dist/waterHeater.js.map +0 -1
@@ -1,74 +1,30 @@
1
- /**
2
- * This file contains the class MatterbridgeAccessoryPlatform.
3
- *
4
- * @file matterbridgePlatform.ts
5
- * @author Luca Liguori
6
- * @date 2024-03-21
7
- * @version 1.2.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
1
  import { checkNotLatinCharacters } from './matterbridgeEndpointHelpers.js';
24
2
  import { isValidArray, isValidObject, isValidString } from './utils/export.js';
25
- // AnsiLogger module
26
3
  import { CYAN, db, er, nf, wr } from './logger/export.js';
27
- // Storage module
28
4
  import { NodeStorageManager } from './storage/export.js';
29
- // Node.js module
30
5
  import path from 'node:path';
31
- /**
32
- * Represents the base Matterbridge platform. It is extended by the MatterbridgeAccessoryPlatform and MatterbridgeServicePlatform classes.
33
- *
34
- */
35
6
  export class MatterbridgePlatform {
36
7
  matterbridge;
37
8
  log;
38
9
  config = {};
39
- name = ''; // Will be set by the loadPlugin() method using the package.json value.
40
- type = ''; // Will be set by the extending classes.
41
- version = '1.0.0'; // Will be set by the loadPlugin() method using the package.json value.
42
- // Platform storage
10
+ name = '';
11
+ type = '';
12
+ version = '1.0.0';
43
13
  storage;
44
14
  context;
45
- // Device and entity selection
46
15
  selectDevice = new Map();
47
16
  selectEntity = new Map();
48
- // Promises for storage
49
17
  _contextReady;
50
18
  _selectDeviceContextReady;
51
19
  _selectEntityContextReady;
52
20
  ready;
53
- // Registered devices
54
- _registeredEndpoints = new Map(); // uniqueId, MatterbridgeEndpoint
55
- _registeredEndpointsByName = new Map(); // deviceName, MatterbridgeEndpoint
56
- // Stored devices
57
- _storedDevices = new Map(); // serial, { serial, name }
58
- /**
59
- * Creates an instance of the base MatterbridgePlatform.
60
- * It is extended by the MatterbridgeAccessoryPlatform and MatterbridgeServicePlatform classes.
61
- * Each plugin must extend the MatterbridgeAccessoryPlatform and MatterbridgeServicePlatform classes.
62
- *
63
- * @param {Matterbridge} matterbridge - The Matterbridge instance.
64
- * @param {AnsiLogger} log - The logger instance.
65
- * @param {PlatformConfig} config - The platform configuration.
66
- */
21
+ _registeredEndpoints = new Map();
22
+ _registeredEndpointsByName = new Map();
23
+ _storedDevices = new Map();
67
24
  constructor(matterbridge, log, config) {
68
25
  this.matterbridge = matterbridge;
69
26
  this.log = log;
70
27
  this.config = config;
71
- // create the NodeStorageManager for the plugin platform
72
28
  if (!isValidString(this.config.name) || this.config.name === '')
73
29
  throw new Error('Platform: the plugin name is missing or invalid.');
74
30
  this.log.debug(`Creating storage for plugin ${this.config.name} in ${path.join(this.matterbridge.matterbridgeDirectory, this.config.name)}`);
@@ -79,14 +35,12 @@ export class MatterbridgePlatform {
79
35
  logging: false,
80
36
  forgiveParseErrors: true,
81
37
  });
82
- // create the context storage for the plugin platform
83
38
  this.log.debug(`Creating context for plugin ${this.config.name}`);
84
39
  this._contextReady = this.storage.createStorage('context').then((context) => {
85
40
  this.context = context;
86
- this.context.remove('endpointMap'); // Remove the old endpointMap TODO: remove in future versions
41
+ this.context.remove('endpointMap');
87
42
  this.log.debug(`Created context for plugin ${this.config.name}`);
88
43
  });
89
- // create the selectDevice storage for the plugin platform
90
44
  this.log.debug(`Loading selectDevice for plugin ${this.config.name}`);
91
45
  this._selectDeviceContextReady = this.storage.createStorage('selectDevice').then(async (context) => {
92
46
  const selectDevice = await context.get('selectDevice', []);
@@ -94,7 +48,6 @@ export class MatterbridgePlatform {
94
48
  this.selectDevice.set(device.serial, device);
95
49
  this.log.debug(`Loaded ${this.selectDevice.size} selectDevice for plugin ${this.config.name}`);
96
50
  });
97
- // create the selectEntity storage for the plugin platform
98
51
  this.log.debug(`Loading selectEntity for plugin ${this.config.name}`);
99
52
  this._selectEntityContextReady = this.storage.createStorage('selectEntity').then(async (context) => {
100
53
  const selectEntity = await context.get('selectEntity', []);
@@ -102,111 +55,44 @@ export class MatterbridgePlatform {
102
55
  this.selectEntity.set(entity.name, entity);
103
56
  this.log.debug(`Loaded ${this.selectEntity.size} selectEntity for plugin ${this.config.name}`);
104
57
  });
105
- // Create the `ready` promise for the platform
106
58
  this.ready = Promise.all([this._contextReady, this._selectDeviceContextReady, this._selectEntityContextReady]).then(() => {
107
59
  this.log.debug(`MatterbridgePlatform for plugin ${this.config.name} is fully initialized`);
108
60
  });
109
61
  }
110
- /**
111
- * This method must be overridden in the extended class.
112
- * It is called when the platform is started.
113
- * Use this method to create the MatterbridgeDevice and call this.registerDevice().
114
- * @param {string} [reason] - The reason for starting.
115
- * @throws {Error} - Throws an error if the method is not overridden.
116
- */
117
62
  async onStart(reason) {
118
63
  this.log.error('Plugins must override onStart.', reason);
119
64
  throw new Error('Plugins must override onStart.');
120
65
  }
121
- /**
122
- * This method can be overridden in the extended class. Call super.onConfigure() to run checkEndpointNumbers().
123
- * It is called after the platform has started.
124
- * Use this method to perform any configuration of your devices and to override the value of the attributes that are stored in the
125
- * matter storage (i.e. the onOff attribute of the OnOff cluster).
126
- */
127
66
  async onConfigure() {
128
67
  this.log.debug(`Configuring platform ${this.name}`);
129
- // Save the selectDevice and selectEntity
130
68
  await this.saveSelects();
131
- // Check and update the endpoint numbers
132
69
  await this.checkEndpointNumbers();
133
70
  }
134
- /**
135
- * This method can be overridden in the extended class. In this case always call super.onShutdown() to save the selects, run checkEndpointNumbers() and cleanup memory.
136
- * It is called when the platform is shutting down.
137
- * Use this method to clean up any resources.
138
- * @param {string} [reason] - The reason for shutting down.
139
- */
140
71
  async onShutdown(reason) {
141
72
  this.log.debug(`Shutting down platform ${this.name}`, reason);
142
- // Save the selectDevice and selectEntity
143
73
  await this.saveSelects();
144
- // Check and update the endpoint numbers
145
74
  await this.checkEndpointNumbers();
146
- // Cleanup memory
147
75
  this.selectDevice.clear();
148
76
  this.selectEntity.clear();
149
77
  this._registeredEndpoints.clear();
150
78
  this._registeredEndpointsByName.clear();
151
79
  this._storedDevices.clear();
152
- // Close the storage
153
80
  await this.context?.close();
154
81
  this.context = undefined;
155
82
  await this.storage?.close();
156
83
  }
157
- /**
158
- * Sets the logger level and logs a debug message indicating that the plugin doesn't override this method.
159
- * @param {LogLevel} logLevel The new logger level.
160
- */
161
84
  async onChangeLoggerLevel(logLevel) {
162
85
  this.log.debug(`The plugin doesn't override onChangeLoggerLevel. Logger level set to: ${logLevel}`);
163
86
  }
164
- /**
165
- * Called when a plugin config includes an action button or an action button with text field.
166
- * @param {string} action The action triggered by the button in plugin config.
167
- * @param {string} value The value of the field of the action button.
168
- * @param {string} id The id of the schema associated with the action.
169
- * @param {PlatformConfig} formData The changed form data of the plugin.
170
- *
171
- * @remarks
172
- * This method can be overridden in the extended class.
173
- *
174
- * Use this method to handle the action defined in the plugin schema:
175
- * ```json
176
- * "addDevice": {
177
- * "description": "Manually add a device that has not been discovered with mdns:",
178
- * "type": "boolean",
179
- * "buttonText": "ADD", // The text on the button. This is used when the action doesn't include a text field.
180
- * "buttonField": "ADD", // The text on the button. This is used when the action includes a text field.
181
- * "buttonClose": false, // optional, default is false. When true, the dialog will close after the action is sent.
182
- * "buttonSave": false, // optional, default is false. When true, the dialog will close and trigger the restart required after the action is sent.
183
- * "textPlaceholder": "Enter the device IP address", // optional: the placeholder text for the text field.
184
- * "default": false
185
- * },
186
- * ```
187
- */
188
87
  async onAction(action, value, id, formData) {
189
88
  this.log.debug(`The plugin ${CYAN}${this.name}${db} doesn't override onAction. Received action ${CYAN}${action}${db}${value ? ' with ' + CYAN + value + db : ''} ${id ? ' for schema ' + CYAN + id + db : ''}`, formData);
190
89
  }
191
- /**
192
- * Called when the plugin config has been updated.
193
- * @param {PlatformConfig} config The new plugin config.
194
- */
195
90
  async onConfigChanged(config) {
196
91
  this.log.debug(`The plugin ${CYAN}${config.name}${db} doesn't override onConfigChanged. Received new config.`);
197
92
  }
198
- /**
199
- * Check if a device with this name is already registered in the platform.
200
- * @param {string} deviceName - The device name to check.
201
- * @returns {boolean} True if the device is already registered, false otherwise.
202
- */
203
93
  hasDeviceName(deviceName) {
204
94
  return this._registeredEndpointsByName.has(deviceName);
205
95
  }
206
- /**
207
- * Registers a device with the Matterbridge platform.
208
- * @param {MatterbridgeEndpoint} device - The device to register.
209
- */
210
96
  async registerDevice(device) {
211
97
  device.plugin = this.name;
212
98
  if (device.deviceName && this._registeredEndpointsByName.has(device.deviceName)) {
@@ -222,10 +108,6 @@ export class MatterbridgePlatform {
222
108
  if (device.deviceName)
223
109
  this._registeredEndpointsByName.set(device.deviceName, device);
224
110
  }
225
- /**
226
- * Unregisters a device registered with the Matterbridge platform.
227
- * @param {MatterbridgeEndpoint} device - The device to unregister.
228
- */
229
111
  async unregisterDevice(device) {
230
112
  await this.matterbridge.removeBridgedEndpoint(this.name, device);
231
113
  if (device.uniqueId)
@@ -233,24 +115,11 @@ export class MatterbridgePlatform {
233
115
  if (device.deviceName)
234
116
  this._registeredEndpointsByName.delete(device.deviceName);
235
117
  }
236
- /**
237
- * Unregisters all devices registered with the Matterbridge platform.
238
- *
239
- * @param {number} [delay=0] - The delay in milliseconds between removing each bridged endpoint (default: 0).
240
- */
241
118
  async unregisterAllDevices(delay = 0) {
242
119
  await this.matterbridge.removeAllBridgedEndpoints(this.name, delay);
243
120
  this._registeredEndpoints.clear();
244
121
  this._registeredEndpointsByName.clear();
245
122
  }
246
- /**
247
- * Saves the select devices and entities to storage.
248
- *
249
- * This method saves the current state of `selectDevice` and `selectEntity` maps to their respective storage.
250
- * It logs the number of items being saved and ensures that the storage is properly closed after saving.
251
- *
252
- * @returns {Promise<void>} A promise that resolves when the save operation is complete.
253
- */
254
123
  async saveSelects() {
255
124
  if (this.storage) {
256
125
  this.log.debug(`Saving ${this.selectDevice.size} selectDevice...`);
@@ -263,36 +132,15 @@ export class MatterbridgePlatform {
263
132
  await selectEntity.close();
264
133
  }
265
134
  }
266
- /**
267
- * Clears the select device and entity maps.
268
- *
269
- * @returns {void}
270
- */
271
135
  async clearSelect() {
272
136
  this.selectDevice.clear();
273
137
  this.selectEntity.clear();
274
138
  await this.saveSelects();
275
139
  }
276
- /**
277
- * Clears the select for a single device.
278
- *
279
- * @param {string} serial - The serial of the device to clear.
280
- * @returns {void}
281
- */
282
140
  async clearDeviceSelect(serial) {
283
141
  this.selectDevice.delete(serial);
284
142
  await this.saveSelects();
285
143
  }
286
- /**
287
- * Set the select device in the platform map.
288
- *
289
- * @param {string} serial - The serial number of the device.
290
- * @param {string} name - The name of the device.
291
- * @param {string} [configUrl] - The configuration URL of the device.
292
- * @param {string} [icon] - The icon of the device: 'wifi', 'ble', 'hub'
293
- * @param {Array<{ name: string; description: string; icon?: string }>} [entities] - The entities associated with the device.
294
- * @returns {void}
295
- */
296
144
  setSelectDevice(serial, name, configUrl, icon, entities) {
297
145
  const device = this.selectDevice.get(serial);
298
146
  if (device) {
@@ -309,15 +157,6 @@ export class MatterbridgePlatform {
309
157
  this.selectDevice.set(serial, { serial, name, configUrl, icon, entities });
310
158
  }
311
159
  }
312
- /**
313
- * Set the select device entity in the platform map.
314
- *
315
- * @param {string} serial - The serial number of the device.
316
- * @param {string} entityName - The name of the entity.
317
- * @param {string} entityDescription - The description of the entity.
318
- * @param {string} [entityIcon] - The icon of the entity: 'wifi', 'ble', 'hub', 'component', 'matter'
319
- * @returns {void}
320
- */
321
160
  setSelectDeviceEntity(serial, entityName, entityDescription, entityIcon) {
322
161
  const device = this.selectDevice.get(serial);
323
162
  if (device) {
@@ -327,11 +166,6 @@ export class MatterbridgePlatform {
327
166
  device.entities.push({ name: entityName, description: entityDescription, icon: entityIcon });
328
167
  }
329
168
  }
330
- /**
331
- * Retrieves the select devices from the platform map.
332
- *
333
- * @returns {{ pluginName: string; serial: string; name: string; configUrl?: string; icon?: string; entities?: { name: string; description: string; icon?: string }[] }[]} The selected devices array.
334
- */
335
169
  getSelectDevices() {
336
170
  const selectDevices = [];
337
171
  for (const device of this.selectDevice.values()) {
@@ -339,22 +173,9 @@ export class MatterbridgePlatform {
339
173
  }
340
174
  return selectDevices;
341
175
  }
342
- /**
343
- * Set the select entity in the platform map.
344
- *
345
- * @param {string} name - The entity name.
346
- * @param {string} description - The entity description.
347
- * @param {string} [icon] - The entity icon: 'wifi', 'ble', 'hub', 'component', 'matter'
348
- * @returns {void}
349
- */
350
176
  setSelectEntity(name, description, icon) {
351
177
  this.selectEntity.set(name, { name, description, icon });
352
178
  }
353
- /**
354
- * Retrieve the select entities.
355
- *
356
- * @returns {{ pluginName: string; name: string; description: string; icon?: string }[]} The select entities array.
357
- */
358
179
  getSelectEntities() {
359
180
  const selectEntities = [];
360
181
  for (const entity of this.selectEntity.values()) {
@@ -362,11 +183,6 @@ export class MatterbridgePlatform {
362
183
  }
363
184
  return selectEntities;
364
185
  }
365
- /**
366
- * Verifies if the Matterbridge version meets the required version.
367
- * @param {string} requiredVersion - The required version to compare against.
368
- * @returns {boolean} True if the Matterbridge version meets or exceeds the required version, false otherwise.
369
- */
370
186
  verifyMatterbridgeVersion(requiredVersion) {
371
187
  const compareVersions = (matterbridgeVersion, requiredVersion) => {
372
188
  const stripTag = (v) => {
@@ -391,21 +207,9 @@ export class MatterbridgePlatform {
391
207
  return false;
392
208
  return true;
393
209
  }
394
- /**
395
- * @deprecated This method is deprecated and will be removed in future versions. Use validateDevice instead.
396
- */
397
210
  validateDeviceWhiteBlackList(device, log = true) {
398
211
  return this.validateDevice(device, log);
399
212
  }
400
- /**
401
- * Validates if a device is allowed based on the whitelist and blacklist configurations.
402
- * The blacklist has priority over the whitelist.
403
- *
404
- * @param {string | string[]} device - The device name(s) to validate.
405
- * @param {boolean} [log=true] - Whether to log the validation result.
406
- * @returns {boolean} - Returns true if the device is allowed, false otherwise.
407
- *
408
- */
409
213
  validateDevice(device, log = true) {
410
214
  if (!Array.isArray(device))
411
215
  device = [device];
@@ -435,21 +239,9 @@ export class MatterbridgePlatform {
435
239
  this.log.info(`Skipping device ${CYAN}${device.join(', ')}${nf} because not in whitelist`);
436
240
  return false;
437
241
  }
438
- /**
439
- * @deprecated This method is deprecated and will be removed in future versions. Use validateEntity instead.
440
- */
441
242
  validateEntityBlackList(device, entity, log = true) {
442
243
  return this.validateEntity(device, entity, log);
443
244
  }
444
- /**
445
- * Validates if an entity is allowed based on the entity blacklist and device-entity blacklist configurations.
446
- *
447
- * @param {string} device - The device to which the entity belongs.
448
- * @param {string} entity - The entity to validate.
449
- * @param {boolean} [log=true] - Whether to log the validation result.
450
- * @returns {boolean} - Returns true if the entity is allowed, false otherwise.
451
- *
452
- */
453
245
  validateEntity(device, entity, log = true) {
454
246
  if (isValidArray(this.config.entityBlackList, 1) && this.config.entityBlackList.find((e) => e === entity)) {
455
247
  if (log)
@@ -468,15 +260,6 @@ export class MatterbridgePlatform {
468
260
  }
469
261
  return true;
470
262
  }
471
- /**
472
- * Checks and updates the endpoint numbers for Matterbridge devices.
473
- *
474
- * This method retrieves the list of Matterbridge devices and their child endpoints,
475
- * compares their current endpoint numbers with the stored ones, and updates the storage
476
- * if there are any changes. It logs the changes and updates the endpoint numbers accordingly.
477
- *
478
- * @returns {Promise<number>} The size of the updated endpoint map, or -1 if storage is not available.
479
- */
480
263
  async checkEndpointNumbers() {
481
264
  if (!this.storage)
482
265
  return -1;
@@ -517,4 +300,3 @@ export class MatterbridgePlatform {
517
300
  return endpointMap.size;
518
301
  }
519
302
  }
520
- //# sourceMappingURL=matterbridgePlatform.js.map
@@ -1,27 +1,3 @@
1
- /**
2
- * This file contains the types for Matterbridge.
3
- *
4
- * @file matterbridgeTypes.ts
5
- * @author Luca Liguori
6
- * @date 2024-07-12
7
- * @version 1.0.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
- // Default colors
24
1
  export const plg = '\u001B[38;5;33m';
25
2
  export const dev = '\u001B[38;5;79m';
26
3
  export const typ = '\u001B[38;5;207m';
27
- //# sourceMappingURL=matterbridgeTypes.js.map