matterbridge 1.6.8-dev.9 → 1.7.1

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 (108) hide show
  1. package/CHANGELOG.md +46 -3
  2. package/README-DOCKER.md +8 -6
  3. package/README-EDGE.md +74 -0
  4. package/README-SERVICE.md +3 -3
  5. package/README.md +6 -3
  6. package/dist/cli.d.ts +25 -0
  7. package/dist/cli.d.ts.map +1 -0
  8. package/dist/cli.js +26 -0
  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 +46 -0
  19. package/dist/deviceManager.d.ts.map +1 -0
  20. package/dist/deviceManager.js +26 -1
  21. package/dist/deviceManager.js.map +1 -0
  22. package/dist/index.d.ts +40 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +30 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/logger/export.d.ts +2 -0
  27. package/dist/logger/export.d.ts.map +1 -0
  28. package/dist/logger/export.js +1 -0
  29. package/dist/logger/export.js.map +1 -0
  30. package/dist/matter/export.d.ts +11 -0
  31. package/dist/matter/export.d.ts.map +1 -0
  32. package/dist/matter/export.js +4 -0
  33. package/dist/matter/export.js.map +1 -0
  34. package/dist/matterbridge.d.ts +483 -0
  35. package/dist/matterbridge.d.ts.map +1 -0
  36. package/dist/matterbridge.js +818 -110
  37. package/dist/matterbridge.js.map +1 -0
  38. package/dist/matterbridgeAccessoryPlatform.d.ts +39 -0
  39. package/dist/matterbridgeAccessoryPlatform.d.ts.map +1 -0
  40. package/dist/matterbridgeAccessoryPlatform.js +33 -0
  41. package/dist/matterbridgeAccessoryPlatform.js.map +1 -0
  42. package/dist/matterbridgeBehaviors.d.ts +942 -0
  43. package/dist/matterbridgeBehaviors.d.ts.map +1 -0
  44. package/dist/matterbridgeBehaviors.js +29 -1
  45. package/dist/matterbridgeBehaviors.js.map +1 -0
  46. package/dist/matterbridgeDevice.d.ts +7077 -0
  47. package/dist/matterbridgeDevice.d.ts.map +1 -0
  48. package/dist/matterbridgeDevice.js +996 -9
  49. package/dist/matterbridgeDevice.js.map +1 -0
  50. package/dist/matterbridgeDeviceTypes.d.ts +109 -0
  51. package/dist/matterbridgeDeviceTypes.d.ts.map +1 -0
  52. package/dist/matterbridgeDeviceTypes.js +82 -11
  53. package/dist/matterbridgeDeviceTypes.js.map +1 -0
  54. package/dist/matterbridgeDynamicPlatform.d.ts +39 -0
  55. package/dist/matterbridgeDynamicPlatform.d.ts.map +1 -0
  56. package/dist/matterbridgeDynamicPlatform.js +33 -0
  57. package/dist/matterbridgeDynamicPlatform.js.map +1 -0
  58. package/dist/matterbridgeEdge.d.ts +91 -0
  59. package/dist/matterbridgeEdge.d.ts.map +1 -0
  60. package/dist/matterbridgeEdge.js +558 -11
  61. package/dist/matterbridgeEdge.js.map +1 -0
  62. package/dist/matterbridgeEndpoint.d.ts +10151 -0
  63. package/dist/matterbridgeEndpoint.d.ts.map +1 -0
  64. package/dist/matterbridgeEndpoint.js +1120 -11
  65. package/dist/matterbridgeEndpoint.js.map +1 -0
  66. package/dist/matterbridgePlatform.d.ts +145 -0
  67. package/dist/matterbridgePlatform.d.ts.map +1 -0
  68. package/dist/matterbridgePlatform.js +127 -4
  69. package/dist/matterbridgePlatform.js.map +1 -0
  70. package/dist/matterbridgeTypes.d.ts +172 -0
  71. package/dist/matterbridgeTypes.d.ts.map +1 -0
  72. package/dist/matterbridgeTypes.js +24 -0
  73. package/dist/matterbridgeTypes.js.map +1 -0
  74. package/dist/matterbridgeWebsocket.d.ts +49 -0
  75. package/dist/matterbridgeWebsocket.d.ts.map +1 -0
  76. package/dist/matterbridgeWebsocket.js +182 -17
  77. package/dist/matterbridgeWebsocket.js.map +1 -0
  78. package/dist/pluginManager.d.ts +238 -0
  79. package/dist/pluginManager.d.ts.map +1 -0
  80. package/dist/pluginManager.js +238 -3
  81. package/dist/pluginManager.js.map +1 -0
  82. package/dist/storage/export.d.ts +2 -0
  83. package/dist/storage/export.d.ts.map +1 -0
  84. package/dist/storage/export.js +1 -0
  85. package/dist/storage/export.js.map +1 -0
  86. package/dist/utils/colorUtils.d.ts +61 -0
  87. package/dist/utils/colorUtils.d.ts.map +1 -0
  88. package/dist/utils/colorUtils.js +205 -2
  89. package/dist/utils/colorUtils.js.map +1 -0
  90. package/dist/utils/export.d.ts +3 -0
  91. package/dist/utils/export.d.ts.map +1 -0
  92. package/dist/utils/export.js +1 -0
  93. package/dist/utils/export.js.map +1 -0
  94. package/dist/utils/utils.d.ts +221 -0
  95. package/dist/utils/utils.d.ts.map +1 -0
  96. package/dist/utils/utils.js +252 -7
  97. package/dist/utils/utils.js.map +1 -0
  98. package/frontend/build/asset-manifest.json +6 -6
  99. package/frontend/build/index.html +1 -1
  100. package/frontend/build/static/css/{main.823e08b6.css → main.b1a621ee.css} +2 -2
  101. package/frontend/build/static/css/main.b1a621ee.css.map +1 -0
  102. package/frontend/build/static/js/{main.4dd7e165.js → main.ecd94d17.js} +15 -15
  103. package/frontend/build/static/js/main.ecd94d17.js.map +1 -0
  104. package/npm-shrinkwrap.json +33 -20
  105. package/package.json +2 -1
  106. package/frontend/build/static/css/main.823e08b6.css.map +0 -1
  107. package/frontend/build/static/js/main.4dd7e165.js.map +0 -1
  108. /package/frontend/build/static/js/{main.4dd7e165.js.LICENSE.txt → main.ecd94d17.js.LICENSE.txt} +0 -0
@@ -1,8 +1,35 @@
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 1.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
+ /* eslint-disable @typescript-eslint/no-unused-vars */
24
+ // Node.js modules
1
25
  import { createHash } from 'crypto';
26
+ // AnsiLogger module
2
27
  import { AnsiLogger, BLUE, CYAN, YELLOW, db, debugStringify, er, hk, or, rs, zb } from 'node-ansi-logger';
28
+ // Matterbridge
3
29
  import { MatterbridgeBehavior, MatterbridgeBehaviorDevice, MatterbridgeBooleanStateConfigurationServer, MatterbridgeColorControlServer, MatterbridgeDoorLockServer, MatterbridgeFanControlServer, MatterbridgeIdentifyServer, MatterbridgeLevelControlServer, MatterbridgeOnOffServer, MatterbridgeThermostatServer, MatterbridgeWindowCoveringServer, } from './matterbridgeBehaviors.js';
4
30
  import { bridgedNode } from './matterbridgeDeviceTypes.js';
5
31
  import { deepCopy, isValidNumber } from './utils/utils.js';
32
+ // @matter
6
33
  import { Endpoint, MutableEndpoint, SupportedBehaviors, NamedHandler, Lifecycle } from '@matter/main';
7
34
  import { EndpointNumber, VendorId } from '@matter/main';
8
35
  import { AirQuality, AirQualityCluster, BasicInformation, BasicInformationCluster, BooleanState, BooleanStateCluster, BooleanStateConfiguration, BooleanStateConfigurationCluster, BridgedDeviceBasicInformation, BridgedDeviceBasicInformationCluster, CarbonDioxideConcentrationMeasurement, CarbonDioxideConcentrationMeasurementCluster, CarbonMonoxideConcentrationMeasurement, CarbonMonoxideConcentrationMeasurementCluster, ColorControl, ColorControlCluster, ConcentrationMeasurement, Descriptor, DoorLock, DoorLockCluster, ElectricalEnergyMeasurement, ElectricalEnergyMeasurementCluster, ElectricalPowerMeasurement, ElectricalPowerMeasurementCluster, FanControl, FanControlCluster, FixedLabel, FixedLabelCluster, FlowMeasurement, FlowMeasurementCluster, FormaldehydeConcentrationMeasurement, FormaldehydeConcentrationMeasurementCluster, Groups, GroupsCluster, Identify, IdentifyCluster, IlluminanceMeasurement, IlluminanceMeasurementCluster, LevelControl, LevelControlCluster, ModeSelect, ModeSelectCluster, NitrogenDioxideConcentrationMeasurement, NitrogenDioxideConcentrationMeasurementCluster, OccupancySensing, OccupancySensingCluster, OnOff, OnOffCluster, OzoneConcentrationMeasurement, OzoneConcentrationMeasurementCluster, Pm10ConcentrationMeasurement, Pm10ConcentrationMeasurementCluster, Pm1ConcentrationMeasurement, Pm1ConcentrationMeasurementCluster, Pm25ConcentrationMeasurement, Pm25ConcentrationMeasurementCluster, PowerSource, PowerSourceCluster, PowerSourceConfigurationCluster, PowerTopology, PowerTopologyCluster, PressureMeasurement, PressureMeasurementCluster, PumpConfigurationAndControl, PumpConfigurationAndControlCluster, RadonConcentrationMeasurement, RadonConcentrationMeasurementCluster, RelativeHumidityMeasurement, RelativeHumidityMeasurementCluster, SmokeCoAlarm, SmokeCoAlarmCluster, Switch, SwitchCluster, TemperatureMeasurement, TemperatureMeasurementCluster, Thermostat, ThermostatCluster, TotalVolatileOrganicCompoundsConcentrationMeasurement, TotalVolatileOrganicCompoundsConcentrationMeasurementCluster, UserLabel, UserLabelCluster, ValveConfigurationAndControl, ValveConfigurationAndControlCluster, WindowCovering, WindowCoveringCluster, } from '@matter/main/clusters';
