matterbridge 1.6.8-dev.8 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/CHANGELOG.md +23 -1
  2. package/README-DOCKER.md +8 -6
  3. package/README-EDGE.md +76 -0
  4. package/README-SERVICE.md +3 -3
  5. package/README.md +6 -3
  6. package/dist/cli.d.ts +25 -0
  7. package/dist/cli.d.ts.map +1 -0
  8. package/dist/cli.js +26 -0
  9. package/dist/cli.js.map +1 -0
  10. package/dist/cluster/export.d.ts +2 -0
  11. package/dist/cluster/export.d.ts.map +1 -0
  12. package/dist/cluster/export.js +2 -0
  13. package/dist/cluster/export.js.map +1 -0
  14. package/dist/defaultConfigSchema.d.ts +27 -0
  15. package/dist/defaultConfigSchema.d.ts.map +1 -0
  16. package/dist/defaultConfigSchema.js +23 -0
  17. package/dist/defaultConfigSchema.js.map +1 -0
  18. package/dist/deviceManager.d.ts +46 -0
  19. package/dist/deviceManager.d.ts.map +1 -0
  20. package/dist/deviceManager.js +26 -1
  21. package/dist/deviceManager.js.map +1 -0
  22. package/dist/index.d.ts +40 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +30 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/logger/export.d.ts +2 -0
  27. package/dist/logger/export.d.ts.map +1 -0
  28. package/dist/logger/export.js +1 -0
  29. package/dist/logger/export.js.map +1 -0
  30. package/dist/matter/export.d.ts +11 -0
  31. package/dist/matter/export.d.ts.map +1 -0
  32. package/dist/matter/export.js +4 -0
  33. package/dist/matter/export.js.map +1 -0
  34. package/dist/matterbridge.d.ts +483 -0
  35. package/dist/matterbridge.d.ts.map +1 -0
  36. package/dist/matterbridge.js +851 -106
  37. package/dist/matterbridge.js.map +1 -0
  38. package/dist/matterbridgeAccessoryPlatform.d.ts +39 -0
  39. package/dist/matterbridgeAccessoryPlatform.d.ts.map +1 -0
  40. package/dist/matterbridgeAccessoryPlatform.js +33 -0
  41. package/dist/matterbridgeAccessoryPlatform.js.map +1 -0
  42. package/dist/matterbridgeBehaviors.d.ts +942 -0
  43. package/dist/matterbridgeBehaviors.d.ts.map +1 -0
  44. package/dist/matterbridgeBehaviors.js +29 -1
  45. package/dist/matterbridgeBehaviors.js.map +1 -0
  46. package/dist/matterbridgeDevice.d.ts +7077 -0
  47. package/dist/matterbridgeDevice.d.ts.map +1 -0
  48. package/dist/matterbridgeDevice.js +996 -9
  49. package/dist/matterbridgeDevice.js.map +1 -0
  50. package/dist/matterbridgeDeviceTypes.d.ts +109 -0
  51. package/dist/matterbridgeDeviceTypes.d.ts.map +1 -0
  52. package/dist/matterbridgeDeviceTypes.js +82 -11
  53. package/dist/matterbridgeDeviceTypes.js.map +1 -0
  54. package/dist/matterbridgeDynamicPlatform.d.ts +39 -0
  55. package/dist/matterbridgeDynamicPlatform.d.ts.map +1 -0
  56. package/dist/matterbridgeDynamicPlatform.js +33 -0
  57. package/dist/matterbridgeDynamicPlatform.js.map +1 -0
  58. package/dist/matterbridgeEdge.d.ts +91 -0
  59. package/dist/matterbridgeEdge.d.ts.map +1 -0
  60. package/dist/matterbridgeEdge.js +558 -11
  61. package/dist/matterbridgeEdge.js.map +1 -0
  62. package/dist/matterbridgeEndpoint.d.ts +10151 -0
  63. package/dist/matterbridgeEndpoint.d.ts.map +1 -0
  64. package/dist/matterbridgeEndpoint.js +1120 -11
  65. package/dist/matterbridgeEndpoint.js.map +1 -0
  66. package/dist/matterbridgePlatform.d.ts +140 -0
  67. package/dist/matterbridgePlatform.d.ts.map +1 -0
  68. package/dist/matterbridgePlatform.js +179 -7
  69. package/dist/matterbridgePlatform.js.map +1 -0
  70. package/dist/matterbridgeTypes.d.ts +169 -0
  71. package/dist/matterbridgeTypes.d.ts.map +1 -0
  72. package/dist/matterbridgeTypes.js +24 -0
  73. package/dist/matterbridgeTypes.js.map +1 -0
  74. package/dist/matterbridgeWebsocket.d.ts +49 -0
  75. package/dist/matterbridgeWebsocket.d.ts.map +1 -0
  76. package/dist/matterbridgeWebsocket.js +139 -17
  77. package/dist/matterbridgeWebsocket.js.map +1 -0
  78. package/dist/pluginManager.d.ts +238 -0
  79. package/dist/pluginManager.d.ts.map +1 -0
  80. package/dist/pluginManager.js +238 -3
  81. package/dist/pluginManager.js.map +1 -0
  82. package/dist/storage/export.d.ts +2 -0
  83. package/dist/storage/export.d.ts.map +1 -0
  84. package/dist/storage/export.js +1 -0
  85. package/dist/storage/export.js.map +1 -0
  86. package/dist/utils/colorUtils.d.ts +61 -0
  87. package/dist/utils/colorUtils.d.ts.map +1 -0
  88. package/dist/utils/colorUtils.js +205 -2
  89. package/dist/utils/colorUtils.js.map +1 -0
  90. package/dist/utils/export.d.ts +3 -0
  91. package/dist/utils/export.d.ts.map +1 -0
  92. package/dist/utils/export.js +1 -0
  93. package/dist/utils/export.js.map +1 -0
  94. package/dist/utils/utils.d.ts +221 -0
  95. package/dist/utils/utils.d.ts.map +1 -0
  96. package/dist/utils/utils.js +252 -7
  97. package/dist/utils/utils.js.map +1 -0
  98. package/frontend/build/asset-manifest.json +6 -6
  99. package/frontend/build/index.html +1 -1
  100. package/frontend/build/static/css/{main.823e08b6.css → main.f1fce054.css} +2 -2
  101. package/frontend/build/static/css/main.f1fce054.css.map +1 -0
  102. package/frontend/build/static/js/{main.4dd7e165.js → main.5caad8c7.js} +15 -15
  103. package/frontend/build/static/js/main.5caad8c7.js.map +1 -0
  104. package/npm-shrinkwrap.json +30 -17
  105. package/package.json +2 -1
  106. package/frontend/build/static/css/main.823e08b6.css.map +0 -1
  107. package/frontend/build/static/js/main.4dd7e165.js.map +0 -1
  108. /package/frontend/build/static/js/{main.4dd7e165.js.LICENSE.txt → main.5caad8c7.js.LICENSE.txt} +0 -0
@@ -1,15 +1,41 @@
1
+ /**
2
+ * This file contains the class MatterbridgeDevice.
3
+ *
4
+ * @file matterbridgeDevice.ts
5
+ * @author Luca Liguori
6
+ * @date 2023-12-29
7
+ * @version 2.0.0
8
+ *
9
+ * Copyright 2023, 2024, 2025 Luca Liguori.
10
+ *
11
+ * Licensed under the Apache License, Version 2.0 (the "License");
12
+ * you may not use this file except in compliance with the License.
13
+ * You may obtain a copy of the License at
14
+ *
15
+ * http://www.apache.org/licenses/LICENSE-2.0
16
+ *
17
+ * Unless required by applicable law or agreed to in writing, software
18
+ * distributed under the License is distributed on an "AS IS" BASIS,
19
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
+ * See the License for the specific language governing permissions and
21
+ * limitations under the License. *
22
+ */
23
+ // @matter
1
24
  import { AirQuality, AirQualityCluster, BasicInformationCluster, BooleanState, BooleanStateCluster, BooleanStateConfiguration, BooleanStateConfigurationCluster, BridgedDeviceBasicInformationCluster, CarbonDioxideConcentrationMeasurement, CarbonDioxideConcentrationMeasurementCluster, CarbonMonoxideConcentrationMeasurement, CarbonMonoxideConcentrationMeasurementCluster, ColorControl, ColorControlCluster, ConcentrationMeasurement, Descriptor, DescriptorCluster, DeviceEnergyManagement, DeviceEnergyManagementCluster, DeviceEnergyManagementMode, DeviceEnergyManagementModeCluster, DoorLock, DoorLockCluster, ElectricalEnergyMeasurement, ElectricalEnergyMeasurementCluster, ElectricalPowerMeasurement, ElectricalPowerMeasurementCluster, FanControl, FanControlCluster, FlowMeasurement, FlowMeasurementCluster, FormaldehydeConcentrationMeasurement, FormaldehydeConcentrationMeasurementCluster, Groups, GroupsCluster, Identify, IdentifyCluster, IlluminanceMeasurement, IlluminanceMeasurementCluster, LevelControl, LevelControlCluster, 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, ThreadNetworkDiagnostics, ThreadNetworkDiagnosticsCluster, TimeSynchronization, TimeSynchronizationCluster, TotalVolatileOrganicCompoundsConcentrationMeasurement, TotalVolatileOrganicCompoundsConcentrationMeasurementCluster, ValveConfigurationAndControl, ValveConfigurationAndControlCluster, WindowCovering, WindowCoveringCluster, } from '@matter/main/clusters';
2
25
  import { Specification } from '@matter/main/model';
3
26
  import { EndpointNumber, extendPublicHandlerMethods, VendorId } from '@matter/main';
4
27
  import { MeasurementType, getClusterNameById } from '@matter/main/types';
28
+ // @project-chip
5
29
  import { Device } from '@project-chip/matter.js/device';
6
30
  import { GroupsClusterHandler, ClusterServer } from '@project-chip/matter.js/cluster';
31
+ // AnsiLogger module
7
32
  import { AnsiLogger, CYAN, YELLOW, db, hk, or, zb, debugStringify } from 'node-ansi-logger';
33
+ // Node.js modules
8
34
  import { createHash } from 'crypto';
9
35
  import { bridgedNode } from './matterbridgeDeviceTypes.js';
10
36
  export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
11
37
  static bridgeMode = '';
12
- static logLevel = "info";
38
+ static logLevel = "info" /* LogLevel.INFO */;
13
39
  log;
14
40
  plugin = undefined;
15
41
  configUrl = undefined;
@@ -24,15 +50,22 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
24
50
  softwareVersionString = undefined;
25
51
  hardwareVersion = undefined;
26
52
  hardwareVersionString = undefined;
