matterbridge 3.0.7-dev-20250618-fb768ee → 3.0.7

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 (188) hide show
  1. package/CHANGELOG.md +3 -2
  2. package/README-DEV.md +4 -4
  3. package/dist/cli.d.ts +29 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +62 -2
  6. package/dist/cli.js.map +1 -0
  7. package/dist/clusters/export.d.ts +2 -0
  8. package/dist/clusters/export.d.ts.map +1 -0
  9. package/dist/clusters/export.js +2 -0
  10. package/dist/clusters/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/devices/export.d.ts +5 -0
  20. package/dist/devices/export.d.ts.map +1 -0
  21. package/dist/devices/export.js +2 -0
  22. package/dist/devices/export.js.map +1 -0
  23. package/dist/evse.d.ts +67 -0
  24. package/dist/evse.d.ts.map +1 -0
  25. package/dist/evse.js +65 -9
  26. package/dist/evse.js.map +1 -0
  27. package/dist/frontend.d.ts +256 -0
  28. package/dist/frontend.d.ts.map +1 -0
  29. package/dist/frontend.js +374 -16
  30. package/dist/frontend.js.map +1 -0
  31. package/dist/globalMatterbridge.d.ts +32 -0
  32. package/dist/globalMatterbridge.d.ts.map +1 -0
  33. package/dist/globalMatterbridge.js +20 -0
  34. package/dist/globalMatterbridge.js.map +1 -0
  35. package/dist/helpers.d.ts +47 -0
  36. package/dist/helpers.d.ts.map +1 -0
  37. package/dist/helpers.js +51 -0
  38. package/dist/helpers.js.map +1 -0
  39. package/dist/index.d.ts +37 -0
  40. package/dist/index.d.ts.map +1 -0
  41. package/dist/index.js +28 -1
  42. package/dist/index.js.map +1 -0
  43. package/dist/laundryWasher.d.ts +243 -0
  44. package/dist/laundryWasher.d.ts.map +1 -0
  45. package/dist/laundryWasher.js +92 -7
  46. package/dist/laundryWasher.js.map +1 -0
  47. package/dist/logger/export.d.ts +2 -0
  48. package/dist/logger/export.d.ts.map +1 -0
  49. package/dist/logger/export.js +1 -0
  50. package/dist/logger/export.js.map +1 -0
  51. package/dist/matter/behaviors.d.ts +2 -0
  52. package/dist/matter/behaviors.d.ts.map +1 -0
  53. package/dist/matter/behaviors.js +2 -0
  54. package/dist/matter/behaviors.js.map +1 -0
  55. package/dist/matter/clusters.d.ts +2 -0
  56. package/dist/matter/clusters.d.ts.map +1 -0
  57. package/dist/matter/clusters.js +2 -0
  58. package/dist/matter/clusters.js.map +1 -0
  59. package/dist/matter/devices.d.ts +2 -0
  60. package/dist/matter/devices.d.ts.map +1 -0
  61. package/dist/matter/devices.js +2 -0
  62. package/dist/matter/devices.js.map +1 -0
  63. package/dist/matter/endpoints.d.ts +2 -0
  64. package/dist/matter/endpoints.d.ts.map +1 -0
  65. package/dist/matter/endpoints.js +2 -0
  66. package/dist/matter/endpoints.js.map +1 -0
  67. package/dist/matter/export.d.ts +5 -0
  68. package/dist/matter/export.d.ts.map +1 -0
  69. package/dist/matter/export.js +2 -0
  70. package/dist/matter/export.js.map +1 -0
  71. package/dist/matter/types.d.ts +3 -0
  72. package/dist/matter/types.d.ts.map +1 -0
  73. package/dist/matter/types.js +2 -0
  74. package/dist/matter/types.js.map +1 -0
  75. package/dist/matterbridge.d.ts +445 -0
  76. package/dist/matterbridge.d.ts.map +1 -0
  77. package/dist/matterbridge.js +748 -46
  78. package/dist/matterbridge.js.map +1 -0
  79. package/dist/matterbridgeAccessoryPlatform.d.ts +40 -0
  80. package/dist/matterbridgeAccessoryPlatform.d.ts.map +1 -0
  81. package/dist/matterbridgeAccessoryPlatform.js +34 -0
  82. package/dist/matterbridgeAccessoryPlatform.js.map +1 -0
  83. package/dist/matterbridgeBehaviors.d.ts +1333 -0
  84. package/dist/matterbridgeBehaviors.d.ts.map +1 -0
  85. package/dist/matterbridgeBehaviors.js +54 -1
  86. package/dist/matterbridgeBehaviors.js.map +1 -0
  87. package/dist/matterbridgeDeviceTypes.d.ts +644 -0
  88. package/dist/matterbridgeDeviceTypes.d.ts.map +1 -0
  89. package/dist/matterbridgeDeviceTypes.js +578 -15
  90. package/dist/matterbridgeDeviceTypes.js.map +1 -0
  91. package/dist/matterbridgeDynamicPlatform.d.ts +40 -0
  92. package/dist/matterbridgeDynamicPlatform.d.ts.map +1 -0
  93. package/dist/matterbridgeDynamicPlatform.js +34 -0
  94. package/dist/matterbridgeDynamicPlatform.js.map +1 -0
  95. package/dist/matterbridgeEndpoint.d.ts +1145 -0
  96. package/dist/matterbridgeEndpoint.d.ts.map +1 -0
  97. package/dist/matterbridgeEndpoint.js +995 -40
  98. package/dist/matterbridgeEndpoint.js.map +1 -0
  99. package/dist/matterbridgeEndpointHelpers.d.ts +3083 -0
  100. package/dist/matterbridgeEndpointHelpers.d.ts.map +1 -0
  101. package/dist/matterbridgeEndpointHelpers.js +204 -10
  102. package/dist/matterbridgeEndpointHelpers.js.map +1 -0
  103. package/dist/matterbridgePlatform.d.ts +290 -0
  104. package/dist/matterbridgePlatform.d.ts.map +1 -0
  105. package/dist/matterbridgePlatform.js +221 -6
  106. package/dist/matterbridgePlatform.js.map +1 -0
  107. package/dist/matterbridgeTypes.d.ts +196 -0
  108. package/dist/matterbridgeTypes.d.ts.map +1 -0
  109. package/dist/matterbridgeTypes.js +24 -0
  110. package/dist/matterbridgeTypes.js.map +1 -0
  111. package/dist/pluginManager.d.ts +273 -0
  112. package/dist/pluginManager.d.ts.map +1 -0
  113. package/dist/pluginManager.js +269 -3
  114. package/dist/pluginManager.js.map +1 -0
  115. package/dist/roboticVacuumCleaner.d.ts +102 -0
  116. package/dist/roboticVacuumCleaner.d.ts.map +1 -0
  117. package/dist/roboticVacuumCleaner.js +81 -6
  118. package/dist/roboticVacuumCleaner.js.map +1 -0
  119. package/dist/shelly.d.ts +161 -0
  120. package/dist/shelly.d.ts.map +1 -0
  121. package/dist/shelly.js +155 -7
  122. package/dist/shelly.js.map +1 -0
  123. package/dist/storage/export.d.ts +2 -0
  124. package/dist/storage/export.d.ts.map +1 -0
  125. package/dist/storage/export.js +1 -0
  126. package/dist/storage/export.js.map +1 -0
  127. package/dist/update.d.ts +58 -0
  128. package/dist/update.d.ts.map +1 -0
  129. package/dist/update.js +53 -0
  130. package/dist/update.js.map +1 -0
  131. package/dist/utils/colorUtils.d.ts +61 -0
  132. package/dist/utils/colorUtils.d.ts.map +1 -0
  133. package/dist/utils/colorUtils.js +205 -2
  134. package/dist/utils/colorUtils.js.map +1 -0
  135. package/dist/utils/commandLine.d.ts +58 -0
  136. package/dist/utils/commandLine.d.ts.map +1 -0
  137. package/dist/utils/commandLine.js +53 -0
  138. package/dist/utils/commandLine.js.map +1 -0
  139. package/dist/utils/copyDirectory.d.ts +32 -0
  140. package/dist/utils/copyDirectory.d.ts.map +1 -0
  141. package/dist/utils/copyDirectory.js +37 -1
  142. package/dist/utils/copyDirectory.js.map +1 -0
  143. package/dist/utils/createDirectory.d.ts +32 -0
  144. package/dist/utils/createDirectory.d.ts.map +1 -0
  145. package/dist/utils/createDirectory.js +31 -0
  146. package/dist/utils/createDirectory.js.map +1 -0
  147. package/dist/utils/createZip.d.ts +38 -0
  148. package/dist/utils/createZip.d.ts.map +1 -0
  149. package/dist/utils/createZip.js +42 -2
  150. package/dist/utils/createZip.js.map +1 -0
  151. package/dist/utils/deepCopy.d.ts +31 -0
  152. package/dist/utils/deepCopy.d.ts.map +1 -0
  153. package/dist/utils/deepCopy.js +38 -0
  154. package/dist/utils/deepCopy.js.map +1 -0
  155. package/dist/utils/deepEqual.d.ts +53 -0
  156. package/dist/utils/deepEqual.d.ts.map +1 -0
  157. package/dist/utils/deepEqual.js +71 -1
  158. package/dist/utils/deepEqual.js.map +1 -0
  159. package/dist/utils/export.d.ts +12 -0
  160. package/dist/utils/export.d.ts.map +1 -0
  161. package/dist/utils/export.js +1 -0
  162. package/dist/utils/export.js.map +1 -0
  163. package/dist/utils/hex.d.ts +48 -0
  164. package/dist/utils/hex.d.ts.map +1 -0
  165. package/dist/utils/hex.js +57 -0
  166. package/dist/utils/hex.js.map +1 -0
  167. package/dist/utils/isvalid.d.ts +102 -0
  168. package/dist/utils/isvalid.d.ts.map +1 -0
  169. package/dist/utils/isvalid.js +100 -0
  170. package/dist/utils/isvalid.js.map +1 -0
  171. package/dist/utils/network.d.ts +69 -0
  172. package/dist/utils/network.d.ts.map +1 -0
  173. package/dist/utils/network.js +76 -5
  174. package/dist/utils/network.js.map +1 -0
  175. package/dist/utils/spawn.d.ts +12 -0
  176. package/dist/utils/spawn.d.ts.map +1 -0
  177. package/dist/utils/spawn.js +16 -0
  178. package/dist/utils/spawn.js.map +1 -0
  179. package/dist/utils/wait.d.ts +52 -0
  180. package/dist/utils/wait.d.ts.map +1 -0
  181. package/dist/utils/wait.js +58 -9
  182. package/dist/utils/wait.js.map +1 -0
  183. package/dist/waterHeater.d.ts +90 -0
  184. package/dist/waterHeater.d.ts.map +1 -0
  185. package/dist/waterHeater.js +62 -2
  186. package/dist/waterHeater.js.map +1 -0
  187. package/npm-shrinkwrap.json +2 -2
  188. package/package.json +2 -1