@@ -23,7 +50,7 @@ import { AirQualityServer, BasicInformationServer, CarbonDioxideConcentrationMea
23
50
  import { ClusterServer, GroupsClusterHandler } from '@project-chip/matter.js/cluster';
24
51
  export class MatterbridgeEndpoint extends Endpoint {
25
52
  static bridgeMode = '';
26
- static logLevel = "info";
53
+ static logLevel = "info" /* LogLevel.INFO */;
27
54
  log;
28
55
  plugin = undefined;
29
56
  configUrl = undefined;
@@ -43,12 +70,20 @@ export class MatterbridgeEndpoint extends Endpoint {
43
70
  uniqueStorageKey = undefined;
44
71
  tagList = undefined;
45
72
  subType = '';
73
+ // Maps matter deviceTypes and endpoints
46
74
  deviceTypes = new Map();
47
75
  clusterServers = new Map();
48
76
  clusterClients = new Map();
49
77
  commandHandler = new NamedHandler();
78
+ /**
79
+ * Represents a MatterbridgeEndpoint.
80
+ * @constructor
81
+ * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the endpoint.
82
+ * @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
83
+ */
50
84
  constructor(definition, options = {}, debug = false) {
51
85
  let deviceTypeList = [];
86
+ // Get the first DeviceTypeDefinition
52
87
  let firstDefinition;
53
88
  if (Array.isArray(definition)) {
54
89
  firstDefinition = definition[0];
@@ -61,6 +96,7 @@ export class MatterbridgeEndpoint extends Endpoint {
61
96
  firstDefinition = definition;
62
97
  deviceTypeList = [{ deviceType: firstDefinition.code, revision: firstDefinition.revision }];
63
98
  }
99
+ // Convert the first DeviceTypeDefinition to an EndpointType.Options
64
100
  const deviceTypeDefinitionV8 = {
65
101
  name: firstDefinition.name.replace('-', '_'),
66
102
  deviceType: firstDefinition.code,
@@ -79,6 +115,7 @@ export class MatterbridgeEndpoint extends Endpoint {
79
115
  behaviors: options.tagList ? SupportedBehaviors(DescriptorServer.with(Descriptor.Feature.TagList)) : {},
80
116
  };
81
117
  const endpointV8 = MutableEndpoint(deviceTypeDefinitionV8);
118
+ // Convert the options to an Endpoint.Options
82
119
  const optionsV8 = {
83
120
  id: options.uniqueStorageKey?.replace(/[ .]/g, ''),
84
121
  number: options.endpointId,
@@ -96,15 +133,27 @@ export class MatterbridgeEndpoint extends Endpoint {
96
133
  }
97
134
  else
98
135
  this.deviceTypes.set(firstDefinition.code, firstDefinition);
99
- this.log = new AnsiLogger({ logName: 'MatterbridgeEndpoint', logTimestampFormat: 4, logLevel: debug === true ? "debug" : MatterbridgeEndpoint.logLevel });
136
+ // console.log('MatterbridgeEndpoint.option', options);
137
+ // console.log('MatterbridgeEndpoint.endpointV8', endpointV8);
138
+ // console.log('MatterbridgeEndpoint.optionsV8', optionsV8);
139
+ // Create the logger
140
+ this.log = new AnsiLogger({ logName: 'MatterbridgeEndpoint', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: debug === true ? "debug" /* LogLevel.DEBUG */ : MatterbridgeEndpoint.logLevel });
100
141
  this.log.debug(`${YELLOW}new${db} MatterbridgeEndpoint: ${zb}${'0x' + firstDefinition.code.toString(16).padStart(4, '0')}${db}-${zb}${firstDefinition.name}${db} ` +
101
142
  `id: ${CYAN}${options.uniqueStorageKey}${db} number: ${CYAN}${options.endpointId}${db} taglist: ${CYAN}${options.tagList ? debugStringify(options.tagList) : 'undefined'}${db}`);
143
+ // Add MatterbridgeBehavior with MatterbridgeBehaviorDevice
102
144
  this.behaviors.require(MatterbridgeBehavior, { deviceCommand: new MatterbridgeBehaviorDevice(this.log, this.commandHandler, undefined) });
103
145
  }
146
+ /**
147
+ * Loads an instance of the MatterbridgeDevice class.
148
+ *
149
+ * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the device.
150
+ * @returns MatterbridgeDevice instance.
151
+ */
104
152
  static async loadInstance(definition, options = {}, debug = false) {
105
153
  return new MatterbridgeEndpoint(definition, options, debug);
106
154
  }
107
155
  static getBehaviourTypesFromClusterServerIds(clusterServerList) {
156
+ // Map Server ClusterId to Behavior.Type
108
157
  const behaviorTypes = [];
109
158
  clusterServerList.forEach((clusterId) => {
110
159
  behaviorTypes.push(MatterbridgeEndpoint.getBehaviourTypeFromClusterServerId(clusterId));
@@ -112,12 +161,15 @@ export class MatterbridgeEndpoint extends Endpoint {
112
161
  return behaviorTypes;
113
162
  }
114
163
  static getBehaviourTypesFromClusterClientIds(clusterClientList) {
164
+ // Map Client ClusterId to Behavior.Type
115
165
  const behaviorTypes = [];
116
166
  clusterClientList.forEach((clusterId) => {
167
+ // behaviorTypes.push(MatterbridgeEndpoint.getBehaviourTypeFromClusterClientId(clusterId));
117
168
  });
118
169
  return behaviorTypes;
119
170
  }
120
171
  static getBehaviourTypeFromClusterServerId(clusterId, subType) {
172
+ // Map ClusterId to Behavior.Type
121
173
  if (clusterId === Identify.Cluster.id)
122
174
  return MatterbridgeIdentifyServer;
123
175
  if (clusterId === Groups.Cluster.id)
@@ -229,12 +281,21 @@ export class MatterbridgeEndpoint extends Endpoint {
229
281
  return MatterbridgeIdentifyServer;
230
282
  }
231
283
  static getBehaviourTypeFromClusterClientId(clusterId) {
284
+ // Map ClusterId to Behavior.Type
232
285
  return IdentifyBehavior;
233
286
  }
287
+ /**
288
+ * Adds a device type to the list of device types.
289
+ * If the device type is not already present in the list, it will be added.
290
+ *
291
+ * @param {DeviceTypeDefinition} deviceType - The device type to add.
292
+ */
234
293
  addDeviceType(deviceType) {
235
294
  if (!this.deviceTypes.has(deviceType.code)) {
295
+ // Keep the Matterbridge internal map
236
296
  this.log.debug(`addDeviceType: ${zb}${'0x' + deviceType.code.toString(16).padStart(4, '0')}${db}-${zb}${deviceType.name}${db}`);
237
297
  this.deviceTypes.set(deviceType.code, deviceType);
298
+ // Add the device types to the descriptor server
238
299
  const deviceTypeList = Array.from(this.deviceTypes.values()).map((dt) => ({
239
300
  deviceType: dt.code,
240
301
  revision: dt.revision,
@@ -252,6 +313,12 @@ export class MatterbridgeEndpoint extends Endpoint {
252
313
  }
253
314
  }
254
315
  }
316
+ /**
317
+ * Adds one or more device types with the required cluster servers and the specified cluster servers.
318
+ *
319
+ * @param {AtLeastOne<DeviceTypeDefinition>} deviceTypes - The device types to add.
320
+ * @param {ClusterId[]} includeServerList - The list of cluster IDs to include.
321
+ */
255
322
  addDeviceTypeWithClusterServer(deviceTypes, includeServerList) {
256
323
  this.log.debug('addDeviceTypeWithClusterServer:');
257
324
  deviceTypes.forEach((deviceType) => {
@@ -274,6 +341,12 @@ export class MatterbridgeEndpoint extends Endpoint {
274
341
  });
275
342
  this.addClusterServerFromList(this, includeServerList);
276
343
  }
344
+ /**
345
+ * Adds the required cluster servers (only if they are not present) for the device types of the specified endpoint.
346
+ *
347
+ * @param {MatterbridgeEndpoint} endpoint - The endpoint to add the required cluster servers to.
348
+ * @returns {MatterbridgeEndpoint} The updated endpoint with the required cluster servers added.
349
+ */
277
350
  addRequiredClusterServers(endpoint) {
278
351
  const requiredServerList = [];
279
352
  this.log.debug(`addRequiredClusterServer for ${CYAN}${endpoint.id}${db}`);
@@ -290,6 +363,12 @@ export class MatterbridgeEndpoint extends Endpoint {
290
363
  this.addClusterServerFromList(endpoint, requiredServerList);
291
364
  return endpoint;
292
365
  }
366
+ /**
367
+ * Adds the optional cluster servers (only if they are not present) for the device types of the specified endpoint.
368
+ *
369
+ * @param {MatterbridgeEndpoint} endpoint - The endpoint to add the required cluster servers to.
370
+ * @returns {MatterbridgeEndpoint} The updated endpoint with the required cluster servers added.
371
+ */
293
372
  addOptionalClusterServers(endpoint) {
294
373
  const optionalServerList = [];
295
374
  this.log.debug(`addRequiredClusterServer for ${CYAN}${endpoint.id}${db}`);
@@ -306,6 +385,22 @@ export class MatterbridgeEndpoint extends Endpoint {
306
385
  this.addClusterServerFromList(endpoint, optionalServerList);
307
386
  return endpoint;
308
387
  }
388
+ /**
389
+ * Adds a child endpoint with the specified device types and options.
390
+ * If the child endpoint is not already present, it will be created and added.
391
+ * If the child endpoint is already present, the device types will be added to the existing child endpoint.
392
+ *
393
+ * @param {string} endpointName - The name of the new endpoint to add.
394
+ * @param {AtLeastOne<DeviceTypeDefinition>} deviceTypes - The device types to add.
395
+ * @param {MatterbridgeEndpointOptions} [options={}] - The options for the endpoint.
396
+ * @param {boolean} [debug=false] - Whether to enable debug logging.
397
+ * @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
398
+ *
399
+ * @example
400
+ * ```typescript
401
+ * const endpoint = device.addChildDeviceType('Temperature', [temperatureSensor], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
402
+ * ```
403
+ */
309
404
  addChildDeviceType(endpointName, deviceTypes, options = {}, debug = false) {
310
405
  this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
311
406
  let child = this.getChildEndpointByName(endpointName);
@@ -336,6 +431,23 @@ export class MatterbridgeEndpoint extends Endpoint {
336
431
  }
337
432
  return child;
338
433
  }
434
+ /**
435
+ * Adds a child endpoint with one or more device types with the required cluster servers and the specified cluster servers.
436
+ * If the child endpoint is not already present in the childEndpoints, it will be added.
437
+ * If the child endpoint is already present in the childEndpoints, the device types and cluster servers will be added to the existing child endpoint.
438
+ *
439
+ * @param {string} endpointName - The name of the new enpoint to add.
440
+ * @param {AtLeastOne<DeviceTypeDefinition>} deviceTypes - The device types to add.
441
+ * @param {ClusterId[]} [includeServerList=[]] - The list of cluster IDs to include.
442
+ * @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
443
+ * @param {boolean} [debug=false] - Whether to enable debug logging.
444
+ * @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
445
+ *
446
+ * @example
447
+ * ```typescript
448
+ * const endpoint = device.addChildDeviceTypeWithClusterServer('Temperature', [temperatureSensor], [], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
449
+ * ```
450
+ */
339
451
  addChildDeviceTypeWithClusterServer(endpointName, deviceTypes, includeServerList = [], options = {}, debug = false) {
340
452
  this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
341
453
  let child = this.getChildEndpointByName(endpointName);
@@ -379,6 +491,12 @@ export class MatterbridgeEndpoint extends Endpoint {
379
491
  }
380
492
  return child;
381
493
  }
494
+ /**
495
+ * Retrieves a child endpoint by its name.
496
+ *
497
+ * @param {string} endpointName - The name of the endpoint to retrieve.
498
+ * @returns {Endpoint | undefined} The child endpoint with the specified name, or undefined if not found.
499
+ */
382
500
  getChildEndpointByName(endpointName) {
383
501
  return this.parts.find((part) => part.id === endpointName);
384
502
  }
@@ -397,6 +515,8 @@ export class MatterbridgeEndpoint extends Endpoint {
397
515
  });
398
516
  }
399
517
  async setBridgedDeviceReachability(reachable) {
518
+ // await this.setAttribute(BridgedDeviceBasicInformationCluster.id, 'reachable', reachable, this.log);
519
+ // await this.triggerEvent(BridgedDeviceBasicInformationCluster.id, 'reachableChanged', { reachableNewValue: reachable }, this.log);
400
520
  }
401
521
  hasClusterServer(cluster) {
402
522
  return this.clusterServers.has(cluster.id);
@@ -414,15 +534,25 @@ export class MatterbridgeEndpoint extends Endpoint {
414
534
  return this.clusterServers.get(clusterId);
415
535
  }
416
536
  addTagList(endpoint, mfgCode, namespaceId, tag, label) {
537
+ // Do nothing here only for old api compatibility
417
538
  }
418
539
  addClusterServer(cluster) {
540
+ // console.log('addClusterServer:', cluster.id, cluster.name, cluster.attributes, cluster.events, cluster.commands);
419
541
  let features = {};
542
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
420
543
  const options = {};
421
544
  for (const attribute of Object.values(cluster.attributes)) {
545
+ // console.error('Attribute:', (attribute as any).id, (attribute as any).name, (attribute as any).value);
546
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
422
547
  if (attribute.name === 'featureMap') {
548
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
423
549
  features = attribute.value;
550
+ // console.log('Cluster', cluster.name, 'FeatureMap:', features);
551
+ // options[(attribute as any).name] = (attribute as any).value;
424
552
  }
553
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
425
554
  if (attribute.id < 0xfff0) {
555
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
426
556
  options[attribute.name] = attribute.value;
427
557
  }
428
558
  }
@@ -462,9 +592,16 @@ export class MatterbridgeEndpoint extends Endpoint {
462
592
  const behavior = MatterbridgeEndpoint.getBehaviourTypeFromClusterServerId(cluster.id, this.subType);
463
593
  this.clusterServers.set(cluster.id, cluster);
464
594
  if (cluster.id === BasicInformationCluster.id)
465
- return;
595
+ return; // Not used in Matterbridge edge for devices. Only on server node.
466
596
  this.behaviors.require(behavior, options);
467
597
  }
598
+ /**
599
+ * Adds cluster servers to the specified endpoint based on the provided server list.
600
+ *
601
+ * @param {Endpoint} endpoint - The endpoint to add cluster servers to.
602
+ * @param {ClusterId[]} includeServerList - The list of cluster IDs to include.
603
+ * @returns void
604
+ */
468
605
  addClusterServerFromList(endpoint, includeServerList) {
469
606
  if (includeServerList.includes(Identify.Cluster.id))
470
607
  endpoint.addClusterServer(this.getDefaultIdentifyClusterServer());
@@ -534,6 +671,8 @@ export class MatterbridgeEndpoint extends Endpoint {
534
671
  endpoint.addClusterServer(this.getDefaultRadonConcentrationMeasurementClusterServer());
535
672
  if (includeServerList.includes(TotalVolatileOrganicCompoundsConcentrationMeasurement.Cluster.id))
536
673
  endpoint.addClusterServer(this.getDefaultTvocMeasurementClusterServer());
674
+ // if (includeServerList.includes(DeviceEnergyManagement.Cluster.id)) endpoint.addClusterServer(this.getDefaultDeviceEnergyManagementClusterServer());
675
+ // if (includeServerList.includes(DeviceEnergyManagementMode.Cluster.id)) endpoint.addClusterServer(this.getDefaultDeviceEnergyManagementModeClusterServer());
537
676
  }
538
677
  async addFixedLabel(label, value) {
539
678
  if (!this.clusterServers.get(FixedLabelCluster.id)) {
@@ -571,6 +710,16 @@ export class MatterbridgeEndpoint extends Endpoint {
571
710
  return name;
572
711
  return name.charAt(0).toLowerCase() + name.slice(1);
573
712
  }
713
+ /**
714
+ * Retrieves the value of the specified attribute from the given endpoint and cluster.
715
+ *
716
+ * @param {ClusterId} clusterId - The ID of the cluster to retrieve the attribute from.
717
+ * @param {string} attribute - The name of the attribute to retrieve.
718
+ * @param {AnsiLogger} [log] - Optional logger for error and info messages.
719
+ * @param {MatterbridgeEndpoint} [endpoint] - Optional the child endpoint to retrieve the attribute from.
720
+ * @returns {any} The value of the attribute, or undefined if the attribute is not found.
721
+ */
722
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
574
723
  getAttribute(clusterId, attribute, log, endpoint) {
575
724
  if (!endpoint)
576
725
  endpoint = this;
@@ -579,6 +728,7 @@ export class MatterbridgeEndpoint extends Endpoint {
579
728
  this.log.error(`getAttribute ${hk}${clusterName}.${attribute}${er} error: Endpoint ${or}${endpoint.id}${er} is in the ${BLUE}${endpoint.construction.status}${er} state`);
580
729
  return undefined;
581
730
  }
731
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
582
732
  const state = endpoint.state;
583
733
  if (!(clusterName in state)) {
584
734
  this.log.error(`getAttribute error: Cluster ${'0x' + clusterId.toString(16).padStart(4, '0')}:${clusterName} not found on endpoint ${or}${endpoint.id}${er}:${or}${endpoint.number}${er}`);
@@ -593,6 +743,17 @@ export class MatterbridgeEndpoint extends Endpoint {
593
743
  log?.info(`${db}Get endpoint ${or}${endpoint.id}${db}:${or}${endpoint.number}${db} attribute ${hk}${this.capitalizeFirstLetter(clusterName)}${db}.${hk}${attribute}${db} value ${YELLOW}${typeof value === 'object' ? debugStringify(value) : value}${db}`);
594
744
  return value;
595
745
  }
746
+ /**
747
+ * Sets the value of an attribute on a cluster server endpoint.
748
+ *
749
+ * @param {ClusterId} clusterId - The ID of the cluster.
750
+ * @param {string} attribute - The name of the attribute.
751
+ * @param {any} value - The value to set for the attribute.
752
+ * @param {AnsiLogger} [log] - (Optional) The logger to use for logging errors and information.
753
+ * @param {MatterbridgeEndpoint} [endpoint] - (Optional) The endpoint to set the attribute on. If not provided, the attribute will be set on the current endpoint.
754
+ * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
755
+ */
756
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
596
757
  async setAttribute(clusterId, attribute, value, log, endpoint) {
597
758
  if (!endpoint)
598
759
  endpoint = this;
@@ -601,6 +762,7 @@ export class MatterbridgeEndpoint extends Endpoint {
601
762
  this.log.error(`setAttribute ${hk}${clusterName}.${attribute}${er} error: Endpoint ${or}${endpoint.id}${er} is in the ${BLUE}${endpoint.construction.status}${er} state`);
602
763
  return false;
603
764
  }
765
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
604
766
  const state = endpoint.state;
605
767
  if (!(clusterName in state)) {
606
768
  this.log.error(`setAttribute ${hk}${attribute}${er} error: Cluster ${'0x' + clusterId.toString(16).padStart(4, '0')}:${clusterName} not found on endpoint ${or}${endpoint.id}${er}:${or}${endpoint.number}${er}`);
@@ -620,13 +782,26 @@ export class MatterbridgeEndpoint extends Endpoint {
620
782
  `to ${YELLOW}${typeof value === 'object' ? debugStringify(value) : value}${db}`);
621
783
  return true;
622
784
  }
785
+ /**
786
+ * Subscribes to an attribute on a cluster.
787
+ *
788
+ * @param {ClusterId} clusterId - The ID of the cluster.
789
+ * @param {string} attribute - The name of the attribute to subscribe to.
790
+ * @param {(newValue: any, oldValue: any) => void} listener - A callback function that will be called when the attribute value changes.
791
+ * @param {AnsiLogger} [log] - Optional logger for logging errors and information.
792
+ * @param {MatterbridgeEndpoint} [endpoint] - Optional endpoint to subscribe the attribute on. Defaults to the current endpoint.
793
+ * @returns {boolean} - A boolean indicating whether the subscription was successful.
794
+ */
795
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
623
796
  async subscribeAttribute(clusterId, attribute, listener, log, endpoint) {
624
797
  if (!endpoint)
625
798
  endpoint = this;
626
799
  const clusterName = this.lowercaseFirstLetter(getClusterNameById(clusterId));
627
800
  if (endpoint.construction.status !== Lifecycle.Status.Active) {
801
+ // this.log.error(`subscribeAttribute ${hk}${clusterName}.${attribute}${er} error: Endpoint ${or}${endpoint.id}${er} is in the ${BLUE}${endpoint.construction.status}${er} state`);
628
802
  await endpoint.construction.ready;
629
803
  }
804
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
630
805
  const events = endpoint.events;
631
806
  if (!(clusterName in events)) {
632
807
  this.log.error(`subscribeAttribute ${hk}${attribute}${er} error: Cluster ${'0x' + clusterId.toString(16).padStart(4, '0')}:${clusterName} not found on endpoint ${or}${endpoint.id}${er}:${or}${endpoint.number}${er}`);
@@ -641,67 +816,218 @@ export class MatterbridgeEndpoint extends Endpoint {
641
816
  log?.info(`${db}Subscribe endpoint ${or}${endpoint.id}${db}:${or}${endpoint.number}${db} attribute ${hk}${this.capitalizeFirstLetter(clusterName)}${db}.${hk}${attribute}${db}`);
642
817
  return true;
643
818
  }
819
+ /**
820
+ * Triggers an event on the specified cluster.
821
+ *
822
+ * @param {ClusterId} clusterId - The ID of the cluster.
823
+ * @param {string} event - The name of the event to trigger.
824
+ * @param {Record<string, boolean | number | bigint | string | object | undefined | null>} payload - The payload to pass to the event.
825
+ * @param {AnsiLogger} [log] - Optional logger for logging information.
826
+ * @param {MatterbridgeEndpoint} [endpoint] - Optional endpoint to trigger the event on. Defaults to the current endpoint.
827
+ * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the event was successfully triggered.
828
+ */
644
829
  async triggerEvent(clusterId, event, payload, log, endpoint) {
645
830
  if (!endpoint)
646
831
  endpoint = this;
647
832
  const clusterName = this.lowercaseFirstLetter(getClusterNameById(clusterId));
648
833
  if (endpoint.construction.status !== Lifecycle.Status.Active) {
834
+ // this.log.error(`triggerEvent ${hk}${clusterName}.${event}${er} error: Endpoint ${or}${endpoint.id}${er} is in the ${BLUE}${endpoint.construction.status}${er} state`);
649
835
  await endpoint.construction.ready;
836
+ // return false;
650
837
  }
838
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
651
839
  const events = endpoint.events;
652
840
  if (!(clusterName in events) || !(event in events[clusterName])) {
653
841
  this.log.error(`triggerEvent ${hk}${event}${er} error: Cluster ${'0x' + clusterId.toString(16).padStart(4, '0')}:${clusterName} not found on endpoint ${or}${endpoint.id}${er}:${or}${endpoint.number}${er}`);
654
842
  return false;
655
843
  }
844
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
845
+ // @ts-ignore
656
846
  await endpoint.act((agent) => agent[clusterName].events[event].emit(payload, agent.context));
657
847
  log?.info(`${db}Trigger event ${hk}${this.capitalizeFirstLetter(clusterName)}${db}.${hk}${event}${db} with ${debugStringify(payload)}${db} on endpoint ${or}${endpoint.id}${db}:${or}${endpoint.number}${db} `);
658
848
  return true;
659
849
  }
850
+ /**
851
+ * Adds a command handler for the specified command.
852
+ *
853
+ * @param {keyof MatterbridgeEndpointCommands} command - The command to add the handler for.
854
+ * @param {(data: any) => void} handler - The handler function to execute when the command is received.
855
+ * @returns {void}
856
+ */
857
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
660
858
  addCommandHandler(command, handler) {
661
859
  this.commandHandler.addHandler(command, handler);
662
860
  }
861
+ /**
862
+ * Serializes the Matterbridge device into a serialized object.
863
+ *
864
+ * @param pluginName - The name of the plugin.
865
+ * @returns The serialized Matterbridge device object.
866
+ */
663
867
  serialize() {
664
868
  return undefined;
665
- }
869
+ /*
870
+ if (!this.serialNumber || !this.deviceName || !this.uniqueId) return;
871
+ const cluster = this.getClusterServer(BasicInformationCluster) ?? this.getClusterServer(BridgedDeviceBasicInformationCluster);
872
+ if (!cluster) return;
873
+ const serialized: SerializedMatterbridgeDevice = {
874
+ pluginName: this.plugin ?? 'Unknown',
875
+ serialNumber: this.serialNumber,
876
+ deviceName: this.deviceName,
877
+ uniqueId: this.uniqueId,
878
+ productName: cluster.attributes.productName?.getLocal(),
879
+ vendorId: cluster.attributes.vendorId?.getLocal(),
880
+ vendorName: cluster.attributes.vendorName?.getLocal(),
881
+ deviceTypes: Array.from(this.deviceTypes.values()),
882
+ endpoint: this.number,
883
+ endpointName: this.id,
884
+ clusterServersId: [],
885
+ };
886
+ this.getAllClusterServers().forEach((clusterServer) => {
887
+ serialized.clusterServersId.push(clusterServer.id);
888
+ });
889
+ return serialized;
890
+ */
891
+ }
892
+ /**
893
+ * Deserializes the device into a serialized object.
894
+ *
895
+ * @returns The deserialized MatterbridgeDevice.
896
+ */
666
897
  static deserialize(serializedDevice) {
667
898
  return undefined;
668
- }
899
+ /*
900
+ const device = new MatterbridgeDevice(serializedDevice.deviceTypes);
901
+ device.serialNumber = serializedDevice.serialNumber;
902
+ device.deviceName = serializedDevice.deviceName;
903
+ device.uniqueId = serializedDevice.uniqueId;
904
+ for (const clusterId of serializedDevice.clusterServersId) {
905
+ if (clusterId === BasicInformationCluster.id)
906
+ device.createDefaultBasicInformationClusterServer(
907
+ serializedDevice.deviceName,
908
+ serializedDevice.serialNumber,
909
+ serializedDevice.vendorId ?? 0xfff1,
910
+ serializedDevice.vendorName ?? 'Matterbridge',
911
+ serializedDevice.productId ?? 0x8000,
912
+ serializedDevice.productName ?? 'Matterbridge device',
913
+ );
914
+ else if (clusterId === BridgedDeviceBasicInformationCluster.id)
915
+ device.createDefaultBridgedDeviceBasicInformationClusterServer(
916
+ serializedDevice.deviceName,
917
+ serializedDevice.serialNumber,
918
+ serializedDevice.vendorId ?? 0xfff1,
919
+ serializedDevice.vendorName ?? 'Matterbridge',
920
+ serializedDevice.productName ?? 'Matterbridge device',
921
+ );
922
+ else device.addClusterServerFromList(device, [clusterId]);
923
+ }
924
+ return device;
925
+ */
926
+ }
927
+ /**
928
+ * From here copy paste from MatterbridgeDevice
929
+ */
930
+ /**
931
+ * Get a default IdentifyCluster server.
932
+ */
669
933
  getDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
670
934
  return ClusterServer(IdentifyCluster, {
671
935
  identifyTime,
672
936
  identifyType,
673
937
  }, {
674
938
  identify: async (data) => {
939
+ // Never called in edge
675
940
  },
676
941
  triggerEffect: async (data) => {
942
+ // Never called in edge
677
943
  },
678
944
  });
679
945
  }
946
+ /**
947
+ * Creates a default IdentifyCluster server.
948
+ */
680
949
  createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
681
950
  this.addClusterServer(this.getDefaultIdentifyClusterServer(identifyTime, identifyType));
682
951
  return this;
683
952
  }
953
+ /**
954
+ * Get a default IdentifyCluster server.
955
+ */
684
956
  getDefaultGroupsClusterServer() {
685
957
  return ClusterServer(GroupsCluster, {
686
958
  nameSupport: {
687
959
  nameSupport: true,
688
960
  },
689
961
  }, GroupsClusterHandler());
962
+ // return createDefaultGroupsClusterServer();
690
963
  }
964
+ /**
965
+ * Creates a default groups cluster server and adds it to the device.
966
+ */
691
967
  createDefaultGroupsClusterServer() {
692
968
  this.addClusterServer(this.getDefaultGroupsClusterServer());
693
969
  return this;
694
970
  }
971
+ /**
972
+ * Get a default scenes cluster server and adds it to the current instance.
973
+ * @deprecated This method is deprecated.
974
+ *
975
+ */
695
976
  getDefaultScenesClusterServer() {
696
- }
977
+ /*
978
+ return ClusterServer(
979
+ ScenesCluster,
980
+ {
981
+ sceneCount: 0,
982
+ currentScene: 0,
983
+ currentGroup: GroupId(0),
984
+ sceneValid: false,
985
+ nameSupport: {
986
+ nameSupport: true,
987
+ },
988
+ lastConfiguredBy: null,
989
+ },
990
+ {},
991
+ );
992
+ */
993
+ }
994
+ /**
995
+ * Creates a default scenes cluster server and adds it to the current instance.
996
+ * @deprecated This method is deprecated.
997
+ */
697
998
  createDefaultScenesClusterServer() {
999
+ /*
1000
+ this.addClusterServer(this.getDefaultScenesClusterServer());
1001
+ */
698
1002
  return this;
699
1003
  }
1004
+ /**
1005
+ * Creates a unique identifier based on the provided parameters.
1006
+ * @param param1 - The first parameter.
1007
+ * @param param2 - The second parameter.
1008
+ * @param param3 - The third parameter.
1009
+ * @param param4 - The fourth parameter.
1010
+ * @returns A unique identifier generated using the MD5 hash algorithm.
1011
+ */
700
1012
  createUniqueId(param1, param2, param3, param4) {
701
1013
  const hash = createHash('md5');
702
1014
  hash.update(param1 + param2 + param3 + param4);
703
1015
  return hash.digest('hex');
704
1016
  }
1017
+ /**
1018
+ * Get a default Basic Information Cluster Server.
1019
+ *
1020
+ * @param deviceName - The name of the device.
1021
+ * @param serialNumber - The serial number of the device.
1022
+ * @param vendorId - The vendor ID of the device.
1023
+ * @param vendorName - The vendor name of the device.
1024
+ * @param productId - The product ID of the device.
1025
+ * @param productName - The product name of the device.
1026
+ * @param softwareVersion - The software version of the device. Default is 1.
1027
+ * @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
1028
+ * @param hardwareVersion - The hardware version of the device. Default is 1.
1029
+ * @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
1030
+ */
705
1031
  getDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
706
1032
  this.log.logName = deviceName;
707
1033
  this.deviceName = deviceName;
@@ -742,6 +1068,20 @@ export class MatterbridgeEndpoint extends Endpoint {
742
1068
  reachableChanged: true,
743
1069
  });
744
1070
  }
1071
+ /**
1072
+ * Creates a default Basic Information Cluster Server.
1073
+ *
1074
+ * @param deviceName - The name of the device.
1075
+ * @param serialNumber - The serial number of the device.
1076
+ * @param vendorId - The vendor ID of the device.
1077
+ * @param vendorName - The vendor name of the device.
1078
+ * @param productId - The product ID of the device.
1079
+ * @param productName - The product name of the device.
1080
+ * @param softwareVersion - The software version of the device. Default is 1.
1081
+ * @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
1082
+ * @param hardwareVersion - The hardware version of the device. Default is 1.
1083
+ * @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
1084
+ */
745
1085
  createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
746
1086
  if (MatterbridgeEndpoint.bridgeMode === 'bridge') {
747
1087
  this.addDeviceType(bridgedNode);
@@ -751,6 +1091,19 @@ export class MatterbridgeEndpoint extends Endpoint {
751
1091
  this.addClusterServer(this.getDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion, softwareVersionString, hardwareVersion, hardwareVersionString));
752
1092
  return this;
753
1093
  }
1094
+ /**
1095
+ * Get a default BridgedDeviceBasicInformationClusterServer.
1096
+ *
1097
+ * @param deviceName - The name of the device.
1098
+ * @param serialNumber - The serial number of the device.
1099
+ * @param vendorId - The vendor ID of the device.
1100
+ * @param vendorName - The name of the vendor.
1101
+ * @param productName - The name of the product.
1102
+ * @param softwareVersion - The software version of the device. Default is 1.
1103
+ * @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
1104
+ * @param hardwareVersion - The hardware version of the device. Default is 1.
1105
+ * @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
1106
+ */
754
1107
  getDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
755
1108
  this.log.logName = deviceName;
756
1109
  this.deviceName = deviceName;
@@ -765,7 +1118,7 @@ export class MatterbridgeEndpoint extends Endpoint {
765
1118
  this.hardwareVersion = hardwareVersion;
766
1119
  this.hardwareVersionString = hardwareVersionString;
767
1120
  return ClusterServer(BridgedDeviceBasicInformationCluster, {
768
- vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
1121
+ vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined, // 4874
769
1122
  vendorName: vendorName.slice(0, 32),
770
1123
  productName: productName.slice(0, 32),
771
1124
  productUrl: 'https://www.npmjs.com/package/matterbridge',
@@ -785,13 +1138,37 @@ export class MatterbridgeEndpoint extends Endpoint {
785
1138
  reachableChanged: true,
786
1139
  });
787
1140
  }
1141
+ /**
1142
+ * Creates a default BridgedDeviceBasicInformationClusterServer.
1143
+ *
1144
+ * @param deviceName - The name of the device.
1145
+ * @param serialNumber - The serial number of the device.
1146
+ * @param vendorId - The vendor ID of the device.
1147
+ * @param vendorName - The name of the vendor.
1148
+ * @param productName - The name of the product.
1149
+ * @param softwareVersion - The software version of the device. Default is 1.
1150
+ * @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
1151
+ * @param hardwareVersion - The hardware version of the device. Default is 1.
1152
+ * @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
1153
+ */
788
1154
  createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
789
1155
  this.addClusterServer(this.getDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion, softwareVersionString, hardwareVersion, hardwareVersionString));
790
1156
  return this;
791
1157
  }
1158
+ /**
1159
+ * Get a default Power Topology Cluster Server. Only needed for an electricalSensor device type.
1160
+ *
1161
+ * @returns {ClusterServer} - The configured Power Topology Cluster Server.
1162
+ */
792
1163
  getDefaultPowerTopologyClusterServer() {
793
1164
  return ClusterServer(PowerTopologyCluster.with(PowerTopology.Feature.TreeTopology), {}, {}, {});
794
1165
  }
1166
+ /**
1167
+ * Get a default Electrical Energy Measurement Cluster Server.
1168
+ *
1169
+ * @param {number} energy - The total consumption value in mW/h.
1170
+ * @returns {ClusterServer} - The configured Electrical Energy Measurement Cluster Server.
1171
+ */
795
1172
  getDefaultElectricalEnergyMeasurementClusterServer(energy = null) {
796
1173
  return ClusterServer(ElectricalEnergyMeasurementCluster.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
797
1174
  accuracy: {
@@ -808,6 +1185,15 @@ export class MatterbridgeEndpoint extends Endpoint {
808
1185
  cumulativeEnergyMeasured: true,
809
1186
  });
810
1187
  }
1188
+ /**
1189
+ * Get a default Electrical Power Measurement Cluster Server.
1190
+ *
1191
+ * @param {number} voltage - The voltage value in millivolts.
1192
+ * @param {number} current - The current value in milliamperes.
1193
+ * @param {number} power - The power value in milliwatts.
1194
+ * @param {number} frequency - The frequency value in millihertz.
1195
+ * @returns {ClusterServer} - The configured Electrical Power Measurement Cluster Server.
1196
+ */
811
1197
  getDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
812
1198
  return ClusterServer(ElectricalPowerMeasurementCluster.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
813
1199
  powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
@@ -848,6 +1234,16 @@ export class MatterbridgeEndpoint extends Endpoint {
848
1234
  frequency: frequency,
849
1235
  }, {}, {});
850
1236
  }
1237
+ /**
1238
+ * Get a default OnOff cluster server for light devices.
1239
+ *
1240
+ * @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
1241
+ * @param {boolean} [globalSceneControl=false] - The global scene control state.
1242
+ * @param {number} [onTime=0] - The on time value.
1243
+ * @param {number} [offWaitTime=0] - The off wait time value.
1244
+ * @param {OnOff.StartUpOnOff | null} [startUpOnOff=null] - The start-up OnOff state. Null means previous state.
1245
+ * @returns {ClusterServer} - The configured OnOff cluster server.
1246
+ */
851
1247
  getDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
852
1248
  return ClusterServer(OnOffCluster.with(OnOff.Feature.Lighting), {
853
1249
  onOff,
@@ -857,55 +1253,110 @@ export class MatterbridgeEndpoint extends Endpoint {
857
1253
  startUpOnOff,
858
1254
  }, {
859
1255
  on: async (data) => {
1256
+ // Never called in edge
860
1257
  },
861
1258
  off: async (data) => {
1259
+ // Never called in edge
862
1260
  },
863
1261
  toggle: async (data) => {
1262
+ // Never called in edge
864
1263
  },
865
1264
  offWithEffect: async () => {
1265
+ // Never called in edge
866
1266
  },
867
1267
  onWithRecallGlobalScene: async () => {
1268
+ // Never called in edge
868
1269
  },
869
1270
  onWithTimedOff: async () => {
1271
+ // Never called in edge
870
1272
  },
871
1273
  }, {});
872
1274
  }
1275
+ /**
1276
+ * Creates a default OnOff cluster server for light devices.
1277
+ *
1278
+ * @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
1279
+ * @param {boolean} [globalSceneControl=false] - The global scene control state.
1280
+ * @param {number} [onTime=0] - The on time value.
1281
+ * @param {number} [offWaitTime=0] - The off wait time value.
1282
+ * @param {OnOff.StartUpOnOff | null} [startUpOnOff=null] - The start-up OnOff state. Null means previous state.
1283
+ * @returns {void}
1284
+ */
873
1285
  createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
874
1286
  this.addClusterServer(this.getDefaultOnOffClusterServer(onOff, globalSceneControl, onTime, offWaitTime, startUpOnOff));
875
1287
  return this;
876
1288
  }
1289
+ /**
1290
+ * Get an OnOff cluster server without features.
1291
+ *
1292
+ * @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
1293
+ *
1294
+ * @returns {ClusterServer} - The configured OnOff cluster server.
1295
+ */
877
1296
  getOnOffClusterServer(onOff = false) {
878
1297
  return ClusterServer(OnOffCluster, {
879
1298
  onOff,
880
1299
  }, {
881
1300
  on: async (data) => {
1301
+ // Never called in edge
882
1302
  },
883
1303
  off: async (data) => {
1304
+ // Never called in edge
884
1305
  },
885
1306
  toggle: async (data) => {
1307
+ // Never called in edge
886
1308
  },
887
1309
  }, {});
888
1310
  }
1311
+ /**
1312
+ * Creates an OnOff cluster server without features.
1313
+ *
1314
+ * @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
1315
+ */
889
1316
  createOnOffClusterServer(onOff = false) {
890
1317
  this.addClusterServer(this.getOnOffClusterServer(onOff));
891
1318
  return this;
892
1319
  }
1320
+ /**
1321
+ * Get a DeadFront OnOff cluster server.
1322
+ *
1323
+ * @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
1324
+ *
1325
+ * @returns {ClusterServer} - The configured OnOff cluster server.
1326
+ */
893
1327
  getDeadFrontOnOffClusterServer(onOff = false) {
894
1328
  return ClusterServer(OnOffCluster.with(OnOff.Feature.DeadFrontBehavior), {
895
1329
  onOff,
896
1330
  }, {
897
1331
  on: async (data) => {
1332
+ // Never called in edge
898
1333
  },
899
1334
  off: async (data) => {
1335
+ // Never called in edge
900
1336
  },
901
1337
  toggle: async (data) => {
1338
+ // Never called in edge
902
1339
  },
903
1340
  }, {});
904
1341
  }
1342
+ /**
1343
+ * Creates a DeadFront OnOff cluster server.
1344
+ *
1345
+ * @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
1346
+ */
905
1347
  createDeadFrontOnOffClusterServer(onOff = false) {
906
1348
  this.addClusterServer(this.getDeadFrontOnOffClusterServer(onOff));
907
1349
  return this;
908
1350
  }
1351
+ /**
1352
+ * Get a default level control cluster server.
1353
+ *
1354
+ * @param currentLevel - The current level (default: 254).
1355
+ * @param minLevel - The minimum level (default: 1).
1356
+ * @param maxLevel - The maximum level (default: 254).
1357
+ * @param onLevel - The on level (default: null).
1358
+ * @param startUpCurrentLevel - The startUp on level (default: null).
1359
+ */
909
1360
  getDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
910
1361
  return ClusterServer(LevelControlCluster.with(LevelControl.Feature.OnOff, LevelControl.Feature.Lighting), {
911
1362
  currentLevel,
@@ -920,27 +1371,55 @@ export class MatterbridgeEndpoint extends Endpoint {
920
1371
  },
921
1372
  }, {
922
1373
  moveToLevel: async (data) => {
1374
+ // Never called in edge
923
1375
  },
924
1376
  move: async () => {
1377
+ // Never called in edge
925
1378
  },
926
1379
  step: async () => {
1380
+ // Never called in edge
927
1381
  },
928
1382
  stop: async () => {
1383
+ // Never called in edge
929
1384
  },
930
1385
  moveToLevelWithOnOff: async (data) => {
1386
+ // Never called in edge
931
1387
  },
932
1388
  moveWithOnOff: async () => {
1389
+ // Never called in edge
933
1390
  },
934
1391
  stepWithOnOff: async () => {
1392
+ // Never called in edge
935
1393
  },
936
1394
  stopWithOnOff: async () => {
1395
+ // Never called in edge
937
1396
  },
938
1397
  });
939
1398
  }
1399
+ /**
1400
+ * Creates a default level control cluster server.
1401
+ *
1402
+ * @param currentLevel - The current level (default: 254).
1403
+ * @param minLevel - The minimum level (default: 1).
1404
+ * @param maxLevel - The maximum level (default: 254).
1405
+ * @param onLevel - The on level (default: null).
1406
+ * @param startUpCurrentLevel - The startUp on level (default: null).
1407
+ */
940
1408
  createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
941
1409
  this.addClusterServer(this.getDefaultLevelControlClusterServer(currentLevel, minLevel, maxLevel, onLevel, startUpCurrentLevel));
942
1410
  return this;
943
1411
  }
1412
+ /**
1413
+ * Get a default color control cluster server with Xy, HueSaturation and ColorTemperature.
1414
+ *
1415
+ * @param currentX - The current X value.
1416
+ * @param currentY - The current Y value.
1417
+ * @param currentHue - The current hue value.
1418
+ * @param currentSaturation - The current saturation value.
1419
+ * @param colorTemperatureMireds - The color temperature in mireds.
1420
+ * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1421
+ * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1422
+ */
944
1423
  getDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
945
1424
  return ClusterServer(ColorControlCluster.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
946
1425
  colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
@@ -962,39 +1441,73 @@ export class MatterbridgeEndpoint extends Endpoint {
962
1441
  startUpColorTemperatureMireds: null,
963
1442
  }, {
964
1443
  moveToColor: async (data) => {
1444
+ // Never called in edge
965
1445
  },
966
1446
  moveColor: async () => {
1447
+ // Never called in edge
967
1448
  },
968
1449
  stepColor: async () => {
1450
+ // Never called in edge
969
1451
  },
970
1452
  moveToHue: async (data) => {
1453
+ // Never called in edge
971
1454
  },
972
1455
  moveHue: async () => {
1456
+ // Never called in edge
973
1457
  },
974
1458
  stepHue: async () => {
1459
+ // Never called in edge
975
1460
  },
976
1461
  moveToSaturation: async (data) => {
1462
+ // Never called in edge
977
1463
  },
978
1464
  moveSaturation: async () => {
1465
+ // Never called in edge
979
1466
  },
980
1467
  stepSaturation: async () => {
1468
+ // Never called in edge
981
1469
  },
982
1470
  moveToHueAndSaturation: async (data) => {
1471
+ // Never called in edge
983
1472
  },
984
1473
  stopMoveStep: async () => {
1474
+ // Never called in edge
985
1475
  },
986
1476
  moveToColorTemperature: async (data) => {
1477
+ // Never called in edge
987
1478
  },
988
1479
  moveColorTemperature: async () => {
1480
+ // Never called in edge
989
1481
  },
990
1482
  stepColorTemperature: async () => {
1483
+ // Never called in edge
991
1484
  },
992
1485
  }, {});
993
1486
  }
1487
+ /**
1488
+ * Creates a default color control cluster server with Xy, HueSaturation and ColorTemperature.
1489
+ *
1490
+ * @param currentX - The current X value.
1491
+ * @param currentY - The current Y value.
1492
+ * @param currentHue - The current hue value.
1493
+ * @param currentSaturation - The current saturation value.
1494
+ * @param colorTemperatureMireds - The color temperature in mireds.
1495
+ * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1496
+ * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1497
+ */
994
1498
  createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
995
1499
  this.addClusterServer(this.getDefaultColorControlClusterServer(currentX, currentY, currentHue, currentSaturation, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
996
1500
  return this;
997
1501
  }
1502
+ /**
1503
+ * Get a Xy color control cluster server with Xy and ColorTemperature.
1504
+ *
1505
+ * @param currentX - The current X value.
1506
+ * @param currentY - The current Y value.
1507
+ * @param colorTemperatureMireds - The color temperature in mireds.
1508
+ * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1509
+ * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1510
+ */
998
1511
  getXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
999
1512
  return ClusterServer(ColorControlCluster.with(ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature), {
1000
1513
  colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
@@ -1014,25 +1527,50 @@ export class MatterbridgeEndpoint extends Endpoint {
1014
1527
  remainingTime: 0,
1015
1528
  }, {
1016
1529
  moveToColor: async () => {
1530
+ // Never called in edge
1017
1531
  },
1018
1532
  moveColor: async () => {
1533
+ // Never called in edge
1019
1534
  },
1020
1535
  stepColor: async () => {
1536
+ // Never called in edge
1021
1537
  },
1022
1538
  stopMoveStep: async () => {
1539
+ // Never called in edge
1023
1540
  },
1024
1541
  moveToColorTemperature: async () => {
1542
+ // Never called in edge
1025
1543
  },
1026
1544
  moveColorTemperature: async () => {
1545
+ // Never called in edge
1027
1546
  },
1028
1547
  stepColorTemperature: async () => {
1548
+ // Never called in edge
1029
1549
  },
1030
1550
  }, {});
1031
1551
  }
1552
+ /**
1553
+ * Creates a Xy color control cluster server with Xy and ColorTemperature.
1554
+ *
1555
+ * @param currentX - The current X value.
1556
+ * @param currentY - The current Y value.
1557
+ * @param colorTemperatureMireds - The color temperature in mireds.
1558
+ * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1559
+ * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1560
+ */
1032
1561
  createXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1033
1562
  this.addClusterServer(this.getXyColorControlClusterServer(currentX, currentY, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
1034
1563
  return this;
1035
1564
  }
1565
+ /**
1566
+ * Get a default hue and saturation control cluster server with HueSaturation and ColorTemperature.
1567
+ *
1568
+ * @param currentHue - The current hue value.
1569
+ * @param currentSaturation - The current saturation value.
1570
+ * @param colorTemperatureMireds - The color temperature in mireds.
1571
+ * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1572
+ * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1573
+ */
1036
1574
  getHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1037
1575
  return ClusterServer(ColorControlCluster.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
1038
1576
  colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
@@ -1052,33 +1590,60 @@ export class MatterbridgeEndpoint extends Endpoint {
1052
1590
  remainingTime: 0,
1053
1591
  }, {
1054
1592
  moveToHue: async () => {
1593
+ // Never called in edge
1055
1594
  },
1056
1595
  moveHue: async () => {
1596
+ // Never called in edge
1057
1597
  },
1058
1598
  stepHue: async () => {
1599
+ // Never called in edge
1059
1600
  },
1060
1601
  moveToSaturation: async () => {
1602
+ // Never called in edge
1061
1603
  },
1062
1604
  moveSaturation: async () => {
1605
+ // Never called in edge
1063
1606
  },
1064
1607
  stepSaturation: async () => {
1608
+ // Never called in edge
1065
1609
  },
1066
1610
  moveToHueAndSaturation: async () => {
1611
+ // Never called in edge
1067
1612
  },
1068
1613
  stopMoveStep: async () => {
1614
+ // Never called in edge
1069
1615
  },
1070
1616
  moveToColorTemperature: async () => {
1617
+ // Never called in edge
1071
1618
  },
1072
1619
  moveColorTemperature: async () => {
1620
+ // Never called in edge
1073
1621
  },
1074
1622
  stepColorTemperature: async () => {
1623
+ // Never called in edge
1075
1624
  },
1076
1625
  }, {});
1077
1626
  }
1627
+ /**
1628
+ * Creates a hue and saturation color control cluster server with HueSaturation and ColorTemperature.
1629
+ *
1630
+ * @param currentHue - The current hue value.
1631
+ * @param currentSaturation - The current saturation value.
1632
+ * @param colorTemperatureMireds - The color temperature in mireds.
1633
+ * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1634
+ * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1635
+ */
1078
1636
  createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1079
1637
  this.addClusterServer(this.getHsColorControlClusterServer(currentHue, currentSaturation, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
1080
1638
  return this;
1081
1639
  }
1640
+ /**
1641
+ * Get a color temperature color control cluster server.
1642
+ *
1643
+ * @param colorTemperatureMireds - The color temperature in mireds.
1644
+ * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1645
+ * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1646
+ */
1082
1647
  getCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1083
1648
  return ClusterServer(ColorControlCluster.with(ColorControl.Feature.ColorTemperature), {
1084
1649
  colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
@@ -1096,20 +1661,45 @@ export class MatterbridgeEndpoint extends Endpoint {
1096
1661
  startUpColorTemperatureMireds: null,
1097
1662
  }, {
1098
1663
  stopMoveStep: async () => {
1664
+ // Never called in edge
1099
1665
  },
1100
1666
  moveToColorTemperature: async () => {
1667
+ // Never called in edge
1101
1668
  },
1102
1669
  moveColorTemperature: async () => {
1670
+ // Never called in edge
1103
1671
  },
1104
1672
  stepColorTemperature: async () => {
1673
+ // Never called in edge
1105
1674
  },
1106
1675
  }, {});
1107
1676
  }
1677
+ /**
1678
+ * Creates a color temperature color control cluster server.
1679
+ *
1680
+ * @param colorTemperatureMireds - The color temperature in mireds.
1681
+ * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1682
+ * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1683
+ */
1108
1684
  createCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1109
1685
  this.addClusterServer(this.getCtColorControlClusterServer(colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
1110
1686
  return this;
1111
1687
  }
1112
1688
  isColorControlConfigured = false;
1689
+ /**
1690
+ * Configures the color control cluster for a device.
1691
+ *
1692
+ * @remark This method must be called only after creating the cluster with getDefaultColorControlClusterServer or createDefaultColorControlClusterServer
1693
+ * and before starting the matter node.
1694
+ *
1695
+ * @deprecated Use configureColorControlMode instead.
1696
+ *
1697
+ * @param {boolean} hueSaturation - A boolean indicating whether the device supports hue and saturation control.
1698
+ * @param {boolean} xy - A boolean indicating whether the device supports XY control.
1699
+ * @param {boolean} colorTemperature - A boolean indicating whether the device supports color temperature control.
1700
+ * @param {ColorControl.ColorMode} colorMode - An optional parameter specifying the color mode of the device.
1701
+ * @param {Endpoint} endpoint - An optional parameter specifying the endpoint to configure. If not provided, the device endpoint will be used.
1702
+ */
1113
1703
  async configureColorControlCluster(hueSaturation, xy, colorTemperature, colorMode, endpoint) {
1114
1704
  if (!endpoint)
1115
1705
  endpoint = this;
@@ -1133,6 +1723,12 @@ export class MatterbridgeEndpoint extends Endpoint {
1133
1723
  this.isColorControlConfigured = true;
1134
1724
  return this;
1135
1725
  }
1726
+ /**
1727
+ * Configures the color control mode for the device.
1728
+ *
1729
+ * @param {ColorControl.ColorMode} colorMode - The color mode to set.
1730
+ * @param {Endpoint} endpoint - The optional endpoint to configure. If not provided, the method will configure the current endpoint.
1731
+ */
1136
1732
  async configureColorControlMode(colorMode, endpoint) {
1137
1733
  if (!endpoint)
1138
1734
  endpoint = this;
@@ -1142,6 +1738,11 @@ export class MatterbridgeEndpoint extends Endpoint {
1142
1738
  }
1143
1739
  return this;
1144
1740
  }
1741
+ /**
1742
+ * Get a default window covering cluster server.
1743
+ *
1744
+ * @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
1745
+ */
1145
1746
  getDefaultWindowCoveringClusterServer(positionPercent100ths) {
1146
1747
  return ClusterServer(WindowCoveringCluster.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
1147
1748
  type: WindowCovering.WindowCoveringType.Rollershade,
@@ -1157,26 +1758,39 @@ export class MatterbridgeEndpoint extends Endpoint {
1157
1758
  operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
1158
1759
  endProductType: WindowCovering.EndProductType.RollerShade,
1159
1760
  mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
1160
- targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
1161
- currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
1761
+ targetPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
1762
+ currentPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
1162
1763
  }, {
1163
1764
  upOrOpen: async (data) => {
1765
+ // Never called in edge
1164
1766
  },
1165
1767
  downOrClose: async (data) => {
1768
+ // Never called in edge
1166
1769
  },
1167
1770
  stopMotion: async (data) => {
1771
+ // Never called in edge
1168
1772
  },
1169
1773
  goToLiftPercentage: async (data) => {
1774
+ // Never called in edge
1170
1775
  },
1171
1776
  }, {});
1172
1777
  }
1778
+ /**
1779
+ * Creates a default window covering cluster server.
1780
+ *
1781
+ * @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
1782
+ */
1173
1783
  createDefaultWindowCoveringClusterServer(positionPercent100ths) {
1174
1784
  this.addClusterServer(this.getDefaultWindowCoveringClusterServer(positionPercent100ths));
1175
1785
  }
1786
+ /**
1787
+ * Sets the window covering target position as the current position and stops the movement.
1788
+ * @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
1789
+ */
1176
1790
  async setWindowCoveringTargetAsCurrentAndStopped(endpoint) {
1177
1791
  if (!endpoint)
1178
1792
  endpoint = this;
1179
- const position = endpoint.getAttribute(WindowCoveringCluster.id, 'currentPositionLiftPercent100ths', this.log, endpoint);
1793
+ const position = endpoint.getAttribute(WindowCoveringCluster.id, 'currentPositionLiftPercent100ths', this.log, endpoint); // windowCoveringCluster.getCurrentPositionLiftPercent100thsAttribute();
1180
1794
  if (position !== null) {
1181
1795
  await endpoint.setAttribute(WindowCoveringCluster.id, 'targetPositionLiftPercent100ths', position, this.log, endpoint);
1182
1796
  await endpoint.setAttribute(WindowCoveringCluster.id, 'operationalStatus', {
@@ -1187,6 +1801,13 @@ export class MatterbridgeEndpoint extends Endpoint {
1187
1801
  }
1188
1802
  this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths and targetPositionLiftPercent100ths to ${position} and operationalStatus to Stopped.`);
1189
1803
  }
1804
+ /**
1805
+ * Sets the current and target status of a window covering.
1806
+ * @param {number} current - The current position of the window covering.
1807
+ * @param {number} target - The target position of the window covering.
1808
+ * @param {WindowCovering.MovementStatus} status - The movement status of the window covering.
1809
+ * @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
1810
+ */
1190
1811
  async setWindowCoveringCurrentTargetStatus(current, target, status, endpoint) {
1191
1812
  if (!endpoint)
1192
1813
  endpoint = this;
@@ -1199,6 +1820,11 @@ export class MatterbridgeEndpoint extends Endpoint {
1199
1820
  }, this.log, endpoint);
1200
1821
  this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
1201
1822
  }
1823
+ /**
1824
+ * Sets the status of the window covering.
1825
+ * @param {WindowCovering.MovementStatus} status - The movement status to set.
1826
+ * @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
1827
+ */
1202
1828
  async setWindowCoveringStatus(status, endpoint) {
1203
1829
  if (!endpoint)
1204
1830
  endpoint = this;
@@ -1209,6 +1835,12 @@ export class MatterbridgeEndpoint extends Endpoint {
1209
1835
  }, this.log, endpoint);
1210
1836
  this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
1211
1837
  }
1838
+ /**
1839
+ * Retrieves the status of the window covering.
1840
+ * @param {Endpoint} endpoint - The endpoint on which to get the window covering (default the device endpoint).
1841
+ *
1842
+ * @returns The global operational status of the window covering.
1843
+ */
1212
1844
  getWindowCoveringStatus(endpoint) {
1213
1845
  if (!endpoint)
1214
1846
  endpoint = this;
@@ -1216,6 +1848,12 @@ export class MatterbridgeEndpoint extends Endpoint {
1216
1848
  this.log.debug(`Get WindowCovering operationalStatus: ${status.global}`);
1217
1849
  return status.global;
1218
1850
  }
1851
+ /**
1852
+ * Sets the target and current position of the window covering.
1853
+ *
1854
+ * @param position - The position to set, specified as a number.
1855
+ * @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
1856
+ */
1219
1857
  async setWindowCoveringTargetAndCurrentPosition(position, endpoint) {
1220
1858
  if (!endpoint)
1221
1859
  endpoint = this;
@@ -1223,6 +1861,13 @@ export class MatterbridgeEndpoint extends Endpoint {
1223
1861
  await endpoint.setAttribute(WindowCoveringCluster.id, 'targetPositionLiftPercent100ths', position, this.log, endpoint);
1224
1862
  this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${position} and targetPositionLiftPercent100ths: ${position}.`);
1225
1863
  }
1864
+ /**
1865
+ * Get a default door lock cluster server.
1866
+ *
1867
+ * @remarks
1868
+ * This method adds a cluster server for a door lock cluster with default settings.
1869
+ *
1870
+ */
1226
1871
  getDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
1227
1872
  return ClusterServer(DoorLockCluster, {
1228
1873
  operatingMode: DoorLock.OperatingMode.Normal,
@@ -1232,8 +1877,10 @@ export class MatterbridgeEndpoint extends Endpoint {
1232
1877
  supportedOperatingModes: { normal: true, vacation: false, privacy: false, noRemoteLockUnlock: false, passage: false },
1233
1878
  }, {
1234
1879
  lockDoor: async (data) => {
1880
+ // Never called in edge
1235
1881
  },
1236
1882
  unlockDoor: async (data) => {
1883
+ // Never called in edge
1237
1884
  },
1238
1885
  }, {
1239
1886
  doorLockAlarm: true,
@@ -1241,9 +1888,22 @@ export class MatterbridgeEndpoint extends Endpoint {
1241
1888
  lockOperationError: true,
1242
1889
  });
1243
1890
  }
1891
+ /**
1892
+ * Creates a default door lock cluster server.
1893
+ *
1894
+ * @remarks
1895
+ * This method adds a cluster server for a door lock cluster with default settings.
1896
+ *
1897
+ */
1244
1898
  createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
1245
1899
  this.addClusterServer(this.getDefaultDoorLockClusterServer(lockState, lockType));
1246
1900
  }
1901
+ /**
1902
+ * Get a default momentary switch cluster server.
1903
+ *
1904
+ * @remarks
1905
+ * This method adds a cluster server with default momentary switch features and configurations suitable for (AppleHome) Single Double Long automations.
1906
+ */
1247
1907
  getDefaultSwitchClusterServer() {
1248
1908
  return ClusterServer(SwitchCluster.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress), {
1249
1909
  numberOfPositions: 2,
@@ -1258,9 +1918,21 @@ export class MatterbridgeEndpoint extends Endpoint {
1258
1918
  multiPressComplete: true,
1259
1919
  });
1260
1920
  }
1921
+ /**
1922
+ * Creates a default momentary switch cluster server.
1923
+ *
1924
+ * @remarks
1925
+ * This method adds a cluster server with default momentary switch features and configurations.
1926
+ */
1261
1927
  createDefaultSwitchClusterServer() {
1262
1928
  this.addClusterServer(this.getDefaultSwitchClusterServer());
1263
1929
  }
1930
+ /**
1931
+ * Get a default latching switch cluster server.
1932
+ *
1933
+ * @remarks
1934
+ * This method adds a cluster server with default latching switch features and configuration.
1935
+ */
1264
1936
  getDefaultLatchingSwitchClusterServer() {
1265
1937
  return ClusterServer(SwitchCluster.with(Switch.Feature.LatchingSwitch), {
1266
1938
  numberOfPositions: 2,
@@ -1269,9 +1941,22 @@ export class MatterbridgeEndpoint extends Endpoint {
1269
1941
  switchLatched: true,
1270
1942
  });
1271
1943
  }
1944
+ /**
1945
+ * Creates a default latching switch cluster server.
1946
+ *
1947
+ * @remarks
1948
+ * This method adds a cluster server with default latching switch features and configuration.
1949
+ */
1272
1950
  createDefaultLatchingSwitchClusterServer() {
1273
1951
  this.addClusterServer(this.getDefaultLatchingSwitchClusterServer());
1274
1952
  }
1953
+ /**
1954
+ * Triggers a switch event on the specified endpoint.
1955
+ *
1956
+ * @param {string} event - The type of event to trigger. Possible values are 'Single', 'Double', 'Long' for momentarySwitch and 'Press', 'Release' for latchingSwitch.
1957
+ * @param {Endpoint} endpoint - The endpoint on which to trigger the event (default the device endpoint).
1958
+ * @returns {void}
1959
+ */
1275
1960
  async triggerSwitchEvent(event, log, endpoint) {
1276
1961
  if (!endpoint)
1277
1962
  endpoint = this;
@@ -1339,6 +2024,15 @@ export class MatterbridgeEndpoint extends Endpoint {
1339
2024
  }
1340
2025
  return true;
1341
2026
  }
2027
+ /**
2028
+ * Retrieves the default mode select cluster server.
2029
+ *
2030
+ * @param description - The description of the cluster server.
2031
+ * @param supportedModes - The supported modes for the cluster server.
2032
+ * @param currentMode - The current mode of the cluster server. Defaults to 0.
2033
+ * @param startUpMode - The startup mode of the cluster server. Defaults to 0.
2034
+ * @returns The default mode select cluster server.
2035
+ */
1342
2036
  getDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
1343
2037
  return ClusterServer(ModeSelectCluster, {
1344
2038
  description: description,
@@ -1348,14 +2042,30 @@ export class MatterbridgeEndpoint extends Endpoint {
1348
2042
  startUpMode: startUpMode,
1349
2043
  }, {
1350
2044
  changeToMode: async (data) => {
2045
+ // Never called in edge
1351
2046
  },
1352
2047
  });
1353
2048
  }
2049
+ /**
2050
+ * Creates a default mode select cluster server.
2051
+ *
2052
+ * @param description - The description of the cluster server.
2053
+ * @param supportedModes - The supported modes for the cluster server.
2054
+ * @param currentMode - The current mode of the cluster server. Defaults to 0.
2055
+ * @param startUpMode - The startup mode of the cluster server. Defaults to 0.
2056
+ * @param endpoint - The endpoint to add the cluster server to. Defaults to `this` if not provided.
2057
+ *
2058
+ */
1354
2059
  createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0, endpoint) {
1355
2060
  if (!endpoint)
1356
2061
  endpoint = this;
1357
2062
  endpoint.addClusterServer(this.getDefaultModeSelectClusterServer(description, supportedModes, currentMode, startUpMode));
1358
2063
  }
2064
+ /**
2065
+ * Get a default occupancy sensing cluster server.
2066
+ *
2067
+ * @param occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
2068
+ */
1359
2069
  getDefaultOccupancySensingClusterServer(occupied = false) {
1360
2070
  return ClusterServer(OccupancySensingCluster, {
1361
2071
  occupancy: { occupied },
@@ -1364,9 +2074,19 @@ export class MatterbridgeEndpoint extends Endpoint {
1364
2074
  pirOccupiedToUnoccupiedDelay: 30,
1365
2075
  }, {});
1366
2076
  }
2077
+ /**
2078
+ * Creates a default occupancy sensing cluster server.
2079
+ *
2080
+ * @param occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
2081
+ */
1367
2082
  createDefaultOccupancySensingClusterServer(occupied = false) {
1368
2083
  this.addClusterServer(this.getDefaultOccupancySensingClusterServer(occupied));
1369
2084
  }
2085
+ /**
2086
+ * Get a default Illuminance Measurement Cluster Server.
2087
+ *
2088
+ * @param measuredValue - The measured value of illuminance.
2089
+ */
1370
2090
  getDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
1371
2091
  return ClusterServer(IlluminanceMeasurementCluster, {
1372
2092
  measuredValue,
@@ -1375,9 +2095,19 @@ export class MatterbridgeEndpoint extends Endpoint {
1375
2095
  tolerance: 0,
1376
2096
  }, {}, {});
1377
2097
  }
2098
+ /**
2099
+ * Creates a default Illuminance Measurement Cluster Server.
2100
+ *
2101
+ * @param measuredValue - The measured value of illuminance.
2102
+ */
1378
2103
  createDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
1379
2104
  this.addClusterServer(this.getDefaultIlluminanceMeasurementClusterServer(measuredValue));
1380
2105
  }
2106
+ /**
2107
+ * Get a default flow measurement cluster server.
2108
+ *
2109
+ * @param measuredValue - The measured value of the flow in 10 x m/h.
2110
+ */
1381
2111
  getDefaultFlowMeasurementClusterServer(measuredValue = 0) {
1382
2112
  return ClusterServer(FlowMeasurementCluster, {
1383
2113
  measuredValue,
@@ -1386,9 +2116,19 @@ export class MatterbridgeEndpoint extends Endpoint {
1386
2116
  tolerance: 0,
1387
2117
  }, {}, {});
1388
2118
  }
2119
+ /**
2120
+ * Creates a default flow measurement cluster server.
2121
+ *
2122
+ * @param measuredValue - The measured value of the flow in 10 x m/h.
2123
+ */
1389
2124
  createDefaultFlowMeasurementClusterServer(measuredValue = 0) {
1390
2125
  this.addClusterServer(this.getDefaultFlowMeasurementClusterServer(measuredValue));
1391
2126
  }
2127
+ /**
2128
+ * Get a default temperature measurement cluster server.
2129
+ *
2130
+ * @param measuredValue - The measured value of the temperature x 100.
2131
+ */
1392
2132
  getDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
1393
2133
  return ClusterServer(TemperatureMeasurementCluster, {
1394
2134
  measuredValue,
@@ -1397,9 +2137,19 @@ export class MatterbridgeEndpoint extends Endpoint {
1397
2137
  tolerance: 0,
1398
2138
  }, {}, {});
1399
2139
  }
2140
+ /**
2141
+ * Creates a default temperature measurement cluster server.
2142
+ *
2143
+ * @param measuredValue - The measured value of the temperature x 100.
2144
+ */
1400
2145
  createDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
1401
2146
  this.addClusterServer(this.getDefaultTemperatureMeasurementClusterServer(measuredValue));
1402
2147
  }
2148
+ /**
2149
+ * Get a default RelativeHumidityMeasurementCluster server.
2150
+ *
2151
+ * @param measuredValue - The measured value of the relative humidity x 100.
2152
+ */
1403
2153
  getDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
1404
2154
  return ClusterServer(RelativeHumidityMeasurementCluster, {
1405
2155
  measuredValue,
@@ -1408,9 +2158,19 @@ export class MatterbridgeEndpoint extends Endpoint {
1408
2158
  tolerance: 0,
1409
2159
  }, {}, {});
1410
2160
  }
2161
+ /**
2162
+ * Creates a default RelativeHumidityMeasurementCluster server.
2163
+ *
2164
+ * @param measuredValue - The measured value of the relative humidity x 100.
2165
+ */
1411
2166
  createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
1412
2167
  this.addClusterServer(this.getDefaultRelativeHumidityMeasurementClusterServer(measuredValue));
1413
2168
  }
2169
+ /**
2170
+ * Get a default Pressure Measurement Cluster Server.
2171
+ *
2172
+ * @param measuredValue - The measured value for the pressure.
2173
+ */
1414
2174
  getDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
1415
2175
  return ClusterServer(PressureMeasurementCluster, {
1416
2176
  measuredValue,
@@ -1419,19 +2179,39 @@ export class MatterbridgeEndpoint extends Endpoint {
1419
2179
  tolerance: 0,
1420
2180
  }, {}, {});
1421
2181
  }
2182
+ /**
2183
+ * Creates a default Pressure Measurement Cluster Server.
2184
+ *
2185
+ * @param measuredValue - The measured value for the pressure.
2186
+ */
1422
2187
  createDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
1423
2188
  this.addClusterServer(this.getDefaultPressureMeasurementClusterServer(measuredValue));
1424
2189
  }
2190
+ /**
2191
+ * Get a default boolean state cluster server.
2192
+ *
2193
+ * @param contact - Optional boolean value indicating the contact state. Defaults to `true` if not provided.
2194
+ */
1425
2195
  getDefaultBooleanStateClusterServer(contact) {
1426
2196
  return ClusterServer(BooleanStateCluster, {
1427
- stateValue: contact ?? true,
2197
+ stateValue: contact ?? true, // true=contact false=no_contact
1428
2198
  }, {}, {
1429
2199
  stateChange: true,
1430
2200
  });
1431
2201
  }
2202
+ /**
2203
+ * Creates a default boolean state configuration cluster server.
2204
+ *
2205
+ * @param contact - Optional boolean value indicating the contact state. Defaults to `true` if not provided.
2206
+ */
1432
2207
  createDefaultBooleanStateClusterServer(contact) {
1433
2208
  this.addClusterServer(this.getDefaultBooleanStateClusterServer(contact));
1434
2209
  }
2210
+ /**
2211
+ * Get a default boolean state configuration cluster server.
2212
+ *
2213
+ * @param contact - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
2214
+ */
1435
2215
  getDefaultBooleanStateConfigurationClusterServer(sensorFault = false) {
1436
2216
  return ClusterServer(BooleanStateConfigurationCluster.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel), {
1437
2217
  currentSensitivityLevel: 0,
@@ -1440,18 +2220,34 @@ export class MatterbridgeEndpoint extends Endpoint {
1440
2220
  alarmsActive: { visual: false, audible: false },
1441
2221
  alarmsEnabled: { visual: false, audible: false },
1442
2222
  alarmsSupported: { visual: true, audible: true },
2223
+ // alarmsSuppressed: { visual: false, audible: false },
1443
2224
  sensorFault: { generalFault: sensorFault },
1444
2225
  }, {
1445
2226
  enableDisableAlarm: async (data) => {
2227
+ // Never called in edge
1446
2228
  },
1447
2229
  }, {
1448
2230
  alarmsStateChanged: true,
1449
2231
  sensorFault: true,
1450
2232
  });
1451
2233
  }
2234
+ /**
2235
+ * Creates a default boolean state configuration cluster server.
2236
+ *
2237
+ * @param contact - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
2238
+ */
1452
2239
  createDefaultBooleanStateConfigurationClusterServer(sensorFault = false) {
1453
2240
  this.addClusterServer(this.getDefaultBooleanStateConfigurationClusterServer(sensorFault));
1454
2241
  }
2242
+ /**
2243
+ * Get a default power source replaceable battery cluster server.
2244
+ *
2245
+ * @param batPercentRemaining - The remaining battery percentage (default: 100).
2246
+ * @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
2247
+ * @param batVoltage - The battery voltage (default: 1500).
2248
+ * @param batReplacementDescription - The battery replacement description (default: 'Battery type').
2249
+ * @param batQuantity - The battery quantity (default: 1).
2250
+ */
1455
2251
  getDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
1456
2252
  return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
1457
2253
  status: PowerSource.PowerSourceStatus.Active,
@@ -1468,9 +2264,25 @@ export class MatterbridgeEndpoint extends Endpoint {
1468
2264
  endpointList: [],
1469
2265
  }, {}, {});
1470
2266
  }
2267
+ /**
2268
+ * Creates a default power source replaceable battery cluster server.
2269
+ *
2270
+ * @param batPercentRemaining - The remaining battery percentage (default: 100).
2271
+ * @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
2272
+ * @param batVoltage - The battery voltage (default: 1500).
2273
+ * @param batReplacementDescription - The battery replacement description (default: 'Battery type').
2274
+ * @param batQuantity - The battery quantity (default: 1).
2275
+ */
1471
2276
  createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
1472
2277
  this.addClusterServer(this.getDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining, batChargeLevel, batVoltage, batReplacementDescription, batQuantity));
1473
2278
  }
2279
+ /**
2280
+ * Get a default power source rechargeable battery cluster server.
2281
+ *
2282
+ * @param batPercentRemaining - The remaining battery percentage (default: 100).
2283
+ * @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
2284
+ * @param batVoltage - The battery voltage (default: 1500).
2285
+ */
1474
2286
  getDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
1475
2287
  return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
1476
2288
  status: PowerSource.PowerSourceStatus.Active,
@@ -1488,9 +2300,21 @@ export class MatterbridgeEndpoint extends Endpoint {
1488
2300
  endpointList: [],
1489
2301
  }, {}, {});
1490
2302
  }
2303
+ /**
2304
+ * Creates a default power source rechargeable battery cluster server.
2305
+ *
2306
+ * @param batPercentRemaining - The remaining battery percentage (default: 100).
2307
+ * @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
2308
+ * @param batVoltage - The battery voltage (default: 1500).
2309
+ */
1491
2310
  createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
1492
2311
  this.addClusterServer(this.getDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining, batChargeLevel, batVoltage));
1493
2312
  }
2313
+ /**
2314
+ * Get a default power source wired cluster server.
2315
+ *
2316
+ * @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
2317
+ */
1494
2318
  getDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
1495
2319
  return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Wired), {
1496
2320
  wiredCurrentType,
@@ -1500,22 +2324,45 @@ export class MatterbridgeEndpoint extends Endpoint {
1500
2324
  endpointList: [],
1501
2325
  }, {}, {});
1502
2326
  }
2327
+ /**
2328
+ * Creates a default power source wired cluster server.
2329
+ *
2330
+ * @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
2331
+ */
1503
2332
  createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
1504
2333
  this.addClusterServer(this.getDefaultPowerSourceWiredClusterServer(wiredCurrentType));
1505
2334
  }
2335
+ /**
2336
+ * @deprecated This function is deprecated by Matter 1.3 spec and will be removed in a future version.
2337
+ */
1506
2338
  createDefaultPowerSourceConfigurationClusterServer(endpointNumber) {
1507
2339
  this.addClusterServer(ClusterServer(PowerSourceConfigurationCluster, {
1508
2340
  sources: endpointNumber ? [EndpointNumber(endpointNumber)] : [],
1509
2341
  }, {}, {}));
1510
2342
  }
2343
+ /**
2344
+ * Get a default air quality cluster server.
2345
+ *
2346
+ * @param airQuality The air quality type. Defaults to `AirQuality.AirQualityType.Unknown`.
2347
+ */
1511
2348
  getDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
1512
2349
  return ClusterServer(AirQualityCluster.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
1513
2350
  airQuality,
1514
2351
  }, {}, {});
1515
2352
  }
2353
+ /**
2354
+ * Creates a default air quality cluster server.
2355
+ *
2356
+ * @param airQuality The air quality type. Defaults to `AirQuality.AirQualityType.Unknown`.
2357
+ */
1516
2358
  createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
1517
2359
  this.addClusterServer(this.getDefaultAirQualityClusterServer(airQuality));
1518
2360
  }
2361
+ /**
2362
+ * Get a default TVOC measurement cluster server.
2363
+ *
2364
+ * @param measuredValue - The measured value for TVOC.
2365
+ */
1519
2366
  getDefaultTvocMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1520
2367
  return ClusterServer(TotalVolatileOrganicCompoundsConcentrationMeasurementCluster.with('NumericMeasurement'), {
1521
2368
  measuredValue,
@@ -1526,14 +2373,28 @@ export class MatterbridgeEndpoint extends Endpoint {
1526
2373
  measurementMedium,
1527
2374
  }, {}, {});
1528
2375
  }
2376
+ /**
2377
+ * Creates a default TVOC measurement cluster server.
2378
+ *
2379
+ * @param measuredValue - The measured value for TVOC.
2380
+ */
1529
2381
  createDefaultTvocMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1530
2382
  this.addClusterServer(this.getDefaultTvocMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
1531
2383
  }
2384
+ /**
2385
+ * Get a default heating thermostat cluster server with the specified parameters.
2386
+ * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
2387
+ * @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
2388
+ * @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
2389
+ * @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
2390
+ * @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
2391
+ */
1532
2392
  getDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
1533
2393
  return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Heating), {
1534
2394
  localTemperature: localTemperature * 100,
1535
2395
  systemMode: Thermostat.SystemMode.Heat,
1536
2396
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
2397
+ // Thermostat.Feature.Heating
1537
2398
  occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
1538
2399
  minHeatSetpointLimit: minHeatSetpointLimit * 100,
1539
2400
  maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
@@ -1541,17 +2402,35 @@ export class MatterbridgeEndpoint extends Endpoint {
1541
2402
  absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
1542
2403
  }, {
1543
2404
  setpointRaiseLower: async (data) => {
2405
+ // Never called in edge
1544
2406
  },
1545
2407
  }, {});
1546
2408
  }