53
+ /**
54
+ * Create a Matterbridge device.
55
+ * @constructor
56
+ * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition of the device.
57
+ * @param {EndpointOptions} [options={}] - The options for the device.
58
+ * @param {boolean} [debug=false] - The debug level for the device.
59
+ */
27
60
  constructor(definition, options = {}, debug = false) {
28
61
  let firstDefinition;
29
62
  if (Array.isArray(definition))
30
63
  firstDefinition = definition[0];
31
64
  else
32
65
  firstDefinition = definition;
33
- options.uniqueStorageKey?.replace(/[ .]/g, '');
66
+ options.uniqueStorageKey?.replace(/[ .]/g, ''); // Remove spaces and dots from the uniqueStorageKey to avoid issues with storage converter
34
67
  super(firstDefinition, options);
35
- this.log = new AnsiLogger({ logName: 'MatterbridgeDevice', logTimestampFormat: 4, logLevel: debug === true ? "debug" : MatterbridgeDevice.logLevel });
68
+ this.log = new AnsiLogger({ logName: 'MatterbridgeDevice', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: debug === true ? "debug" /* LogLevel.DEBUG */ : MatterbridgeDevice.logLevel });
36
69
  this.log.debug(`new MatterbridgeDevice with deviceType: ${zb}${firstDefinition.code}${db}-${zb}${firstDefinition.name}${db}`);
37
70
  if (Array.isArray(definition)) {
38
71
  definition.forEach((deviceType) => {
@@ -42,12 +75,28 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
42
75
  else
43
76
  this.addDeviceType(firstDefinition);
44
77
  }
78
+ /**
79
+ * Loads asyncronously an instance of the MatterbridgeDevice class.
80
+ *
81
+ * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition of the device.
82
+ * @param {EndpointOptions} [options={}] - The options for the device.
83
+ * @param {boolean} [debug=false] - The debug level for the device.
84
+ * @returns {Promise<MatterbridgeDevice>} A Promise of MatterbridgeDevice instance.
85
+ */
45
86
  static async loadInstance(definition, options = {}, debug = false) {
46
87
  return new MatterbridgeDevice(definition, options, debug);
47
88
  }
89
+ // Present in new API but not here
48
90
  get maybeNumber() {
49
91
  return this.number;
50
92
  }
93
+ /**
94
+ * Adds a device type to the list of device types of the MatterbridgeDevice endpoint.
95
+ * If the device type is not already present in the list, it will be added.
96
+ *
97
+ * @param {DeviceTypeDefinition} deviceType - The device type to add.
98
+ * @returns {MatterbridgeDevice} The MatterbridgeDevice instance.
99
+ */
51
100
  addDeviceType(deviceType) {
52
101
  const deviceTypes = this.getDeviceTypes();
53
102
  if (!deviceTypes.includes(deviceType)) {
@@ -57,6 +106,13 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
57
106
  }
58
107
  return this;
59
108
  }
109
+ /**
110
+ * Adds one or more device types with the required cluster servers and the specified cluster servers.
111
+ *
112
+ * @param {AtLeastOne<DeviceTypeDefinition>} deviceTypes - The device types to add.
113
+ * @param {ClusterId[]} includeServerList - The list of cluster IDs to include.
114
+ * @returns {MatterbridgeDevice} The MatterbridgeDevice instance.
115
+ */
60
116
  addDeviceTypeWithClusterServer(deviceTypes, includeServerList = []) {
61
117
  this.log.debug('addDeviceTypeWithClusterServer:');
62
118
  deviceTypes.forEach((deviceType) => {
@@ -78,6 +134,22 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
78
134
  this.addClusterServerFromList(this, includeServerList);
79
135
  return this;
80
136
  }
137
+ /**
138
+ * Adds a child endpoint with the specified device types and options.
139
+ * If the child endpoint is not already present, it will be created and added.
140
+ * If the child endpoint is already present, the device types will be added to the existing child endpoint.
141
+ *
142
+ * @param {string} endpointName - The name of the new endpoint to add.
143
+ * @param {AtLeastOne<DeviceTypeDefinition>} deviceTypes - The device types to add.
144
+ * @param {MatterbridgeEndpointOptions} [options={}] - The options for the endpoint.
145
+ * @param {boolean} [debug=false] - Whether to enable debug logging.
146
+ * @returns {MatterbridgeDevice} - The child endpoint that was found or added.
147
+ *
148
+ * @example
149
+ * ```typescript
150
+ * const endpoint = device.addChildDeviceType('Temperature', [temperatureSensor], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
151
+ * ```
152
+ */
81
153
  addChildDeviceType(endpointName, deviceTypes, options = {}, debug = false) {
82
154
  this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
83
155
  let child = this.getChildEndpoints().find((endpoint) => endpoint.uniqueStorageKey === endpointName);
@@ -102,6 +174,23 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
102
174
  child.setDeviceTypes(childDeviceTypes);
103
175
  return child;
104
176
  }
177
+ /**
178
+ * Adds a child endpoint with one or more device types with the required cluster servers and the specified cluster servers.
179
+ * If the child endpoint is not already present in the childEndpoints, it will be added.
180
+ * If the child endpoint is already present in the childEndpoints, the device types and cluster servers will be added to the existing child endpoint.
181
+ *
182
+ * @param {string} endpointName - The name of the new enpoint to add.
183
+ * @param {AtLeastOne<DeviceTypeDefinition>} deviceTypes - The device types to add.
184
+ * @param {ClusterId[]} [includeServerList=[]] - The list of cluster IDs to include.
185
+ * @param {EndpointOptions} [options={}] - The options for the device.
186
+ * @param {boolean} [debug=false] - Whether to enable debug logging.
187
+ * @returns {MatterbridgeDevice} - The child endpoint that was found or added.
188
+ *
189
+ * @example
190
+ * ```typescript
191
+ * const endpoint = device.addChildDeviceTypeWithClusterServer('Temperature', [temperatureSensor], [], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
192
+ * ```
193
+ */
105
194
  addChildDeviceTypeWithClusterServer(endpointName, deviceTypes, includeServerList = [], options = {}, debug = false) {
106
195
  this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
107
196
  let child = this.getChildEndpoints().find((endpoint) => endpoint.uniqueStorageKey === endpointName);
@@ -134,6 +223,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
134
223
  this.addClusterServerFromList(child, includeServerList);
135
224
  return child;
136
225
  }
226
+ /**
227
+ * Adds the required cluster servers (only if they are not present) for the device types of the specified endpoint.
228
+ *
229
+ * @param {Endpoint} endpoint - The endpoint to add the required cluster servers to.
230
+ * @returns {Endpoint} The updated endpoint with the required cluster servers added.
231
+ */
137
232
  addRequiredClusterServers(endpoint) {
138
233
  const requiredServerList = [];
139
234
  this.log.debug(`addRequiredClusterServer for ${CYAN}${endpoint.name}${db}`);
@@ -150,6 +245,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
150
245
  this.addClusterServerFromList(endpoint, requiredServerList);
151
246
  return endpoint;
152
247
  }
248
+ /**
249
+ * Adds the optional cluster servers (only if they are not present) for the device types of the specified endpoint.
250
+ *
251
+ * @param {Endpoint} endpoint - The endpoint to add the required cluster servers to.
252
+ * @returns {Endpoint} The updated endpoint with the required cluster servers added.
253
+ */
153
254
  addOptionalClusterServers(endpoint) {
154
255
  const optionalServerList = [];
155
256
  this.log.debug(`addRequiredClusterServer for ${CYAN}${endpoint.name}${db}`);
@@ -166,11 +267,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
166
267
  this.addClusterServerFromList(endpoint, optionalServerList);
167
268
  return endpoint;
168
269
  }
270
+ /**
271
+ * Adds cluster servers to the specified endpoint based on the provided server list.
272
+ *
273
+ * @param {Endpoint} endpoint - The endpoint to add cluster servers to.
274
+ * @param {ClusterId[]} includeServerList - The list of cluster IDs to include.
275
+ * @returns {Endpoint} The updated endpoint with the cluster servers added.
276
+ */
169
277
  addClusterServerFromList(endpoint, includeServerList) {
170
278
  if (includeServerList.includes(Identify.Cluster.id))
171
279
  endpoint.addClusterServer(this.getDefaultIdentifyClusterServer());
172
280
  if (includeServerList.includes(Groups.Cluster.id))
173
281
  endpoint.addClusterServer(this.getDefaultGroupsClusterServer());
282
+ // if (includeServerList.includes(ScenesManagement.Cluster.id)) endpoint.addClusterServer(this.getDefaultScenesClusterServer());
174
283
  if (includeServerList.includes(OnOff.Cluster.id))
175
284
  endpoint.addClusterServer(this.getDefaultOnOffClusterServer());
176
285
  if (includeServerList.includes(LevelControl.Cluster.id))
@@ -243,9 +352,25 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
243
352
  endpoint.addClusterServer(this.getDefaultDeviceEnergyManagementModeClusterServer());
244
353
  return endpoint;
245
354
  }
355
+ /**
356
+ * Retrieves a child endpoint by its name.
357
+ *
358
+ * @param {string} endpointName - The name of the endpoint to retrieve.
359
+ * @returns {Endpoint | undefined} The child endpoint with the specified name, or undefined if not found.
360
+ */
246
361
  getChildEndpointByName(endpointName) {
247
362
  return this.getChildEndpoints().find((endpoint) => endpoint.uniqueStorageKey === endpointName);
248
363
  }
364
+ /**
365
+ * Retrieves the value of the specified attribute from the given endpoint and cluster.
366
+ *
367
+ * @param {ClusterId} clusterId - The ID of the cluster to retrieve the attribute from.
368
+ * @param {string} attribute - The name of the attribute to retrieve.
369
+ * @param {AnsiLogger} [log] - Optional logger for error and info messages.
370
+ * @param {Endpoint} [endpoint] - Optional the child endpoint to retrieve the attribute from.
371
+ * @returns {any} The value of the attribute, or undefined if the attribute is not found.
372
+ */
373
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
249
374
  getAttribute(clusterId, attribute, log, endpoint) {
250
375
  if (!endpoint)
251
376
  endpoint = this;
@@ -259,15 +384,28 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
259
384
  this.log.error(`getAttribute error: Attribute ${attribute} not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
260
385
  return undefined;
261
386
  }
387
+ // Find the getter method
388
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
262
389
  if (!clusterServer[`get${capitalizedAttributeName}Attribute`]) {
263
390
  this.log.error(`getAttribute error: Getter get${capitalizedAttributeName}Attribute not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
264
391
  return undefined;
265
392
  }
393
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
266
394
  const getter = clusterServer[`get${capitalizedAttributeName}Attribute`];
267
395
  const value = getter();
268
396
  log?.info(`${db}Get endpoint ${or}${endpoint.name}:${endpoint.number}${db} attribute ${hk}${clusterServer.name}.${capitalizedAttributeName}${db} value ${YELLOW}${typeof value === 'object' ? debugStringify(value) : value}${db}`);
269
397
  return value;
270
398
  }
399
+ /**
400
+ * Sets the value of an attribute on a cluster server endpoint.
401
+ *
402
+ * @param {ClusterId} clusterId - The ID of the cluster.
403
+ * @param {string} attribute - The name of the attribute.
404
+ * @param {any} value - The value to set for the attribute.
405
+ * @param {AnsiLogger} [log] - (Optional) The logger to use for logging errors and information.
406
+ * @param {Endpoint} [endpoint] - (Optional) The endpoint to set the attribute on. If not provided, the attribute will be set on the current endpoint.
407
+ */
408
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
271
409
  setAttribute(clusterId, attribute, value, log, endpoint) {
272
410
  if (!endpoint)
273
411
  endpoint = this;
@@ -281,15 +419,21 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
281
419
  this.log.error(`setAttribute error: Attribute ${attribute} not found on Cluster ${clusterId} on endpoint ${endpoint.name}:${endpoint.number}`);
282
420
  return false;
283
421
  }
422
+ // Find the getter method
423
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
284
424
  if (!clusterServer[`get${capitalizedAttributeName}Attribute`]) {
285
425
  this.log.error(`setAttribute error: Getter get${capitalizedAttributeName}Attribute not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
286
426
  return false;
287
427
  }
428
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
288
429
  const getter = clusterServer[`get${capitalizedAttributeName}Attribute`];
430
+ // Find the setter method
431
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
289
432
  if (!clusterServer[`set${capitalizedAttributeName}Attribute`]) {
290
433
  this.log.error(`setAttribute error: Setter set${capitalizedAttributeName}Attribute not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
291
434
  return false;
292
435
  }
436
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
293
437
  const setter = clusterServer[`set${capitalizedAttributeName}Attribute`];
294
438
  const oldValue = getter();
295
439
  setter(value);
@@ -298,6 +442,17 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
298
442
  `to ${YELLOW}${typeof value === 'object' ? debugStringify(value) : value}${db}`);
299
443
  return true;
300
444
  }
445
+ /**
446
+ * Subscribes to an attribute on a cluster.
447
+ *
448
+ * @param {ClusterId} clusterId - The ID of the cluster.
449
+ * @param {string} attribute - The name of the attribute to subscribe to.
450
+ * @param {(newValue: any, oldValue: any) => void} listener - A callback function that will be called when the attribute value changes.
451
+ * @param {AnsiLogger} log - (Optional) An AnsiLogger instance for logging errors and information.
452
+ * @param {Endpoint} endpoint - (Optional) The endpoint to subscribe the attribute on. If not provided, the current endpoint will be used.
453
+ * @returns A boolean indicating whether the subscription was successful.
454
+ */
455
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
301
456
  subscribeAttribute(clusterId, attribute, listener, log, endpoint) {
302
457
  if (!endpoint)
303
458
  endpoint = this;
@@ -311,15 +466,28 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
311
466
  this.log.error(`subscribeAttribute error: Attribute ${attribute} not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
312
467
  return false;
313
468
  }
469
+ // Find the subscribe method
470
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
314
471
  if (!clusterServer[`subscribe${capitalizedAttributeName}Attribute`]) {
315
472
  this.log.error(`subscribeAttribute error: subscribe${capitalizedAttributeName}Attribute not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
316
473
  return false;
317
474
  }
475
+ // Subscribe to the attribute
476
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
318
477
  const subscribe = clusterServer[`subscribe${capitalizedAttributeName}Attribute`];
319
478
  subscribe(listener);
320
479
  log?.info(`${db}Subscribe endpoint ${or}${endpoint.name}:${endpoint.number}${db} attribute ${hk}${clusterServer.name}.${capitalizedAttributeName}${db}`);
321
480
  return true;
322
481
  }
482
+ /**
483
+ * Triggers the specified event of the specified cluster from the given endpoint and cluster.
484
+ *
485
+ * @param {ClusterId} clusterId - The ID of the cluster to retrieve the event from.
486
+ * @param {string} event - The name of the event to trigger.
487
+ * @param {Record<string, any>} payload - The payload of the event to trigger.
488
+ * @param {AnsiLogger} [log] - Optional logger for error and info messages.
489
+ * @param {Endpoint} [endpoint] - Optional the child endpoint to retrieve the event from.
490
+ */
323
491
  triggerEvent(clusterId, event, payload, log, endpoint) {
324
492
  if (!endpoint)
325
493
  endpoint = this;
@@ -335,20 +503,43 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
335
503
  this.log.error(`triggerEvent error: Event ${event} not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
336
504
  return;
337
505
  }
506
+ // Find the getter method
507
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
338
508
  if (!clusterServer[`trigger${capitalizedEventName}Event`]) {
339
509
  this.log.error(`triggerEvent error: Trigger trigger${capitalizedEventName}Event not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
340
510
  return;
341
511
  }
512
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
342
513
  const trigger = clusterServer[`trigger${capitalizedEventName}Event`];
343
514
  trigger(payload);
344
515
  log?.info(`${db}Trigger event ${hk}${clusterServer.name}.${capitalizedEventName}${db} on endpoint ${or}${endpoint.name}:${endpoint.number}${db}`);
345
516
  }
517
+ /**
518
+ * Adds a tag to the tag list of the specified endpoint.
519
+ *
520
+ * @param {Endpoint} endpoint - The endpoint to add the tag to.
521
+ * @param {VendorId | null} mfgCode - The manufacturer code.
522
+ * @param {number} namespaceId - The namespace ID of the tag.
523
+ * @param {number} tag - The tag number.
524
+ * @param {string | null} [label=null] - The label for the tag.
525
+ *
526
+ * @remarks
527
+ * This method is used to add a tag to the tag list of a given endpoint.
528
+ * If the tag list already exists, the new tag is added to the existing list. Otherwise, a new tag list is created with the provided tag.
529
+ *
530
+ * Example usage:
531
+ * ```typescript
532
+ * this.addTagList(endpoint, null, NumberTag.One.namespaceId, NumberTag.One.tag, 'Label');
533
+ * this.addTagList(endpoint, null, SwitchesTag.Custom.namespaceId, SwitchesTag.Custom.tag, 'Label');
534
+ * ```
535
+ */
346
536
  addTagList(endpoint, mfgCode, namespaceId, tag, label) {
347
537
  const descriptor = endpoint.getClusterServer(DescriptorCluster.with(Descriptor.Feature.TagList));
348
538
  if (!descriptor) {
349
539
  this.log.error(`addTagList: descriptor cluster not found on endpoint ${endpoint.name}:${endpoint.number}`);
350
540
  return;
351
541
  }
542
+ // tagList: { mfgCode: VendorId | null; namespaceId: number; tag: number; label?: string | null }[] = [];
352
543
  if (descriptor.attributes.tagList) {
353
544
  this.log.debug(`addTagList: adding ${CYAN}tagList${db} mfCode: ${mfgCode}, namespaceId: ${namespaceId}, tag: ${tag}, label: ${label} on endpoint ${endpoint.name}:${endpoint.number}`);
354
545
  const tagList = descriptor.attributes.tagList.getLocal();
@@ -364,6 +555,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
364
555
  partsList: [...descriptor.attributes.partsList.getLocal()],
365
556
  }, {}, {}));
366
557
  }
558
+ /**
559
+ * Serializes the Matterbridge device into a serialized object.
560
+ *
561
+ * @param pluginName - The name of the plugin.
562
+ * @returns The serialized Matterbridge device object.
563
+ */
367
564
  serialize() {
368
565
  if (!this.serialNumber || !this.deviceName || !this.uniqueId)
369
566
  return;
@@ -388,6 +585,11 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
388
585
  });
389
586
  return serialized;
390
587
  }
