matterbridge 3.0.0-edge.8 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/CHANGELOG.md +50 -9
  2. package/README-DEV.md +4 -0
  3. package/README-DOCKER.md +21 -12
  4. package/README-SERVICE.md +27 -21
  5. package/README.md +80 -2
  6. package/dist/cli.d.ts +29 -0
  7. package/dist/cli.d.ts.map +1 -0
  8. package/dist/cli.js +41 -3
  9. package/dist/cli.js.map +1 -0
  10. package/dist/cluster/export.d.ts +2 -0
  11. package/dist/cluster/export.d.ts.map +1 -0
  12. package/dist/cluster/export.js +2 -0
  13. package/dist/cluster/export.js.map +1 -0
  14. package/dist/defaultConfigSchema.d.ts +27 -0
  15. package/dist/defaultConfigSchema.d.ts.map +1 -0
  16. package/dist/defaultConfigSchema.js +23 -0
  17. package/dist/defaultConfigSchema.js.map +1 -0
  18. package/dist/deviceManager.d.ts +114 -0
  19. package/dist/deviceManager.d.ts.map +1 -0
  20. package/dist/deviceManager.js +94 -1
  21. package/dist/deviceManager.js.map +1 -0
  22. package/dist/frontend.d.ts +222 -0
  23. package/dist/frontend.d.ts.map +1 -0
  24. package/dist/frontend.js +443 -35
  25. package/dist/frontend.js.map +1 -0
  26. package/dist/index.d.ts +35 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +28 -1
  29. package/dist/index.js.map +1 -0
  30. package/dist/logger/export.d.ts +2 -0
  31. package/dist/logger/export.d.ts.map +1 -0
  32. package/dist/logger/export.js +1 -0
  33. package/dist/logger/export.js.map +1 -0
  34. package/dist/matter/behaviors.d.ts +2 -0
  35. package/dist/matter/behaviors.d.ts.map +1 -0
  36. package/dist/matter/behaviors.js +2 -0
  37. package/dist/matter/behaviors.js.map +1 -0
  38. package/dist/matter/clusters.d.ts +2 -0
  39. package/dist/matter/clusters.d.ts.map +1 -0
  40. package/dist/matter/clusters.js +2 -0
  41. package/dist/matter/clusters.js.map +1 -0
  42. package/dist/matter/devices.d.ts +2 -0
  43. package/dist/matter/devices.d.ts.map +1 -0
  44. package/dist/matter/devices.js +2 -0
  45. package/dist/matter/devices.js.map +1 -0
  46. package/dist/matter/endpoints.d.ts +2 -0
  47. package/dist/matter/endpoints.d.ts.map +1 -0
  48. package/dist/matter/endpoints.js +2 -0
  49. package/dist/matter/endpoints.js.map +1 -0
  50. package/dist/matter/export.d.ts +5 -0
  51. package/dist/matter/export.d.ts.map +1 -0
  52. package/dist/matter/export.js +2 -0
  53. package/dist/matter/export.js.map +1 -0
  54. package/dist/matter/types.d.ts +3 -0
  55. package/dist/matter/types.d.ts.map +1 -0
  56. package/dist/matter/types.js +2 -0
  57. package/dist/matter/types.js.map +1 -0
  58. package/dist/matterbridge.d.ts +431 -0
  59. package/dist/matterbridge.d.ts.map +1 -0
  60. package/dist/matterbridge.js +800 -79
  61. package/dist/matterbridge.js.map +1 -0
  62. package/dist/matterbridgeAccessoryPlatform.d.ts +40 -0
  63. package/dist/matterbridgeAccessoryPlatform.d.ts.map +1 -0
  64. package/dist/matterbridgeAccessoryPlatform.js +34 -0
  65. package/dist/matterbridgeAccessoryPlatform.js.map +1 -0
  66. package/dist/matterbridgeBehaviors.d.ts +1514 -0
  67. package/dist/matterbridgeBehaviors.d.ts.map +1 -0
  68. package/dist/matterbridgeBehaviors.js +33 -1
  69. package/dist/matterbridgeBehaviors.js.map +1 -0
  70. package/dist/matterbridgeDeviceTypes.d.ts +494 -0
  71. package/dist/matterbridgeDeviceTypes.d.ts.map +1 -0
  72. package/dist/matterbridgeDeviceTypes.js +431 -12
  73. package/dist/matterbridgeDeviceTypes.js.map +1 -0
  74. package/dist/matterbridgeDynamicPlatform.d.ts +40 -0
  75. package/dist/matterbridgeDynamicPlatform.d.ts.map +1 -0
  76. package/dist/matterbridgeDynamicPlatform.js +34 -0
  77. package/dist/matterbridgeDynamicPlatform.js.map +1 -0
  78. package/dist/matterbridgeEndpoint.d.ts +943 -0
  79. package/dist/matterbridgeEndpoint.d.ts.map +1 -0
  80. package/dist/matterbridgeEndpoint.js +806 -7
  81. package/dist/matterbridgeEndpoint.js.map +1 -0
  82. package/dist/matterbridgeEndpointHelpers.d.ts +2706 -0
  83. package/dist/matterbridgeEndpointHelpers.d.ts.map +1 -0
  84. package/dist/matterbridgeEndpointHelpers.js +156 -9
  85. package/dist/matterbridgeEndpointHelpers.js.map +1 -0
  86. package/dist/matterbridgePlatform.d.ts +294 -0
  87. package/dist/matterbridgePlatform.d.ts.map +1 -0
  88. package/dist/matterbridgePlatform.js +227 -9
  89. package/dist/matterbridgePlatform.js.map +1 -0
  90. package/dist/matterbridgeTypes.d.ts +187 -0
  91. package/dist/matterbridgeTypes.d.ts.map +1 -0
  92. package/dist/matterbridgeTypes.js +24 -0
  93. package/dist/matterbridgeTypes.js.map +1 -0
  94. package/dist/pluginManager.d.ts +271 -0
  95. package/dist/pluginManager.d.ts.map +1 -0
  96. package/dist/pluginManager.js +262 -3
  97. package/dist/pluginManager.js.map +1 -0
  98. package/dist/shelly.d.ts +92 -0
  99. package/dist/shelly.d.ts.map +1 -0
  100. package/dist/shelly.js +146 -6
  101. package/dist/shelly.js.map +1 -0
  102. package/dist/storage/export.d.ts +2 -0
  103. package/dist/storage/export.d.ts.map +1 -0
  104. package/dist/storage/export.js +1 -0
  105. package/dist/storage/export.js.map +1 -0
  106. package/dist/update.d.ts +32 -0
  107. package/dist/update.d.ts.map +1 -0
  108. package/dist/update.js +70 -0
  109. package/dist/update.js.map +1 -0
  110. package/dist/utils/colorUtils.d.ts +61 -0
  111. package/dist/utils/colorUtils.d.ts.map +1 -0
  112. package/dist/utils/colorUtils.js +205 -2
  113. package/dist/utils/colorUtils.js.map +1 -0
  114. package/dist/utils/copyDirectory.d.ts +32 -0
  115. package/dist/utils/copyDirectory.d.ts.map +1 -0
  116. package/dist/utils/copyDirectory.js +37 -1
  117. package/dist/utils/copyDirectory.js.map +1 -0
  118. package/dist/utils/createZip.d.ts +38 -0
  119. package/dist/utils/createZip.d.ts.map +1 -0
  120. package/dist/utils/createZip.js +42 -2
  121. package/dist/utils/createZip.js.map +1 -0
  122. package/dist/utils/deepCopy.d.ts +31 -0
  123. package/dist/utils/deepCopy.d.ts.map +1 -0
  124. package/dist/utils/deepCopy.js +40 -0
  125. package/dist/utils/deepCopy.js.map +1 -0
  126. package/dist/utils/deepEqual.d.ts +53 -0
  127. package/dist/utils/deepEqual.d.ts.map +1 -0
  128. package/dist/utils/deepEqual.js +65 -1
  129. package/dist/utils/deepEqual.js.map +1 -0
  130. package/dist/utils/export.d.ts +10 -0
  131. package/dist/utils/export.d.ts.map +1 -0
  132. package/dist/utils/export.js +1 -0
  133. package/dist/utils/export.js.map +1 -0
  134. package/dist/utils/isvalid.d.ts +87 -0
  135. package/dist/utils/isvalid.d.ts.map +1 -0
  136. package/dist/utils/isvalid.js +86 -0
  137. package/dist/utils/isvalid.js.map +1 -0
  138. package/dist/utils/network.d.ts +69 -0
  139. package/dist/utils/network.d.ts.map +1 -0
  140. package/dist/utils/network.js +76 -5
  141. package/dist/utils/network.js.map +1 -0
  142. package/dist/utils/parameter.d.ts +58 -0
  143. package/dist/utils/parameter.d.ts.map +1 -0
  144. package/dist/utils/parameter.js +92 -7
  145. package/dist/utils/parameter.js.map +1 -0
  146. package/dist/utils/wait.d.ts +43 -0
  147. package/dist/utils/wait.d.ts.map +1 -0
  148. package/dist/utils/wait.js +50 -5
  149. package/dist/utils/wait.js.map +1 -0
  150. package/frontend/build/asset-manifest.json +6 -6
  151. package/frontend/build/bmc-button.svg +22 -0
  152. package/frontend/build/discord.svg +5 -0
  153. package/frontend/build/index.html +1 -1
  154. package/frontend/build/static/css/{main.ea7910e9.css → main.944b63c3.css} +2 -2
  155. package/frontend/build/static/css/main.944b63c3.css.map +1 -0
  156. package/frontend/build/static/js/{main.e11d6bb4.js → main.1d983660.js} +12 -12
  157. package/frontend/build/static/js/{main.e11d6bb4.js.map → main.1d983660.js.map} +1 -1
  158. package/npm-shrinkwrap.json +300 -362
  159. package/package.json +5 -4
  160. package/tsconfig.jest.json +8 -0
  161. package/README-EDGE.md +0 -74
  162. package/frontend/build/static/css/main.ea7910e9.css.map +0 -1
  163. /package/frontend/build/static/js/{main.e11d6bb4.js.LICENSE.txt → main.1d983660.js.LICENSE.txt} +0 -0