2409
+ /**
2410
+ * Creates and adds a default heating thermostat cluster server to the device.
2411
+ *
2412
+ * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
2413
+ * @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
2414
+ * @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
2415
+ * @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
2416
+ */
1547
2417
  createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 25, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
1548
2418
  this.addClusterServer(this.getDefaultHeatingThermostatClusterServer(localTemperature, occupiedHeatingSetpoint, minHeatSetpointLimit, maxHeatSetpointLimit));
1549
2419
  }
2420
+ /**
2421
+ * Get a default cooling thermostat cluster server with the specified parameters.
2422
+ * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
2423
+ * @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
2424
+ * @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
2425
+ * @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
2426
+ * @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
2427
+ */
1550
2428
  getDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
1551
2429
  return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Cooling), {
1552
2430
  localTemperature: localTemperature * 100,
1553
2431
  systemMode: Thermostat.SystemMode.Cool,
1554
2432
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
2433
+ // Thermostat.Feature.Cooling
1555
2434
  occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
1556
2435
  minCoolSetpointLimit: minCoolSetpointLimit * 100,
1557
2436
  maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
@@ -1559,37 +2438,82 @@ export class MatterbridgeEndpoint extends Endpoint {
1559
2438
  absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
1560
2439
  }, {
1561
2440
  setpointRaiseLower: async (data) => {
2441
+ // Never called in edge
1562
2442
  },
1563
2443
  }, {});