588
+ /**
589
+ * Deserializes the device into a serialized object.
590
+ *
591
+ * @returns The deserialized MatterbridgeDevice.
592
+ */
391
593
  static deserialize(serializedDevice) {
392
594
  const device = new MatterbridgeDevice(serializedDevice.deviceTypes);
393
595
  device.serialNumber = serializedDevice.serialNumber;
@@ -403,6 +605,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
403
605
  }
404
606
  return device;
405
607
  }
608
+ /**
609
+ * Get a default IdentifyCluster server.
610
+ */
406
611
  getDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
407
612
  return ClusterServer(IdentifyCluster, {
408
613
  identifyTime,
@@ -418,31 +623,91 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
418
623
  },
419
624
  });
420
625
  }
626
+ /**
627
+ * Creates a default IdentifyCluster server.
628
+ */
421
629
  createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
422
630
  this.addClusterServer(this.getDefaultIdentifyClusterServer(identifyTime, identifyType));
423
631
  return this;
424
632
  }
633
+ /**
634
+ * Get a default IdentifyCluster server.
635
+ */
425
636
  getDefaultGroupsClusterServer() {
426
637
  return ClusterServer(GroupsCluster, {
427
638
  nameSupport: {
428
639
  nameSupport: true,
429
640
  },
430
641
  }, GroupsClusterHandler());
642
+ // return createDefaultGroupsClusterServer();
431
643
  }
644
+ /**
645
+ * Creates a default groups cluster server and adds it to the device.
646
+ */
432
647
  createDefaultGroupsClusterServer() {
433
648
  this.addClusterServer(this.getDefaultGroupsClusterServer());
434
649
  return this;
435
650
  }
651
+ /**
652
+ * Get a default scenes cluster server and adds it to the current instance.
653
+ * @deprecated This method is deprecated.
654
+ *
655
+ */
436
656
  getDefaultScenesClusterServer() {
437
- }
657
+ /*
658
+ return ClusterServer(
659
+ ScenesCluster,
660
+ {
661
+ sceneCount: 0,
662
+ currentScene: 0,
663
+ currentGroup: GroupId(0),
664
+ sceneValid: false,
665
+ nameSupport: {
666
+ nameSupport: true,
667
+ },
668
+ lastConfiguredBy: null,
669
+ },
670
+ {},
671
+ );
672
+ */
673
+ }
674
+ /**
675
+ * Creates a default scenes cluster server and adds it to the current instance.
676
+ * @deprecated This method is deprecated.
677
+ */
438
678
  createDefaultScenesClusterServer() {
679
+ /*
680
+ this.addClusterServer(this.getDefaultScenesClusterServer());
681
+ */
439
682
  return this;
440
683
  }
684
+ /**
685
+ * Creates a unique identifier based on the provided parameters.
686
+ * @param param1 - The first parameter.
687
+ * @param param2 - The second parameter.
688
+ * @param param3 - The third parameter.
689
+ * @param param4 - The fourth parameter.
690
+ * @returns A unique identifier generated using the MD5 hash algorithm.
691
+ */
441
692
  createUniqueId(param1, param2, param3, param4) {
442
693
  const hash = createHash('md5');
443
694
  hash.update(param1 + param2 + param3 + param4);
444
695
  return hash.digest('hex');
445
696
  }
697
+ /**
698
+ * Get a default Basic Information Cluster Server.
699
+ *
700
+ * @param deviceName - The name of the device.
701
+ * @param serialNumber - The serial number of the device.
702
+ * @param vendorId - The vendor ID of the device.
703
+ * @param vendorName - The vendor name of the device.
704
+ * @param productId - The product ID of the device.
705
+ * @param productName - The product name of the device.
706
+ * @param softwareVersion - The software version of the device. Default is 1.
707
+ * @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
708
+ * @param hardwareVersion - The hardware version of the device. Default is 1.
709
+ * @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
710
+ */
446
711
  getDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
447
712
  this.log.logName = deviceName;
448
713
  this.deviceName = deviceName;