@@ -1,10 +1,36 @@
1
+ /**
2
+ * This file contains the class MatterbridgeEndpoint that extends the Endpoint class from the Matter.js library.
3
+ *
4
+ * @file matterbridgeEndpoint.ts
5
+ * @author Luca Liguori
6
+ * @date 2024-10-01
7
+ * @version 2.0.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
+ // AnsiLogger module
1
24
  import { AnsiLogger, BLUE, CYAN, YELLOW, db, debugStringify, er, hk, or, zb } from './logger/export.js';
25
+ // Matterbridge
2
26
  import { bridgedNode } from './matterbridgeDeviceTypes.js';
3
27
  import { isValidNumber, isValidObject } from './utils/export.js';
4
28
  import { MatterbridgeServer, MatterbridgeServerDevice, MatterbridgeIdentifyServer, MatterbridgeOnOffServer, MatterbridgeLevelControlServer, MatterbridgeColorControlServer, MatterbridgeWindowCoveringServer, MatterbridgeThermostatServer, MatterbridgeFanControlServer, MatterbridgeDoorLockServer, MatterbridgeModeSelectServer, MatterbridgeValveConfigurationAndControlServer, MatterbridgeSmokeCoAlarmServer, MatterbridgeBooleanStateConfigurationServer, MatterbridgeSwitchServer, } from './matterbridgeBehaviors.js';
5
29
  import { addClusterServers, addFixedLabel, addOptionalClusterServers, addRequiredClusterServers, addUserLabel, capitalizeFirstLetter, createUniqueId, getBehavior, getBehaviourTypesFromClusterClientIds, getBehaviourTypesFromClusterServerIds, getDefaultFlowMeasurementClusterServer, getDefaultIlluminanceMeasurementClusterServer, getDefaultPressureMeasurementClusterServer, getDefaultRelativeHumidityMeasurementClusterServer, getDefaultTemperatureMeasurementClusterServer, getDefaultOccupancySensingClusterServer, lowercaseFirstLetter, updateAttribute, getClusterId, getAttributeId, setAttribute, getAttribute, checkNotLatinCharacters, generateUniqueId, subscribeAttribute, } from './matterbridgeEndpointHelpers.js';
30
+ // @matter
6
31
  import { Endpoint, Lifecycle, MutableEndpoint, NamedHandler, SupportedBehaviors, VendorId } from '@matter/main';
7
32
  import { getClusterNameById, MeasurementType } from '@matter/main/types';
33
+ // @matter clusters
8
34
  import { Descriptor } from '@matter/main/clusters/descriptor';
9
35
  import { PowerSource } from '@matter/main/clusters/power-source';
10
36
  import { BridgedDeviceBasicInformation } from '@matter/main/clusters/bridged-device-basic-information';
@@ -27,6 +53,8 @@ import { ElectricalEnergyMeasurement } from '@matter/main/clusters/electrical-en
27
53
  import { AirQuality } from '@matter/main/clusters/air-quality';
28
54
  import { ConcentrationMeasurement } from '@matter/main/clusters/concentration-measurement';
29
55
  import { OccupancySensing } from '@matter/main/clusters/occupancy-sensing';
56
+ import { ThermostatUserInterfaceConfiguration } from '@matter/main/clusters/thermostat-user-interface-configuration';
57
+ // @matter behaviors
30
58
  import { DescriptorServer } from '@matter/main/behaviors/descriptor';
31
59
  import { PowerSourceServer } from '@matter/main/behaviors/power-source';
32
60
  import { BridgedDeviceBasicInformationServer } from '@matter/main/behaviors/bridged-device-basic-information';
@@ -59,9 +87,10 @@ import { FanControlServer } from '@matter/main/behaviors/fan-control';
59
87
  import { ResourceMonitoring } from '@matter/main/clusters/resource-monitoring';
60
88
  import { HepaFilterMonitoringServer } from '@matter/main/behaviors/hepa-filter-monitoring';
61
89
  import { ActivatedCarbonFilterMonitoringServer } from '@matter/main/behaviors/activated-carbon-filter-monitoring';
90
+ import { ThermostatUserInterfaceConfigurationServer } from '@matter/main/behaviors/thermostat-user-interface-configuration';
62
91
  export class MatterbridgeEndpoint extends Endpoint {
63
92
  static bridgeMode = '';
64
- static logLevel = "info";
93
+ static logLevel = "info" /* LogLevel.INFO */;
65
94
  log;
66
95
  plugin = undefined;
67
96
  configUrl = undefined;