1564
2444
  }
2445
+ /**
2446
+ * Creates and adds a default cooling thermostat cluster server to the device.
2447
+ *
2448
+ * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
2449
+ * @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
2450
+ * @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
2451
+ * @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
2452
+ */
1565
2453
  createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
1566
2454
  this.addClusterServer(this.getDefaultCoolingThermostatClusterServer(localTemperature, occupiedCoolingSetpoint, minCoolSetpointLimit, maxCoolSetpointLimit));
1567
2455
  }
2456
+ /**
2457
+ * Get a default thermostat cluster server with the specified parameters.
2458
+ *
2459
+ * @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
2460
+ * @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
2461
+ * @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
2462
+ * @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
2463
+ * @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
2464
+ * @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
2465
+ * @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
2466
+ * @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
2467
+ * @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
2468
+ */
1568
2469
  getDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
1569
2470
  return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
1570
2471
  localTemperature: localTemperature * 100,
1571
2472
  systemMode: Thermostat.SystemMode.Auto,
1572
2473
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
2474
+ // Thermostat.Feature.Heating
1573
2475
  occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
1574
2476
  minHeatSetpointLimit: minHeatSetpointLimit * 100,
1575
2477
  maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
1576
2478
  absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
1577
2479
  absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
2480
+ // Thermostat.Feature.Cooling
1578
2481
  occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