@@ -483,6 +748,20 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
483
748
  reachableChanged: true,
484
749
  });
485
750
  }
751
+ /**
752
+ * Creates a default Basic Information Cluster Server.
753
+ *
754
+ * @param deviceName - The name of the device.
755
+ * @param serialNumber - The serial number of the device.
756
+ * @param vendorId - The vendor ID of the device.
757
+ * @param vendorName - The vendor name of the device.
758
+ * @param productId - The product ID of the device.
759
+ * @param productName - The product name of the device.
760
+ * @param softwareVersion - The software version of the device. Default is 1.
761
+ * @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
762
+ * @param hardwareVersion - The hardware version of the device. Default is 1.
763
+ * @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
764
+ */
486
765
  createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
487
766
  if (MatterbridgeDevice.bridgeMode === 'bridge') {
488
767
  this.addDeviceType(bridgedNode);
@@ -492,6 +771,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
492
771
  this.addClusterServer(this.getDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion, softwareVersionString, hardwareVersion, hardwareVersionString));
493
772
  return this;
494
773
  }
774
+ /**
775
+ * Get a default BridgedDeviceBasicInformationClusterServer.
776
+ *
777
+ * @param deviceName - The name of the device.
778
+ * @param serialNumber - The serial number of the device.
779
+ * @param vendorId - The vendor ID of the device.
780
+ * @param vendorName - The name of the vendor.
781
+ * @param productName - The name of the product.
782
+ * @param softwareVersion - The software version of the device. Default is 1.
783
+ * @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
784
+ * @param hardwareVersion - The hardware version of the device. Default is 1.
785
+ * @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
786
+ */
495
787
  getDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
496
788
  this.log.logName = deviceName;
497
789
  this.deviceName = deviceName;
@@ -506,7 +798,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
506
798
  this.hardwareVersion = hardwareVersion;
507
799
  this.hardwareVersionString = hardwareVersionString;
508
800
  return ClusterServer(BridgedDeviceBasicInformationCluster, {
509
- vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
801
+ vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined, // 4874
510
802
  vendorName: vendorName.slice(0, 32),
511
803
  productName: productName.slice(0, 32),
512
804
  productUrl: 'https://www.npmjs.com/package/matterbridge',
@@ -526,13 +818,37 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
526
818
  reachableChanged: true,
527
819
  });
528
820
  }
821
+ /**
822
+ * Creates a default BridgedDeviceBasicInformationClusterServer.
823
+ *
824
+ * @param deviceName - The name of the device.
825
+ * @param serialNumber - The serial number of the device.
826
+ * @param vendorId - The vendor ID of the device.
827
+ * @param vendorName - The name of the vendor.
828
+ * @param productName - The name of the product.
829
+ * @param softwareVersion - The software version of the device. Default is 1.
830
+ * @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
831
+ * @param hardwareVersion - The hardware version of the device. Default is 1.
832
+ * @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
833
+ */
529
834
  createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
530
835
  this.addClusterServer(this.getDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion, softwareVersionString, hardwareVersion, hardwareVersionString));
531
836
  return this;
532
837
  }
838
+ /**
839
+ * Get a default Power Topology Cluster Server.
840
+ *
841
+ * @returns {ClusterServer} - The configured Power Topology Cluster Server.
842
+ */
533
843
  getDefaultPowerTopologyClusterServer() {
534
844
  return ClusterServer(PowerTopologyCluster.with(PowerTopology.Feature.TreeTopology), {}, {}, {});
535
845
  }
846
+ /**
847
+ * Get a default Electrical Energy Measurement Cluster Server.
848
+ *
849
+ * @param {number} energy - The total consumption value in mW/h.
850
+ * @returns {ClusterServer} - The configured Electrical Energy Measurement Cluster Server.
851
+ */
536
852
  getDefaultElectricalEnergyMeasurementClusterServer(energy = null) {
537
853
  return ClusterServer(ElectricalEnergyMeasurementCluster.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
538
854
  accuracy: {
@@ -549,6 +865,15 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
549
865
  cumulativeEnergyMeasured: true,
550
866
  });
551
867
  }
868
+ /**
869
+ * Get a default Electrical Power Measurement Cluster Server.
870
+ *
871
+ * @param {number} voltage - The voltage value in millivolts.
872
+ * @param {number} current - The current value in milliamperes.
873
+ * @param {number} power - The power value in milliwatts.
874
+ * @param {number} frequency - The frequency value in millihertz.
875
+ * @returns {ClusterServer} - The configured Electrical Power Measurement Cluster Server.
876
+ */
552
877
  getDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
553
878
  return ClusterServer(ElectricalPowerMeasurementCluster.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
554
879
  powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
@@ -589,6 +914,15 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
589
914
  frequency: frequency,
590
915
  }, {}, {});
591
916
  }
917
+ /**
918
+ * Creates a default Dummy Thread Network Diagnostics Cluster server.
919
+ * @deprecated This method is deprecated and is only used for testing.
920
+ *
921
+ * @remarks
922
+ * This method adds a cluster server used only to give the networkName to Eve app.
923
+ *
924
+ * @returns void
925
+ */
592
926
  createDefaultDummyThreadNetworkDiagnosticsClusterServer() {
593
927
  this.addClusterServer(ClusterServer(ThreadNetworkDiagnosticsCluster.with(ThreadNetworkDiagnostics.Feature.PacketCounts, ThreadNetworkDiagnostics.Feature.ErrorCounts), {
594
928
  channel: 1,
@@ -616,6 +950,17 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
616
950
  },
617
951
  }, {}));
618
952
  }
953
+ /**
954
+ * Get a default OnOff cluster server for light devices.
955
+ *
956
+ * @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
957
+ * @param {boolean} [globalSceneControl=false] - The global scene control state.
958
+ * @param {number} [onTime=0] - The on time value.
959
+ * @param {number} [offWaitTime=0] - The off wait time value.
960
+ * @param {OnOff.StartUpOnOff | null} [startUpOnOff=null] - The start-up OnOff state. Null means previous state.
961
+ *
962
+ * @returns {ClusterServer} - The configured OnOff cluster server.
963
+ */
619
964
  getDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
620
965
  return ClusterServer(OnOffCluster.with(OnOff.Feature.Lighting), {
621
966
  onOff,
@@ -650,10 +995,26 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
650
995
  },
651
996
  }, {});
652
997
  }
998
+ /**
999
+ * Creates a default OnOff cluster server for light devices.
1000
+ *
1001
+ * @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
1002
+ * @param {boolean} [globalSceneControl=false] - The global scene control state.
1003
+ * @param {number} [onTime=0] - The on time value.
1004
+ * @param {number} [offWaitTime=0] - The off wait time value.
1005
+ * @param {OnOff.StartUpOnOff | null} [startUpOnOff=null] - The start-up OnOff state. Null means previous state.
1006
+ */
653
1007
  createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
654
1008
  this.addClusterServer(this.getDefaultOnOffClusterServer(onOff, globalSceneControl, onTime, offWaitTime, startUpOnOff));
655
1009
  return this;
656
1010
  }
1011
+ /**
1012
+ * Get a DeadFront OnOff cluster server.
1013
+ *
1014
+ * @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
1015
+ *
1016
+ * @returns {ClusterServer} - The configured OnOff cluster server.
1017
+ */
657
1018
  getDeadFrontOnOffClusterServer(onOff = false) {
658
1019
  return ClusterServer(OnOffCluster.with(OnOff.Feature.DeadFrontBehavior), {
659
1020
  onOff,
@@ -672,10 +1033,22 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
672
1033
  },
673
1034
  }, {});
674
1035
  }
1036
+ /**
1037
+ * Creates a DeadFront OnOff cluster server.
1038
+ *
1039
+ * @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
1040
+ */
675
1041
  createDeadFrontOnOffClusterServer(onOff = false) {
676
1042
  this.addClusterServer(this.getDeadFrontOnOffClusterServer(onOff));
677
1043
  return this;
678
1044
  }
1045
+ /**
1046
+ * Get an OnOff cluster server without features.
1047
+ *
1048
+ * @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
1049
+ *
1050
+ * @returns {ClusterServer} - The configured OnOff cluster server.
1051
+ */
679
1052
  getOnOffClusterServer(onOff = false) {
680
1053
  return ClusterServer(OnOffCluster, {
681
1054
  onOff,
@@ -694,10 +1067,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
694
1067
  },
695
1068
  }, {});
696
1069
  }
1070
+ /**
1071
+ * Creates an OnOff cluster server without features.
1072
+ *
1073
+ * @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
1074
+ */
697
1075
  createOnOffClusterServer(onOff = false) {
698
1076
  this.addClusterServer(this.getOnOffClusterServer(onOff));
699
1077
  return this;
700
1078
  }
1079
+ /**
1080
+ * Get a default level control cluster server.
1081
+ *
1082
+ * @param currentLevel - The current level (default: 254).
1083
+ * @param minLevel - The minimum level (default: 1).
1084
+ * @param maxLevel - The maximum level (default: 254).
1085
+ * @param onLevel - The on level (default: null).
1086
+ * @param startUpCurrentLevel - The startUp on level (default: null).
1087
+ */
701
1088
  getDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
702
1089
  return ClusterServer(LevelControlCluster.with(LevelControl.Feature.OnOff, LevelControl.Feature.Lighting), {
703
1090
  currentLevel,
@@ -739,10 +1126,30 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
739
1126
  },
740
1127
  });
741
1128
  }
1129
+ /**
1130
+ * Creates a default level control cluster server.
1131
+ *
1132
+ * @param currentLevel - The current level (default: 254).
1133
+ * @param minLevel - The minimum level (default: 1).
1134
+ * @param maxLevel - The maximum level (default: 254).
1135
+ * @param onLevel - The on level (default: null).
1136
+ * @param startUpCurrentLevel - The startUp on level (default: null).
1137
+ */
742
1138
  createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
743
1139
  this.addClusterServer(this.getDefaultLevelControlClusterServer(currentLevel, minLevel, maxLevel, onLevel, startUpCurrentLevel));
744
1140
  return this;
745
1141
  }
1142
+ /**
1143
+ * Get a default color control cluster server with Xy, HueSaturation and ColorTemperature.
1144
+ *
1145
+ * @param currentX - The current X value.
1146
+ * @param currentY - The current Y value.
1147
+ * @param currentHue - The current hue value.
1148
+ * @param currentSaturation - The current saturation value.
1149
+ * @param colorTemperatureMireds - The color temperature in mireds.
1150
+ * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1151
+ * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1152
+ */
746
1153
  getDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
747
1154
  return ClusterServer(ColorControlCluster.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
748
1155
  colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
@@ -812,10 +1219,30 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
812
1219
  },
813
1220
  }, {});
814
1221
  }
1222
+ /**
1223
+ * Creates a default color control cluster server with Xy, HueSaturation and ColorTemperature.
1224
+ *
1225
+ * @param currentX - The current X value.
1226
+ * @param currentY - The current Y value.
1227
+ * @param currentHue - The current hue value.
1228
+ * @param currentSaturation - The current saturation value.
1229
+ * @param colorTemperatureMireds - The color temperature in mireds.
1230
+ * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1231
+ * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1232
+ */
815
1233
  createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