@@ -77,14 +106,25 @@ export class MatterbridgeEndpoint extends Endpoint {
77
106
  hardwareVersion = undefined;
78
107
  hardwareVersionString = undefined;
79
108
  productUrl = 'https://www.npmjs.com/package/matterbridge';
109
+ // The first device type of the endpoint
80
110
  name = undefined;
81
111
  deviceType;
82
112
  uniqueStorageKey = undefined;
83
113
  tagList = undefined;
114
+ // Maps matter deviceTypes
84
115
  deviceTypes = new Map();
116
+ // Command handler
85
117
  commandHandler = new NamedHandler();
118
+ /**
119
+ * Represents a MatterbridgeEndpoint.
120
+ * @constructor
121
+ * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the endpoint.
122
+ * @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
123
+ * @param {boolean} [debug=false] - Debug flag.
124
+ */
86
125
  constructor(definition, options = {}, debug = false) {
87
126
  let deviceTypeList = [];
127
+ // Get the first DeviceTypeDefinition
88
128
  let firstDefinition;
89
129
  if (Array.isArray(definition)) {
90
130
  firstDefinition = definition[0];
@@ -97,6 +137,7 @@ export class MatterbridgeEndpoint extends Endpoint {
97
137
  firstDefinition = definition;
98
138
  deviceTypeList = [{ deviceType: firstDefinition.code, revision: firstDefinition.revision }];
99
139
  }
140
+ // Convert the first DeviceTypeDefinition to an EndpointType.Options
100
141
  const deviceTypeDefinitionV8 = {
101
142
  name: firstDefinition.name.replace('-', '_'),
102
143
  deviceType: firstDefinition.code,
@@ -115,9 +156,11 @@ export class MatterbridgeEndpoint extends Endpoint {
115
156
  behaviors: options.tagList ? SupportedBehaviors(DescriptorServer.with(Descriptor.Feature.TagList)) : {},
116
157
  };
117
158
  const endpointV8 = MutableEndpoint(deviceTypeDefinitionV8);
159
+ // Check if the uniqueStorageKey is valid
118
160
  if (options.uniqueStorageKey && checkNotLatinCharacters(options.uniqueStorageKey)) {
119
161
  options.uniqueStorageKey = generateUniqueId(options.uniqueStorageKey);
120
162
  }
163
+ // Convert the options to an Endpoint.Options
121
164
  const optionsV8 = {
122
165
  id: options.uniqueStorageKey?.replace(/[ .]/g, ''),
123
166
  number: options.endpointId,
@@ -135,17 +178,41 @@ export class MatterbridgeEndpoint extends Endpoint {
135
178
  }
136
179
  else
137
180
  this.deviceTypes.set(firstDefinition.code, firstDefinition);
138
- this.log = new AnsiLogger({ logName: options.uniqueStorageKey ?? 'MatterbridgeEndpoint', logTimestampFormat: 4, logLevel: debug === true ? "debug" : MatterbridgeEndpoint.logLevel });
181
+ // console.log('MatterbridgeEndpoint.option', options);
182
+ // console.log('MatterbridgeEndpoint.endpointV8', endpointV8);
183
+ // console.log('MatterbridgeEndpoint.optionsV8', optionsV8);
184
+ // Create the logger
185
+ this.log = new AnsiLogger({ logName: options.uniqueStorageKey ?? 'MatterbridgeEndpoint', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: debug === true ? "debug" /* LogLevel.DEBUG */ : MatterbridgeEndpoint.logLevel });
139
186
  this.log.debug(`${YELLOW}new${db} MatterbridgeEndpoint: ${zb}${'0x' + firstDefinition.code.toString(16).padStart(4, '0')}${db}-${zb}${firstDefinition.name}${db} ` +
140
187
  `id: ${CYAN}${options.uniqueStorageKey}${db} number: ${CYAN}${options.endpointId}${db} taglist: ${CYAN}${options.tagList ? debugStringify(options.tagList) : 'undefined'}${db}`);
188
+ // Add MatterbridgeBehavior with MatterbridgeBehaviorDevice
141
189
  this.behaviors.require(MatterbridgeServer, { deviceCommand: new MatterbridgeServerDevice(this.log, this.commandHandler, undefined) });
142
190
  }
191
+ /**
192
+ * Loads an instance of the MatterbridgeEndpoint class.
193
+ *
194
+ * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the device.
195
+ * @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
196
+ * @param {boolean} [debug=false] - Debug flag.
197
+ * @returns {Promise<MatterbridgeEndpoint>} MatterbridgeEndpoint instance.
198
+ */
143
199
  static async loadInstance(definition, options = {}, debug = false) {
144
200
  return new MatterbridgeEndpoint(definition, options, debug);
145
201
  }
202
+ /**
203
+ * Get all the device types of this endpoint.
204
+ *
205
+ * @returns {DeviceTypeDefinition[]} The device types of this endpoint.
206
+ */
146
207
  getDeviceTypes() {
147
208
  return Array.from(this.deviceTypes.values());
148
209
  }
210
+ /**
211
+ * Checks if the provided cluster server is supported by this endpoint.
212
+ *
213
+ * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
214
+ * @returns {boolean} True if the cluster server is supported, false otherwise.
215
+ */
149
216
  hasClusterServer(cluster) {
150
217
  const behavior = getBehavior(this, cluster);
151
218
  if (behavior)
@@ -153,6 +220,13 @@ export class MatterbridgeEndpoint extends Endpoint {
153
220
  else
154
221
  return false;
155
222
  }
223
+ /**
224
+ * Checks if the provided attribute server is supported for a given cluster of this endpoint.
225
+ *
226
+ * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
227
+ * @param {string} attribute - The attribute name to check.
228
+ * @returns {boolean} True if the attribute server is supported, false otherwise.
229
+ */
156
230
  hasAttributeServer(cluster, attribute) {
157
231
  const behavior = getBehavior(this, cluster);
158
232
  if (!behavior || !this.behaviors.supported[behavior.id])
@@ -161,72 +235,186 @@ export class MatterbridgeEndpoint extends Endpoint {
161
235
  const defaults = this.behaviors.defaultsFor(behavior);
162
236
  return lowercaseFirstLetter(attribute) in options || lowercaseFirstLetter(attribute) in defaults;
163
237
  }
238
+ /**
239
+ * Retrieves the initial options for the provided cluster server.
240
+ *
241
+ * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to get options for.
242
+ * @returns {Record<string, boolean | number | bigint | string | object | null> | undefined} The options for the provided cluster server, or undefined if the cluster is not supported.
243
+ */
164
244
  getClusterServerOptions(cluster) {
165
245
  const behavior = getBehavior(this, cluster);
166
246
  if (!behavior)
167
247
  return undefined;
168
248
  return this.behaviors.optionsFor(behavior);
169
249
  }
250
+ /**
251
+ * Retrieves the value of the provided attribute from the given cluster.
252
+ *
253
+ * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to retrieve the attribute from.
254
+ * @param {string} attribute - The name of the attribute to retrieve.
255
+ * @param {AnsiLogger} [log] - Optional logger for error and info messages.
256
+ * @returns {any} The value of the attribute, or undefined if the attribute is not found.
257
+ */
258
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
170
259
  getAttribute(cluster, attribute, log) {
171
260
  return getAttribute(this, cluster, attribute, log);
172
261
  }
262
+ /**
263
+ * Sets the value of an attribute on a cluster server.
264
+ *
265
+ * @param {Behavior.Type | ClusterType | ClusterId | string} clusterId - The ID of the cluster.
266
+ * @param {string} attribute - The name of the attribute.
267
+ * @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
268
+ * @param {AnsiLogger} [log] - (Optional) The logger to use for logging errors and information.
269
+ * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
270
+ */
173
271
  async setAttribute(clusterId, attribute, value, log) {
174
272
  return await setAttribute(this, clusterId, attribute, value, log);
175
273
  }
274
+ /**
275
+ * Update the value of an attribute on a cluster server only if the value is different.
276
+ *
277
+ * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to set the attribute on.
278
+ * @param {string} attribute - The name of the attribute.
279
+ * @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
280
+ * @param {AnsiLogger} [log] - (Optional) The logger to use for logging the update. Errors are logged to the endpoint logger.
281
+ * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
282
+ */
176
283
  async updateAttribute(cluster, attribute, value, log) {
177
284
  return await updateAttribute(this, cluster, attribute, value, log);
178
285
  }
286
+ /**
287
+ * Subscribes to the provided attribute on a cluster.
288
+ *
289
+ * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to subscribe the attribute to.
290
+ * @param {string} attribute - The name of the attribute to subscribe to.
291
+ * @param {(newValue: any, oldValue: any) => void} listener - A callback function that will be called when the attribute value changes.
292
+ * @param {AnsiLogger} [log] - Optional logger for logging errors and information.
293
+ * @returns {Promise<boolean>} - A boolean indicating whether the subscription was successful.
294
+ */
295
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
179
296
  async subscribeAttribute(cluster, attribute, listener, log) {
180
297
  return await subscribeAttribute(this, cluster, attribute, listener, log);
181
298
  }
299
+ /**
300
+ * Triggers an event on the specified cluster.
301
+ *
302
+ * @param {ClusterId} clusterId - The ID of the cluster.
303
+ * @param {string} event - The name of the event to trigger.
304
+ * @param {Record<string, boolean | number | bigint | string | object | undefined | null>} payload - The payload to pass to the event.
305
+ * @param {AnsiLogger} [log] - Optional logger for logging information.
306
+ * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the event was successfully triggered.
307
+ */
182
308
  async triggerEvent(clusterId, event, payload, log) {
183
309
  const clusterName = lowercaseFirstLetter(getClusterNameById(clusterId));
184
310
  if (this.construction.status !== Lifecycle.Status.Active) {
185
311
  this.log.error(`triggerEvent ${hk}${clusterName}.${event}${er} error: Endpoint ${or}${this.maybeId}${er}:${or}${this.maybeNumber}${er} is in the ${BLUE}${this.construction.status}${er} state`);
186
312
  return false;
187
313
  }
314
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
188
315
  const events = this.events;
189
316
  if (!(clusterName in events) || !(event in events[clusterName])) {
190
317
  this.log.error(`triggerEvent ${hk}${event}${er} error: Cluster ${'0x' + clusterId.toString(16).padStart(4, '0')}:${clusterName} not found on endpoint ${or}${this.id}${er}:${or}${this.number}${er}`);
191
318
  return false;
192
319
  }
320
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
321
+ // @ts-ignore
193
322
  await this.act((agent) => agent[clusterName].events[event].emit(payload, agent.context));
194
323
  log?.info(`${db}Trigger event ${hk}${capitalizeFirstLetter(clusterName)}${db}.${hk}${event}${db} with ${debugStringify(payload)}${db} on endpoint ${or}${this.id}${db}:${or}${this.number}${db} `);
195
324
  return true;
196
325
  }
326
+ /**
327
+ * Adds cluster servers from the provided server list.
328
+ *
329
+ * @param {ClusterId[]} serverList - The list of cluster IDs to add.
330
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
331
+ */
197
332
  addClusterServers(serverList) {
198
333
  addClusterServers(this, serverList);
199
334
  return this;
200
335
  }
336
+ /**
337
+ * Adds a fixed label to the FixedLabel cluster. If the cluster server is not present, it will be added.
338
+ *
339
+ * @param {string} label - The label to add.
340
+ * @param {string} value - The value of the label.
341
+ * @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
342
+ */
201
343
  async addFixedLabel(label, value) {
202
344
  await addFixedLabel(this, label, value);
203
345
  return this;
204
346
  }
347
+ /**
348
+ * Adds a user label to the UserLabel cluster. If the cluster server is not present, it will be added.
349
+ *
350
+ * @param {string} label - The label to add.
351
+ * @param {string} value - The value of the label.
352
+ * @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
353
+ */
205
354
  async addUserLabel(label, value) {
206
355
  await addUserLabel(this, label, value);
207
356
  return this;
208
357
  }
358
+ /**
359
+ * Adds a command handler for the specified command.
360
+ *
361
+ * @param {keyof MatterbridgeEndpointCommands} command - The command to add the handler for.
362
+ * @param {HandlerFunction} handler - The handler function to execute when the command is received.
363
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
364
+ */
209
365
  addCommandHandler(command, handler) {
210
366
  this.commandHandler.addHandler(command, handler);
211
367
  return this;
212
368
  }
369
+ /**
370
+ * Execute the command handler for the specified command. Mainly used in Jest tests.
371
+ *
372
+ * @param {keyof MatterbridgeEndpointCommands} command - The command to execute.
373
+ * @param {Record<string, boolean | number | bigint | string | object | null>} request - The optional request to pass to the handler function.
374
+ * @returns {Promise<void>} A promise that resolves when the command handler has been executed
375
+ */
213
376
  async executeCommandHandler(command, request) {
214
377
  await this.commandHandler.executeHandler(command, { request });
215
378
  }
379
+ /**
380
+ * Adds the required cluster servers (only if they are not present) for the device types of the specified endpoint.
381
+ *
382
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
383
+ */
216
384
  addRequiredClusterServers() {
217
385
  addRequiredClusterServers(this);
218
386
  return this;
219
387
  }
388
+ /**
389
+ * Adds the optional cluster servers (only if they are not present) for the device types of the specified endpoint.
390
+ *
391
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
392
+ */
220
393
  addOptionalClusterServers() {
221
394
  addOptionalClusterServers(this);
222
395
  return this;
223
396
  }
397
+ /**
398
+ * Retrieves all cluster servers.
399
+ *
400
+ * @returns {Behavior.Type[]} An array of all cluster servers.
401
+ */
224
402
  getAllClusterServers() {
225
403
  return Object.values(this.behaviors.supported);
226
404
  }
405
+ /**
406
+ * Retrieves the names of all cluster servers.
407
+ *
408
+ * @returns {string[]} An array of all cluster server names.
409
+ */
227
410
  getAllClusterServerNames() {
228
411
  return Object.keys(this.behaviors.supported);
229
412
  }
413
+ /**
414
+ * Iterates over each attribute of each cluster server of the device state and calls the provided callback function.
415
+ *
416
+ * @param {Function} callback - The callback function to call with the cluster name, cluster id, attribute name, attribute id and attribute value.
417
+ */
230
418
  forEachAttribute(callback) {
231
419
  if (!this.lifecycle.isReady || this.construction.status !== Lifecycle.Status.Active)
232
420
  return;
@@ -234,16 +422,34 @@ export class MatterbridgeEndpoint extends Endpoint {
234
422
  for (const [attributeName, attributeValue] of Object.entries(clusterAttributes)) {
235
423
  const clusterId = getClusterId(this, clusterName);
236
424
  if (clusterId === undefined) {
425
+ // this.log.error(`forEachAttribute error: cluster ${clusterName} not found`);
237
426
  continue;
238
427
  }
239
428
  const attributeId = getAttributeId(this, clusterName, attributeName);
240
429
  if (attributeId === undefined) {
430
+ // this.log.error(`forEachAttribute error: attribute ${clusterName}.${attributeName} not found`);
241
431
  continue;
242
432
  }
243
433
  callback(clusterName, clusterId, attributeName, attributeId, attributeValue);
244
434
  }
245
435
  }
246
436
  }
437
+ /**
438
+ * Adds a child endpoint with the specified device types and options.
439
+ * If the child endpoint is not already present, it will be created and added.
440
+ * If the child endpoint is already present, the existing child endpoint will be returned.
441
+ *
442
+ * @param {string} endpointName - The name of the new endpoint to add.
443
+ * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
444
+ * @param {MatterbridgeEndpointOptions} [options={}] - The options for the endpoint.
445
+ * @param {boolean} [debug=false] - Whether to enable debug logging.
446
+ * @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
447
+ *
448
+ * @example
449
+ * ```typescript
450
+ * const endpoint = device.addChildDeviceType('Temperature', [temperatureSensor], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
451
+ * ```
452
+ */
247
453
  addChildDeviceType(endpointName, definition, options = {}, debug = false) {
248
454
  this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
249
455
  let alreadyAdded = false;
@@ -283,6 +489,23 @@ export class MatterbridgeEndpoint extends Endpoint {
283
489
  }
284
490
  return child;
285
491
  }
492
+ /**
493
+ * Adds a child endpoint with one or more device types with the required cluster servers and the specified cluster servers.
494
+ * If the child endpoint is not already present in the childEndpoints, it will be added.
495
+ * If the child endpoint is already present in the childEndpoints, the device types and cluster servers will be added to the existing child endpoint.
496
+ *
497
+ * @param {string} endpointName - The name of the new enpoint to add.
498
+ * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
499
+ * @param {ClusterId[]} [serverList=[]] - The list of cluster IDs to include.
500
+ * @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
501
+ * @param {boolean} [debug=false] - Whether to enable debug logging.
502
+ * @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
503
+ *
504
+ * @example
505
+ * ```typescript
506
+ * const endpoint = device.addChildDeviceTypeWithClusterServer('Temperature', [temperatureSensor], [], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
507
+ * ```
508
+ */
286
509
  addChildDeviceTypeWithClusterServer(endpointName, definition, serverList = [], options = {}, debug = false) {
287
510
  this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
288
511
  let alreadyAdded = false;
@@ -345,15 +568,38 @@ export class MatterbridgeEndpoint extends Endpoint {
345
568
  }
346
569
  return child;
347
570
  }
571
+ /**
572
+ * Retrieves a child endpoint by its name.
573
+ *
574
+ * @param {string} endpointName - The name of the endpoint to retrieve.
575
+ * @returns {Endpoint | undefined} The child endpoint with the specified name, or undefined if not found.
576
+ */
348
577
  getChildEndpointByName(endpointName) {
349
578
  return this.parts.find((part) => part.id === endpointName);
350
579
  }
580
+ /**
581
+ * Retrieves a child endpoint by its EndpointNumber.
582
+ *
583
+ * @param {EndpointNumber} endpointNumber - The EndpointNumber of the endpoint to retrieve.
584
+ * @returns {MatterbridgeEndpoint | undefined} The child endpoint with the specified EndpointNumber, or undefined if not found.
585
+ */
351
586
  getChildEndpoint(endpointNumber) {
352
587
  return this.parts.find((part) => part.number === endpointNumber);
353
588
  }
589
+ /**
590
+ * Get all the child endpoints of this endpoint.
591
+ *
592
+ * @returns {MatterbridgeEndpoint[]} The child endpoints.
593
+ */
354
594
  getChildEndpoints() {
355
595
  return Array.from(this.parts);
356
596
  }
597
+ /**
598
+ * Serializes the Matterbridge device into a serialized object.
599
+ *
600
+ * @param pluginName - The name of the plugin.
601
+ * @returns The serialized Matterbridge device object.
602
+ */
357
603
  static serialize(device) {
358
604
  if (!device.serialNumber || !device.deviceName || !device.uniqueId)
359
605
  return;
@@ -376,9 +622,15 @@ export class MatterbridgeEndpoint extends Endpoint {
376
622
  serialized.clusterServersId.push(BridgedDeviceBasicInformation.Cluster.id);
377
623
  if (behaviorName === 'powerSource')
378
624
  serialized.clusterServersId.push(PowerSource.Cluster.id);
625
+ // serialized.clusterServersId.push(this.behaviors.supported[behaviorName]cluster.id);
379
626
  });
380
627
  return serialized;
381
628
  }
629
+ /**
630
+ * Deserializes the device into a serialized object.
631
+ *
632
+ * @returns The deserialized MatterbridgeDevice.
633
+ */
382
634
  static deserialize(serializedDevice) {
383
635
  const device = new MatterbridgeEndpoint(serializedDevice.deviceTypes, { uniqueStorageKey: serializedDevice.endpointName, endpointId: serializedDevice.endpoint }, false);
384
636
  device.plugin = serializedDevice.pluginName;
@@ -394,9 +646,16 @@ export class MatterbridgeEndpoint extends Endpoint {
394
646
  device.createDefaultBridgedDeviceBasicInformationClusterServer(serializedDevice.deviceName, serializedDevice.serialNumber, serializedDevice.vendorId ?? 0xfff1, serializedDevice.vendorName ?? 'Matterbridge', serializedDevice.productName ?? 'Matterbridge device');
395
647
  else if (clusterId === PowerSource.Cluster.id)
396
648
  device.createDefaultPowerSourceWiredClusterServer();
649
+ // else addClusterServerFromList(device, [clusterId]);
397
650
  }
398
651
  return device;
399
652
  }
653
+ /**
654
+ * Creates a default power source wired cluster server.
655
+ *
656
+ * @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
657
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
658
+ */
400
659
  createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
401
660
  this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Wired), {
402
661
  wiredCurrentType,
@@ -407,6 +666,16 @@ export class MatterbridgeEndpoint extends Endpoint {
407
666
  });
408
667
  return this;
409
668
  }
669
+ /**
670
+ * Creates a default power source replaceable battery cluster server.
671
+ *
672
+ * @param batPercentRemaining - The remaining battery percentage (default: 100).
673
+ * @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
674
+ * @param batVoltage - The battery voltage (default: 1500).
675
+ * @param batReplacementDescription - The battery replacement description (default: 'Battery type').
676
+ * @param batQuantity - The battery quantity (default: 1).
677
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
678
+ */
410
679
  createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
411
680
  this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
412
681
  status: PowerSource.PowerSourceStatus.Active,
@@ -424,6 +693,14 @@ export class MatterbridgeEndpoint extends Endpoint {
424
693
  });
425
694
  return this;
426
695
  }
696
+ /**
697
+ * Creates a default power source rechargeable battery cluster server.
698
+ *
699
+ * @param batPercentRemaining - The remaining battery percentage (default: 100).
700
+ * @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
701
+ * @param batVoltage - The battery voltage (default: 1500).
702
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
703
+ */
427
704
  createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
428
705
  this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
429
706
  status: PowerSource.PowerSourceStatus.Active,
@@ -442,6 +719,21 @@ export class MatterbridgeEndpoint extends Endpoint {
442
719
  });