1579
2482
  minCoolSetpointLimit: minCoolSetpointLimit * 100,
1580
2483
  maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
1581
2484
  absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
1582
2485
  absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
2486
+ // Thermostat.Feature.AutoMode
1583
2487
  minSetpointDeadBand: minSetpointDeadBand * 100,
1584
2488
  thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
1585
2489
  }, {
1586
2490
  setpointRaiseLower: async (data) => {
2491
+ // Never called in edge
1587
2492
  },
1588
2493
  }, {});
1589
2494
  }
2495
+ /**
2496
+ * Creates and adds a default thermostat cluster server to the device.
2497
+ *
2498
+ * @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
2499
+ * @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
2500
+ * @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
2501
+ * @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
2502
+ * @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
2503
+ * @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
2504
+ * @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
2505
+ * @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
2506
+ */
1590
2507
  createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
1591
2508
  this.addClusterServer(this.getDefaultThermostatClusterServer(localTemperature, occupiedHeatingSetpoint, occupiedCoolingSetpoint, minSetpointDeadBand, minHeatSetpointLimit, maxHeatSetpointLimit, minCoolSetpointLimit, maxCoolSetpointLimit));
1592
2509
  }
2510
+ /**
2511
+ * Returns the default SmokeCOAlarm Cluster Server.
2512
+ *
2513
+ * @param smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
2514
+ * @param coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
2515
+ * @returns The default SmokeCOAlarmClusterServer.
2516
+ */
1593
2517
  getDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