816
1234
  this.addClusterServer(this.getDefaultColorControlClusterServer(currentX, currentY, currentHue, currentSaturation, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
817
1235
  return this;
818
1236
  }
1237
+ /**
1238
+ * Get a Xy color control cluster server with Xy and ColorTemperature.
1239
+ *
1240
+ * @param currentX - The current X value.
1241
+ * @param currentY - The current Y value.
1242
+ * @param colorTemperatureMireds - The color temperature in mireds.
1243
+ * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1244
+ * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1245
+ */
819
1246
  getXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
820
1247
  return ClusterServer(ColorControlCluster.with(ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature), {
821
1248
  colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
@@ -859,10 +1286,28 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
859
1286
  },
860
1287
  }, {});
861
1288
  }
1289
+ /**
1290
+ * Creates a Xy color control cluster server with Xy and ColorTemperature.
1291
+ *
1292
+ * @param currentX - The current X value.
1293
+ * @param currentY - The current Y value.
1294
+ * @param colorTemperatureMireds - The color temperature in mireds.
1295
+ * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1296
+ * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1297
+ */
862
1298
  createXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
863
1299
  this.addClusterServer(this.getXyColorControlClusterServer(currentX, currentY, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
864
1300
  return this;
865
1301
  }
1302
+ /**
1303
+ * Get a default hue and saturation control cluster server with HueSaturation and ColorTemperature.
1304
+ *
1305
+ * @param currentHue - The current hue value.
1306
+ * @param currentSaturation - The current saturation value.
1307
+ * @param colorTemperatureMireds - The color temperature in mireds.
1308
+ * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1309
+ * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1310
+ */
866
1311
  getHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
867
1312
  return ClusterServer(ColorControlCluster.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
868
1313
  colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
@@ -920,10 +1365,26 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
920
1365
  },
921
1366
  }, {});
922
1367
  }
1368
+ /**
1369
+ * Creates a hue and saturation color control cluster server with HueSaturation and ColorTemperature.
1370
+ *
1371
+ * @param currentHue - The current hue value.
1372
+ * @param currentSaturation - The current saturation value.
1373
+ * @param colorTemperatureMireds - The color temperature in mireds.
1374
+ * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1375
+ * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1376
+ */
923
1377
  createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
924
1378
  this.addClusterServer(this.getHsColorControlClusterServer(currentHue, currentSaturation, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
925
1379
  return this;
926
1380
  }
1381
+ /**
1382
+ * Get a color temperature color control cluster server.
1383
+ *
1384
+ * @param colorTemperatureMireds - The color temperature in mireds.
1385
+ * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1386
+ * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1387
+ */
927
1388
  getCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
928
1389
  return ClusterServer(ColorControlCluster.with(ColorControl.Feature.ColorTemperature), {
929
1390
  colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
@@ -955,10 +1416,31 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
955
1416
  },
956
1417
  }, {});
957
1418
  }
1419
+ /**
1420
+ * Creates a color temperature color control cluster server.
1421
+ *
1422
+ * @param colorTemperatureMireds - The color temperature in mireds.
1423
+ * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1424
+ * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1425
+ */
958
1426
  createCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
959
1427
  this.addClusterServer(this.getCtColorControlClusterServer(colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
960
1428
  return this;
961
1429
  }
1430
+ /**
1431
+ * Configures the color control cluster for a device.
1432
+ *
1433
+ * @remark This method must be called only after creating the cluster with getDefaultCompleteColorControlClusterServer or createDefaultCompleteColorControlClusterServer
1434
+ * and before starting the matter server.
1435
+ *
1436
+ * @deprecated Use configureColorControlMode instead.
1437
+ *
1438
+ * @param {boolean} hueSaturation - A boolean indicating whether the device supports hue and saturation control.
1439
+ * @param {boolean} xy - A boolean indicating whether the device supports XY control.
1440
+ * @param {boolean} colorTemperature - A boolean indicating whether the device supports color temperature control.
1441
+ * @param {ColorControl.ColorMode} colorMode - An optional parameter specifying the color mode of the device.
1442
+ * @param {Endpoint} endpoint - An optional parameter specifying the endpoint to configure. If not provided, the device endpoint will be used.
1443
+ */
962
1444
  configureColorControlCluster(hueSaturation, xy, colorTemperature, colorMode, endpoint) {
963
1445
  if (!endpoint)
964
1446
  endpoint = this;
@@ -970,6 +1452,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
970
1452
  }
971
1453
  return this;
972
1454
  }
1455
+ /**
1456
+ * Configures the color control mode for the device.
1457
+ *
1458
+ * @param {ColorControl.ColorMode} colorMode - The color mode to set.
1459
+ * @param {Endpoint} endpoint - The optional endpoint to configure. If not provided, the method will configure the current endpoint.
1460
+ */
973
1461
  configureColorControlMode(colorMode, endpoint) {
974
1462
  if (!endpoint)
975
1463
  endpoint = this;
@@ -979,8 +1467,13 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
979
1467
  }
980
1468
  return this;
981
1469
  }
1470
+ /**
1471
+ * Get a default window covering cluster server.
1472
+ *
1473
+ * @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0.
1474
+ */
982
1475
  getDefaultWindowCoveringClusterServer(positionPercent100ths) {
983
- return ClusterServer(WindowCoveringCluster.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
1476
+ return ClusterServer(WindowCoveringCluster.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift /* , WindowCovering.Feature.AbsolutePosition*/), {
984
1477
  type: WindowCovering.WindowCoveringType.Rollershade,
985
1478
  configStatus: {
986
1479
  operational: true,
@@ -994,8 +1487,10 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
994
1487
  operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
995
1488
  endProductType: WindowCovering.EndProductType.RollerShade,
996
1489
  mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
997
- targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
998
- currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
1490
+ targetPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
1491
+ currentPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
1492
+ // installedClosedLimitLift: 10000,
1493
+ // installedOpenLimitLift: 0,
999
1494
  }, {
1000
1495
  upOrOpen: async (data) => {
1001
1496
  this.log.debug('Matter command: upOrOpen');
@@ -1016,9 +1511,18 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1016
1511
  },
1017
1512
  }, {});
1018
1513
  }
1514
+ /**
1515
+ * Creates a default window covering cluster server.
1516
+ *
1517
+ * @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0.
1518
+ */
1019
1519
  createDefaultWindowCoveringClusterServer(positionPercent100ths) {
1020
1520
  this.addClusterServer(this.getDefaultWindowCoveringClusterServer(positionPercent100ths));
1021
1521
  }
1522
+ /**
1523
+ * Sets the window covering target position as the current position and stops the movement.
1524
+ * @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
1525
+ */
1022
1526
  setWindowCoveringTargetAsCurrentAndStopped(endpoint) {
1023
1527
  if (!endpoint)
1024
1528
  endpoint = this;
@@ -1036,6 +1540,13 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1036
1540
  this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths and targetPositionLiftPercent100ths to ${position} and operationalStatus to Stopped.`);
1037
1541
  }
1038
1542
  }
1543
+ /**
1544
+ * Sets the current and target status of a window covering.
1545
+ * @param {number} current - The current position of the window covering.
1546
+ * @param {number} target - The target position of the window covering.
1547
+ * @param {WindowCovering.MovementStatus} status - The movement status of the window covering.
1548
+ * @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
1549
+ */
1039
1550
  setWindowCoveringCurrentTargetStatus(current, target, status, endpoint) {
1040
1551
  if (!endpoint)
1041
1552
  endpoint = this;
@@ -1051,6 +1562,11 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1051
1562
  }
1052
1563
  this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
1053
1564
  }
1565
+ /**
1566
+ * Sets the status of the window covering.
1567
+ * @param {WindowCovering.MovementStatus} status - The movement status to set.
1568
+ * @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
1569
+ */
1054
1570
  setWindowCoveringStatus(status, endpoint) {
1055
1571
  if (!endpoint)
1056
1572
  endpoint = this;
@@ -1060,6 +1576,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1060
1576
  windowCovering.setOperationalStatusAttribute({ global: status, lift: status, tilt: status });
1061
1577
  this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
1062
1578
  }
1579
+ /**
1580
+ * Retrieves the status of the window covering.
1581
+ * @param {Endpoint} endpoint - The endpoint on which to get the window covering (default the device endpoint).
1582
+ *
1583
+ * @returns The global operational status of the window covering.
1584
+ */
1063
1585
  getWindowCoveringStatus(endpoint) {
1064
1586
  if (!endpoint)
1065
1587
  endpoint = this;
@@ -1070,6 +1592,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1070
1592
  this.log.debug(`Get WindowCovering operationalStatus: ${status.global}`);
1071
1593
  return status.global;
1072
1594
  }
1595
+ /**
1596
+ * Sets the target and current position of the window covering.
1597
+ *
1598
+ * @param position - The position to set, specified as a number.
1599
+ * @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
1600
+ */
1073
1601
  setWindowCoveringTargetAndCurrentPosition(position, endpoint) {
1074
1602
  if (!endpoint)
1075
1603
  endpoint = this;
@@ -1080,6 +1608,13 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1080
1608
  windowCovering.setTargetPositionLiftPercent100thsAttribute(position);
1081
1609
  this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${position} and targetPositionLiftPercent100ths: ${position}.`);
1082
1610
  }
1611
+ /**
1612
+ * Get a default door lock cluster server.
1613
+ *
1614
+ * @remarks
1615
+ * This method adds a cluster server for a door lock cluster with default settings.
1616
+ *
1617
+ */
1083
1618
  getDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
1084
1619
  return ClusterServer(DoorLockCluster, {
1085
1620
  operatingMode: DoorLock.OperatingMode.Normal,
@@ -1102,9 +1637,22 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1102
1637
  lockOperationError: true,
1103
1638
  });
1104
1639
  }
1640
+ /**
1641
+ * Creates a default door lock cluster server.
1642
+ *
1643
+ * @remarks
1644
+ * This method adds a cluster server for a door lock cluster with default settings.
1645
+ *
1646
+ */
1105
1647
  createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
1106
1648
  this.addClusterServer(this.getDefaultDoorLockClusterServer(lockState, lockType));
1107
1649
  }
1650
+ /**
1651
+ * Get a default momentary switch cluster server.
1652
+ *
1653
+ * @remarks
1654
+ * This method adds a cluster server with default momentary switch features and configurations suitable for (AppleHome) Single Double Long automations.
1655
+ */
1108
1656
  getDefaultSwitchClusterServer() {
1109
1657
  return ClusterServer(SwitchCluster.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress), {
1110
1658
  numberOfPositions: 2,
@@ -1119,9 +1667,21 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1119
1667
  multiPressComplete: true,
1120
1668
  });
1121
1669
  }
1670
+ /**
1671
+ * Creates a default momentary switch cluster server.
1672
+ *
1673
+ * @remarks
1674
+ * This method adds a cluster server with default momentary switch features and configurations.
1675
+ */
1122
1676
  createDefaultSwitchClusterServer() {
1123
1677
  this.addClusterServer(this.getDefaultSwitchClusterServer());
1124
1678
  }