443
720
  return this;
444
721
  }
722
+ /**
723
+ * Creates a default Basic Information Cluster Server for the server node.
724
+ *
725
+ * @param deviceName - The name of the device.
726
+ * @param serialNumber - The serial number of the device.
727
+ * @param vendorId - The vendor ID of the device.
728
+ * @param vendorName - The vendor name of the device.
729
+ * @param productId - The product ID of the device.
730
+ * @param productName - The product name of the device.
731
+ * @param softwareVersion - The software version of the device. Default is 1.
732
+ * @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
733
+ * @param hardwareVersion - The hardware version of the device. Default is 1.
734
+ * @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
735
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
736
+ */
445
737
  createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
446
738
  this.log.logName = deviceName;
447
739
  this.deviceName = deviceName;
@@ -465,6 +757,20 @@ export class MatterbridgeEndpoint extends Endpoint {
465
757
  }
466
758
  return this;
467
759
  }
760
+ /**
761
+ * Creates a default BridgedDeviceBasicInformationClusterServer for the aggregator endpoints.
762
+ *
763
+ * @param deviceName - The name of the device.
764
+ * @param serialNumber - The serial number of the device.
765
+ * @param vendorId - The vendor ID of the device.
766
+ * @param vendorName - The name of the vendor.
767
+ * @param productName - The name of the product.
768
+ * @param softwareVersion - The software version of the device. Default is 1.
769
+ * @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
770
+ * @param hardwareVersion - The hardware version of the device. Default is 1.
771
+ * @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
772
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
773
+ */
468
774
  createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
469
775
  this.log.logName = deviceName;
470
776
  this.deviceName = deviceName;
@@ -481,7 +787,7 @@ export class MatterbridgeEndpoint extends Endpoint {
481
787
  this.behaviors.require(BridgedDeviceBasicInformationServer.enable({
482
788
  events: { leave: true, reachableChanged: true },
483
789
  }), {
484
- vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
790
+ vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined, // 4874
485
791
  vendorName: vendorName.slice(0, 32),
486
792
  productName: productName.slice(0, 32),
487
793
  productUrl: this.productUrl,
@@ -497,6 +803,13 @@ export class MatterbridgeEndpoint extends Endpoint {
497
803
  });
498
804
  return this;
499
805
  }
806
+ /**
807
+ * Creates a default identify cluster server with the specified identify time and type.
808
+ *
809
+ * @param {number} [identifyTime=0] - The time to identify the server. Defaults to 0.
810
+ * @param {Identify.IdentifyType} [identifyType=Identify.IdentifyType.None] - The type of identification. Defaults to Identify.IdentifyType.None.
811
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
812
+ */
500
813
  createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
501
814
  this.behaviors.require(MatterbridgeIdentifyServer, {
502
815
  identifyTime,
@@ -504,14 +817,32 @@ export class MatterbridgeEndpoint extends Endpoint {
504
817
  });
505
818
  return this;
506
819
  }
820
+ /**
821
+ * Creates a default groups cluster server.
822
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
823
+ */
507
824
  createDefaultGroupsClusterServer() {
508
825
  this.behaviors.require(GroupsServer);
509
826
  return this;
510
827
  }
828
+ /**
829
+ * Creates a default scenes management cluster server.
830
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
831
+ */
511
832
  createDefaultScenesClusterServer() {
512
833
  this.behaviors.require(ScenesManagementServer);
513
834
  return this;
514
835
  }
836
+ /**
837
+ * Creates a default OnOff cluster server for light devices.
838
+ *
839
+ * @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
840
+ * @param {boolean} [globalSceneControl=false] - The global scene control state.
841
+ * @param {number} [onTime=0] - The on time value.
842
+ * @param {number} [offWaitTime=0] - The off wait time value.
843
+ * @param {OnOff.StartUpOnOff | null} [startUpOnOff=null] - The start-up OnOff state. Null means previous state.
844
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
845
+ */
515
846
  createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
516
847
  this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.Lighting), {
517
848
  onOff,
@@ -522,24 +853,52 @@ export class MatterbridgeEndpoint extends Endpoint {
522
853
  });