1594
2518
  return ClusterServer(SmokeCoAlarmCluster.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm), {
1595
2519
  smokeState,
@@ -1604,6 +2528,7 @@ export class MatterbridgeEndpoint extends Endpoint {
1604
2528
  interconnectCoAlarm: SmokeCoAlarm.AlarmState.Normal,
1605
2529
  }, {
1606
2530
  selfTestRequest: async (data) => {
2531
+ // Never called in edge
1607
2532
  },
1608
2533
  }, {
1609
2534
  smokeAlarm: true,
@@ -1619,9 +2544,24 @@ export class MatterbridgeEndpoint extends Endpoint {
1619
2544
  allClear: true,
1620
2545
  });
1621
2546
  }
2547
+ /**
2548
+ * Create the default SmokeCOAlarm Cluster Server.
2549
+ *
2550
+ * @param smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
2551
+ * @param coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
2552
+ * @returns The default SmokeCOAlarmClusterServer.
2553
+ */
1622
2554
  createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
1623
2555
  this.addClusterServer(this.getDefaultSmokeCOAlarmClusterServer(smokeState, coState));
1624
2556
  }
2557
+ /**
2558
+ * Returns the default Carbon Monoxide Concentration Measurement Cluster Server.
2559
+ *
2560
+ * @param {number} measuredValue - The measured value of the concentration.
2561
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2562
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2563
+ * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2564
+ */
1625
2565
  getDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1626