1679
+ /**
1680
+ * Get a default latching switch cluster server.
1681
+ *
1682
+ * @remarks
1683
+ * This method adds a cluster server with default latching switch features and configuration.
1684
+ */
1125
1685
  getDefaultLatchingSwitchClusterServer() {
1126
1686
  return ClusterServer(SwitchCluster.with(Switch.Feature.LatchingSwitch), {
1127
1687
  numberOfPositions: 2,
@@ -1130,9 +1690,22 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1130
1690
  switchLatched: true,
1131
1691
  });
1132
1692
  }
1693
+ /**
1694
+ * Creates a default latching switch cluster server.
1695
+ *
1696
+ * @remarks
1697
+ * This method adds a cluster server with default latching switch features and configuration.
1698
+ */
1133
1699
  createDefaultLatchingSwitchClusterServer() {
1134
1700
  this.addClusterServer(this.getDefaultLatchingSwitchClusterServer());
1135
1701
  }
1702
+ /**
1703
+ * Triggers a switch event on the specified endpoint.
1704
+ *
1705
+ * @param {string} event - The type of event to trigger. Possible values are 'Single', 'Double', 'Long' for momentarySwitch and 'Press', 'Release' for latchingSwitch.
1706
+ * @param {Endpoint} endpoint - The endpoint on which to trigger the event (default the device endpoint).
1707
+ * @returns {void}
1708
+ */
1136
1709
  triggerSwitchEvent(event, log, endpoint) {
1137
1710
  if (!endpoint)
1138
1711
  endpoint = this;
@@ -1204,6 +1777,15 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1204
1777
  }
1205
1778
  return true;
1206
1779
  }
1780
+ /**
1781
+ * Retrieves the default mode select cluster server.
1782
+ *
1783
+ * @param description - The description of the cluster server.
1784
+ * @param supportedModes - The supported modes for the cluster server.
1785
+ * @param currentMode - The current mode of the cluster server. Defaults to 0.
1786
+ * @param startUpMode - The startup mode of the cluster server. Defaults to 0.
1787
+ * @returns The default mode select cluster server.
1788
+ */
1207
1789
  getDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
1208
1790
  return ClusterServer(ModeSelectCluster, {
1209
1791
  description: description,
@@ -1218,11 +1800,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1218
1800
  },
1219
1801
  });
1220
1802
  }
1803
+ /**
1804
+ * Creates a default mode select cluster server.
1805
+ *
1806
+ * @remarks
1807
+ * This method adds a cluster server for a mode select cluster with default settings.
1808
+ *
1809
+ * @param endpoint - The endpoint to add the cluster server to. Defaults to `this` if not provided.
1810
+ */
1221
1811
  createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0, endpoint) {
1222
1812
  if (!endpoint)
1223
1813
  endpoint = this;
1224
1814
  endpoint.addClusterServer(this.getDefaultModeSelectClusterServer(description, supportedModes, currentMode, startUpMode));
1225
1815
  }
1816
+ /**
1817
+ * Get a default occupancy sensing cluster server.
1818
+ *
1819
+ * @param occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
1820
+ */
1226
1821
  getDefaultOccupancySensingClusterServer(occupied = false) {
1227
1822
  return ClusterServer(OccupancySensingCluster, {
1228
1823
  occupancy: { occupied },
@@ -1231,9 +1826,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1231
1826
  pirOccupiedToUnoccupiedDelay: 30,
1232
1827
  }, {});
1233
1828
  }
1829
+ /**
1830
+ * Creates a default occupancy sensing cluster server.
1831
+ *
1832
+ * @param occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
1833
+ */
1234
1834
  createDefaultOccupancySensingClusterServer(occupied = false) {
1235
1835
  this.addClusterServer(this.getDefaultOccupancySensingClusterServer(occupied));
1236
1836
  }
1837
+ /**
1838
+ * Get a default Illuminance Measurement Cluster Server.
1839
+ *
1840
+ * @param measuredValue - The measured value of illuminance.
1841
+ */
1237
1842
  getDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
1238
1843
  return ClusterServer(IlluminanceMeasurementCluster, {
1239
1844
  measuredValue,
@@ -1242,9 +1847,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1242
1847
  tolerance: 0,
1243
1848
  }, {}, {});
1244
1849
  }
1850
+ /**
1851
+ * Creates a default Illuminance Measurement Cluster Server.
1852
+ *
1853
+ * @param measuredValue - The measured value of illuminance.
1854
+ */
1245
1855
  createDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
1246
1856
  this.addClusterServer(this.getDefaultIlluminanceMeasurementClusterServer(measuredValue));
1247
1857
  }
1858
+ /**
1859
+ * Get a default flow measurement cluster server.
1860
+ *
1861
+ * @param measuredValue - The measured value of the flow in 10 x m/h.
1862
+ */
1248
1863
  getDefaultFlowMeasurementClusterServer(measuredValue = 0) {
1249
1864
  return ClusterServer(FlowMeasurementCluster, {
1250
1865
  measuredValue,
@@ -1253,9 +1868,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1253
1868
  tolerance: 0,
1254
1869
  }, {}, {});
1255
1870
  }
1871
+ /**
1872
+ * Creates a default flow measurement cluster server.
1873
+ *
1874
+ * @param measuredValue - The measured value of the of the flow in 10 x m/h.
1875
+ */
1256
1876
  createDefaultFlowMeasurementClusterServer(measuredValue = 0) {
1257
1877
  this.addClusterServer(this.getDefaultFlowMeasurementClusterServer(measuredValue));
1258
1878
  }
1879
+ /**
1880
+ * Get a default temperature measurement cluster server.
1881
+ *
1882
+ * @param measuredValue - The measured value of the temperature x 100.
1883
+ */
1259
1884
  getDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
1260
1885
  return ClusterServer(TemperatureMeasurementCluster, {
1261
1886
  measuredValue,
@@ -1264,9 +1889,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1264
1889
  tolerance: 0,
1265
1890
  }, {}, {});
1266
1891
  }
1892
+ /**
1893
+ * Creates a default temperature measurement cluster server.
1894
+ *
1895
+ * @param measuredValue - The measured value of the temperature x 100.
1896
+ */
1267
1897
  createDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
1268
1898
  this.addClusterServer(this.getDefaultTemperatureMeasurementClusterServer(measuredValue));
1269
1899
  }
1900
+ /**
1901
+ * Get a default RelativeHumidityMeasurementCluster server.
1902
+ *
1903
+ * @param measuredValue - The measured value of the relative humidity x 100.
1904
+ */
1270
1905
  getDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
1271
1906
  return ClusterServer(RelativeHumidityMeasurementCluster, {
1272
1907
  measuredValue,
@@ -1275,9 +1910,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1275
1910
  tolerance: 0,
1276
1911
  }, {}, {});
1277
1912
  }
1913
+ /**
1914
+ * Creates a default RelativeHumidityMeasurementCluster server.
1915
+ *
1916
+ * @param measuredValue - The measured value of the relative humidity x 100.
1917
+ */
1278
1918
  createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
1279
1919
  this.addClusterServer(this.getDefaultRelativeHumidityMeasurementClusterServer(measuredValue));
1280
1920
  }
1921
+ /**
1922
+ * Get a default Pressure Measurement Cluster Server.
1923
+ *
1924
+ * @param measuredValue - The measured value for the pressure.
1925
+ */
1281
1926
  getDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
1282
1927
  return ClusterServer(PressureMeasurementCluster, {
1283
1928
  measuredValue,
@@ -1286,19 +1931,39 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1286
1931
  tolerance: 0,
1287
1932
  }, {}, {});
1288
1933
  }
1934
+ /**
1935
+ * Creates a default Pressure Measurement Cluster Server.
1936
+ *
1937
+ * @param measuredValue - The measured value for the pressure.
1938
+ */
1289
1939
  createDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
1290
1940
  this.addClusterServer(this.getDefaultPressureMeasurementClusterServer(measuredValue));
1291
1941
  }
1942
+ /**
1943
+ * Get a default boolean state cluster server.
1944
+ *
1945
+ * @param contact - Optional boolean value indicating the contact state. Defaults to `true` if not provided.
1946
+ */
1292
1947
  getDefaultBooleanStateClusterServer(contact) {
1293
1948
  return ClusterServer(BooleanStateCluster, {
1294
- stateValue: contact ?? true,
1949
+ stateValue: contact ?? true, // true=contact false=no_contact
1295
1950
  }, {}, {
1296
1951
  stateChange: true,
1297
1952
  });
1298
1953
  }
1954
+ /**
1955
+ * Creates a default boolean state configuration cluster server.
1956
+ *
1957
+ * @param contact - Optional boolean value indicating the contact state. Defaults to `true` if not provided.
1958
+ */
1299
1959
  createDefaultBooleanStateClusterServer(contact) {
1300
1960
  this.addClusterServer(this.getDefaultBooleanStateClusterServer(contact));
1301
1961
  }
1962
+ /**
1963
+ * Get a default boolean state configuration cluster server.
1964
+ *
1965
+ * @param contact - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
1966
+ */
1302
1967
  getDefaultBooleanStateConfigurationClusterServer(sensorFault = false) {
1303
1968
  return ClusterServer(BooleanStateConfigurationCluster.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel), {
1304
1969
  currentSensitivityLevel: 0,
@@ -1307,6 +1972,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1307
1972
  alarmsActive: { visual: false, audible: false },
1308
1973
  alarmsEnabled: { visual: false, audible: false },
1309
1974
  alarmsSupported: { visual: true, audible: true },
1975
+ // alarmsSuppressed: { visual: false, audible: false },
1310
1976
  sensorFault: { generalFault: sensorFault },
1311
1977
  }, {
1312
1978
  enableDisableAlarm: async ({ request, attributes }) => {
@@ -1318,9 +1984,23 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1318
1984
  sensorFault: true,
1319
1985
  });
1320
1986
  }
1987
+ /**
1988
+ * Creates a default boolean state configuration cluster server.
1989
+ *
1990
+ * @param contact - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
1991
+ */
1321
1992
  createDefaultBooleanStateConfigurationClusterServer(sensorFault = false) {
1322
1993
  this.addClusterServer(this.getDefaultBooleanStateConfigurationClusterServer(sensorFault));
1323
1994
  }
1995
+ /**
1996
+ * Get a default power source replaceable battery cluster server.
1997
+ *
1998
+ * @param batPercentRemaining - The remaining battery percentage (default: 100).
1999
+ * @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
2000
+ * @param batVoltage - The battery voltage (default: 1500).
2001
+ * @param batReplacementDescription - The battery replacement description (default: 'Battery type').
2002
+ * @param batQuantity - The battery quantity (default: 1).
2003
+ */
1324
2004
  getDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
1325
2005
  return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
1326
2006
  status: PowerSource.PowerSourceStatus.Active,
@@ -1337,9 +2017,25 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1337
2017
  endpointList: [],
1338
2018
  }, {}, {});
1339
2019
  }