523
854
  return this;
524
855
  }
856
+ /**
857
+ * Creates an OnOff cluster server without features.
858
+ *
859
+ * @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
860
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
861
+ */
525
862
  createOnOffClusterServer(onOff = false) {
526
863
  this.behaviors.require(MatterbridgeOnOffServer, {
527
864
  onOff,
528
865
  });
529
866
  return this;
530
867
  }
868
+ /**
869
+ * Creates a DeadFront OnOff cluster server.
870
+ *
871
+ * @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
872
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
873
+ */
531
874
  createDeadFrontOnOffClusterServer(onOff = false) {
532
875
  this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.DeadFrontBehavior), {
533
876
  onOff,
534
877
  });
535
878
  return this;
536
879
  }
880
+ /**
881
+ * Creates an OffOnly OnOff cluster server.
882
+ *
883
+ * @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
884
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
885
+ */
537
886
  createOffOnlyOnOffClusterServer(onOff = false) {
538
887
  this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.OffOnly), {
539
888
  onOff,
540
889
  });
541
890
  return this;
542
891
  }
892
+ /**
893
+ * Creates a default level control cluster server for light devices.
894
+ *
895
+ * @param {number} [currentLevel=254] - The current level (default: 254).
896
+ * @param {number} [minLevel=1] - The minimum level (default: 1).
897
+ * @param {number} [maxLevel=254] - The maximum level (default: 254).
898
+ * @param {number | null} [onLevel=null] - The on level (default: null).
899
+ * @param {number | null} [startUpCurrentLevel=null] - The startUp on level (default: null).
900
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
901
+ */
543
902
  createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
544
903
  this.behaviors.require(MatterbridgeLevelControlServer.with(LevelControl.Feature.OnOff, LevelControl.Feature.Lighting), {
545
904
  currentLevel,
@@ -555,6 +914,13 @@ export class MatterbridgeEndpoint extends Endpoint {
555
914
  });
556
915
  return this;
557
916
  }
917
+ /**
918
+ * Creates a level control cluster server without features.
919
+ *
920
+ * @param {number} [currentLevel=254] - The current level (default: 254).
921
+ * @param {number | null} [onLevel=null] - The on level (default: null).
922
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
923
+ */
558
924
  createLevelControlClusterServer(currentLevel = 254, onLevel = null) {
559
925
  this.behaviors.require(MatterbridgeLevelControlServer, {
560
926
  currentLevel,
@@ -566,6 +932,18 @@ export class MatterbridgeEndpoint extends Endpoint {
566
932
  });
567
933
  return this;
568
934
  }
935
+ /**
936
+ * Creates a default color control cluster server with Xy, HueSaturation and ColorTemperature.
937
+ *
938
+ * @param currentX - The current X value.
939
+ * @param currentY - The current Y value.
940
+ * @param currentHue - The current hue value.
941
+ * @param currentSaturation - The current saturation value.
942
+ * @param colorTemperatureMireds - The color temperature in mireds.
943
+ * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
944
+ * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
945
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
946
+ */
569
947
  createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
570
948
  this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
571
949
  colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
@@ -588,6 +966,19 @@ export class MatterbridgeEndpoint extends Endpoint {
588
966
  });
589
967
  return this;
590
968
  }
969
+ /**
970
+ * Creates a Xy color control cluster server with Xy and ColorTemperature.
971
+ *
972
+ * @param currentX - The current X value.
973
+ * @param currentY - The current Y value.
974
+ * @param colorTemperatureMireds - The color temperature in mireds.
975
+ * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
976
+ * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
977
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
978
+ *
979
+ * @remarks
980
+ * From zigbee to matter = Math.max(Math.min(Math.round(x * 65536), 65279), 0)
981
+ */
591
982
  createXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
592
983
  this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature), {
593
984
  colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
@@ -608,6 +999,16 @@ export class MatterbridgeEndpoint extends Endpoint {
608
999
  });
609
1000
  return this;
610
1001
  }
1002
+ /**
1003
+ * Creates a default hue and saturation control cluster server with HueSaturation and ColorTemperature.
1004
+ *
1005
+ * @param currentHue - The current hue value.
1006
+ * @param currentSaturation - The current saturation value.
1007
+ * @param colorTemperatureMireds - The color temperature in mireds.
1008
+ * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1009
+ * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1010
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1011
+ */
611
1012
  createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
612
1013
  this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
613
1014
  colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
@@ -628,6 +1029,14 @@ export class MatterbridgeEndpoint extends Endpoint {
628
1029
  });
629
1030
  return this;
630
1031
  }
1032
+ /**
1033
+ * Creates a color temperature color control cluster server.
1034
+ *
1035
+ * @param colorTemperatureMireds - The color temperature in mireds.
1036
+ * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1037
+ * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1038
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1039
+ */
631
1040
  createCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
632
1041
  this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.ColorTemperature), {
633
1042
  colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
@@ -646,12 +1055,23 @@ export class MatterbridgeEndpoint extends Endpoint {
646
1055
  });
647
1056
  return this;
648
1057
  }
1058
+ /**
1059
+ * Configures the color control mode for the device.
1060
+ *
1061
+ * @param {ColorControl.ColorMode} colorMode - The color mode to set.
1062
+ */
649
1063
  async configureColorControlMode(colorMode) {
650
1064
  if (isValidNumber(colorMode, ColorControl.ColorMode.CurrentHueAndCurrentSaturation, ColorControl.ColorMode.ColorTemperatureMireds)) {
651
1065
  await this.setAttribute(ColorControl.Cluster.id, 'colorMode', colorMode, this.log);
652
1066
  await this.setAttribute(ColorControl.Cluster.id, 'enhancedColorMode', colorMode, this.log);
653
1067
  }
654
1068
  }
1069
+ /**
1070
+ * Creates a default window covering cluster server (Lift and PositionAwareLift).
1071
+ *
1072
+ * @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
1073
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1074
+ */
655
1075
  createDefaultWindowCoveringClusterServer(positionPercent100ths) {
656
1076
  this.behaviors.require(MatterbridgeWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
657
1077
  type: WindowCovering.WindowCoveringType.Rollershade,
@@ -667,11 +1087,15 @@ export class MatterbridgeEndpoint extends Endpoint {
667
1087
  operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
668
1088
  endProductType: WindowCovering.EndProductType.RollerShade,
669
1089
  mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
670
- targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
671
- currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
1090
+ targetPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
1091
+ currentPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
672
1092
  });
673
1093
  return this;
674
1094
  }
1095
+ /**
1096
+ * Sets the window covering target position as the current position and stops the movement.
1097
+ *
1098
+ */
675
1099
  async setWindowCoveringTargetAsCurrentAndStopped() {
676
1100
  const position = this.getAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', this.log);
677
1101
  if (isValidNumber(position, 0, 10000)) {
@@ -684,6 +1108,12 @@ export class MatterbridgeEndpoint extends Endpoint {
684
1108
  }
685
1109
  this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths and targetPositionLiftPercent100ths to ${position} and operationalStatus to Stopped.`);
686
1110
  }
1111
+ /**
1112
+ * Sets the current and target status of a window covering.
1113
+ * @param {number} current - The current position of the window covering.
1114
+ * @param {number} target - The target position of the window covering.
1115
+ * @param {WindowCovering.MovementStatus} status - The movement status of the window covering.
1116
+ */
687
1117
  async setWindowCoveringCurrentTargetStatus(current, target, status) {
688
1118
  await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', current, this.log);
689
1119
  await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', target, this.log);
@@ -694,6 +1124,10 @@ export class MatterbridgeEndpoint extends Endpoint {
694
1124
  }, this.log);
695
1125
  this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
696
1126
  }
1127
+ /**
1128
+ * Sets the status of the window covering.
1129
+ * @param {WindowCovering.MovementStatus} status - The movement status to set.
1130
+ */
697
1131
  async setWindowCoveringStatus(status) {
698
1132
  await this.setAttribute(WindowCovering.Cluster.id, 'operationalStatus', {
699
1133
  global: status,
@@ -702,6 +1136,11 @@ export class MatterbridgeEndpoint extends Endpoint {
702
1136
  }, this.log);
703
1137
  this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
704
1138
  }
1139
+ /**
1140
+ * Retrieves the status of the window covering.
1141
+ *
1142
+ * @returns The global operational status of the window covering or undefined.
1143
+ */
705
1144
  getWindowCoveringStatus() {
706
1145
  const status = this.getAttribute(WindowCovering.Cluster.id, 'operationalStatus', this.log);
707
1146
  if (isValidObject(status, 3) && 'global' in status && typeof status.global === 'number') {
@@ -709,36 +1148,66 @@ export class MatterbridgeEndpoint extends Endpoint {
709
1148
  return status.global;
710
1149
  }
711
1150
  }
1151
+ /**
1152
+ * Sets the target and current position of the window covering.
1153
+ *
1154
+ * @param position - The position to set, specified as a number.
1155
+ */
712
1156
  async setWindowCoveringTargetAndCurrentPosition(position) {
713
1157
  await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', position, this.log);
714
1158
  await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', position, this.log);
715
1159
  this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${position} and targetPositionLiftPercent100ths: ${position}.`);
716
1160
  }
1161
+ /**
1162
+ * Creates a default thermostat cluster server with Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode.
1163
+ *
1164
+ * @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
1165
+ * @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
1166
+ * @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
1167
+ * @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
1168
+ * @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
1169
+ * @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
1170
+ * @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
1171
+ * @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
1172
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1173
+ */
717
1174
  createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