2566
  return ClusterServer(CarbonMonoxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
1627
2567
  measuredValue,
@@ -1632,9 +2572,24 @@ export class MatterbridgeEndpoint extends Endpoint {
1632
2572
  measurementMedium,
1633
2573
  }, {}, {});
1634
2574
  }
2575
+ /**
2576
+ * Create the default Carbon Monoxide Concentration Measurement Cluster Server.
2577
+ *
2578
+ * @param {number} measuredValue - The measured value of the concentration.
2579
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2580
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2581
+ */
1635
2582
  createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1636
2583
  this.addClusterServer(this.getDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
1637
2584
  }
2585
+ /**
2586
+ * Returns the default Carbon Dioxide Concentration Measurement Cluster Server.
2587
+ *
2588
+ * @param {number} measuredValue - The measured value of the concentration.
2589
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2590
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2591
+ * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2592
+ */
1638
2593
  getDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1639
2594
  return ClusterServer(CarbonDioxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
1640
2595
  measuredValue,
@@ -1645,9 +2600,24 @@ export class MatterbridgeEndpoint extends Endpoint {
1645
2600
  measurementMedium,
1646
2601
  }, {}, {});
1647
2602
  }
2603
+ /**
2604
+ * Create the default Carbon Dioxide Concentration Measurement Cluster Server.
2605
+ *
2606
+ * @param {number} measuredValue - The measured value of the concentration.
2607
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2608
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2609
+ */
1648
2610
  createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1649