@@ -1,29 +1,72 @@
1
+ /**
2
+ * This file contains the class MatterbridgePlatform.
3
+ *
4
+ * @file matterbridgePlatform.ts
5
+ * @author Luca Liguori
6
+ * @date 2024-03-21
7
+ * @version 1.2.1
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
+ */
1
23
  import { checkNotLatinCharacters } from './matterbridgeEndpointHelpers.js';
2
24
  import { isValidArray, isValidObject, isValidString } from './utils/export.js';
25
+ // AnsiLogger module
3
26
  import { CYAN, db, er, nf, wr } from './logger/export.js';
27
+ // Storage module
4
28
  import { NodeStorageManager } from './storage/export.js';
29
+ // Node.js module
5
30
  import path from 'node:path';
31
+ /**
32
+ * Represents the base Matterbridge platform. It is extended by the MatterbridgeAccessoryPlatform and MatterbridgeServicePlatform classes.
33
+ *
34
+ */
6
35
  export class MatterbridgePlatform {
7
36
  matterbridge;
8
37
  log;
9
38
  config = {};
10
- name = '';
11
- type = '';
12
- version = '1.0.0';
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
13
43
  storage;
14
44
  context;
45
+ // Device and entity select in the plugin config UI
15
46
  selectDevice = new Map();
16
47
  selectEntity = new Map();
48
+ // Promises for storage
17
49
  _contextReady;
18
50
  _selectDeviceContextReady;
19
51
  _selectEntityContextReady;
20
52
  ready;
21
- _registeredEndpoints = new Map();
22
- _registeredEndpointsByName = new Map();
53
+ // Registered devices
54
+ _registeredEndpoints = new Map(); // uniqueId, MatterbridgeEndpoint
55
+ _registeredEndpointsByName = new Map(); // deviceName, MatterbridgeEndpoint
56
+ /**
57
+ * Creates an instance of the base MatterbridgePlatform.
58
+ * It is extended by the MatterbridgeAccessoryPlatform and MatterbridgeServicePlatform classes.
59
+ * Each plugin must extend the MatterbridgeAccessoryPlatform and MatterbridgeServicePlatform classes.
60
+ *
61
+ * @param {Matterbridge} matterbridge - The Matterbridge instance.
62
+ * @param {AnsiLogger} log - The logger instance.
63
+ * @param {PlatformConfig} config - The platform configuration.
64
+ */
23
65
  constructor(matterbridge, log, config) {
24
66
  this.matterbridge = matterbridge;
25
67
  this.log = log;
26
68
  this.config = config;
69
+ // create the NodeStorageManager for the plugin platform
27
70
  if (!isValidString(this.config.name) || this.config.name === '')
28
71
  throw new Error('Platform: the plugin name is missing or invalid.');
29
72
  this.log.debug(`Creating storage for plugin ${this.config.name} in ${path.join(this.matterbridge.matterbridgeDirectory, this.config.name)}`);
@@ -34,12 +77,14 @@ export class MatterbridgePlatform {
34
77
  logging: false,
35
78
  forgiveParseErrors: true,
36
79
  });
80
+ // create the context storage for the plugin platform
37
81
  this.log.debug(`Creating context for plugin ${this.config.name}`);
38
82
  this._contextReady = this.storage.createStorage('context').then((context) => {
39
83
  this.context = context;
40
- this.context.remove('endpointMap');
84
+ this.context.remove('endpointMap'); // Remove the old endpointMap TODO: remove in future versions
41
85
  this.log.debug(`Created context for plugin ${this.config.name}`);
42
86
  });
87
+ // create the selectDevice storage for the plugin platform
43
88
  this.log.debug(`Loading selectDevice for plugin ${this.config.name}`);
44
89
  this._selectDeviceContextReady = this.storage.createStorage('selectDevice').then(async (context) => {
45
90
  const selectDevice = await context.get('selectDevice', []);
@@ -47,6 +92,7 @@ export class MatterbridgePlatform {
47
92
  this.selectDevice.set(device.serial, device);
48
93
  this.log.debug(`Loaded ${this.selectDevice.size} selectDevice for plugin ${this.config.name}`);
49
94
  });
95
+ // create the selectEntity storage for the plugin platform
50
96
  this.log.debug(`Loading selectEntity for plugin ${this.config.name}`);
51
97
  this._selectEntityContextReady = this.storage.createStorage('selectEntity').then(async (context) => {
52
98
  const selectEntity = await context.get('selectEntity', []);
@@ -54,46 +100,117 @@ export class MatterbridgePlatform {
54
100
  this.selectEntity.set(entity.name, entity);
55
101
  this.log.debug(`Loaded ${this.selectEntity.size} selectEntity for plugin ${this.config.name}`);
56
102
  });
103
+ // Create the `ready` promise for the platform
57
104
  this.ready = Promise.all([this._contextReady, this._selectDeviceContextReady, this._selectEntityContextReady]).then(() => {
58
105
  this.log.debug(`MatterbridgePlatform for plugin ${this.config.name} is fully initialized`);
59
106
  });
60
107
  }
108
+ /**
109
+ * This method must be overridden in the extended class.
110
+ * It is called when the platform is started.
111
+ * Use this method to create the MatterbridgeEndpoints and call this.registerDevice().
112
+ * @param {string} [reason] - The reason for starting.
113
+ * @throws {Error} - Throws an error if the method is not overridden.
114
+ */
61
115
  async onStart(reason) {
62
116
  this.log.error('Plugins must override onStart.', reason);
63
117
  throw new Error('Plugins must override onStart.');
64
118
  }
119
+ /**
120
+ * This method can be overridden in the extended class. In this case always call super.onConfigure() to save the select and run checkEndpointNumbers().
121
+ * It is called after the platform has started.
122
+ * Use this method to perform any configuration of your devices and to override the value of the attributes that are persistent and stored in the
123
+ * matter storage (i.e. the onOff attribute of the OnOff cluster).
124
+ */
65
125
  async onConfigure() {
66
126
  this.log.debug(`Configuring platform ${this.name}`);
127
+ // Save the selectDevice and selectEntity
67
128
  await this.saveSelects();
129
+ // Check and update the endpoint numbers
68
130
  await this.checkEndpointNumbers();
69
131
  }
132
+ /**
133
+ * 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.
134
+ * It is called when the platform is shutting down.
135
+ * Use this method to clean up any resources you used in the constructor or onStart.
136
+ * @param {string} [reason] - The reason for shutting down.
137
+ */
70
138
  async onShutdown(reason) {
71
139
  this.log.debug(`Shutting down platform ${this.name}`, reason);
140
+ // Save the selectDevice and selectEntity
72
141
  await this.saveSelects();
142
+ // Check and update the endpoint numbers
73
143
  await this.checkEndpointNumbers();
144
+ // Cleanup memory
74
145
  this.selectDevice.clear();
75
146
  this.selectEntity.clear();
76
147
  this._registeredEndpoints.clear();
77
148
  this._registeredEndpointsByName.clear();
149
+ // Close the storage
78
150
  await this.context?.close();
79
151
  this.context = undefined;
80
152
  await this.storage?.close();
81
153
  }
154
+ /**
155
+ * Called when the logger level is changed.
156
+ * @param {LogLevel} logLevel The new logger level.
157
+ */
82
158
  async onChangeLoggerLevel(logLevel) {
83
159
  this.log.debug(`The plugin doesn't override onChangeLoggerLevel. Logger level set to: ${logLevel}`);
84
160
  }
161
+ /**
162
+ * Called when a plugin config includes an action button or an action button with text field.
163
+ * @param {string} action The action triggered by the button in plugin config.
164
+ * @param {string} value The value of the field of the action button.
165
+ * @param {string} id The id of the schema associated with the action.
166
+ * @param {PlatformConfig} formData The changed form data of the plugin.
167
+ *
168
+ * @remarks
169
+ * This method can be overridden in the extended class.
170
+ *
171
+ * Use this method to handle the action defined in the plugin schema:
172
+ * ```json
173
+ * "addDevice": {
174
+ * "description": "Manually add a device that has not been discovered with mdns:",
175
+ * "type": "boolean",
176
+ * "buttonText": "ADD", // The text on the button. This is used when the action doesn't include a text field.
177
+ * "buttonField": "ADD", // The text on the button. This is used when the action includes a text field.
178
+ * "buttonClose": false, // optional, default is false. When true, the dialog will close after the action is sent.
179
+ * "buttonSave": false, // optional, default is false. When true, the dialog will close and trigger the restart required after the action is sent.
180
+ * "textPlaceholder": "Enter the device IP address", // optional: the placeholder text for the text field.
181
+ * "default": false
182
+ * },
183
+ * ```
184
+ */
85
185
  async onAction(action, value, id, formData) {
86
186
  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);
87
187
  }
188
+ /**
189
+ * Called when the plugin config has been updated.
190
+ * @param {PlatformConfig} config The new plugin config.
191
+ */
88
192
  async onConfigChanged(config) {
89
193
  this.log.debug(`The plugin ${CYAN}${config.name}${db} doesn't override onConfigChanged. Received new config.`);
90
194
  }
195
+ /**
196
+ * Retrieves the devices registered with the platform.
197
+ * @returns {MatterbridgeEndpoint[]} The registered devices.
198
+ */
91
199
  getDevices() {
92
200
  return Array.from(this._registeredEndpoints.values());
93
201
  }
202
+ /**
203
+ * Checks if a device with this name is already registered in the platform.
204
+ * @param {string} deviceName - The device name to check.
205
+ * @returns {boolean} True if the device is already registered, false otherwise.
206
+ */
94
207
  hasDeviceName(deviceName) {
95
208
  return this._registeredEndpointsByName.has(deviceName);
96
209
  }
210
+ /**
211
+ * Registers a device with the Matterbridge platform.
212
+ * @param {MatterbridgeEndpoint} device - The device to register.
213
+ */
97
214
  async registerDevice(device) {
98
215
  device.plugin = this.name;
99
216
  if (device.deviceName && this._registeredEndpointsByName.has(device.deviceName)) {
@@ -109,6 +226,10 @@ export class MatterbridgePlatform {
109
226
  if (device.deviceName)
110
227
  this._registeredEndpointsByName.set(device.deviceName, device);
111
228
  }
229
+ /**
230
+ * Unregisters a device registered with the Matterbridge platform.
231
+ * @param {MatterbridgeEndpoint} device - The device to unregister.
232
+ */
112
233
  async unregisterDevice(device) {
113
234
  await this.matterbridge.removeBridgedEndpoint(this.name, device);
114
235
  if (device.uniqueId)
@@ -116,11 +237,24 @@ export class MatterbridgePlatform {
116
237
  if (device.deviceName)
117
238
  this._registeredEndpointsByName.delete(device.deviceName);
118
239
  }
240
+ /**
241
+ * Unregisters all devices registered with the Matterbridge platform.
242
+ *
243
+ * @param {number} [delay=0] - The delay in milliseconds between removing each bridged endpoint (default: 0).
244
+ */
119
245
  async unregisterAllDevices(delay = 0) {
120
246
  await this.matterbridge.removeAllBridgedEndpoints(this.name, delay);
121
247
  this._registeredEndpoints.clear();
122
248
  this._registeredEndpointsByName.clear();
123
249
  }
250
+ /**
251
+ * Saves the select devices and entities to storage.
252
+ *
253
+ * This method saves the current state of `selectDevice` and `selectEntity` maps to their respective storage.
254
+ * It logs the number of items being saved and ensures that the storage is properly closed after saving.
255
+ *
256
+ * @returns {Promise<void>} A promise that resolves when the save operation is complete.
257
+ */
124
258
  async saveSelects() {
125
259
  if (this.storage) {
126
260
  this.log.debug(`Saving ${this.selectDevice.size} selectDevice...`);
@@ -133,15 +267,36 @@ export class MatterbridgePlatform {
133
267
  await selectEntity.close();
134
268
  }
135
269
  }
270
+ /**
271
+ * Clears all the select device and entity maps.
272
+ *
273
+ * @returns {void}
274
+ */
136
275
  async clearSelect() {
137
276
  this.selectDevice.clear();
138
277
  this.selectEntity.clear();
139
278
  await this.saveSelects();
140
279
  }
280
+ /**
281
+ * Clears the select for a single device.
282
+ *
283
+ * @param {string} serial - The serial of the device to clear.
284
+ * @returns {void}
285
+ */
141
286
  async clearDeviceSelect(serial) {
142
287
  this.selectDevice.delete(serial);
143
288
  await this.saveSelects();
144
289
  }
290
+ /**
291
+ * Set the select device in the platform map.
292
+ *
293
+ * @param {string} serial - The serial number of the device.
294
+ * @param {string} name - The name of the device.
295
+ * @param {string} [configUrl] - The configuration URL of the device.
296
+ * @param {string} [icon] - The icon of the device: 'wifi', 'ble', 'hub'
297
+ * @param {Array<{ name: string; description: string; icon?: string }>} [entities] - The entities associated with the device.
298
+ * @returns {void}
299
+ */
145
300
  setSelectDevice(serial, name, configUrl, icon, entities) {
146
301
  const device = this.selectDevice.get(serial);
147
302
  if (device) {
@@ -158,6 +313,15 @@ export class MatterbridgePlatform {
158
313
  this.selectDevice.set(serial, { serial, name, configUrl, icon, entities });
159
314
  }
160
315
  }
316
+ /**
317
+ * Set the select device entity in the platform map.
318
+ *
319
+ * @param {string} serial - The serial number of the device.
320
+ * @param {string} entityName - The name of the entity.
321
+ * @param {string} entityDescription - The description of the entity.
322
+ * @param {string} [entityIcon] - The icon of the entity: 'wifi', 'ble', 'hub', 'component', 'matter'
323
+ * @returns {void}
324
+ */
161
325
  setSelectDeviceEntity(serial, entityName, entityDescription, entityIcon) {
162
326
  const device = this.selectDevice.get(serial);
163
327
  if (device) {
@@ -167,6 +331,11 @@ export class MatterbridgePlatform {
167
331
  device.entities.push({ name: entityName, description: entityDescription, icon: entityIcon });
168
332
  }
169
333
  }
334
+ /**
335
+ * Retrieves the select devices from the platform map.
336
+ *
337
+ * @returns {{ pluginName: string; serial: string; name: string; configUrl?: string; icon?: string; entities?: { name: string; description: string; icon?: string }[] }[]} The selected devices array.
338
+ */
170
339
  getSelectDevices() {
171
340
  const selectDevices = [];
172
341
  for (const device of this.selectDevice.values()) {
@@ -174,9 +343,22 @@ export class MatterbridgePlatform {
174
343
  }
175
344
  return selectDevices;
176
345
  }
346
+ /**
347
+ * Set the select entity in the platform map.
348
+ *
349
+ * @param {string} name - The entity name.
350
+ * @param {string} description - The entity description.
351
+ * @param {string} [icon] - The entity icon: 'wifi', 'ble', 'hub', 'component', 'matter'
352
+ * @returns {void}
353
+ */
177
354
  setSelectEntity(name, description, icon) {
178
355
  this.selectEntity.set(name, { name, description, icon });
179
356
  }
357
+ /**
358
+ * Retrieve the select entities.
359
+ *
360
+ * @returns {{ pluginName: string; name: string; description: string; icon?: string }[]} The select entities array.
361
+ */
180
362
  getSelectEntities() {
181
363
  const selectEntities = [];
182
364
  for (const entity of this.selectEntity.values()) {
@@ -184,6 +366,11 @@ export class MatterbridgePlatform {
184
366
  }
185
367
  return selectEntities;
186
368
  }
369
+ /**
370
+ * Verifies if the Matterbridge version meets the required version.
371
+ * @param {string} requiredVersion - The required version to compare against.
372
+ * @returns {boolean} True if the Matterbridge version meets or exceeds the required version, false otherwise.
373
+ */
187
374
  verifyMatterbridgeVersion(requiredVersion) {
188
375
  const compareVersions = (matterbridgeVersion, requiredVersion) => {
189
376
  const stripTag = (v) => {
@@ -208,6 +395,15 @@ export class MatterbridgePlatform {
208
395
  return false;
209
396
  return true;
210
397
  }
398
+ /**
399
+ * Validates if a device is allowed based on the whitelist and blacklist configurations.
400
+ * The blacklist has priority over the whitelist.
401
+ *
402
+ * @param {string | string[]} device - The device name(s) to validate.
403
+ * @param {boolean} [log=true] - Whether to log the validation result.
404
+ * @returns {boolean} - Returns true if the device is allowed, false otherwise.
405
+ *
406
+ */
211
407
  validateDevice(device, log = true) {
212
408
  if (!Array.isArray(device))
213
409
  device = [device];
@@ -237,6 +433,15 @@ export class MatterbridgePlatform {
237
433
  this.log.info(`Skipping device ${CYAN}${device.join(', ')}${nf} because not in whitelist`);
238
434
  return false;
239
435
  }
436
+ /**
437
+ * Validates if an entity is allowed based on the entity blacklist and device-entity blacklist configurations.
438
+ *
439
+ * @param {string} device - The device to which the entity belongs.
440
+ * @param {string} entity - The entity to validate.
441
+ * @param {boolean} [log=true] - Whether to log the validation result.
442
+ * @returns {boolean} - Returns true if the entity is allowed, false otherwise.
443
+ *
444
+ */
240
445
  validateEntity(device, entity, log = true) {
241
446
  if (isValidArray(this.config.entityBlackList, 1) && this.config.entityBlackList.find((e) => e === entity)) {
242
447
  if (log)
@@ -255,6 +460,15 @@ export class MatterbridgePlatform {
255
460
  }
256
461
  return true;
257
462
  }
463
+ /**
464
+ * Checks and updates the endpoint numbers for Matterbridge devices.
465
+ *
466
+ * This method retrieves the list of Matterbridge devices and their child endpoints,
467
+ * compares their current endpoint numbers with the stored ones, and updates the storage
468
+ * if there are any changes. It logs the changes and updates the endpoint numbers accordingly.
469
+ *
470
+ * @returns {Promise<number>} The size of the updated endpoint map, or -1 if storage is not available.
471
+ */
258
472
  async checkEndpointNumbers() {
259
473
  if (!this.storage)
260
474
  return -1;
@@ -295,3 +509,4 @@ export class MatterbridgePlatform {
295
509
  return endpointMap.size;
296
510
  }
297
511
  }
512
+ //# sourceMappingURL=matterbridgePlatform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matterbridgePlatform.js","sourceRoot":"","sources":["../src/matterbridgePlatform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAKH,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE/E,oBAAoB;AACpB,OAAO,EAAc,IAAI,EAAE,EAAE,EAAE,EAAE,EAAY,EAAE,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAEhF,iBAAiB;AACjB,OAAO,EAAe,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAKtE,iBAAiB;AACjB,OAAO,IAAI,MAAM,WAAW,CAAC;AAqB7B;;;GAGG;AACH,MAAM,OAAO,oBAAoB;IAC/B,YAAY,C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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
+ import { NodeStorage } from './storage/export.js';
24
+ import { LogLevel } from './logger/export.js';
25
+ import { MatterbridgePlatform, PlatformConfig, PlatformSchema } from './matterbridgePlatform.js';
26
+ import { MatterbridgeEndpoint } from './matterbridgeEndpoint.js';
27
+ import { FabricIndex, NodeId, VendorId, StorageContext, ServerNode, EndpointNumber, Endpoint as EndpointNode } from '@matter/main';
28
+ import { ExposedFabricInformation } from '@matter/main/protocol';
29
+ import { AggregatorEndpoint } from '@matter/main/endpoints/aggregator';
30
+ export declare const plg = "\u001B[38;5;33m";
31
+ export declare const dev = "\u001B[38;5;79m";
32
+ export declare const typ = "\u001B[38;5;207m";
33
+ export interface RegisteredPlugin extends BaseRegisteredPlugin {
34
+ nodeContext?: NodeStorage;
35
+ storageContext?: StorageContext;
36
+ serverNode?: ServerNode<ServerNode.RootEndpoint>;
37
+ aggregatorNode?: EndpointNode<AggregatorEndpoint>;
38
+ device?: MatterbridgeEndpoint;
39
+ platform?: MatterbridgePlatform;
40
+ reachabilityTimeout?: NodeJS.Timeout;
41
+ }
42
+ export interface BaseRegisteredPlugin {
43
+ name: string;
44
+ version: string;
45
+ description: string;
46
+ author: string;
47
+ path: string;
48
+ type: string;
49
+ latestVersion?: string;
50
+ serialNumber?: string;
51
+ homepage?: string;
52
+ help?: string;
53
+ changelog?: string;
54
+ funding?: string;
55
+ locked?: boolean;
56
+ error?: boolean;
57
+ enabled?: boolean;
58
+ loaded?: boolean;
59
+ started?: boolean;
60
+ configured?: boolean;
61
+ paired?: boolean;
62
+ restartRequired?: boolean;
63
+ fabricInformations?: SanitizedExposedFabricInformation[];
64
+ sessionInformations?: SanitizedSessionInformation[];
65
+ registeredDevices?: number;
66
+ addedDevices?: number;
67
+ qrPairingCode?: string;
68
+ manualPairingCode?: string;
69
+ configJson?: PlatformConfig;
70
+ schemaJson?: PlatformSchema;
71
+ hasWhiteList?: boolean;
72
+ hasBlackList?: boolean;
73
+ }
74
+ export interface SystemInformation {
75
+ interfaceName: string;
76
+ macAddress: string;
77
+ ipv4Address: string;
78
+ ipv6Address: string;
79
+ nodeVersion: string;
80
+ hostname: string;
81
+ user: string;
82
+ osType: string;
83
+ osRelease: string;
84
+ osPlatform: string;
85
+ osArch: string;
86
+ totalMemory: string;
87
+ freeMemory: string;
88
+ systemUptime: string;
89
+ processUptime: string;
90
+ cpuUsage: string;
91
+ rss: string;
92
+ heapTotal: string;
93
+ heapUsed: string;
94
+ }
95
+ export interface MatterbridgeInformation {
96
+ homeDirectory: string;
97
+ rootDirectory: string;
98
+ matterbridgeDirectory: string;
99
+ matterbridgePluginDirectory: string;
100
+ matterbridgeCertDirectory: string;
101
+ globalModulesDirectory: string;
102
+ matterbridgeVersion: string;
103
+ matterbridgeLatestVersion: string;
104
+ matterbridgeDevVersion: string;
105
+ matterbridgeSerialNumber: string;
106
+ matterbridgeQrPairingCode: string | undefined;
107
+ matterbridgeManualPairingCode: string | undefined;
108
+ matterbridgeFabricInformations: SanitizedExposedFabricInformation[] | undefined;
109
+ matterbridgeSessionInformations: SanitizedSessionInformation[] | undefined;
110
+ matterbridgePaired: boolean | undefined;
111
+ matterbridgeAdvertise: boolean | undefined;
112
+ bridgeMode: string;
113
+ restartMode: string;
114
+ virtualMode: 'disabled' | 'outlet' | 'light' | 'switch' | 'mounted_switch';
115
+ readOnly: boolean;
116
+ shellyBoard: boolean;
117
+ shellySysUpdate: boolean;
118
+ shellyMainUpdate: boolean;
119
+ profile?: string;
120
+ loggerLevel: LogLevel;
121
+ fileLogger: boolean;
122
+ matterLoggerLevel: number;
123
+ matterFileLogger: boolean;
124
+ mattermdnsinterface: string | undefined;
125
+ matteripv4address: string | undefined;
126
+ matteripv6address: string | undefined;
127
+ matterPort: number;
128
+ matterDiscriminator: number | undefined;
129
+ matterPasscode: number | undefined;
130
+ restartRequired: boolean;
131
+ updateRequired: boolean;
132
+ }
133
+ export interface SanitizedExposedFabricInformation {
134
+ fabricIndex: FabricIndex;
135
+ fabricId: string;
136
+ nodeId: string;
137
+ rootNodeId: string;
138
+ rootVendorId: VendorId;
139
+ rootVendorName: string;
140
+ label: string;
141
+ }
142
+ export interface SessionInformation {
143
+ name: string;
144
+ nodeId: NodeId;
145
+ peerNodeId: NodeId;
146
+ fabric?: ExposedFabricInformation;
147
+ isPeerActive: boolean;
148
+ secure: boolean;
149
+ lastInteractionTimestamp?: number;
150
+ lastActiveTimestamp?: number;
151
+ numberOfActiveSubscriptions: number;
152
+ }
153
+ export interface SanitizedSessionInformation {
154
+ name: string;
155
+ nodeId: string;
156
+ peerNodeId: string;
157
+ fabric?: SanitizedExposedFabricInformation;
158
+ isPeerActive: boolean;
159
+ secure: boolean;
160
+ lastInteractionTimestamp?: string;
161
+ lastActiveTimestamp?: string;
162
+ numberOfActiveSubscriptions: number;
163
+ }
164
+ export interface ApiDevices {
165
+ pluginName: string;
166
+ type: string;
167
+ endpoint: EndpointNumber | undefined;
168
+ name: string;
169
+ serial: string;
170
+ productUrl: string;
171
+ configUrl?: string;
172
+ uniqueId: string;
173
+ reachable: boolean;
174
+ powerSource?: 'ac' | 'dc' | 'ok' | 'warning' | 'critical';
175
+ cluster: string;
176
+ }
177
+ export interface ApiClustersResponse {
178
+ plugin: string;
179
+ deviceName: string;
180
+ serialNumber: string;
181
+ endpoint: number;
182
+ deviceTypes: number[];
183
+ clusters: ApiClusters[];
184
+ }
185
+ export interface ApiClusters {
186
+ endpoint: string;
187
+ id: string;
188
+ deviceTypes: number[];
189
+ clusterName: string;
190
+ clusterId: string;
191
+ attributeName: string;
192
+ attributeId: string;
193
+ attributeValue: string;
194
+ attributeLocalValue: unknown;
195
+ }
196
+ //# sourceMappingURL=matterbridgeTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matterbridgeTypes.d.ts","sourceRoot":"","sources":["../src/matterbridgeTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG9C,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACjG,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAGjE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,cAAc,CAAC;AACnI,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAGvE,eAAO,MAAM,GAAG,oBAAoB,CAAC;AACrC,eAAO,MAAM,GAAG,oBAAoB,CAAC;AACrC,eAAO,MAAM,GAAG,qBAAqB,CAAC;AAGtC,MAAM,WAAW,gBAAiB,SAAQ,oBAAoB;IAC5D,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,UAAU,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IACjD,cAAc,CAAC,EAAE,YAAY,CAAC,kBAAkB,CAAC,CAAC;IAClD,MAAM,CAAC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IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,mBAAmB,EAAE,OAAO,CAAC;CAC9B"}
@@ -1,3 +1,27 @@
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
1
24
  export const plg = '\u001B[38;5;33m';
2
25
  export const dev = '\u001B[38;5;79m';
3
26
  export const typ = '\u001B[38;5;207m';
27
+ //# sourceMappingURL=matterbridgeTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matterbridgeTypes.js","sourceRoot":"","sources":["../src/matterbridgeTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAeH,iBAAiB;AACjB,MAAM,CAAC,MAAM,GAAG,GAAG,iBAAiB,CAAC;AACrC,MAAM,CAAC,MAAM,GAAG,GAAG,iBAAiB,CAAC;AACrC,MAAM,CAAC,MAAM,GAAG,GAAG,kBAAkB,CAAC"}