718
1175
  this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
719
1176
  localTemperature: localTemperature * 100,
720
1177
  systemMode: Thermostat.SystemMode.Auto,
721
1178
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
1179
+ // Thermostat.Feature.Heating
722
1180
  occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
723
1181
  minHeatSetpointLimit: minHeatSetpointLimit * 100,
724
1182
  maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
725
1183
  absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
726
1184
  absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
1185
+ // Thermostat.Feature.Cooling
727
1186
  occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
728
1187
  minCoolSetpointLimit: minCoolSetpointLimit * 100,
729
1188
  maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
730
1189
  absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
731
1190
  absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
1191
+ // Thermostat.Feature.AutoMode
732
1192
  minSetpointDeadBand: minSetpointDeadBand * 100,
733
1193
  thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
734
1194
  });
735
1195
  return this;
736
1196
  }
1197
+ /**
1198
+ * Creates a default heating thermostat cluster server with Thermostat.Feature.Heating.
1199
+ * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
1200
+ * @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
1201
+ * @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
1202
+ * @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
1203
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1204
+ */
737
1205
  createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
738
1206
  this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating), {
739
1207
  localTemperature: localTemperature * 100,
740
1208
  systemMode: Thermostat.SystemMode.Heat,
741
1209
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
1210
+ // Thermostat.Feature.Heating
742
1211
  occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
743
1212
  minHeatSetpointLimit: minHeatSetpointLimit * 100,
744
1213
  maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
@@ -747,11 +1216,20 @@ export class MatterbridgeEndpoint extends Endpoint {
747
1216
  });
748
1217
  return this;
749
1218
  }
1219
+ /**
1220
+ * Creates a default cooling thermostat cluster server with Thermostat.Feature.Cooling.
1221
+ * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
1222
+ * @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
1223
+ * @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
1224
+ * @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
1225
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1226
+ */
750
1227
  createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
751
1228
  this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Cooling), {
752
1229
  localTemperature: localTemperature * 100,
753
1230
  systemMode: Thermostat.SystemMode.Cool,
754
1231
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
1232
+ // Thermostat.Feature.Cooling
755
1233
  occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
756
1234
  minCoolSetpointLimit: minCoolSetpointLimit * 100,
757
1235
  maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
@@ -760,6 +1238,29 @@ export class MatterbridgeEndpoint extends Endpoint {
760
1238
  });
761
1239
  return this;
762
1240
  }
1241
+ /**
1242
+ * Creates a default thermostat user interface configuration cluster server.
1243
+ *
1244
+ * @remarks
1245
+ * The default values are:
1246
+ * - temperatureDisplayMode: ThermostatUserInterfaceConfiguration.TemperatureDisplayMode.Celsius (writeble).
1247
+ * - keypadLockout: ThermostatUserInterfaceConfiguration.KeypadLockout.NoLockout (writeble).
1248
+ * - scheduleProgrammingVisibility: ThermostatUserInterfaceConfiguration.ScheduleProgrammingVisibility.ScheduleProgrammingPermitted (writeble).
1249
+ */
1250
+ createDefaultThermostatUserInterfaceConfigurationClusterServer() {
1251
+ this.behaviors.require(ThermostatUserInterfaceConfigurationServer, {
1252
+ temperatureDisplayMode: ThermostatUserInterfaceConfiguration.TemperatureDisplayMode.Celsius,
1253
+ keypadLockout: ThermostatUserInterfaceConfiguration.KeypadLockout.NoLockout,
1254
+ scheduleProgrammingVisibility: ThermostatUserInterfaceConfiguration.ScheduleProgrammingVisibility.ScheduleProgrammingPermitted,
1255
+ });
1256
+ return this;
1257
+ }
1258
+ /**
1259
+ * Creates a default fan control cluster server.
1260
+ *
1261
+ * @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
1262
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1263
+ */
763
1264
  createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
764
1265
  this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
765
1266
  fanMode,
@@ -772,6 +1273,12 @@ export class MatterbridgeEndpoint extends Endpoint {
772
1273
  });
773
1274
  return this;
774
1275
  }
1276
+ /**
1277
+ * Creates a base fan control cluster server.
1278
+ *
1279
+ * @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
1280
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1281
+ */
775
1282
  createBaseFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
776
1283
  this.behaviors.require(FanControlServer, {
777
1284
  fanMode,
@@ -781,33 +1288,82 @@ export class MatterbridgeEndpoint extends Endpoint {
781
1288
  });
782
1289
  return this;
783
1290
  }
1291
+ /**
1292
+ * Creates a default HEPA Filter Monitoring Cluster Server.
1293
+ * It supports ResourceMonitoring.Feature.Condition and ResourceMonitoring.Feature.ReplacementProductList.
1294
+ *
1295
+ * @param {ResourceMonitoring.ChangeIndication} changeIndication - The initial change indication. Default is ResourceMonitoring.ChangeIndication.Ok.
1296
+ * @param {boolean | undefined} inPlaceIndicator - The in-place indicator. Default is undefined.
1297
+ * @param {number | undefined} lastChangedTime - The last changed time (EpochS). Default is undefined.
1298
+ *
1299
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1300
+ */
784
1301
  createDefaultHepaFilterMonitoringClusterServer(changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = undefined, lastChangedTime = undefined) {
785
- this.behaviors.require(HepaFilterMonitoringServer, {
1302
+ this.behaviors.require(HepaFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.ReplacementProductList), {
1303
+ condition: 100, // Feature.Condition
1304
+ degradationDirection: ResourceMonitoring.DegradationDirection.Down, // Feature.Condition
786
1305
  changeIndication,
787
1306
  inPlaceIndicator,
788
1307
  lastChangedTime,
1308
+ replacementProductList: [], // Feature.ReplacementProductList
789
1309
  });
790
1310
  return this;
791
1311
  }
1312
+ /**
1313
+ * Creates a default Activated Carbon Filter Monitoring Cluster Server.
1314
+ * It supports ResourceMonitoring.Feature.Condition and ResourceMonitoring.Feature.ReplacementProductList.
1315
+ *
1316
+ * @param {ResourceMonitoring.ChangeIndication} changeIndication - The initial change indication. Default is ResourceMonitoring.ChangeIndication.Ok.
1317
+ * @param {boolean | undefined} inPlaceIndicator - The in-place indicator. Default is undefined.
1318
+ * @param {number | undefined} lastChangedTime - The last changed time (EpochS). Default is undefined.
1319
+ *
1320
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1321
+ */
792
1322
  createDefaultActivatedCarbonFilterMonitoringClusterServer(changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = undefined, lastChangedTime = undefined) {
793
- this.behaviors.require(ActivatedCarbonFilterMonitoringServer, {
1323
+ this.behaviors.require(ActivatedCarbonFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.ReplacementProductList), {
1324
+ condition: 100, // Feature.Condition
1325
+ degradationDirection: ResourceMonitoring.DegradationDirection.Down, // Feature.Condition
794
1326
  changeIndication,
795
1327
  inPlaceIndicator,
796
1328
  lastChangedTime,
1329
+ replacementProductList: [], // Feature.ReplacementProductList
797
1330
  });
798
1331
  return this;
799
1332
  }
1333
+ /**
1334
+ * Creates a default door lock cluster server.
1335
+ *
1336
+ * @param {DoorLock.LockState} [lockState=DoorLock.LockState.Locked] - The initial state of the lock (default: Locked).
1337
+ * @param {DoorLock.LockType} [lockType=DoorLock.LockType.DeadBolt] - The type of the lock (default: DeadBolt).
1338
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1339
+ *
1340
+ * @remarks
1341
+ * All operating modes NOT supported by a lock SHALL be set to one. The value of the OperatingMode enumeration defines the related bit to be set.
1342
+ */
800
1343
  createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
801
1344
  this.behaviors.require(MatterbridgeDoorLockServer.enable({ events: { doorLockAlarm: true, lockOperation: true, lockOperationError: true } }), {
802
1345
  lockState,
803
1346
  lockType,
804
1347
  actuatorEnabled: false,
805
1348
  operatingMode: DoorLock.OperatingMode.Normal,
1349
+ // Special case of inverted bitmap: add also alwaysSet = 2047
806
1350
  supportedOperatingModes: { normal: false, vacation: true, privacy: true, noRemoteLockUnlock: true, passage: true, alwaysSet: 2047 },
807
1351
  alarmMask: { lockJammed: false, lockFactoryReset: false, lockRadioPowerCycled: false, wrongCodeEntryLimit: false, frontEscutcheonRemoved: false, doorForcedOpen: false },
808
1352
  });
809
1353
  return this;
810
1354
  }
1355
+ /**
1356
+ * Creates a default Mode Select cluster server.
1357
+ *
1358
+ * @param {string} description - The description of the mode select cluster.
1359
+ * @param {ModeSelect.ModeOption[]} supportedModes - The list of supported modes.
1360
+ * @param {number} [currentMode=0] - The current mode (default: 0).
1361
+ * @param {number} [startUpMode=0] - The startup mode (default: 0).
1362
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1363
+ *
1364
+ * @remarks
1365
+ * endpoint.createDefaultModeSelectClusterServer('Night mode', [{ label: 'Led ON', mode: 0, semanticTags: [] }, { label: 'Led OFF', mode: 1, semanticTags: [] }], 0, 0);
1366
+ */
811
1367
  createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
812
1368
  this.behaviors.require(MatterbridgeModeSelectServer, {
813
1369
  description: description,
@@ -818,6 +1374,13 @@ export class MatterbridgeEndpoint extends Endpoint {
818
1374
  });
819
1375
  return this;
820
1376
  }
1377
+ /**
1378
+ * Creates the default Valve Configuration And Control cluster server.
1379
+ *
1380
+ * @param {ValveConfigurationAndControl.ValveState} [valveState=ValveConfigurationAndControl.ValveState.Closed] - The valve state to set. Defaults to `ValveConfigurationAndControl.ValveState.Closed`.
1381
+ * @param {number} [valveLevel=0] - The valve level to set. Defaults to 0.
1382
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1383
+ */
821
1384
  createDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
822
1385
  this.behaviors.require(MatterbridgeValveConfigurationAndControlServer.with(ValveConfigurationAndControl.Feature.Level), {
823
1386
  currentState: valveState,
@@ -833,6 +1396,12 @@ export class MatterbridgeEndpoint extends Endpoint {
833
1396
  });
834
1397
  return this;
835
1398
  }
1399
+ /**
1400
+ * Creates the default PumpConfigurationAndControl cluster server.
1401
+ *
1402
+ * @param {PumpConfigurationAndControl.OperationMode} [pumpMode=PumpConfigurationAndControl.OperationMode.Normal] - The pump mode to set. Defaults to `PumpConfigurationAndControl.OperationMode.Normal`.
1403
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1404
+ */
836
1405
  createDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
837
1406
  this.behaviors.require(PumpConfigurationAndControlServer.with(PumpConfigurationAndControl.Feature.ConstantSpeed), {
838
1407
  minConstSpeed: null,
@@ -847,6 +1416,13 @@ export class MatterbridgeEndpoint extends Endpoint {
847
1416
  });
848
1417
  return this;
849
1418
  }
1419
+ /**
1420
+ * Creates the default SmokeCOAlarm Cluster Server.
1421
+ *
1422
+ * @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
1423
+ * @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
1424
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1425
+ */
850
1426
  createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
851
1427
  this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm).enable({
852
1428
  events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
@@ -862,6 +1438,12 @@ export class MatterbridgeEndpoint extends Endpoint {
862
1438
  });
863
1439
  return this;
864
1440
  }