2611
  this.addClusterServer(this.getDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
1650
2612
  }
2613
+ /**
2614
+ * Returns the default Formaldehyde Concentration Measurement Cluster Server.
2615
+ *
2616
+ * @param {number} measuredValue - The measured value of the concentration.
2617
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2618
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2619
+ * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2620
+ */
1651
2621
  getDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1652
2622
  return ClusterServer(FormaldehydeConcentrationMeasurementCluster.with('NumericMeasurement'), {
1653
2623
  measuredValue,
@@ -1658,9 +2628,24 @@ export class MatterbridgeEndpoint extends Endpoint {
1658
2628
  measurementMedium,
1659
2629
  }, {}, {});
1660
2630
  }
2631
+ /**
2632
+ * Create the default Formaldehyde Concentration Measurement Cluster Server.
2633
+ *
2634
+ * @param {number} measuredValue - The measured value of the concentration.
2635
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2636
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2637
+ */
1661
2638
  createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1662
2639
  this.addClusterServer(this.getDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
1663
2640
  }
2641
+ /**
2642
+ * Returns the default Pm1 Concentration Measurement Cluster Server.
2643
+ *
2644
+ * @param {number} measuredValue - The measured value of the concentration.
2645
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2646
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2647
+ * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2648
+ */
1664
2649
  getDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1665
2650
  return ClusterServer(Pm1ConcentrationMeasurementCluster.with('NumericMeasurement'), {
1666
2651
  measuredValue,
@@ -1671,9 +2656,24 @@ export class MatterbridgeEndpoint extends Endpoint {
1671
2656
  measurementMedium,
1672
2657
  }, {}, {});
1673
2658
  }
2659
+ /**
2660
+ * Create the default Pm1 Concentration Measurement Cluster Server.
2661
+ *
2662
+ * @param {number} measuredValue - The measured value of the concentration.
2663
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2664
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2665
+ */
1674
2666
  createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1675
2667
  this.addClusterServer(this.getDefaultPm1ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
1676
2668
  }
2669
+ /**
2670
+ * Returns the default Pm25 Concentration Measurement Cluster Server.
2671
+ *
2672
+ * @param {number} measuredValue - The measured value of the concentration.
2673
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2674
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2675
+ * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2676
+ */
1677
2677
  getDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1678
2678
  return ClusterServer(Pm25ConcentrationMeasurementCluster.with('NumericMeasurement'), {
1679
2679
  measuredValue,
@@ -1684,9 +2684,24 @@ export class MatterbridgeEndpoint extends Endpoint {
1684
2684
  measurementMedium,
1685
2685
  }, {}, {});
1686
2686
  }
2687
+ /**
2688
+ * Create the default Pm25 Concentration Measurement Cluster Server.
2689
+ *
2690
+ * @param {number} measuredValue - The measured value of the concentration.
2691
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2692
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2693
+ */
1687
2694
  createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1688
2695
  this.addClusterServer(this.getDefaultPm25ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
1689
2696
  }
2697
+ /**
2698
+ * Returns the default Pm10 Concentration Measurement Cluster Server.
2699
+ *
2700
+ * @param {number} measuredValue - The measured value of the concentration.
2701
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2702
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2703
+ * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2704
+ */
1690
2705
  getDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1691
2706
  return ClusterServer(Pm10ConcentrationMeasurementCluster.with('NumericMeasurement'), {
1692
2707
  measuredValue,
@@ -1697,9 +2712,24 @@ export class MatterbridgeEndpoint extends Endpoint {
1697
2712
  measurementMedium,
1698
2713
  }, {}, {});
1699
2714
  }
2715
+ /**
2716
+ * Create the default Pm10 Concentration Measurement Cluster Server.
2717
+ *
2718
+ * @param {number} measuredValue - The measured value of the concentration.
2719
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2720
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2721
+ */
1700
2722
  createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1701
2723
  this.addClusterServer(this.getDefaultPm10ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
1702
2724
  }
2725
+ /**
2726
+ * Returns the default Ozone Concentration Measurement Cluster Server.
2727
+ *
2728
+ * @param {number} measuredValue - The measured value of the concentration.
2729
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2730
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2731
+ * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2732
+ */
1703
2733
  getDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1704
2734
  return ClusterServer(OzoneConcentrationMeasurementCluster.with('NumericMeasurement'), {
1705
2735
  measuredValue,
@@ -1710,9 +2740,24 @@ export class MatterbridgeEndpoint extends Endpoint {
1710
2740
  measurementMedium,
1711
2741
  }, {}, {});
1712
2742
  }
2743
+ /**
2744
+ * Create the default Ozone Concentration Measurement Cluster Server.
2745
+ *
2746
+ * @param {number} measuredValue - The measured value of the concentration.
2747
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2748
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2749
+ */
1713
2750
  createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1714
2751
  this.addClusterServer(this.getDefaultOzoneConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
1715
2752
  }
2753
+ /**
2754
+ * Returns the default Radon Concentration Measurement Cluster Server.
2755
+ *
2756
+ * @param {number} measuredValue - The measured value of the concentration.
2757
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2758
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2759
+ * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2760
+ */
1716
2761
  getDefaultRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1717
2762
  return ClusterServer(RadonConcentrationMeasurementCluster.with('NumericMeasurement'), {
1718
2763
  measuredValue,
@@ -1723,9 +2768,24 @@ export class MatterbridgeEndpoint extends Endpoint {
1723
2768
  measurementMedium,
1724
2769
  }, {}, {});
1725
2770
  }
2771
+ /**
2772
+ * Create the default Radon Concentration Measurement Cluster Server.
2773
+ *
2774
+ * @param {number} measuredValue - The measured value of the concentration.
2775
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2776
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2777
+ */
1726
2778
  createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1727
2779
  this.addClusterServer(this.getDefaultRadonConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
1728
2780
  }
2781
+ /**
2782
+ * Returns the default Nitrogen Dioxide Concentration Measurement Cluster Server.
2783
+ *
2784
+ * @param {number} measuredValue - The measured value of the concentration.
2785
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2786
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2787
+ * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2788
+ */
1729
2789
  getDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1730
2790
  return ClusterServer(NitrogenDioxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
1731
2791
  measuredValue,
@@ -1736,9 +2796,22 @@ export class MatterbridgeEndpoint extends Endpoint {
1736
2796
  measurementMedium,
1737
2797
  }, {}, {});
1738
2798
  }
2799
+ /**
2800
+ * Create the default Nitrogen Dioxide Concentration Measurement Cluster Server.
2801
+ *
2802
+ * @param {number} measuredValue - The measured value of the concentration.
2803
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2804
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2805
+ */
1739
2806
  createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1740
2807
  this.addClusterServer(this.getDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
1741
2808
  }
2809
+ /**
2810
+ * Returns the default fan control cluster server rev 2.
2811
+ *
2812
+ * @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
2813
+ * @returns The default fan control cluster server.
2814
+ */
1742
2815
  getDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
1743
2816
  return ClusterServer(FanControlCluster.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
1744
2817
  fanMode,
@@ -1750,12 +2823,25 @@ export class MatterbridgeEndpoint extends Endpoint {
1750
2823
  speedCurrent: 0,
1751
2824
  }, {
1752
2825
  step: async (data) => {
2826
+ // Never called in edge
1753
2827
  },
1754
2828
  }, {});
1755
2829
  }
2830
+ /**
2831
+ * Create the default fan control cluster server rev 2.
2832
+ *
2833
+ * @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
2834
+ * @returns The default fan control cluster server.
2835
+ */
1756
2836
  createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
1757
2837
  this.addClusterServer(this.getDefaultFanControlClusterServer(fanMode));
1758
2838
  }
2839
+ /**
2840
+ * Returns the default Pump Configuration And Control cluster server.
2841
+ *
2842
+ * @param {PumpConfigurationAndControl.OperationMode} [pumpMode=PumpConfigurationAndControl.OperationMode.Normal] - The pump mode to set. Defaults to `PumpConfigurationAndControl.OperationMode.Normal`.
2843
+ * @returns {ClusterServer} - The default Pump Configuration And Control cluster server.
2844
+ */
1759
2845
  getDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
1760
2846
  return ClusterServer(PumpConfigurationAndControlCluster.with(PumpConfigurationAndControl.Feature.ConstantSpeed), {
1761
2847
  minConstSpeed: null,
@@ -1769,9 +2855,22 @@ export class MatterbridgeEndpoint extends Endpoint {
1769
2855
  operationMode: pumpMode,
1770
2856
  }, {}, {});
1771
2857
  }
2858
+ /**
2859
+ * Creates the default Pump Configuration And Control cluster server.
2860
+ *
2861
+ * @param {PumpConfigurationAndControl.OperationMode} [pumpMode=PumpConfigurationAndControl.OperationMode.Normal] - The pump mode to set. Defaults to `PumpConfigurationAndControl.OperationMode.Normal`.
2862
+ * @returns {void}
2863
+ */
1772
2864
  createDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
1773
2865
  this.addClusterServer(this.getDefaultPumpConfigurationAndControlClusterServer(pumpMode));
1774
2866
  }
2867
+ /**
2868
+ * Returns the default Valve Configuration And Control cluster server rev 2.
2869
+ *
2870
+ * @param {ValveConfigurationAndControl.ValveState} [valveState=ValveConfigurationAndControl.ValveState.Closed] - The valve state to set. Defaults to `ValveConfigurationAndControl.ValveState.Closed`.
2871
+ * @param {number} [valveLevel=0] - The valve level to set. Defaults to 0.
2872
+ * @returns {ClusterServer} - The default Valve Configuration And Control cluster server.
2873
+ */
1775
2874
  getDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
1776
2875
  return ClusterServer(ValveConfigurationAndControlCluster.with(ValveConfigurationAndControl.Feature.Level), {
1777
2876
  currentState: valveState,
@@ -1783,12 +2882,22 @@ export class MatterbridgeEndpoint extends Endpoint {
1783
2882
  remainingDuration: null,
1784
2883
  }, {
1785
2884
  open: async (data) => {
2885
+ // Never called in edge
1786
2886
  },
1787
2887
  close: async (data) => {
2888
+ // Never called in edge
1788
2889
  },
1789
2890
  }, {});
1790
2891
  }
2892
+ /**
2893
+ * Create the default Valve Configuration And Control cluster server rev 2.
2894
+ *
2895
+ * @param {ValveConfigurationAndControl.ValveState} [valveState=ValveConfigurationAndControl.ValveState.Closed] - The valve state to set. Defaults to `ValveConfigurationAndControl.ValveState.Closed`.
2896
+ * @param {number} [valveLevel=0] - The valve level to set. Defaults to 0.
2897
+ * @returns {void}
2898
+ */
1791
2899
  createDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
1792
2900
  this.addClusterServer(this.getDefaultValveConfigurationAndControlClusterServer(valveState, valveLevel));
1793
2901
  }
1794
2902
  }
2903
+ //# sourceMappingURL=matterbridgeEndpoint.js.map