2020
+ /**
2021
+ * Creates a default power source replaceable battery cluster server.
2022
+ *
2023
+ * @param batPercentRemaining - The remaining battery percentage (default: 100).
2024
+ * @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
2025
+ * @param batVoltage - The battery voltage (default: 1500).
2026
+ * @param batReplacementDescription - The battery replacement description (default: 'Battery type').
2027
+ * @param batQuantity - The battery quantity (default: 1).
2028
+ */
1340
2029
  createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
1341
2030
  this.addClusterServer(this.getDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining, batChargeLevel, batVoltage, batReplacementDescription, batQuantity));
1342
2031
  }
2032
+ /**
2033
+ * Get a default power source rechargeable battery cluster server.
2034
+ *
2035
+ * @param batPercentRemaining - The remaining battery percentage (default: 100).
2036
+ * @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
2037
+ * @param batVoltage - The battery voltage (default: 1500).
2038
+ */
1343
2039
  getDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
1344
2040
  return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
1345
2041
  status: PowerSource.PowerSourceStatus.Active,
@@ -1357,9 +2053,21 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1357
2053
  endpointList: [],
1358
2054
  }, {}, {});
1359
2055
  }
2056
+ /**
2057
+ * Creates a default power source rechargeable battery cluster server.
2058
+ *
2059
+ * @param batPercentRemaining - The remaining battery percentage (default: 100).
2060
+ * @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
2061
+ * @param batVoltage - The battery voltage (default: 1500).
2062
+ */
1360
2063
  createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
1361
2064
  this.addClusterServer(this.getDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining, batChargeLevel, batVoltage));
1362
2065
  }
2066
+ /**
2067
+ * Get a default power source wired cluster server.
2068
+ *
2069
+ * @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
2070
+ */
1363
2071
  getDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
1364
2072
  return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Wired), {
1365
2073
  wiredCurrentType,
@@ -1369,22 +2077,45 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1369
2077
  endpointList: [],
1370
2078
  }, {}, {});
1371
2079
  }
2080
+ /**
2081
+ * Creates a default power source wired cluster server.
2082
+ *
2083
+ * @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
2084
+ */
1372
2085
  createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
1373
2086
  this.addClusterServer(this.getDefaultPowerSourceWiredClusterServer(wiredCurrentType));
1374
2087
  }
2088
+ /**
2089
+ * @deprecated This function is deprecated by Matter 1.3 spec and will be removed in a future version.
2090
+ */
1375
2091
  createDefaultPowerSourceConfigurationClusterServer(endpointNumber) {
1376
2092
  this.addClusterServer(ClusterServer(PowerSourceConfigurationCluster, {
1377
2093
  sources: endpointNumber ? [EndpointNumber(endpointNumber)] : [],
1378
2094
  }, {}, {}));
1379
2095
  }
2096
+ /**
2097
+ * Get a default air quality cluster server.
2098
+ *
2099
+ * @param airQuality The air quality type. Defaults to `AirQuality.AirQualityType.Unknown`.
2100
+ */
1380
2101
  getDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
1381
2102
  return ClusterServer(AirQualityCluster.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
1382
2103
  airQuality,
1383
2104
  }, {}, {});
1384
2105
  }
2106
+ /**
2107
+ * Creates a default air quality cluster server.
2108
+ *
2109
+ * @param airQuality The air quality type. Defaults to `AirQuality.AirQualityType.Unknown`.
2110
+ */
1385
2111
  createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
1386
2112
  this.addClusterServer(this.getDefaultAirQualityClusterServer(airQuality));
1387
2113
  }
2114
+ /**
2115
+ * Get a default TVOC measurement cluster server.
2116
+ *
2117
+ * @param measuredValue - The measured value for TVOC.
2118
+ */
1388
2119
  getDefaultTvocMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1389
2120
  return ClusterServer(TotalVolatileOrganicCompoundsConcentrationMeasurementCluster.with('NumericMeasurement'), {
1390
2121
  measuredValue,
@@ -1395,14 +2126,28 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1395
2126
  measurementMedium,
1396
2127
  }, {}, {});
1397
2128
  }
2129
+ /**
2130
+ * Creates a default TVOC measurement cluster server.
2131
+ *
2132
+ * @param measuredValue - The measured value for TVOC.
2133
+ */
1398
2134
  createDefaultTvocMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1399
2135
  this.addClusterServer(this.getDefaultTvocMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
1400
2136
  }
2137
+ /**
2138
+ * Get a default heating thermostat cluster server with the specified parameters.
2139
+ * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
2140
+ * @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
2141
+ * @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
2142
+ * @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
2143
+ * @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
2144
+ */
1401
2145
  getDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
1402
2146
  return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Heating), {
1403
2147
  localTemperature: localTemperature * 100,
1404
2148
  systemMode: Thermostat.SystemMode.Heat,
1405
2149
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
2150
+ // Thermostat.Feature.Heating
1406
2151
  occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
1407
2152
  minHeatSetpointLimit: minHeatSetpointLimit * 100,
1408
2153
  maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
@@ -1415,14 +2160,31 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1415
2160
  },
1416
2161
  }, {});
1417
2162
  }
2163
+ /**
2164
+ * Creates and adds a default heating thermostat cluster server to the device.
2165
+ *
2166
+ * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
2167
+ * @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
2168
+ * @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
2169
+ * @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
2170
+ */
1418
2171
  createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 25, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
1419
2172
  this.addClusterServer(this.getDefaultHeatingThermostatClusterServer(localTemperature, occupiedHeatingSetpoint, minHeatSetpointLimit, maxHeatSetpointLimit));
1420
2173
  }
2174
+ /**
2175
+ * Get a default cooling thermostat cluster server with the specified parameters.
2176
+ * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
2177
+ * @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
2178
+ * @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
2179
+ * @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
2180
+ * @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
2181
+ */
1421
2182
  getDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
1422
2183
  return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Cooling), {
1423
2184
  localTemperature: localTemperature * 100,
1424
2185
  systemMode: Thermostat.SystemMode.Cool,
1425
2186
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
2187
+ // Thermostat.Feature.Cooling
1426
2188
  occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
1427
2189
  minCoolSetpointLimit: minCoolSetpointLimit * 100,
1428
2190
  maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
@@ -1435,24 +2197,48 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1435
2197
  },
1436
2198
  }, {});
1437
2199
  }
2200
+ /**
2201
+ * Creates and adds a default cooling thermostat cluster server to the device.
2202
+ *
2203
+ * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
2204
+ * @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
2205
+ * @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
2206
+ * @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
2207
+ */
1438
2208
  createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
1439
2209
  this.addClusterServer(this.getDefaultCoolingThermostatClusterServer(localTemperature, occupiedCoolingSetpoint, minCoolSetpointLimit, maxCoolSetpointLimit));
1440
2210
  }
2211
+ /**
2212
+ * Get a default thermostat cluster server with the specified parameters.
2213
+ *
2214
+ * @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
2215
+ * @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
2216
+ * @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
2217
+ * @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
2218
+ * @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
2219
+ * @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
2220
+ * @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
2221
+ * @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
2222
+ * @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
2223
+ */
1441
2224
  getDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
1442
2225
  return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
1443
2226
  localTemperature: localTemperature * 100,
1444
2227
  systemMode: Thermostat.SystemMode.Auto,
1445
2228
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
2229
+ // Thermostat.Feature.Heating
1446
2230
  occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
1447
2231
  minHeatSetpointLimit: minHeatSetpointLimit * 100,
1448
2232
  maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
1449
2233
  absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
1450
2234
  absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
2235
+ // Thermostat.Feature.Cooling
1451
2236
  occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
1452
2237
  minCoolSetpointLimit: minCoolSetpointLimit * 100,
1453
2238
  maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
1454
2239
  absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
1455
2240
  absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
2241
+ // Thermostat.Feature.AutoMode
1456
2242
  minSetpointDeadBand: minSetpointDeadBand * 100,
1457
2243
  thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
1458
2244
  }, {
@@ -1462,9 +2248,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1462
2248
  },
1463
2249
  }, {});
1464
2250
  }
2251
+ /**
2252
+ * Creates and adds a default thermostat cluster server to the device.
2253
+ *
2254
+ * @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
2255
+ * @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
2256
+ * @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
2257
+ * @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
2258
+ * @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
2259
+ * @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
2260
+ * @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
2261
+ * @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
2262
+ */
1465
2263
  createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
1466
2264
  this.addClusterServer(this.getDefaultThermostatClusterServer(localTemperature, occupiedHeatingSetpoint, occupiedCoolingSetpoint, minSetpointDeadBand, minHeatSetpointLimit, maxHeatSetpointLimit, minCoolSetpointLimit, maxCoolSetpointLimit));
1467
2265
  }
2266
+ /**
2267
+ * Get a default dummy time sync cluster server. Only needed to create a thermostat.
2268
+ */
1468
2269
  getDefaultTimeSyncClusterServer() {
1469
2270
  return ClusterServer(TimeSynchronizationCluster.with(TimeSynchronization.Feature.TimeZone), {
1470
2271
  utcTime: null,
@@ -1496,9 +2297,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1496
2297
  timeFailure: true,
1497
2298
  });
1498
2299
  }
2300
+ /**
2301
+ * Creates a default dummy time sync cluster server. Only needed to create a thermostat.
2302
+ */
1499
2303
  createDefaultTimeSyncClusterServer() {
1500
2304
  this.addClusterServer(this.getDefaultTimeSyncClusterServer());
1501
2305
  }
2306
+ /**
2307
+ * Returns the default SmokeCOAlarm Cluster Server.
2308
+ *
2309
+ * @param smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
2310
+ * @param coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
2311
+ * @returns The default SmokeCOAlarmClusterServer.
2312
+ */
1502
2313
  getDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
1503
2314
  return ClusterServer(SmokeCoAlarmCluster.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm), {
1504
2315
  smokeState,
@@ -1530,9 +2341,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1530
2341
  allClear: true,
1531
2342
  });
1532
2343
  }
2344
+ /**
2345
+ * Create the default SmokeCOAlarm Cluster Server.
2346
+ *
2347
+ * @param smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
2348
+ * @param coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
2349
+ * @returns The default SmokeCOAlarmClusterServer.
2350
+ */
1533
2351
  createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
1534
2352
  this.addClusterServer(this.getDefaultSmokeCOAlarmClusterServer(smokeState, coState));
1535
2353
  }
2354
+ /**
2355
+ * Returns the default Carbon Monoxide Concentration Measurement Cluster Server.
2356
+ *
2357
+ * @param {number} measuredValue - The measured value of the concentration.
2358
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2359
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2360
+ * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2361
+ */
1536
2362
  getDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1537
2363
  return ClusterServer(CarbonMonoxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
1538
2364
  measuredValue,
@@ -1543,9 +2369,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1543
2369
  measurementMedium,
1544
2370
  }, {}, {});
1545
2371
  }
2372
+ /**
2373
+ * Create the default Carbon Monoxide Concentration Measurement Cluster Server.
2374
+ *
2375
+ * @param {number} measuredValue - The measured value of the concentration.
2376
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2377
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2378
+ */
1546
2379
  createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1547