1441
+ /**
1442
+ * Creates a smoke only SmokeCOAlarm Cluster Server.
1443
+ *
1444
+ * @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
1445
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1446
+ */
865
1447
  createSmokeOnlySmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal) {
866
1448
  this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm).enable({
867
1449
  events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: false, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
@@ -876,6 +1458,12 @@ export class MatterbridgeEndpoint extends Endpoint {
876
1458
  });
877
1459
  return this;
878
1460
  }
1461
+ /**
1462
+ * Creates a co only SmokeCOAlarm Cluster Server.
1463
+ *
1464
+ * @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
1465
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1466
+ */
879
1467
  createCoOnlySmokeCOAlarmClusterServer(coState = SmokeCoAlarm.AlarmState.Normal) {
880
1468
  this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.CoAlarm).enable({
881
1469
  events: { smokeAlarm: false, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
@@ -890,6 +1478,13 @@ export class MatterbridgeEndpoint extends Endpoint {
890
1478
  });
891
1479
  return this;
892
1480
  }
1481
+ /**
1482
+ * Creates a default momentary switch cluster server.
1483
+ *
1484
+ * @remarks
1485
+ * This method adds a cluster server with default momentary switch features and configuration suitable for (AppleHome) Single Double Long automations.
1486
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1487
+ */
893
1488
  createDefaultSwitchClusterServer() {
894
1489
  this.behaviors.require(MatterbridgeSwitchServer.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress).enable({
895
1490
  events: { initialPress: true, longPress: true, shortRelease: true, longRelease: true, multiPressOngoing: true, multiPressComplete: true },
@@ -900,6 +1495,13 @@ export class MatterbridgeEndpoint extends Endpoint {
900
1495
  });
901
1496
  return this;
902
1497
  }
1498
+ /**
1499
+ * Creates a default latching switch cluster server.
1500
+ *
1501
+ * @remarks
1502
+ * This method adds a cluster server with default latching switch features and configuration suitable for a latching switch with 2 positions.
1503
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1504
+ */
903
1505
  createDefaultLatchingSwitchClusterServer() {
904
1506
  this.behaviors.require(SwitchServer.with(Switch.Feature.LatchingSwitch).enable({
905
1507
  events: { switchLatched: true },
@@ -909,6 +1511,13 @@ export class MatterbridgeEndpoint extends Endpoint {
909
1511
  });
910
1512
  return this;
911
1513
  }
1514
+ /**
1515
+ * Triggers a switch event on the specified endpoint.
1516
+ *
1517
+ * @param {string} event - The type of event to trigger. Possible values are 'Single', 'Double', 'Long' for momentarySwitch and 'Press', 'Release' for latchingSwitch.
1518
+ * @param {Endpoint} endpoint - The endpoint on which to trigger the event (default the device endpoint).
1519
+ * @returns {boolean} - A boolean indicating whether the event was successfully triggered.
1520
+ */
912
1521
  async triggerSwitchEvent(event, log) {
913
1522
  if (this.maybeNumber === undefined) {
914
1523
  this.log.error(`triggerSwitchEvent ${event} error: Endpoint number not assigned on endpoint ${this.maybeId}:${this.maybeNumber}`);
@@ -968,6 +1577,18 @@ export class MatterbridgeEndpoint extends Endpoint {
968
1577
  }
969
1578
  return true;
970
1579
  }
1580
+ /**
1581
+ * Creates a default boolean state cluster server.
1582
+ *
1583
+ * @param {boolean} contact - The state of the cluster. Defaults to true (true = contact).
1584
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1585
+ *
1586
+ * @remarks
1587
+ * Water Leak Detector: true = leak, false = no leak
1588
+ * Water Freeze Detector: true = freeze, false = no freeze
1589
+ * Rain Sensor: true = rain, false = no rain
1590
+ * Contact Sensor: true = closed or contact, false = open or no contact
1591
+ */
971
1592
  createDefaultBooleanStateClusterServer(contact) {
972
1593
  this.behaviors.require(BooleanStateServer.enable({
973
1594
  events: { stateChange: true },
@@ -976,6 +1597,18 @@ export class MatterbridgeEndpoint extends Endpoint {
976
1597
  });
977
1598
  return this;
978
1599
  }
1600
+ /**
1601
+ * Creates a default boolean state configuration cluster server to be used with the waterFreezeDetector, waterLeakDetector, and rainSensor device types.
1602
+ *
1603
+ * @remarks Supports the enableDisableAlarm command.
1604
+ *
1605
+ * @param {boolean} [sensorFault=false] - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
1606
+ * @param {number} [currentSensitivityLevel=0] - The current sensitivity level. Defaults to `0` if not provided.
1607
+ * @param {number} [supportedSensitivityLevels=2] - The number of supported sensitivity levels. Defaults to `2` if not provided (min 2, max 10).
1608
+ * @param {number} [defaultSensitivityLevel=0] - The default sensitivity level. Defaults to `0` if not provided.
1609
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1610
+ *
1611
+ */
979
1612
  createDefaultBooleanStateConfigurationClusterServer(sensorFault = false, currentSensitivityLevel = 0, supportedSensitivityLevels = 2, defaultSensitivityLevel = 0) {
980
1613
  this.behaviors.require(MatterbridgeBooleanStateConfigurationServer.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel).enable({
981
1614
  events: { alarmsStateChanged: true, sensorFault: true },
@@ -990,10 +1623,21 @@ export class MatterbridgeEndpoint extends Endpoint {
990
1623
  });
991
1624
  return this;
992
1625
  }
1626
+ /**
1627
+ * Creates a default Power Topology Cluster Server with feature TreeTopology. Only needed for an electricalSensor device type.
1628
+ *
1629
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1630
+ */
993
1631
  createDefaultPowerTopologyClusterServer() {
994
1632
  this.behaviors.require(PowerTopologyServer.with(PowerTopology.Feature.TreeTopology));
995
1633
  return this;
996
1634
  }
1635
+ /**
1636
+ * Creates a default Electrical Energy Measurement Cluster Server.
1637
+ *
1638
+ * @param {number} energy - The total consumption value in mW/h.
1639
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1640
+ */
997
1641
  createDefaultElectricalEnergyMeasurementClusterServer(energy = null) {
998
1642
  this.behaviors.require(ElectricalEnergyMeasurementServer.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
999
1643
  accuracy: {
@@ -1009,6 +1653,15 @@ export class MatterbridgeEndpoint extends Endpoint {
1009
1653
  });
1010
1654
  return this;
1011
1655
  }
1656
+ /**
1657
+ * Creates a default Electrical Power Measurement Cluster Server.
1658
+ *
1659
+ * @param {number} voltage - The voltage value in millivolts.
1660
+ * @param {number} current - The current value in milliamperes.
1661
+ * @param {number} power - The power value in milliwatts.
1662
+ * @param {number} frequency - The frequency value in millihertz.
1663
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1664
+ */
1012
1665
  createDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
1013
1666
  this.behaviors.require(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
1014
1667
  powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
@@ -1050,36 +1703,113 @@ export class MatterbridgeEndpoint extends Endpoint {
1050
1703
  });
1051
1704
  return this;
1052
1705
  }
1706
+ /**
1707
+ * Creates a default TemperatureMeasurement cluster server.
1708
+ *
1709
+ * @param {number | null} measuredValue - The measured value of the temperature x 100.
1710
+ * @param {number | null} minMeasuredValue - The minimum measured value of the temperature x 100.
1711
+ * @param {number | null} maxMeasuredValue - The maximum measured value of the temperature x 100.
1712
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1713
+ */
1053
1714
  createDefaultTemperatureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
1054
1715
  this.behaviors.require(TemperatureMeasurementServer, getDefaultTemperatureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
1055
1716
  return this;
1056
1717
  }
1718
+ /**
1719
+ * Creates a default RelativeHumidityMeasurement cluster server.
1720
+ *
1721
+ * @param {number | null} measuredValue - The measured value of the relative humidity x 100.
1722
+ * @param {number | null} minMeasuredValue - The minimum measured value of the relative humidity x 100.
1723
+ * @param {number | null} maxMeasuredValue - The maximum measured value of the relative humidity x 100.
1724
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1725
+ */
1057
1726
  createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
1058
1727
  this.behaviors.require(RelativeHumidityMeasurementServer, getDefaultRelativeHumidityMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
1059
1728
  return this;
1060
1729
  }
1730
+ /**
1731
+ * Creates a default PressureMeasurement cluster server.
1732
+ *
1733
+ * @param {number | null} measuredValue - The measured value for the pressure.
1734
+ * @param {number | null} minMeasuredValue - The minimum measured value for the pressure.
1735
+ * @param {number | null} maxMeasuredValue - The maximum measured value for the pressure.
1736
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1737
+ */
1061
1738
  createDefaultPressureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
1062
1739
  this.behaviors.require(PressureMeasurementServer, getDefaultPressureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
1063
1740
  return this;
1064
1741
  }
1742
+ /**
1743
+ * Creates a default IlluminanceMeasurement cluster server.
1744
+ *
1745
+ * @param {number | null} measuredValue - The measured value of illuminance.
1746
+ * @param {number | null} minMeasuredValue - The minimum measured value of illuminance.
1747
+ * @param {number | null} maxMeasuredValue - The maximum measured value of illuminance.
1748
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1749
+ *
1750
+ * @remark The default value for the illuminance measurement is null.
1751
+ * This attribute SHALL indicate the illuminance in Lux (symbol lx) as follows:
1752
+ * • MeasuredValue = 10,000 x log10(illuminance) + 1,
1753
+ * where 1 lx <= illuminance <= 3.576 Mlx, corresponding to a MeasuredValue in the range 1 to 0xFFFE.
1754
+ * • 0 indicates a value of illuminance that is too low to be measured
1755
+ * • null indicates that the illuminance measurement is invalid.
1756
+ *
1757
+ * @remarks
1758
+ * Lux to matter = Math.round(Math.max(Math.min(10000 * Math.log10(lux), 0xfffe), 0))
1759
+ * Matter to Lux = Math.round(Math.max(Math.pow(10, value / 10000), 0))
1760
+ */
1065
1761
  createDefaultIlluminanceMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
1066
1762
  this.behaviors.require(IlluminanceMeasurementServer, getDefaultIlluminanceMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
1067
1763
  return this;
1068
1764
  }
1765
+ /**
1766
+ * Creates a default FlowMeasurement cluster server.
1767
+ *
1768
+ * @param {number | null} measuredValue - The measured value of the flow in 10 x m3/h.
1769
+ * @param {number | null} minMeasuredValue - The minimum measured value of the flow in 10 x m3/h.
1770
+ * @param {number | null} maxMeasuredValue - The maximum measured value of the flow in 10 x m3/h.
1771
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1772
+ */
1069
1773
  createDefaultFlowMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
1070
1774
  this.behaviors.require(FlowMeasurementServer, getDefaultFlowMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
1071
1775
  return this;
1072
1776
  }
1777
+ /**
1778
+ * Creates a default OccupancySensing cluster server.
1779
+ *
1780
+ * @param {boolean} occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
1781
+ * @param {number} holdTime - The hold time in seconds. Default is 30.
1782
+ * @param {number} holdTimeMin - The minimum hold time in seconds. Default is 1.
1783
+ * @param {number} holdTimeMax - The maximum hold time in seconds. Default is 300.
1784
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1785
+ *
1786
+ * @remark The default value for the occupancy sensor type is PIR.
1787
+ */
1073
1788
  createDefaultOccupancySensingClusterServer(occupied = false, holdTime = 30, holdTimeMin = 1, holdTimeMax = 300) {
1074
1789
  this.behaviors.require(OccupancySensingServer.with(OccupancySensing.Feature.PassiveInfrared), getDefaultOccupancySensingClusterServer(occupied, holdTime, holdTimeMin, holdTimeMax));
1075
1790
  return this;
1076
1791
  }
1792
+ /**
1793
+ * Creates a default AirQuality cluster server.
1794
+ *
1795
+ * @param {AirQuality.AirQualityEnum} airQuality The air quality level. Defaults to `AirQuality.AirQualityType.Unknown`.
1796
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1797
+ */
1077
1798
  createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
1078
1799
  this.behaviors.require(AirQualityServer.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
1079
1800
  airQuality,
1080
1801
  });
1081
1802
  return this;
1082
1803
  }
1804
+ /**
1805
+ * Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server.
1806
+ *
1807
+ * @param {number | null} measuredValue - The measured value of the concentration.
1808
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
1809
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1810
+ * @param {number} [uncertainty] - The uncertainty value (optional).
1811
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1812
+ */
1083
1813
  createDefaultTvocMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air, uncertainty) {
1084
1814
  this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1085
1815
  measuredValue,
@@ -1091,6 +1821,11 @@ export class MatterbridgeEndpoint extends Endpoint {
1091
1821
  });
1092
1822
  return this;
1093
1823
  }
1824
+ /**
1825
+ * @param {ConcentrationMeasurement.LevelValue} levelValue - The level value of the measurement (default to ConcentrationMeasurement.LevelValue.Unknown).
1826
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The measurement medium (default to ConcentrationMeasurement.MeasurementMedium.Air).
1827
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1828
+ */
1094
1829
  createLevelTvocMeasurementClusterServer(levelValue = ConcentrationMeasurement.LevelValue.Unknown, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1095
1830
  this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.LevelIndication, ConcentrationMeasurement.Feature.MediumLevel, ConcentrationMeasurement.Feature.CriticalLevel), {
1096
1831
  levelValue,
@@ -1098,6 +1833,13 @@ export class MatterbridgeEndpoint extends Endpoint {
1098
1833
  });
1099
1834
  return this;
1100
1835
  }
1836
+ /**
1837
+ * Create a default CarbonMonoxideConcentrationMeasurement cluster server.
1838
+ *
1839
+ * @param {number | null} measuredValue - The measured value of the concentration.
1840
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
1841
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1842
+ */
1101
1843
  createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1102
1844
  this.behaviors.require(CarbonMonoxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1103
1845
  measuredValue,
@@ -1109,6 +1851,13 @@ export class MatterbridgeEndpoint extends Endpoint {
1109
1851
  });
1110
1852
  return this;
1111
1853
  }
1854
+ /**
1855
+ * Create a default CarbonDioxideConcentrationMeasurement cluster server.
1856
+ *
1857
+ * @param {number | null} measuredValue - The measured value of the concentration.
1858
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
1859
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1860
+ */
1112
1861
  createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1113
1862
  this.behaviors.require(CarbonDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1114
1863
  measuredValue,
@@ -1120,6 +1869,13 @@ export class MatterbridgeEndpoint extends Endpoint {
1120
1869
  });
1121
1870
  return this;
1122
1871
  }
1872
+ /**
1873
+ * Create a default FormaldehydeConcentrationMeasurement cluster server.
1874
+ *
1875
+ * @param {number | null} measuredValue - The measured value of the concentration.
1876
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
1877
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1878
+ */
1123
1879
  createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1124
1880
  this.behaviors.require(FormaldehydeConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1125
1881
  measuredValue,
@@ -1131,6 +1887,13 @@ export class MatterbridgeEndpoint extends Endpoint {
1131
1887
  });
1132
1888
  return this;
1133
1889
  }
