matterbridge 1.7.2-dev.7 → 1.7.2

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