2380
  this.addClusterServer(this.getDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
1548
2381
  }
2382
+ /**
2383
+ * Returns the default Carbon Dioxide Concentration Measurement Cluster Server.
2384
+ *
2385
+ * @param {number} measuredValue - The measured value of the concentration.
2386
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2387
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2388
+ * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2389
+ */
1549
2390
  getDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1550
2391
  return ClusterServer(CarbonDioxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
1551
2392
  measuredValue,
@@ -1556,9 +2397,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1556
2397
  measurementMedium,
1557
2398
  }, {}, {});
1558
2399
  }
2400
+ /**
2401
+ * Create the default Carbon Dioxide Concentration Measurement Cluster Server.
2402
+ *
2403
+ * @param {number} measuredValue - The measured value of the concentration.
2404
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2405
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2406
+ */
1559
2407
  createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1560
2408
  this.addClusterServer(this.getDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
1561
2409
  }
2410
+ /**
2411
+ * Returns the default Formaldehyde Concentration Measurement Cluster Server.
2412
+ *
2413
+ * @param {number} measuredValue - The measured value of the concentration.
2414
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2415
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2416
+ * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2417
+ */
1562
2418
  getDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1563
2419
  return ClusterServer(FormaldehydeConcentrationMeasurementCluster.with('NumericMeasurement'), {
1564
2420
  measuredValue,
@@ -1569,9 +2425,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1569
2425
  measurementMedium,
1570
2426
  }, {}, {});
1571
2427
  }
2428
+ /**
2429
+ * Create the default Formaldehyde Concentration Measurement Cluster Server.
2430
+ *
2431
+ * @param {number} measuredValue - The measured value of the concentration.
2432
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2433
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2434
+ */
1572
2435
  createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1573
2436
  this.addClusterServer(this.getDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
1574
2437
  }
2438
+ /**
2439
+ * Returns the default Pm1 Concentration Measurement Cluster Server.
2440
+ *
2441
+ * @param {number} measuredValue - The measured value of the concentration.
2442
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2443
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2444
+ * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2445
+ */
1575
2446
  getDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1576
2447
  return ClusterServer(Pm1ConcentrationMeasurementCluster.with('NumericMeasurement'), {
1577
2448
  measuredValue,
@@ -1582,9 +2453,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1582
2453
  measurementMedium,
1583
2454
  }, {}, {});
1584
2455
  }
2456
+ /**
2457
+ * Create the default Pm1 Concentration Measurement Cluster Server.
2458
+ *
2459
+ * @param {number} measuredValue - The measured value of the concentration.
2460
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2461
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2462
+ */
1585
2463
  createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1586
2464
  this.addClusterServer(this.getDefaultPm1ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
1587
2465
  }
2466
+ /**
2467
+ * Returns the default Pm25 Concentration Measurement Cluster Server.
2468
+ *
2469
+ * @param {number} measuredValue - The measured value of the concentration.
2470
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2471
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2472
+ * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2473
+ */
1588
2474
  getDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1589
2475
  return ClusterServer(Pm25ConcentrationMeasurementCluster.with('NumericMeasurement'), {
1590
2476
  measuredValue,
@@ -1595,9 +2481,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1595
2481
  measurementMedium,
1596
2482
  }, {}, {});
1597
2483
  }
2484
+ /**
2485
+ * Create the default Pm25 Concentration Measurement Cluster Server.
2486
+ *
2487
+ * @param {number} measuredValue - The measured value of the concentration.
2488
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2489
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2490
+ */
1598
2491
  createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1599
2492
  this.addClusterServer(this.getDefaultPm25ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
1600
2493
  }
2494
+ /**
2495
+ * Returns the default Pm10 Concentration Measurement Cluster Server.
2496
+ *
2497
+ * @param {number} measuredValue - The measured value of the concentration.
2498
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2499
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2500
+ * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2501
+ */
1601
2502
  getDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1602
2503
  return ClusterServer(Pm10ConcentrationMeasurementCluster.with('NumericMeasurement'), {
1603
2504
  measuredValue,
@@ -1608,9 +2509,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1608
2509
  measurementMedium,
1609
2510
  }, {}, {});
1610
2511
  }
2512
+ /**
2513
+ * Create the default Pm10 Concentration Measurement Cluster Server.
2514
+ *
2515
+ * @param {number} measuredValue - The measured value of the concentration.
2516
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2517
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2518
+ */
1611
2519
  createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1612
2520
  this.addClusterServer(this.getDefaultPm10ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
1613
2521
  }
2522
+ /**
2523
+ * Returns the default Ozone Concentration Measurement Cluster Server.
2524
+ *
2525
+ * @param {number} measuredValue - The measured value of the concentration.
2526
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2527
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2528
+ * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2529
+ */
1614
2530
  getDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1615
2531
  return ClusterServer(OzoneConcentrationMeasurementCluster.with('NumericMeasurement'), {
1616
2532
  measuredValue,
@@ -1621,9 +2537,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1621
2537
  measurementMedium,
1622
2538
  }, {}, {});
1623
2539
  }
2540
+ /**
2541
+ * Create the default Ozone Concentration Measurement Cluster Server.
2542
+ *
2543
+ * @param {number} measuredValue - The measured value of the concentration.
2544
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2545
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2546
+ */
1624
2547
  createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1625
2548
  this.addClusterServer(this.getDefaultOzoneConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
1626
2549
  }
2550
+ /**
2551
+ * Returns the default Radon Concentration Measurement Cluster Server.
2552
+ *
2553
+ * @param {number} measuredValue - The measured value of the concentration.
2554
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2555
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2556
+ * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2557
+ */
1627
2558
  getDefaultRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1628
2559
  return ClusterServer(RadonConcentrationMeasurementCluster.with('NumericMeasurement'), {
1629
2560
  measuredValue,
@@ -1634,9 +2565,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1634
2565
  measurementMedium,
1635
2566
  }, {}, {});
1636
2567
  }
2568
+ /**
2569
+ * Create the default Radon Concentration Measurement Cluster Server.
2570
+ *
2571
+ * @param {number} measuredValue - The measured value of the concentration.
2572
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2573
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2574
+ */
1637
2575
  createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1638
2576
  this.addClusterServer(this.getDefaultRadonConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
1639
2577
  }
2578
+ /**
2579
+ * Returns the default Nitrogen Dioxide Concentration Measurement Cluster Server.
2580
+ *
2581
+ * @param {number} measuredValue - The measured value of the concentration.
2582
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2583
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2584
+ * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2585
+ */
1640
2586
  getDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1641
2587
  return ClusterServer(NitrogenDioxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
1642
2588
  measuredValue,
@@ -1647,9 +2593,22 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1647
2593
  measurementMedium,
1648
2594
  }, {}, {});
1649
2595
  }
2596
+ /**
2597
+ * Create the default Nitrogen Dioxide Concentration Measurement Cluster Server.
2598
+ *
2599
+ * @param {number} measuredValue - The measured value of the concentration.
2600
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2601
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2602
+ */
1650
2603
  createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1651
2604
  this.addClusterServer(this.getDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
1652
2605
  }
2606
+ /**
2607
+ * Returns the default fan control cluster server rev 2.
2608
+ *
2609
+ * @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
2610
+ * @returns The default fan control cluster server.
2611
+ */
1653
2612
  getDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
1654
2613
  return ClusterServer(FanControlCluster.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
1655
2614
  fanMode,
@@ -1666,9 +2625,21 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1666
2625
  },
1667
2626
  }, {});
1668
2627
  }
2628
+ /**
2629
+ * Create the default fan control cluster server rev 2.
2630
+ *
2631
+ * @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
2632
+ * @returns The default fan control cluster server.
2633
+ */
1669
2634
  createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
1670
2635
  this.addClusterServer(this.getDefaultFanControlClusterServer(fanMode));
1671
2636
  }
2637
+ /**
2638
+ * Returns the default Pump Configuration And Control cluster server.
2639
+ *
2640
+ * @param {PumpConfigurationAndControl.OperationMode} [pumpMode=PumpConfigurationAndControl.OperationMode.Normal] - The pump mode to set. Defaults to `PumpConfigurationAndControl.OperationMode.Normal`.
2641
+ * @returns {ClusterServer} - The default Pump Configuration And Control cluster server.
2642
+ */
1672
2643
  getDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
1673
2644
  return ClusterServer(PumpConfigurationAndControlCluster.with(PumpConfigurationAndControl.Feature.ConstantSpeed), {
1674
2645
  minConstSpeed: null,
@@ -1682,6 +2653,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1682
2653
  operationMode: pumpMode,
1683
2654
  }, {}, {});
1684
2655
  }
2656
+ /**
2657
+ * Creates the default Pump Configuration And Control cluster server.
2658
+ *
2659
+ * @param {PumpConfigurationAndControl.OperationMode} [pumpMode=PumpConfigurationAndControl.OperationMode.Normal] - The pump mode to set. Defaults to `PumpConfigurationAndControl.OperationMode.Normal`.
2660
+ * @returns {void}
2661
+ */
1685
2662
  createDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
1686
2663
  this.addClusterServer(this.getDefaultPumpConfigurationAndControlClusterServer(pumpMode));
1687
2664
  }
@@ -1705,9 +2682,17 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1705
2682
  },
1706
2683
  }, {});
1707
2684
  }
2685
+ /**
2686
+ * Create the default Valve Configuration And Control cluster server rev 2.
2687
+ *
2688
+ * @param {ValveConfigurationAndControl.ValveState} [valveState=ValveConfigurationAndControl.ValveState.Closed] - The valve state to set. Defaults to `ValveConfigurationAndControl.ValveState.Closed`.
2689
+ * @param {number} [valveLevel=0] - The valve level to set. Defaults to 0.
2690
+ * @returns {void}
2691
+ */
1708
2692
  createDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
1709
2693
  this.addClusterServer(this.getDefaultValveConfigurationAndControlClusterServer(valveState, valveLevel));
1710
2694
  }
2695
+ // NOTE Support of Device Energy Management Cluster is provisional.
1711
2696
  getDefaultDeviceEnergyManagementClusterServer() {
1712
2697
  return ClusterServer(DeviceEnergyManagementCluster.with(DeviceEnergyManagement.Feature.Pausable, DeviceEnergyManagement.Feature.PowerForecastReporting, DeviceEnergyManagement.Feature.StateForecastReporting), {
1713
2698
  esaType: DeviceEnergyManagement.EsaType.Other,
@@ -1731,6 +2716,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1731
2716
  resumed: true,
1732
2717
  });
1733
2718
  }
2719
+ // NOTE Support of Device Energy Management Mode Cluster is provisional.
1734
2720
  getDefaultDeviceEnergyManagementModeClusterServer() {
1735
2721
  return ClusterServer(DeviceEnergyManagementModeCluster, {
1736
2722
  supportedModes: [
@@ -1747,3 +2733,4 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1747
2733
  }, {});
1748
2734
  }
1749
2735
  }
2736
+ //# sourceMappingURL=matterbridgeDevice.js.map