1890
+ /**
1891
+ * Create a default Pm1ConcentrationMeasurement cluster server.
1892
+ *
1893
+ * @param {number | null} measuredValue - The measured value of the concentration.
1894
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
1895
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1896
+ */
1134
1897
  createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1135
1898
  this.behaviors.require(Pm1ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1136
1899
  measuredValue,
@@ -1142,6 +1905,13 @@ export class MatterbridgeEndpoint extends Endpoint {
1142
1905
  });
1143
1906
  return this;
1144
1907
  }
1908
+ /**
1909
+ * Create a default Pm25ConcentrationMeasurement cluster server.
1910
+ *
1911
+ * @param {number | null} measuredValue - The measured value of the concentration.
1912
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
1913
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1914
+ */
1145
1915
  createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1146
1916
  this.behaviors.require(Pm25ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1147
1917
  measuredValue,
@@ -1153,6 +1923,13 @@ export class MatterbridgeEndpoint extends Endpoint {
1153
1923
  });
1154
1924
  return this;
1155
1925
  }
1926
+ /**
1927
+ * Create a default Pm10ConcentrationMeasurement cluster server.
1928
+ *
1929
+ * @param {number | null} measuredValue - The measured value of the concentration.
1930
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
1931
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1932
+ */
1156
1933
  createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1157
1934
  this.behaviors.require(Pm10ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1158
1935
  measuredValue,
@@ -1164,6 +1941,13 @@ export class MatterbridgeEndpoint extends Endpoint {
1164
1941
  });
1165
1942
  return this;
1166
1943
  }
1944
+ /**
1945
+ * Create a default OzoneConcentrationMeasurement cluster server.
1946
+ *
1947
+ * @param {number | null} measuredValue - The measured value of the concentration.
1948
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
1949
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1950
+ */
1167
1951
  createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1168
1952
  this.behaviors.require(OzoneConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1169
1953
  measuredValue,
@@ -1175,6 +1959,13 @@ export class MatterbridgeEndpoint extends Endpoint {
1175
1959
  });
1176
1960
  return this;
1177
1961
  }
1962
+ /**
1963
+ * Create a default RadonConcentrationMeasurement cluster server.
1964
+ *
1965
+ * @param {number | null} measuredValue - The measured value of the concentration.
1966
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
1967
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1968
+ */
1178
1969
  createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1179
1970
  this.behaviors.require(RadonConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1180
1971
  measuredValue,
@@ -1186,6 +1977,13 @@ export class MatterbridgeEndpoint extends Endpoint {
1186
1977
  });
1187
1978
  return this;
1188
1979
  }
1980
+ /**
1981
+ * Create a default NitrogenDioxideConcentrationMeasurement cluster server.
1982
+ *
1983
+ * @param {number | null} measuredValue - The measured value of the concentration.
1984
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
1985
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1986
+ */
1189
1987
  createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1190
1988
  this.behaviors.require(NitrogenDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1191
1989
  measuredValue,
@@ -1198,3 +1996,4 @@ export class MatterbridgeEndpoint extends Endpoint {
1198
1996
  return this;
1199
1997
  }
1200
1998
  }
1999
+ //# sourceMappingURL=matterbridgeEndpoint.js.map