matterbridge 1.6.5-dev.2 → 1.6.5-dev.3

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 (88) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/dist/cli.js +0 -26
  3. package/dist/cluster/export.js +0 -2
  4. package/dist/defaultConfigSchema.js +0 -23
  5. package/dist/deviceManager.js +1 -26
  6. package/dist/index.js +0 -30
  7. package/dist/logger/export.js +0 -1
  8. package/dist/matter/export.js +0 -1
  9. package/dist/matterbridge.js +62 -702
  10. package/dist/matterbridgeAccessoryPlatform.js +0 -33
  11. package/dist/matterbridgeBehaviors.js +1 -29
  12. package/dist/matterbridgeDevice.js +117 -884
  13. package/dist/matterbridgeDeviceTypes.js +12 -40
  14. package/dist/matterbridgeDynamicPlatform.js +0 -33
  15. package/dist/matterbridgeEdge.js +0 -525
  16. package/dist/matterbridgeEndpoint.js +100 -943
  17. package/dist/matterbridgePlatform.js +3 -74
  18. package/dist/matterbridgeTypes.js +0 -24
  19. package/dist/matterbridgeWebsocket.js +0 -45
  20. package/dist/pluginManager.js +3 -231
  21. package/dist/storage/export.js +0 -1
  22. package/dist/utils/colorUtils.js +2 -78
  23. package/dist/utils/export.js +0 -1
  24. package/dist/utils/utils.js +7 -252
  25. package/frontend/build/asset-manifest.json +3 -3
  26. package/frontend/build/index.html +1 -1
  27. package/frontend/build/static/js/{main.a14c87e7.js → main.0ab89802.js} +3 -3
  28. package/frontend/build/static/js/{main.a14c87e7.js.map → main.0ab89802.js.map} +1 -1
  29. package/npm-shrinkwrap.json +5 -5
  30. package/package.json +4 -4
  31. package/tsconfig.production.json +19 -0
  32. package/dist/cli.d.ts.map +0 -1
  33. package/dist/cli.js.map +0 -1
  34. package/dist/cluster/export.d.ts.map +0 -1
  35. package/dist/cluster/export.js.map +0 -1
  36. package/dist/defaultConfigSchema.d.ts.map +0 -1
  37. package/dist/defaultConfigSchema.js.map +0 -1
  38. package/dist/deviceManager.d.ts +0 -46
  39. package/dist/deviceManager.d.ts.map +0 -1
  40. package/dist/deviceManager.js.map +0 -1
  41. package/dist/index.d.ts.map +0 -1
  42. package/dist/index.js.map +0 -1
  43. package/dist/logger/export.d.ts.map +0 -1
  44. package/dist/logger/export.js.map +0 -1
  45. package/dist/matter/export.d.ts.map +0 -1
  46. package/dist/matter/export.js.map +0 -1
  47. package/dist/matterbridge.d.ts +0 -466
  48. package/dist/matterbridge.d.ts.map +0 -1
  49. package/dist/matterbridge.js.map +0 -1
  50. package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
  51. package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
  52. package/dist/matterbridgeBehaviors.d.ts +0 -934
  53. package/dist/matterbridgeBehaviors.d.ts.map +0 -1
  54. package/dist/matterbridgeBehaviors.js.map +0 -1
  55. package/dist/matterbridgeDevice.d.ts +0 -5307
  56. package/dist/matterbridgeDevice.d.ts.map +0 -1
  57. package/dist/matterbridgeDevice.js.map +0 -1
  58. package/dist/matterbridgeDeviceTypes.d.ts +0 -65
  59. package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
  60. package/dist/matterbridgeDeviceTypes.js.map +0 -1
  61. package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
  62. package/dist/matterbridgeDynamicPlatform.js.map +0 -1
  63. package/dist/matterbridgeEdge.d.ts +0 -89
  64. package/dist/matterbridgeEdge.d.ts.map +0 -1
  65. package/dist/matterbridgeEdge.js.map +0 -1
  66. package/dist/matterbridgeEndpoint.d.ts +0 -7368
  67. package/dist/matterbridgeEndpoint.d.ts.map +0 -1
  68. package/dist/matterbridgeEndpoint.js.map +0 -1
  69. package/dist/matterbridgePlatform.d.ts +0 -96
  70. package/dist/matterbridgePlatform.d.ts.map +0 -1
  71. package/dist/matterbridgePlatform.js.map +0 -1
  72. package/dist/matterbridgeTypes.d.ts.map +0 -1
  73. package/dist/matterbridgeTypes.js.map +0 -1
  74. package/dist/matterbridgeWebsocket.d.ts.map +0 -1
  75. package/dist/matterbridgeWebsocket.js.map +0 -1
  76. package/dist/pluginManager.d.ts +0 -238
  77. package/dist/pluginManager.d.ts.map +0 -1
  78. package/dist/pluginManager.js.map +0 -1
  79. package/dist/storage/export.d.ts.map +0 -1
  80. package/dist/storage/export.js.map +0 -1
  81. package/dist/utils/colorUtils.d.ts.map +0 -1
  82. package/dist/utils/colorUtils.js.map +0 -1
  83. package/dist/utils/export.d.ts.map +0 -1
  84. package/dist/utils/export.js.map +0 -1
  85. package/dist/utils/utils.d.ts +0 -221
  86. package/dist/utils/utils.d.ts.map +0 -1
  87. package/dist/utils/utils.js.map +0 -1
  88. /package/frontend/build/static/js/{main.a14c87e7.js.LICENSE.txt → main.0ab89802.js.LICENSE.txt} +0 -0
@@ -1,41 +1,15 @@
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
24
1
  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, RadonConcentrationMeasurement, RadonConcentrationMeasurementCluster, RelativeHumidityMeasurement, RelativeHumidityMeasurementCluster, SmokeCoAlarm, SmokeCoAlarmCluster, Switch, SwitchCluster, TemperatureMeasurement, TemperatureMeasurementCluster, Thermostat, ThermostatCluster, ThreadNetworkDiagnostics, ThreadNetworkDiagnosticsCluster, TimeSynchronization, TimeSynchronizationCluster, TotalVolatileOrganicCompoundsConcentrationMeasurement, TotalVolatileOrganicCompoundsConcentrationMeasurementCluster, WindowCovering, WindowCoveringCluster, } from '@matter/main/clusters';
25
2
  import { Specification } from '@matter/main/model';
26
3
  import { EndpointNumber, extendPublicHandlerMethods, VendorId } from '@matter/main';
27
4
  import { MeasurementType, getClusterNameById } from '@matter/main/types';
28
- // @project-chip
29
- import { Device, Endpoint } from '@project-chip/matter.js/device';
5
+ import { Device } from '@project-chip/matter.js/device';
30
6
  import { GroupsClusterHandler, ClusterServer } from '@project-chip/matter.js/cluster';
31
- // AnsiLogger module
32
7
  import { AnsiLogger, CYAN, YELLOW, db, hk, or, zb, debugStringify } from 'node-ansi-logger';
33
- // Node.js modules
34
8
  import { createHash } from 'crypto';
35
9
  import { bridgedNode } from './matterbridgeDeviceTypes.js';
36
10
  export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
37
11
  static bridgeMode = '';
38
- static logLevel = "info" /* LogLevel.INFO */;
12
+ static logLevel = "info";
39
13
  log;
40
14
  plugin = undefined;
41
15
  serialNumber = undefined;
@@ -49,13 +23,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
49
23
  softwareVersionString = undefined;
50
24
  hardwareVersion = undefined;
51
25
  hardwareVersionString = undefined;
52
- /**
53
- * Create a Matterbridge device.
54
- * @constructor
55
- * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition of the device.
56
- * @param {EndpointOptions} [options={}] - The options for the device.
57
- * @param {boolean} [debug=false] - The debug level for the device.
58
- */
59
26
  constructor(definition, options = {}, debug = false) {
60
27
  let firstDefinition;
61
28
  if (Array.isArray(definition))
@@ -63,7 +30,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
63
30
  else
64
31
  firstDefinition = definition;
65
32
  super(firstDefinition, options);
66
- this.log = new AnsiLogger({ logName: 'MatterbridgeDevice', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: debug === true ? "debug" /* LogLevel.DEBUG */ : MatterbridgeDevice.logLevel });
33
+ this.log = new AnsiLogger({ logName: 'MatterbridgeDevice', logTimestampFormat: 4, logLevel: debug === true ? "debug" : MatterbridgeDevice.logLevel });
67
34
  this.log.debug(`new MatterbridgeDevice with deviceType: ${zb}${firstDefinition.code}${db}-${zb}${firstDefinition.name}${db}`);
68
35
  if (Array.isArray(definition)) {
69
36
  definition.forEach((deviceType) => {
@@ -73,28 +40,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
73
40
  else
74
41
  this.addDeviceType(firstDefinition);
75
42
  }
76
- /**
77
- * Loads asyncronously an instance of the MatterbridgeDevice class.
78
- *
79
- * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition of the device.
80
- * @param {EndpointOptions} [options={}] - The options for the device.
81
- * @param {boolean} [debug=false] - The debug level for the device.
82
- * @returns {Promise<MatterbridgeDevice>} A Promise of MatterbridgeDevice instance.
83
- */
84
43
  static async loadInstance(definition, options = {}, debug = false) {
85
44
  return new MatterbridgeDevice(definition, options, debug);
86
45
  }
87
- // Present in new API but not here
88
46
  get maybeNumber() {
89
47
  return this.number;
90
48
  }
91
- /**
92
- * Adds a device type to the list of device types of the MatterbridgeDevice endpoint.
93
- * If the device type is not already present in the list, it will be added.
94
- *
95
- * @param {DeviceTypeDefinition} deviceType - The device type to add.
96
- * @returns {MatterbridgeDevice} The MatterbridgeDevice instance.
97
- */
98
49
  addDeviceType(deviceType) {
99
50
  const deviceTypes = this.getDeviceTypes();
100
51
  if (!deviceTypes.includes(deviceType)) {
@@ -104,13 +55,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
104
55
  }
105
56
  return this;
106
57
  }
107
- /**
108
- * Adds one or more device types with the required cluster servers and the specified cluster servers.
109
- *
110
- * @param {AtLeastOne<DeviceTypeDefinition>} deviceTypes - The device types to add.
111
- * @param {ClusterId[]} includeServerList - The list of cluster IDs to include.
112
- * @returns {MatterbridgeDevice} The MatterbridgeDevice instance.
113
- */
114
58
  addDeviceTypeWithClusterServer(deviceTypes, includeServerList = []) {
115
59
  this.log.debug('addDeviceTypeWithClusterServer:');
116
60
  deviceTypes.forEach((deviceType) => {
@@ -132,23 +76,11 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
132
76
  this.addClusterServerFromList(this, includeServerList);
133
77
  return this;
134
78
  }
135
- /**
136
- * Adds a child endpoint with the specified device types and options.
137
- * If the child endpoint is not already present, it will be created and added.
138
- * If the child endpoint is already present, the device types will be added to the existing child endpoint.
139
- *
140
- * @param {string} endpointName - The name of the new endpoint to add.
141
- * @param {AtLeastOne<DeviceTypeDefinition>} deviceTypes - The device types to add.
142
- * @param {MatterbridgeEndpointOptions} [options={}] - The options for the endpoint.
143
- * @param {boolean} [debug=false] - Whether to enable debug logging.
144
- * @returns {Endpoint} - The child endpoint that was found or added.
145
- */
146
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
147
79
  addChildDeviceType(endpointName, deviceTypes, options = {}, debug = false) {
148
80
  this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
149
81
  let child = this.getChildEndpoints().find((endpoint) => endpoint.uniqueStorageKey === endpointName);
150
82
  if (!child) {
151
- child = new Endpoint(deviceTypes, { uniqueStorageKey: endpointName });
83
+ child = new MatterbridgeDevice(deviceTypes, { uniqueStorageKey: endpointName });
152
84
  if ('tagList' in options) {
153
85
  for (const tag of options.tagList) {
154
86
  this.log.debug(`- with tagList: mfgCode ${CYAN}${tag.mfgCode}${db} namespaceId ${CYAN}${tag.namespaceId}${db} tag ${CYAN}${tag.tag}${db} label ${CYAN}${tag.label}${db}`);
@@ -168,24 +100,11 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
168
100
  child.setDeviceTypes(childDeviceTypes);
169
101
  return child;
170
102
  }
171
- /**
172
- * Adds a child endpoint with one or more device types with the required cluster servers and the specified cluster servers.
173
- * If the child endpoint is not already present in the childEndpoints, it will be added.
174
- * If the child endpoint is already present in the childEndpoints, the device types and cluster servers will be added to the existing child endpoint.
175
- *
176
- * @param {string} endpointName - The name of the new enpoint to add.
177
- * @param {AtLeastOne<DeviceTypeDefinition>} deviceTypes - The device types to add.
178
- * @param {ClusterId[]} [includeServerList=[]] - The list of cluster IDs to include.
179
- * @param {EndpointOptions} [options={}] - The options for the device.
180
- * @param {boolean} [debug=false] - Whether to enable debug logging.
181
- * @returns {Endpoint} - The child endpoint that was found or added.
182
- */
183
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
184
103
  addChildDeviceTypeWithClusterServer(endpointName, deviceTypes, includeServerList = [], options = {}, debug = false) {
185
104
  this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
186
105
  let child = this.getChildEndpoints().find((endpoint) => endpoint.uniqueStorageKey === endpointName);
187
106
  if (!child) {
188
- child = new Endpoint(deviceTypes, { uniqueStorageKey: endpointName });
107
+ child = new MatterbridgeDevice(deviceTypes, { uniqueStorageKey: endpointName });
189
108
  if ('tagList' in options) {
190
109
  for (const tag of options.tagList) {
191
110
  this.log.debug(`- with tagList: mfgCode ${CYAN}${tag.mfgCode}${db} namespaceId ${CYAN}${tag.namespaceId}${db} tag ${CYAN}${tag.tag}${db} label ${CYAN}${tag.label}${db}`);
@@ -213,12 +132,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
213
132
  this.addClusterServerFromList(child, includeServerList);
214
133
  return child;
215
134
  }
216
- /**
217
- * Adds the required cluster servers (only if they are not present) for the device types of the specified endpoint.
218
- *
219
- * @param {Endpoint} endpoint - The endpoint to add the required cluster servers to.
220
- * @returns {Endpoint} The updated endpoint with the required cluster servers added.
221
- */
222
135
  addRequiredClusterServers(endpoint) {
223
136
  const requiredServerList = [];
224
137
  this.log.debug(`addRequiredClusterServer for ${CYAN}${endpoint.name}${db}`);
@@ -235,12 +148,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
235
148
  this.addClusterServerFromList(endpoint, requiredServerList);
236
149
  return endpoint;
237
150
  }
238
- /**
239
- * Adds the optional cluster servers (only if they are not present) for the device types of the specified endpoint.
240
- *
241
- * @param {Endpoint} endpoint - The endpoint to add the required cluster servers to.
242
- * @returns {Endpoint} The updated endpoint with the required cluster servers added.
243
- */
244
151
  addOptionalClusterServers(endpoint) {
245
152
  const optionalServerList = [];
246
153
  this.log.debug(`addRequiredClusterServer for ${CYAN}${endpoint.name}${db}`);
@@ -257,19 +164,11 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
257
164
  this.addClusterServerFromList(endpoint, optionalServerList);
258
165
  return endpoint;
259
166
  }
260
- /**
261
- * Adds cluster servers to the specified endpoint based on the provided server list.
262
- *
263
- * @param {Endpoint} endpoint - The endpoint to add cluster servers to.
264
- * @param {ClusterId[]} includeServerList - The list of cluster IDs to include.
265
- * @returns {Endpoint} The updated endpoint with the cluster servers added.
266
- */
267
167
  addClusterServerFromList(endpoint, includeServerList) {
268
168
  if (includeServerList.includes(Identify.Cluster.id))
269
169
  endpoint.addClusterServer(this.getDefaultIdentifyClusterServer());
270
170
  if (includeServerList.includes(Groups.Cluster.id))
271
171
  endpoint.addClusterServer(this.getDefaultGroupsClusterServer());
272
- // if (includeServerList.includes(ScenesManagement.Cluster.id)) endpoint.addClusterServer(this.getDefaultScenesClusterServer());
273
172
  if (includeServerList.includes(OnOff.Cluster.id))
274
173
  endpoint.addClusterServer(this.getDefaultOnOffClusterServer());
275
174
  if (includeServerList.includes(LevelControl.Cluster.id))
@@ -342,25 +241,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
342
241
  endpoint.addClusterServer(this.getDefaultDeviceEnergyManagementModeClusterServer());
343
242
  return endpoint;
344
243
  }
345
- /**
346
- * Retrieves a child endpoint by its name.
347
- *
348
- * @param {string} endpointName - The name of the endpoint to retrieve.
349
- * @returns {Endpoint | undefined} The child endpoint with the specified name, or undefined if not found.
350
- */
351
244
  getChildEndpointByName(endpointName) {
352
245
  return this.getChildEndpoints().find((endpoint) => endpoint.uniqueStorageKey === endpointName);
353
246
  }
354
- /**
355
- * Retrieves the value of the specified attribute from the given endpoint and cluster.
356
- *
357
- * @param {ClusterId} clusterId - The ID of the cluster to retrieve the attribute from.
358
- * @param {string} attribute - The name of the attribute to retrieve.
359
- * @param {AnsiLogger} [log] - Optional logger for error and info messages.
360
- * @param {Endpoint} [endpoint] - Optional the child endpoint to retrieve the attribute from.
361
- * @returns {any} The value of the attribute, or undefined if the attribute is not found.
362
- */
363
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
364
247
  getAttribute(clusterId, attribute, log, endpoint) {
365
248
  if (!endpoint)
366
249
  endpoint = this;
@@ -374,28 +257,15 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
374
257
  this.log.error(`getAttribute error: Attribute ${attribute} not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
375
258
  return undefined;
376
259
  }
377
- // Find the getter method
378
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
379
260
  if (!clusterServer[`get${capitalizedAttributeName}Attribute`]) {
380
261
  this.log.error(`getAttribute error: Getter get${capitalizedAttributeName}Attribute not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
381
262
  return undefined;
382
263
  }
383
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
384
264
  const getter = clusterServer[`get${capitalizedAttributeName}Attribute`];
385
265
  const value = getter();
386
266
  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}`);
387
267
  return value;
388
268
  }
389
- /**
390
- * Sets the value of an attribute on a cluster server endpoint.
391
- *
392
- * @param {ClusterId} clusterId - The ID of the cluster.
393
- * @param {string} attribute - The name of the attribute.
394
- * @param {any} value - The value to set for the attribute.
395
- * @param {AnsiLogger} [log] - (Optional) The logger to use for logging errors and information.
396
- * @param {Endpoint} [endpoint] - (Optional) The endpoint to set the attribute on. If not provided, the attribute will be set on the current endpoint.
397
- */
398
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
399
269
  setAttribute(clusterId, attribute, value, log, endpoint) {
400
270
  if (!endpoint)
401
271
  endpoint = this;
@@ -409,21 +279,15 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
409
279
  this.log.error(`setAttribute error: Attribute ${attribute} not found on Cluster ${clusterId} on endpoint ${endpoint.name}:${endpoint.number}`);
410
280
  return false;
411
281
  }
412
- // Find the getter method
413
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
414
282
  if (!clusterServer[`get${capitalizedAttributeName}Attribute`]) {
415
283
  this.log.error(`setAttribute error: Getter get${capitalizedAttributeName}Attribute not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
416
284
  return false;
417
285
  }
418
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
419
286
  const getter = clusterServer[`get${capitalizedAttributeName}Attribute`];
420
- // Find the setter method
421
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
422
287
  if (!clusterServer[`set${capitalizedAttributeName}Attribute`]) {
423
288
  this.log.error(`setAttribute error: Setter set${capitalizedAttributeName}Attribute not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
424
289
  return false;
425
290
  }
426
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
427
291
  const setter = clusterServer[`set${capitalizedAttributeName}Attribute`];
428
292
  const oldValue = getter();
429
293
  setter(value);
@@ -432,17 +296,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
432
296
  `to ${YELLOW}${typeof value === 'object' ? debugStringify(value) : value}${db}`);
433
297
  return true;
434
298
  }
435
- /**
436
- * Subscribes to an attribute on a cluster.
437
- *
438
- * @param {ClusterId} clusterId - The ID of the cluster.
439
- * @param {string} attribute - The name of the attribute to subscribe to.
440
- * @param {(newValue: any, oldValue: any) => void} listener - A callback function that will be called when the attribute value changes.
441
- * @param {AnsiLogger} log - (Optional) An AnsiLogger instance for logging errors and information.
442
- * @param {Endpoint} endpoint - (Optional) The endpoint to subscribe the attribute on. If not provided, the current endpoint will be used.
443
- * @returns A boolean indicating whether the subscription was successful.
444
- */
445
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
446
299
  subscribeAttribute(clusterId, attribute, listener, log, endpoint) {
447
300
  if (!endpoint)
448
301
  endpoint = this;
@@ -456,28 +309,15 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
456
309
  this.log.error(`subscribeAttribute error: Attribute ${attribute} not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
457
310
  return false;
458
311
  }
459
- // Find the subscribe method
460
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
461
312
  if (!clusterServer[`subscribe${capitalizedAttributeName}Attribute`]) {
462
313
  this.log.error(`subscribeAttribute error: subscribe${capitalizedAttributeName}Attribute not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
463
314
  return false;
464
315
  }
465
- // Subscribe to the attribute
466
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
467
316
  const subscribe = clusterServer[`subscribe${capitalizedAttributeName}Attribute`];
468
317
  subscribe(listener);
469
318
  log?.info(`${db}Subscribe endpoint ${or}${endpoint.name}:${endpoint.number}${db} attribute ${hk}${clusterServer.name}.${capitalizedAttributeName}${db}`);
470
319
  return true;
471
320
  }
472
- /**
473
- * Triggers the specified event of the specified cluster from the given endpoint and cluster.
474
- *
475
- * @param {ClusterId} clusterId - The ID of the cluster to retrieve the event from.
476
- * @param {string} event - The name of the event to trigger.
477
- * @param {Record<string, any>} payload - The payload of the event to trigger.
478
- * @param {AnsiLogger} [log] - Optional logger for error and info messages.
479
- * @param {Endpoint} [endpoint] - Optional the child endpoint to retrieve the event from.
480
- */
481
321
  triggerEvent(clusterId, event, payload, log, endpoint) {
482
322
  if (!endpoint)
483
323
  endpoint = this;
@@ -493,43 +333,20 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
493
333
  this.log.error(`triggerEvent error: Event ${event} not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
494
334
  return;
495
335
  }
496
- // Find the getter method
497
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
498
336
  if (!clusterServer[`trigger${capitalizedEventName}Event`]) {
499
337
  this.log.error(`triggerEvent error: Trigger trigger${capitalizedEventName}Event not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
500
338
  return;
501
339
  }
502
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
503
340
  const trigger = clusterServer[`trigger${capitalizedEventName}Event`];
504
341
  trigger(payload);
505
342
  log?.info(`${db}Trigger event ${hk}${clusterServer.name}.${capitalizedEventName}${db} on endpoint ${or}${endpoint.name}:${endpoint.number}${db}`);
506
343
  }
507
- /**
508
- * Adds a tag to the tag list of the specified endpoint.
509
- *
510
- * @param {Endpoint} endpoint - The endpoint to add the tag to.
511
- * @param {VendorId | null} mfgCode - The manufacturer code.
512
- * @param {number} namespaceId - The namespace ID of the tag.
513
- * @param {number} tag - The tag number.
514
- * @param {string | null} [label=null] - The label for the tag.
515
- *
516
- * @remarks
517
- * This method is used to add a tag to the tag list of a given endpoint.
518
- * 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.
519
- *
520
- * Example usage:
521
- * ```typescript
522
- * this.addTagList(endpoint, null, NumberTag.One.namespaceId, NumberTag.One.tag, 'Label');
523
- * this.addTagList(endpoint, null, SwitchesTag.Custom.namespaceId, SwitchesTag.Custom.tag, 'Label');
524
- * ```
525
- */
526
344
  addTagList(endpoint, mfgCode, namespaceId, tag, label) {
527
345
  const descriptor = endpoint.getClusterServer(DescriptorCluster.with(Descriptor.Feature.TagList));
528
346
  if (!descriptor) {
529
347
  this.log.error(`addTagList: descriptor cluster not found on endpoint ${endpoint.name}:${endpoint.number}`);
530
348
  return;
531
349
  }
532
- // tagList: { mfgCode: VendorId | null; namespaceId: number; tag: number; label?: string | null }[] = [];
533
350
  if (descriptor.attributes.tagList) {
534
351
  this.log.debug(`addTagList: adding ${CYAN}tagList${db} mfCode: ${mfgCode}, namespaceId: ${namespaceId}, tag: ${tag}, label: ${label} on endpoint ${endpoint.name}:${endpoint.number}`);
535
352
  const tagList = descriptor.attributes.tagList.getLocal();
@@ -545,12 +362,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
545
362
  partsList: [...descriptor.attributes.partsList.getLocal()],
546
363
  }, {}, {}));
547
364
  }
548
- /**
549
- * Serializes the Matterbridge device into a serialized object.
550
- *
551
- * @param pluginName - The name of the plugin.
552
- * @returns The serialized Matterbridge device object.
553
- */
554
365
  serialize() {
555
366
  if (!this.serialNumber || !this.deviceName || !this.uniqueId)
556
367
  return;
@@ -575,11 +386,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
575
386
  });
576
387
  return serialized;
577
388
  }
578
- /**
579
- * Deserializes the device into a serialized object.
580
- *
581
- * @returns The deserialized MatterbridgeDevice.
582
- */
583
389
  static deserialize(serializedDevice) {
584
390
  const device = new MatterbridgeDevice(serializedDevice.deviceTypes);
585
391
  device.serialNumber = serializedDevice.serialNumber;
@@ -595,9 +401,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
595
401
  }
596
402
  return device;
597
403
  }
598
- /**
599
- * Get a default IdentifyCluster server.
600
- */
601
404
  getDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
602
405
  return ClusterServer(IdentifyCluster, {
603
406
  identifyTime,
@@ -613,88 +416,28 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
613
416
  },
614
417
  });
615
418
  }
616
- /**
617
- * Creates a default IdentifyCluster server.
618
- */
619
419
  createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
620
420
  this.addClusterServer(this.getDefaultIdentifyClusterServer(identifyTime, identifyType));
621
421
  }
622
- /**
623
- * Get a default IdentifyCluster server.
624
- */
625
422
  getDefaultGroupsClusterServer() {
626
423
  return ClusterServer(GroupsCluster, {
627
424
  nameSupport: {
628
425
  nameSupport: true,
629
426
  },
630
427
  }, GroupsClusterHandler());
631
- // return createDefaultGroupsClusterServer();
632
428
  }
633
- /**
634
- * Creates a default groups cluster server and adds it to the device.
635
- */
636
429
  createDefaultGroupsClusterServer() {
637
430
  this.addClusterServer(this.getDefaultGroupsClusterServer());
638
431
  }
639
- /**
640
- * Get a default scenes cluster server and adds it to the current instance.
641
- * @deprecated This method is deprecated.
642
- *
643
- */
644
432
  getDefaultScenesClusterServer() {
645
- /*
646
- return ClusterServer(
647
- ScenesCluster,
648
- {
649
- sceneCount: 0,
650
- currentScene: 0,
651
- currentGroup: GroupId(0),
652
- sceneValid: false,
653
- nameSupport: {
654
- nameSupport: true,
655
- },
656
- lastConfiguredBy: null,
657
- },
658
- {},
659
- );
660
- */
661
- }
662
- /**
663
- * Creates a default scenes cluster server and adds it to the current instance.
664
- * @deprecated This method is deprecated.
665
- */
433
+ }
666
434
  createDefaultScenesClusterServer() {
667
- /*
668
- this.addClusterServer(this.getDefaultScenesClusterServer());
669
- */
670
- }
671
- /**
672
- * Creates a unique identifier based on the provided parameters.
673
- * @param param1 - The first parameter.
674
- * @param param2 - The second parameter.
675
- * @param param3 - The third parameter.
676
- * @param param4 - The fourth parameter.
677
- * @returns A unique identifier generated using the MD5 hash algorithm.
678
- */
435
+ }
679
436
  createUniqueId(param1, param2, param3, param4) {
680
437
  const hash = createHash('md5');
681
438
  hash.update(param1 + param2 + param3 + param4);
682
439
  return hash.digest('hex');
683
440
  }
684
- /**
685
- * Get a default Basic Information Cluster Server.
686
- *
687
- * @param deviceName - The name of the device.
688
- * @param serialNumber - The serial number of the device.
689
- * @param vendorId - The vendor ID of the device.
690
- * @param vendorName - The vendor name of the device.
691
- * @param productId - The product ID of the device.
692
- * @param productName - The product name of the device.
693
- * @param softwareVersion - The software version of the device. Default is 1.
694
- * @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
695
- * @param hardwareVersion - The hardware version of the device. Default is 1.
696
- * @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
697
- */
698
441
  getDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
699
442
  this.log.logName = deviceName;
700
443
  this.deviceName = deviceName;
@@ -734,20 +477,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
734
477
  reachableChanged: true,
735
478
  });
736
479
  }
737
- /**
738
- * Creates a default Basic Information Cluster Server.
739
- *
740
- * @param deviceName - The name of the device.
741
- * @param serialNumber - The serial number of the device.
742
- * @param vendorId - The vendor ID of the device.
743
- * @param vendorName - The vendor name of the device.
744
- * @param productId - The product ID of the device.
745
- * @param productName - The product name of the device.
746
- * @param softwareVersion - The software version of the device. Default is 1.
747
- * @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
748
- * @param hardwareVersion - The hardware version of the device. Default is 1.
749
- * @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
750
- */
751
480
  createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
752
481
  if (MatterbridgeDevice.bridgeMode === 'bridge') {
753
482
  this.addDeviceType(bridgedNode);
@@ -756,19 +485,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
756
485
  }
757
486
  this.addClusterServer(this.getDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion, softwareVersionString, hardwareVersion, hardwareVersionString));
758
487
  }
759
- /**
760
- * Get a default BridgedDeviceBasicInformationClusterServer.
761
- *
762
- * @param deviceName - The name of the device.
763
- * @param serialNumber - The serial number of the device.
764
- * @param vendorId - The vendor ID of the device.
765
- * @param vendorName - The name of the vendor.
766
- * @param productName - The name of the product.
767
- * @param softwareVersion - The software version of the device. Default is 1.
768
- * @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
769
- * @param hardwareVersion - The hardware version of the device. Default is 1.
770
- * @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
771
- */
772
488
  getDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
773
489
  this.log.logName = deviceName;
774
490
  this.deviceName = deviceName;
@@ -783,7 +499,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
783
499
  this.hardwareVersion = hardwareVersion;
784
500
  this.hardwareVersionString = hardwareVersionString;
785
501
  return ClusterServer(BridgedDeviceBasicInformationCluster, {
786
- vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined, // 4874
502
+ vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
787
503
  vendorName: vendorName.slice(0, 32),
788
504
  productName: productName.slice(0, 32),
789
505
  productLabel: deviceName.slice(0, 64),
@@ -802,36 +518,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
802
518
  reachableChanged: true,
803
519
  });
804
520
  }
805
- /**
806
- * Creates a default BridgedDeviceBasicInformationClusterServer.
807
- *
808
- * @param deviceName - The name of the device.
809
- * @param serialNumber - The serial number of the device.
810
- * @param vendorId - The vendor ID of the device.
811
- * @param vendorName - The name of the vendor.
812
- * @param productName - The name of the product.
813
- * @param softwareVersion - The software version of the device. Default is 1.
814
- * @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
815
- * @param hardwareVersion - The hardware version of the device. Default is 1.
816
- * @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
817
- */
818
521
  createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
819
522
  this.addClusterServer(this.getDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion, softwareVersionString, hardwareVersion, hardwareVersionString));
820
523
  }
821
- /**
822
- * Get a default Power Topology Cluster Server.
823
- *
824
- * @returns {ClusterServer} - The configured Power Topology Cluster Server.
825
- */
826
524
  getDefaultPowerTopologyClusterServer() {
827
525
  return ClusterServer(PowerTopologyCluster.with(PowerTopology.Feature.TreeTopology), {}, {}, {});
828
526
  }
829
- /**
830
- * Get a default Electrical Energy Measurement Cluster Server.
831
- *
832
- * @param {number} energy - The total consumption value in mW/h.
833
- * @returns {ClusterServer} - The configured Electrical Energy Measurement Cluster Server.
834
- */
835
527
  getDefaultElectricalEnergyMeasurementClusterServer(energy = null) {
836
528
  return ClusterServer(ElectricalEnergyMeasurementCluster.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
837
529
  accuracy: {
@@ -848,15 +540,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
848
540
  cumulativeEnergyMeasured: true,
849
541
  });
850
542
  }
851
- /**
852
- * Get a default Electrical Power Measurement Cluster Server.
853
- *
854
- * @param {number} voltage - The voltage value in millivolts.
855
- * @param {number} current - The current value in milliamperes.
856
- * @param {number} power - The power value in milliwatts.
857
- * @param {number} frequency - The frequency value in millihertz.
858
- * @returns {ClusterServer} - The configured Electrical Power Measurement Cluster Server.
859
- */
860
543
  getDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
861
544
  return ClusterServer(ElectricalPowerMeasurementCluster.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
862
545
  powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
@@ -897,15 +580,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
897
580
  frequency: frequency,
898
581
  }, {}, {});
899
582
  }
900
- /**
901
- * Creates a default Dummy Thread Network Diagnostics Cluster server.
902
- * @deprecated This method is deprecated and is only used for testing.
903
- *
904
- * @remarks
905
- * This method adds a cluster server used only to give the networkName to Eve app.
906
- *
907
- * @returns void
908
- */
909
583
  createDefaultDummyThreadNetworkDiagnosticsClusterServer() {
910
584
  this.addClusterServer(ClusterServer(ThreadNetworkDiagnosticsCluster.with(ThreadNetworkDiagnostics.Feature.PacketCounts, ThreadNetworkDiagnostics.Feature.ErrorCounts), {
911
585
  channel: 1,
@@ -933,11 +607,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
933
607
  },
934
608
  }, {}));
935
609
  }
936
- /**
937
- * Get a default OnOff cluster server.
938
- *
939
- * @param onOff - The initial state of the OnOff cluster (default: false).
940
- */
941
610
  getDefaultOnOffClusterServer(onOff = false) {
942
611
  return ClusterServer(OnOffCluster, {
943
612
  onOff,
@@ -956,22 +625,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
956
625
  },
957
626
  }, {});
958
627
  }
959
- /**
960
- * Creates a default OnOff cluster server.
961
- *
962
- * @param onOff - The initial state of the OnOff cluster (default: false).
963
- */
964
628
  createDefaultOnOffClusterServer(onOff = false) {
965
629
  this.addClusterServer(this.getDefaultOnOffClusterServer(onOff));
966
630
  }
967
- /**
968
- * Get a default level control cluster server.
969
- *
970
- * @param currentLevel - The current level (default: 254).
971
- * @param minLevel - The minimum level (default: 0).
972
- * @param maxLevel - The maximum level (default: 254).
973
- * @param onLevel - The on level (default: null).
974
- */
975
631
  getDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 0, maxLevel = 254, onLevel = null) {
976
632
  return ClusterServer(LevelControlCluster.with(LevelControl.Feature.OnOff), {
977
633
  currentLevel,
@@ -1011,28 +667,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1011
667
  },
1012
668
  });
1013
669
  }
1014
- /**
1015
- * Creates a default level control cluster server.
1016
- *
1017
- * @param currentLevel - The current level (default: 254).
1018
- * @param minLevel - The minimum level (default: 0).
1019
- * @param maxLevel - The maximum level (default: 254).
1020
- * @param onLevel - The on level (default: null).
1021
- */
1022
670
  createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 0, maxLevel = 254, onLevel = null) {
1023
671
  this.addClusterServer(this.getDefaultLevelControlClusterServer(currentLevel, minLevel, maxLevel, onLevel));
1024
672
  }
1025
- /**
1026
- * Get a default color control cluster server.
1027
- *
1028
- * @param currentX - The current X value.
1029
- * @param currentY - The current Y value.
1030
- * @param currentHue - The current hue value.
1031
- * @param currentSaturation - The current saturation value.
1032
- * @param colorTemperatureMireds - The color temperature in mireds.
1033
- * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1034
- * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1035
- */
1036
673
  getDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1037
674
  return ClusterServer(ColorControlCluster.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
1038
675
  colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
@@ -1099,32 +736,114 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1099
736
  },
1100
737
  }, {});
1101
738
  }
1102
- /**
1103
- * Creates a default color control cluster server.
1104
- *
1105
- * @param currentX - The current X value.
1106
- * @param currentY - The current Y value.
1107
- * @param currentHue - The current hue value.
1108
- * @param currentSaturation - The current saturation value.
1109
- * @param colorTemperatureMireds - The color temperature in mireds.
1110
- * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1111
- * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1112
- */
1113
739
  createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1114
740
  this.addClusterServer(this.getDefaultColorControlClusterServer(currentX, currentY, currentHue, currentSaturation, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
1115
741
  }
1116
- /**
1117
- * Configures the color control cluster for a device.
1118
- *
1119
- * @remark This method must be called only after creating the cluster with getDefaultCompleteColorControlClusterServer or createDefaultCompleteColorControlClusterServer
1120
- * and before starting the matter server.
1121
- *
1122
- * @param {boolean} hueSaturation - A boolean indicating whether the device supports hue and saturation control.
1123
- * @param {boolean} xy - A boolean indicating whether the device supports XY control.
1124
- * @param {boolean} colorTemperature - A boolean indicating whether the device supports color temperature control.
1125
- * @param {ColorControl.ColorMode} colorMode - An optional parameter specifying the color mode of the device.
1126
- * @param {Endpoint} endpoint - An optional parameter specifying the endpoint to configure. If not provided, the device endpoint will be used.
1127
- */
742
+ getXyColorControlClusterServer(currentX = 0, currentY = 0) {
743
+ return ClusterServer(ColorControlCluster.with(ColorControl.Feature.Xy), {
744
+ colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
745
+ enhancedColorMode: ColorControl.EnhancedColorMode.CurrentXAndCurrentY,
746
+ colorCapabilities: { xy: true, hueSaturation: false, colorLoop: false, enhancedHue: false, colorTemperature: false },
747
+ options: {
748
+ executeIfOff: false,
749
+ },
750
+ numberOfPrimaries: null,
751
+ currentX,
752
+ currentY,
753
+ }, {
754
+ moveToColor: async (data) => {
755
+ this.log.debug('Matter command: moveToColor request:', data.request, 'attributes.currentX:', data.attributes.currentX.getLocal(), 'attributes.currentY:', data.attributes.currentY.getLocal());
756
+ this.commandHandler.executeHandler('moveToColor', data);
757
+ },
758
+ moveColor: async () => {
759
+ this.log.error('Matter command: moveColor not implemented');
760
+ },
761
+ stepColor: async () => {
762
+ this.log.error('Matter command: stepColor not implemented');
763
+ },
764
+ stopMoveStep: async () => {
765
+ this.log.error('Matter command: stopMoveStep not implemented');
766
+ },
767
+ }, {});
768
+ }
769
+ createXyControlClusterServer(currentX = 0, currentY = 0) {
770
+ this.addClusterServer(this.getXyColorControlClusterServer(currentX, currentY));
771
+ }
772
+ getHsColorControlClusterServer(currentHue = 0, currentSaturation = 0) {
773
+ return ClusterServer(ColorControlCluster.with(ColorControl.Feature.HueSaturation), {
774
+ colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
775
+ enhancedColorMode: ColorControl.EnhancedColorMode.CurrentHueAndCurrentSaturation,
776
+ colorCapabilities: { xy: false, hueSaturation: true, colorLoop: false, enhancedHue: false, colorTemperature: false },
777
+ options: {
778
+ executeIfOff: false,
779
+ },
780
+ numberOfPrimaries: null,
781
+ currentHue,
782
+ currentSaturation,
783
+ }, {
784
+ moveToHue: async ({ request, attributes, endpoint }) => {
785
+ this.log.debug('Matter command: moveToHue request:', request, 'attributes.currentHue:', attributes.currentHue.getLocal());
786
+ this.commandHandler.executeHandler('moveToHue', { request, attributes, endpoint });
787
+ },
788
+ moveHue: async () => {
789
+ this.log.error('Matter command: moveHue not implemented');
790
+ },
791
+ stepHue: async () => {
792
+ this.log.error('Matter command: stepHue not implemented');
793
+ },
794
+ moveToSaturation: async ({ request, attributes, endpoint }) => {
795
+ this.log.debug('Matter command: moveToSaturation request:', request, 'attributes.currentSaturation:', attributes.currentSaturation.getLocal());
796
+ this.commandHandler.executeHandler('moveToSaturation', { request, attributes, endpoint });
797
+ },
798
+ moveSaturation: async () => {
799
+ this.log.error('Matter command: moveSaturation not implemented');
800
+ },
801
+ stepSaturation: async () => {
802
+ this.log.error('Matter command: stepSaturation not implemented');
803
+ },
804
+ moveToHueAndSaturation: async ({ request, attributes, endpoint }) => {
805
+ this.log.debug('Matter command: moveToHueAndSaturation request:', request, 'attributes.currentHue:', attributes.currentHue.getLocal(), 'attributes.currentSaturation:', attributes.currentSaturation.getLocal());
806
+ this.commandHandler.executeHandler('moveToHueAndSaturation', { request, attributes, endpoint });
807
+ },
808
+ stopMoveStep: async () => {
809
+ this.log.error('Matter command: stopMoveStep not implemented');
810
+ },
811
+ }, {});
812
+ }
813
+ createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0) {
814
+ this.addClusterServer(this.getHsColorControlClusterServer(currentHue, currentSaturation));
815
+ }
816
+ getCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
817
+ return ClusterServer(ColorControlCluster.with(ColorControl.Feature.ColorTemperature), {
818
+ colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
819
+ enhancedColorMode: ColorControl.EnhancedColorMode.ColorTemperatureMireds,
820
+ colorCapabilities: { xy: false, hueSaturation: false, colorLoop: false, enhancedHue: false, colorTemperature: true },
821
+ options: {
822
+ executeIfOff: false,
823
+ },
824
+ numberOfPrimaries: null,
825
+ colorTemperatureMireds,
826
+ colorTempPhysicalMinMireds,
827
+ colorTempPhysicalMaxMireds,
828
+ }, {
829
+ stopMoveStep: async () => {
830
+ this.log.error('Matter command: stopMoveStep not implemented');
831
+ },
832
+ moveToColorTemperature: async ({ request, attributes, endpoint }) => {
833
+ this.log.debug('Matter command: moveToColorTemperature request:', request, 'attributes.colorTemperatureMireds:', attributes.colorTemperatureMireds.getLocal());
834
+ this.commandHandler.executeHandler('moveToColorTemperature', { request, attributes, endpoint });
835
+ },
836
+ moveColorTemperature: async () => {
837
+ this.log.error('Matter command: moveColorTemperature not implemented');
838
+ },
839
+ stepColorTemperature: async () => {
840
+ this.log.error('Matter command: stepColorTemperature not implemented');
841
+ },
842
+ }, {});
843
+ }
844
+ createCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
845
+ this.addClusterServer(this.getCtColorControlClusterServer(colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
846
+ }
1128
847
  configureColorControlCluster(hueSaturation, xy, colorTemperature, colorMode, endpoint) {
1129
848
  if (!endpoint)
1130
849
  endpoint = this;
@@ -1135,12 +854,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1135
854
  endpoint.getClusterServer(ColorControlCluster)?.setEnhancedColorModeAttribute(colorMode);
1136
855
  }
1137
856
  }
1138
- /**
1139
- * Configures the color control mode for the device.
1140
- *
1141
- * @param {ColorControl.ColorMode} colorMode - The color mode to set.
1142
- * @param {Endpoint} endpoint - The optional endpoint to configure. If not provided, the method will configure the current endpoint.
1143
- */
1144
857
  configureColorControlMode(colorMode, endpoint) {
1145
858
  if (!endpoint)
1146
859
  endpoint = this;
@@ -1149,13 +862,8 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1149
862
  endpoint.getClusterServer(ColorControlCluster)?.setEnhancedColorModeAttribute(colorMode);
1150
863
  }
1151
864
  }
1152
- /**
1153
- * Get a default window covering cluster server.
1154
- *
1155
- * @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0.
1156
- */
1157
865
  getDefaultWindowCoveringClusterServer(positionPercent100ths) {
1158
- return ClusterServer(WindowCoveringCluster.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift /* , WindowCovering.Feature.AbsolutePosition*/), {
866
+ return ClusterServer(WindowCoveringCluster.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
1159
867
  type: WindowCovering.WindowCoveringType.Rollershade,
1160
868
  configStatus: {
1161
869
  operational: true,
@@ -1169,10 +877,8 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1169
877
  operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
1170
878
  endProductType: WindowCovering.EndProductType.RollerShade,
1171
879
  mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
1172
- targetPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
1173
- currentPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
1174
- // installedClosedLimitLift: 10000,
1175
- // installedOpenLimitLift: 0,
880
+ targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
881
+ currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
1176
882
  }, {
1177
883
  upOrOpen: async (data) => {
1178
884
  this.log.debug('Matter command: upOrOpen');
@@ -1193,18 +899,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1193
899
  },
1194
900
  }, {});
1195
901
  }
1196
- /**
1197
- * Creates a default window covering cluster server.
1198
- *
1199
- * @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0.
1200
- */
1201
902
  createDefaultWindowCoveringClusterServer(positionPercent100ths) {
1202
903
  this.addClusterServer(this.getDefaultWindowCoveringClusterServer(positionPercent100ths));
1203
904
  }
1204
- /**
1205
- * Sets the window covering target position as the current position and stops the movement.
1206
- * @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
1207
- */
1208
905
  setWindowCoveringTargetAsCurrentAndStopped(endpoint) {
1209
906
  if (!endpoint)
1210
907
  endpoint = this;
@@ -1222,13 +919,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1222
919
  this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths and targetPositionLiftPercent100ths to ${position} and operationalStatus to Stopped.`);
1223
920
  }
1224
921
  }
1225
- /**
1226
- * Sets the current and target status of a window covering.
1227
- * @param {number} current - The current position of the window covering.
1228
- * @param {number} target - The target position of the window covering.
1229
- * @param {WindowCovering.MovementStatus} status - The movement status of the window covering.
1230
- * @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
1231
- */
1232
922
  setWindowCoveringCurrentTargetStatus(current, target, status, endpoint) {
1233
923
  if (!endpoint)
1234
924
  endpoint = this;
@@ -1244,11 +934,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1244
934
  }
1245
935
  this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
1246
936
  }
1247
- /**
1248
- * Sets the status of the window covering.
1249
- * @param {WindowCovering.MovementStatus} status - The movement status to set.
1250
- * @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
1251
- */
1252
937
  setWindowCoveringStatus(status, endpoint) {
1253
938
  if (!endpoint)
1254
939
  endpoint = this;
@@ -1258,12 +943,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1258
943
  windowCovering.setOperationalStatusAttribute({ global: status, lift: status, tilt: status });
1259
944
  this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
1260
945
  }
1261
- /**
1262
- * Retrieves the status of the window covering.
1263
- * @param {Endpoint} endpoint - The endpoint on which to get the window covering (default the device endpoint).
1264
- *
1265
- * @returns The global operational status of the window covering.
1266
- */
1267
946
  getWindowCoveringStatus(endpoint) {
1268
947
  if (!endpoint)
1269
948
  endpoint = this;
@@ -1274,12 +953,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1274
953
  this.log.debug(`Get WindowCovering operationalStatus: ${status.global}`);
1275
954
  return status.global;
1276
955
  }
1277
- /**
1278
- * Sets the target and current position of the window covering.
1279
- *
1280
- * @param position - The position to set, specified as a number.
1281
- * @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
1282
- */
1283
956
  setWindowCoveringTargetAndCurrentPosition(position, endpoint) {
1284
957
  if (!endpoint)
1285
958
  endpoint = this;
@@ -1290,13 +963,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1290
963
  windowCovering.setTargetPositionLiftPercent100thsAttribute(position);
1291
964
  this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${position} and targetPositionLiftPercent100ths: ${position}.`);
1292
965
  }
1293
- /**
1294
- * Get a default door lock cluster server.
1295
- *
1296
- * @remarks
1297
- * This method adds a cluster server for a door lock cluster with default settings.
1298
- *
1299
- */
1300
966
  getDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
1301
967
  return ClusterServer(DoorLockCluster, {
1302
968
  operatingMode: DoorLock.OperatingMode.Normal,
@@ -1319,22 +985,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1319
985
  lockOperationError: true,
1320
986
  });
1321
987
  }
1322
- /**
1323
- * Creates a default door lock cluster server.
1324
- *
1325
- * @remarks
1326
- * This method adds a cluster server for a door lock cluster with default settings.
1327
- *
1328
- */
1329
988
  createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
1330
989
  this.addClusterServer(this.getDefaultDoorLockClusterServer(lockState, lockType));
1331
990
  }
1332
- /**
1333
- * Get a default momentary switch cluster server.
1334
- *
1335
- * @remarks
1336
- * This method adds a cluster server with default momentary switch features and configurations suitable for (AppleHome) Single Double Long automations.
1337
- */
1338
991
  getDefaultSwitchClusterServer() {
1339
992
  return ClusterServer(SwitchCluster.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress), {
1340
993
  numberOfPositions: 2,
@@ -1349,21 +1002,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1349
1002
  multiPressComplete: true,
1350
1003
  });
1351
1004
  }
1352
- /**
1353
- * Creates a default momentary switch cluster server.
1354
- *
1355
- * @remarks
1356
- * This method adds a cluster server with default momentary switch features and configurations.
1357
- */
1358
1005
  createDefaultSwitchClusterServer() {
1359
1006
  this.addClusterServer(this.getDefaultSwitchClusterServer());
1360
1007
  }
1361
- /**
1362
- * Get a default latching switch cluster server.
1363
- *
1364
- * @remarks
1365
- * This method adds a cluster server with default latching switch features and configuration.
1366
- */
1367
1008
  getDefaultLatchingSwitchClusterServer() {
1368
1009
  return ClusterServer(SwitchCluster.with(Switch.Feature.LatchingSwitch), {
1369
1010
  numberOfPositions: 2,
@@ -1372,22 +1013,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1372
1013
  switchLatched: true,
1373
1014
  });
1374
1015
  }
1375
- /**
1376
- * Creates a default latching switch cluster server.
1377
- *
1378
- * @remarks
1379
- * This method adds a cluster server with default latching switch features and configuration.
1380
- */
1381
1016
  createDefaultLatchingSwitchClusterServer() {
1382
1017
  this.addClusterServer(this.getDefaultLatchingSwitchClusterServer());
1383
1018
  }
1384
- /**
1385
- * Triggers a switch event on the specified endpoint.
1386
- *
1387
- * @param {string} event - The type of event to trigger. Possible values are 'Single', 'Double', 'Long' for momentarySwitch and 'Press', 'Release' for latchingSwitch.
1388
- * @param {Endpoint} endpoint - The endpoint on which to trigger the event (default the device endpoint).
1389
- * @returns {void}
1390
- */
1391
1019
  triggerSwitchEvent(event, log, endpoint) {
1392
1020
  if (!endpoint)
1393
1021
  endpoint = this;
@@ -1459,15 +1087,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1459
1087
  }
1460
1088
  return true;
1461
1089
  }
1462
- /**
1463
- * Retrieves the default mode select cluster server.
1464
- *
1465
- * @param description - The description of the cluster server.
1466
- * @param supportedModes - The supported modes for the cluster server.
1467
- * @param currentMode - The current mode of the cluster server. Defaults to 0.
1468
- * @param startUpMode - The startup mode of the cluster server. Defaults to 0.
1469
- * @returns The default mode select cluster server.
1470
- */
1471
1090
  getDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
1472
1091
  return ClusterServer(ModeSelectCluster, {
1473
1092
  description: description,
@@ -1482,24 +1101,11 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1482
1101
  },
1483
1102
  });
1484
1103
  }
1485
- /**
1486
- * Creates a default mode select cluster server.
1487
- *
1488
- * @remarks
1489
- * This method adds a cluster server for a mode select cluster with default settings.
1490
- *
1491
- * @param endpoint - The endpoint to add the cluster server to. Defaults to `this` if not provided.
1492
- */
1493
1104
  createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0, endpoint) {
1494
1105
  if (!endpoint)
1495
1106
  endpoint = this;
1496
1107
  endpoint.addClusterServer(this.getDefaultModeSelectClusterServer(description, supportedModes, currentMode, startUpMode));
1497
1108
  }
1498
- /**
1499
- * Get a default occupancy sensing cluster server.
1500
- *
1501
- * @param occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
1502
- */
1503
1109
  getDefaultOccupancySensingClusterServer(occupied = false) {
1504
1110
  return ClusterServer(OccupancySensingCluster, {
1505
1111
  occupancy: { occupied },
@@ -1508,19 +1114,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1508
1114
  pirOccupiedToUnoccupiedDelay: 30,
1509
1115
  }, {});
1510
1116
  }
1511
- /**
1512
- * Creates a default occupancy sensing cluster server.
1513
- *
1514
- * @param occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
1515
- */
1516
1117
  createDefaultOccupancySensingClusterServer(occupied = false) {
1517
1118
  this.addClusterServer(this.getDefaultOccupancySensingClusterServer(occupied));
1518
1119
  }
1519
- /**
1520
- * Get a default Illuminance Measurement Cluster Server.
1521
- *
1522
- * @param measuredValue - The measured value of illuminance.
1523
- */
1524
1120
  getDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
1525
1121
  return ClusterServer(IlluminanceMeasurementCluster, {
1526
1122
  measuredValue,
@@ -1529,19 +1125,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1529
1125
  tolerance: 0,
1530
1126
  }, {}, {});
1531
1127
  }
1532
- /**
1533
- * Creates a default Illuminance Measurement Cluster Server.
1534
- *
1535
- * @param measuredValue - The measured value of illuminance.
1536
- */
1537
1128
  createDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
1538
1129
  this.addClusterServer(this.getDefaultIlluminanceMeasurementClusterServer(measuredValue));
1539
1130
  }
1540
- /**
1541
- * Get a default flow measurement cluster server.
1542
- *
1543
- * @param measuredValue - The measured value of the flow in 10 x m/h.
1544
- */
1545
1131
  getDefaultFlowMeasurementClusterServer(measuredValue = 0) {
1546
1132
  return ClusterServer(FlowMeasurementCluster, {
1547
1133
  measuredValue,
@@ -1550,19 +1136,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1550
1136
  tolerance: 0,
1551
1137
  }, {}, {});
1552
1138
  }
1553
- /**
1554
- * Creates a default flow measurement cluster server.
1555
- *
1556
- * @param measuredValue - The measured value of the of the flow in 10 x m/h.
1557
- */
1558
1139
  createDefaultFlowMeasurementClusterServer(measuredValue = 0) {
1559
1140
  this.addClusterServer(this.getDefaultFlowMeasurementClusterServer(measuredValue));
1560
1141
  }
1561
- /**
1562
- * Get a default temperature measurement cluster server.
1563
- *
1564
- * @param measuredValue - The measured value of the temperature x 100.
1565
- */
1566
1142
  getDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
1567
1143
  return ClusterServer(TemperatureMeasurementCluster, {
1568
1144
  measuredValue,
@@ -1571,19 +1147,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1571
1147
  tolerance: 0,
1572
1148
  }, {}, {});
1573
1149
  }
1574
- /**
1575
- * Creates a default temperature measurement cluster server.
1576
- *
1577
- * @param measuredValue - The measured value of the temperature x 100.
1578
- */
1579
1150
  createDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
1580
1151
  this.addClusterServer(this.getDefaultTemperatureMeasurementClusterServer(measuredValue));
1581
1152
  }
1582
- /**
1583
- * Get a default RelativeHumidityMeasurementCluster server.
1584
- *
1585
- * @param measuredValue - The measured value of the relative humidity x 100.
1586
- */
1587
1153
  getDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
1588
1154
  return ClusterServer(RelativeHumidityMeasurementCluster, {
1589
1155
  measuredValue,
@@ -1592,19 +1158,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1592
1158
  tolerance: 0,
1593
1159
  }, {}, {});
1594
1160
  }
1595
- /**
1596
- * Creates a default RelativeHumidityMeasurementCluster server.
1597
- *
1598
- * @param measuredValue - The measured value of the relative humidity x 100.
1599
- */
1600
1161
  createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
1601
1162
  this.addClusterServer(this.getDefaultRelativeHumidityMeasurementClusterServer(measuredValue));
1602
1163
  }
1603
- /**
1604
- * Get a default Pressure Measurement Cluster Server.
1605
- *
1606
- * @param measuredValue - The measured value for the pressure.
1607
- */
1608
1164
  getDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
1609
1165
  return ClusterServer(PressureMeasurementCluster, {
1610
1166
  measuredValue,
@@ -1613,39 +1169,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1613
1169
  tolerance: 0,
1614
1170
  }, {}, {});
1615
1171
  }
1616
- /**
1617
- * Creates a default Pressure Measurement Cluster Server.
1618
- *
1619
- * @param measuredValue - The measured value for the pressure.
1620
- */
1621
1172
  createDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
1622
1173
  this.addClusterServer(this.getDefaultPressureMeasurementClusterServer(measuredValue));
1623
1174
  }
1624
- /**
1625
- * Get a default boolean state cluster server.
1626
- *
1627
- * @param contact - Optional boolean value indicating the contact state. Defaults to `true` if not provided.
1628
- */
1629
1175
  getDefaultBooleanStateClusterServer(contact) {
1630
1176
  return ClusterServer(BooleanStateCluster, {
1631
- stateValue: contact ?? true, // true=contact false=no_contact
1177
+ stateValue: contact ?? true,
1632
1178
  }, {}, {
1633
1179
  stateChange: true,
1634
1180
  });
1635
1181
  }
1636
- /**
1637
- * Creates a default boolean state configuration cluster server.
1638
- *
1639
- * @param contact - Optional boolean value indicating the contact state. Defaults to `true` if not provided.
1640
- */
1641
1182
  createDefaultBooleanStateClusterServer(contact) {
1642
1183
  this.addClusterServer(this.getDefaultBooleanStateClusterServer(contact));
1643
1184
  }
1644
- /**
1645
- * Get a default boolean state configuration cluster server.
1646
- *
1647
- * @param contact - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
1648
- */
1649
1185
  getDefaultBooleanStateConfigurationClusterServer(sensorFault = false) {
1650
1186
  return ClusterServer(BooleanStateConfigurationCluster.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel), {
1651
1187
  currentSensitivityLevel: 0,
@@ -1654,7 +1190,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1654
1190
  alarmsActive: { visual: false, audible: false },
1655
1191
  alarmsEnabled: { visual: false, audible: false },
1656
1192
  alarmsSupported: { visual: true, audible: true },
1657
- // alarmsSuppressed: { visual: false, audible: false },
1658
1193
  sensorFault: { generalFault: sensorFault },
1659
1194
  }, {
1660
1195
  enableDisableAlarm: async ({ request, attributes }) => {
@@ -1666,23 +1201,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1666
1201
  sensorFault: true,
1667
1202
  });
1668
1203
  }
1669
- /**
1670
- * Creates a default boolean state configuration cluster server.
1671
- *
1672
- * @param contact - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
1673
- */
1674
1204
  createDefaultBooleanStateConfigurationClusterServer(sensorFault = false) {
1675
1205
  this.addClusterServer(this.getDefaultBooleanStateConfigurationClusterServer(sensorFault));
1676
1206
  }
1677
- /**
1678
- * Get a default power source replaceable battery cluster server.
1679
- *
1680
- * @param batPercentRemaining - The remaining battery percentage (default: 100).
1681
- * @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
1682
- * @param batVoltage - The battery voltage (default: 1500).
1683
- * @param batReplacementDescription - The battery replacement description (default: 'Battery type').
1684
- * @param batQuantity - The battery quantity (default: 1).
1685
- */
1686
1207
  getDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
1687
1208
  return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
1688
1209
  status: PowerSource.PowerSourceStatus.Active,
@@ -1699,25 +1220,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1699
1220
  endpointList: [],
1700
1221
  }, {}, {});
1701
1222
  }
1702
- /**
1703
- * Creates a default power source replaceable battery cluster server.
1704
- *
1705
- * @param batPercentRemaining - The remaining battery percentage (default: 100).
1706
- * @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
1707
- * @param batVoltage - The battery voltage (default: 1500).
1708
- * @param batReplacementDescription - The battery replacement description (default: 'Battery type').
1709
- * @param batQuantity - The battery quantity (default: 1).
1710
- */
1711
1223
  createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
1712
1224
  this.addClusterServer(this.getDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining, batChargeLevel, batVoltage, batReplacementDescription, batQuantity));
1713
1225
  }
1714
- /**
1715
- * Get a default power source rechargeable battery cluster server.
1716
- *
1717
- * @param batPercentRemaining - The remaining battery percentage (default: 100).
1718
- * @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
1719
- * @param batVoltage - The battery voltage (default: 1500).
1720
- */
1721
1226
  getDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
1722
1227
  return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
1723
1228
  status: PowerSource.PowerSourceStatus.Active,
@@ -1735,21 +1240,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1735
1240
  endpointList: [],
1736
1241
  }, {}, {});
1737
1242
  }
1738
- /**
1739
- * Creates a default power source rechargeable battery cluster server.
1740
- *
1741
- * @param batPercentRemaining - The remaining battery percentage (default: 100).
1742
- * @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
1743
- * @param batVoltage - The battery voltage (default: 1500).
1744
- */
1745
1243
  createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
1746
1244
  this.addClusterServer(this.getDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining, batChargeLevel, batVoltage));
1747
1245
  }
1748
- /**
1749
- * Get a default power source wired cluster server.
1750
- *
1751
- * @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
1752
- */
1753
1246
  getDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
1754
1247
  return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Wired), {
1755
1248
  wiredCurrentType,
@@ -1759,45 +1252,22 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1759
1252
  endpointList: [],
1760
1253
  }, {}, {});
1761
1254
  }
1762
- /**
1763
- * Creates a default power source wired cluster server.
1764
- *
1765
- * @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
1766
- */
1767
1255
  createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
1768
1256
  this.addClusterServer(this.getDefaultPowerSourceWiredClusterServer(wiredCurrentType));
1769
1257
  }
1770
- /**
1771
- * @deprecated This function is deprecated by Matter 1.3 spec and will be removed in a future version.
1772
- */
1773
1258
  createDefaultPowerSourceConfigurationClusterServer(endpointNumber) {
1774
1259
  this.addClusterServer(ClusterServer(PowerSourceConfigurationCluster, {
1775
1260
  sources: endpointNumber ? [EndpointNumber(endpointNumber)] : [],
1776
1261
  }, {}, {}));
1777
1262
  }
1778
- /**
1779
- * Get a default air quality cluster server.
1780
- *
1781
- * @param airQuality The air quality type. Defaults to `AirQuality.AirQualityType.Unknown`.
1782
- */
1783
1263
  getDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
1784
1264
  return ClusterServer(AirQualityCluster.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
1785
1265
  airQuality,
1786
1266
  }, {}, {});
1787
1267
  }
1788
- /**
1789
- * Creates a default air quality cluster server.
1790
- *
1791
- * @param airQuality The air quality type. Defaults to `AirQuality.AirQualityType.Unknown`.
1792
- */
1793
1268
  createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
1794
1269
  this.addClusterServer(this.getDefaultAirQualityClusterServer(airQuality));
1795
1270
  }
1796
- /**
1797
- * Get a default TVOC measurement cluster server.
1798
- *
1799
- * @param measuredValue - The measured value for TVOC.
1800
- */
1801
1271
  getDefaultTvocMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1802
1272
  return ClusterServer(TotalVolatileOrganicCompoundsConcentrationMeasurementCluster.with('NumericMeasurement'), {
1803
1273
  measuredValue,
@@ -1808,28 +1278,14 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1808
1278
  measurementMedium,
1809
1279
  }, {}, {});
1810
1280
  }
1811
- /**
1812
- * Creates a default TVOC measurement cluster server.
1813
- *
1814
- * @param measuredValue - The measured value for TVOC.
1815
- */
1816
1281
  createDefaultTvocMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1817
1282
  this.addClusterServer(this.getDefaultTvocMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
1818
1283
  }
1819
- /**
1820
- * Get a default heating thermostat cluster server with the specified parameters.
1821
- * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
1822
- * @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
1823
- * @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
1824
- * @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
1825
- * @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
1826
- */
1827
1284
  getDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
1828
1285
  return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Heating), {
1829
1286
  localTemperature: localTemperature * 100,
1830
1287
  systemMode: Thermostat.SystemMode.Heat,
1831
1288
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
1832
- // Thermostat.Feature.Heating
1833
1289
  occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
1834
1290
  minHeatSetpointLimit: minHeatSetpointLimit * 100,
1835
1291
  maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
@@ -1842,31 +1298,14 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1842
1298
  },
1843
1299
  }, {});
1844
1300
  }
1845
- /**
1846
- * Creates and adds a default heating thermostat cluster server to the device.
1847
- *
1848
- * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
1849
- * @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
1850
- * @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
1851
- * @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
1852
- */
1853
1301
  createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 25, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
1854
1302
  this.addClusterServer(this.getDefaultHeatingThermostatClusterServer(localTemperature, occupiedHeatingSetpoint, minHeatSetpointLimit, maxHeatSetpointLimit));
1855
1303
  }
1856
- /**
1857
- * Get a default cooling thermostat cluster server with the specified parameters.
1858
- * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
1859
- * @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
1860
- * @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
1861
- * @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
1862
- * @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
1863
- */
1864
1304
  getDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
1865
1305
  return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Cooling), {
1866
1306
  localTemperature: localTemperature * 100,
1867
1307
  systemMode: Thermostat.SystemMode.Cool,
1868
1308
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
1869
- // Thermostat.Feature.Cooling
1870
1309
  occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
1871
1310
  minCoolSetpointLimit: minCoolSetpointLimit * 100,
1872
1311
  maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
@@ -1879,48 +1318,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1879
1318
  },
1880
1319
  }, {});
1881
1320
  }
1882
- /**
1883
- * Creates and adds a default cooling thermostat cluster server to the device.
1884
- *
1885
- * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
1886
- * @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
1887
- * @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
1888
- * @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
1889
- */
1890
1321
  createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
1891
1322
  this.addClusterServer(this.getDefaultCoolingThermostatClusterServer(localTemperature, occupiedCoolingSetpoint, minCoolSetpointLimit, maxCoolSetpointLimit));
1892
1323
  }
1893
- /**
1894
- * Get a default thermostat cluster server with the specified parameters.
1895
- *
1896
- * @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
1897
- * @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
1898
- * @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
1899
- * @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
1900
- * @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
1901
- * @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
1902
- * @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
1903
- * @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
1904
- * @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
1905
- */
1906
1324
  getDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
1907
1325
  return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
1908
1326
  localTemperature: localTemperature * 100,
1909
1327
  systemMode: Thermostat.SystemMode.Auto,
1910
1328
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
1911
- // Thermostat.Feature.Heating
1912
1329
  occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
1913
1330
  minHeatSetpointLimit: minHeatSetpointLimit * 100,
1914
1331
  maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
1915
1332
  absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
1916
1333
  absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
1917
- // Thermostat.Feature.Cooling
1918
1334
  occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
1919
1335
  minCoolSetpointLimit: minCoolSetpointLimit * 100,
1920
1336
  maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
1921
1337
  absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
1922
1338
  absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
1923
- // Thermostat.Feature.AutoMode
1924
1339
  minSetpointDeadBand: minSetpointDeadBand * 100,
1925
1340
  thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
1926
1341
  }, {
@@ -1930,24 +1345,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1930
1345
  },
1931
1346
  }, {});
1932
1347
  }
1933
- /**
1934
- * Creates and adds a default thermostat cluster server to the device.
1935
- *
1936
- * @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
1937
- * @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
1938
- * @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
1939
- * @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
1940
- * @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
1941
- * @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
1942
- * @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
1943
- * @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
1944
- */
1945
1348
  createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
1946
1349
  this.addClusterServer(this.getDefaultThermostatClusterServer(localTemperature, occupiedHeatingSetpoint, occupiedCoolingSetpoint, minSetpointDeadBand, minHeatSetpointLimit, maxHeatSetpointLimit, minCoolSetpointLimit, maxCoolSetpointLimit));
1947
1350
  }
1948
- /**
1949
- * Get a default dummy time sync cluster server. Only needed to create a thermostat.
1950
- */
1951
1351
  getDefaultTimeSyncClusterServer() {
1952
1352
  return ClusterServer(TimeSynchronizationCluster.with(TimeSynchronization.Feature.TimeZone), {
1953
1353
  utcTime: null,
@@ -1979,19 +1379,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1979
1379
  timeFailure: true,
1980
1380
  });
1981
1381
  }
1982
- /**
1983
- * Creates a default dummy time sync cluster server. Only needed to create a thermostat.
1984
- */
1985
1382
  createDefaultTimeSyncClusterServer() {
1986
1383
  this.addClusterServer(this.getDefaultTimeSyncClusterServer());
1987
1384
  }
1988
- /**
1989
- * Returns the default SmokeCOAlarm Cluster Server.
1990
- *
1991
- * @param smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
1992
- * @param coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
1993
- * @returns The default SmokeCOAlarmClusterServer.
1994
- */
1995
1385
  getDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
1996
1386
  return ClusterServer(SmokeCoAlarmCluster.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm), {
1997
1387
  smokeState,
@@ -2023,24 +1413,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
2023
1413
  allClear: true,
2024
1414
  });
2025
1415
  }
2026
- /**
2027
- * Create the default SmokeCOAlarm Cluster Server.
2028
- *
2029
- * @param smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
2030
- * @param coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
2031
- * @returns The default SmokeCOAlarmClusterServer.
2032
- */
2033
1416
  createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
2034
1417
  this.addClusterServer(this.getDefaultSmokeCOAlarmClusterServer(smokeState, coState));
2035
1418
  }
2036
- /**
2037
- * Returns the default Carbon Monoxide Concentration Measurement Cluster Server.
2038
- *
2039
- * @param {number} measuredValue - The measured value of the concentration.
2040
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2041
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2042
- * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2043
- */
2044
1419
  getDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2045
1420
  return ClusterServer(CarbonMonoxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
2046
1421
  measuredValue,
@@ -2051,24 +1426,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
2051
1426
  measurementMedium,
2052
1427
  }, {}, {});
2053
1428
  }
2054
- /**
2055
- * Create the default Carbon Monoxide Concentration Measurement Cluster Server.
2056
- *
2057
- * @param {number} measuredValue - The measured value of the concentration.
2058
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2059
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2060
- */
2061
1429
  createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2062
1430
  this.addClusterServer(this.getDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
2063
1431
  }
2064
- /**
2065
- * Returns the default Carbon Dioxide Concentration Measurement Cluster Server.
2066
- *
2067
- * @param {number} measuredValue - The measured value of the concentration.
2068
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2069
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2070
- * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2071
- */
2072
1432
  getDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2073
1433
  return ClusterServer(CarbonDioxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
2074
1434
  measuredValue,
@@ -2079,24 +1439,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
2079
1439
  measurementMedium,
2080
1440
  }, {}, {});
2081
1441
  }
2082
- /**
2083
- * Create the default Carbon Dioxide Concentration Measurement Cluster Server.
2084
- *
2085
- * @param {number} measuredValue - The measured value of the concentration.
2086
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2087
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2088
- */
2089
1442
  createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2090
1443
  this.addClusterServer(this.getDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
2091
1444
  }
2092
- /**
2093
- * Returns the default Formaldehyde Concentration Measurement Cluster Server.
2094
- *
2095
- * @param {number} measuredValue - The measured value of the concentration.
2096
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2097
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2098
- * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2099
- */
2100
1445
  getDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2101
1446
  return ClusterServer(FormaldehydeConcentrationMeasurementCluster.with('NumericMeasurement'), {
2102
1447
  measuredValue,
@@ -2107,24 +1452,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
2107
1452
  measurementMedium,
2108
1453
  }, {}, {});
2109
1454
  }
2110
- /**
2111
- * Create the default Formaldehyde Concentration Measurement Cluster Server.
2112
- *
2113
- * @param {number} measuredValue - The measured value of the concentration.
2114
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2115
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2116
- */
2117
1455
  createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2118
1456
  this.addClusterServer(this.getDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
2119
1457
  }
2120
- /**
2121
- * Returns the default Pm1 Concentration Measurement Cluster Server.
2122
- *
2123
- * @param {number} measuredValue - The measured value of the concentration.
2124
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2125
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2126
- * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2127
- */
2128
1458
  getDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2129
1459
  return ClusterServer(Pm1ConcentrationMeasurementCluster.with('NumericMeasurement'), {
2130
1460
  measuredValue,
@@ -2135,24 +1465,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
2135
1465
  measurementMedium,
2136
1466
  }, {}, {});
2137
1467
  }
2138
- /**
2139
- * Create the default Pm1 Concentration Measurement Cluster Server.
2140
- *
2141
- * @param {number} measuredValue - The measured value of the concentration.
2142
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2143
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2144
- */
2145
1468
  createDefaulPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2146
1469
  this.addClusterServer(this.getDefaultPm1ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
2147
1470
  }
2148
- /**
2149
- * Returns the default Pm25 Concentration Measurement Cluster Server.
2150
- *
2151
- * @param {number} measuredValue - The measured value of the concentration.
2152
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2153
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2154
- * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2155
- */
2156
1471
  getDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2157
1472
  return ClusterServer(Pm25ConcentrationMeasurementCluster.with('NumericMeasurement'), {
2158
1473
  measuredValue,
@@ -2163,24 +1478,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
2163
1478
  measurementMedium,
2164
1479
  }, {}, {});
2165
1480
  }
2166
- /**
2167
- * Create the default Pm25 Concentration Measurement Cluster Server.
2168
- *
2169
- * @param {number} measuredValue - The measured value of the concentration.
2170
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2171
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2172
- */
2173
1481
  createDefaulPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2174
1482
  this.addClusterServer(this.getDefaultPm25ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
2175
1483
  }
2176
- /**
2177
- * Returns the default Pm10 Concentration Measurement Cluster Server.
2178
- *
2179
- * @param {number} measuredValue - The measured value of the concentration.
2180
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2181
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2182
- * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2183
- */
2184
1484
  getDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2185
1485
  return ClusterServer(Pm10ConcentrationMeasurementCluster.with('NumericMeasurement'), {
2186
1486
  measuredValue,
@@ -2191,24 +1491,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
2191
1491
  measurementMedium,
2192
1492
  }, {}, {});
2193
1493
  }
2194
- /**
2195
- * Create the default Pm10 Concentration Measurement Cluster Server.
2196
- *
2197
- * @param {number} measuredValue - The measured value of the concentration.
2198
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2199
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2200
- */
2201
1494
  createDefaulPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2202
1495
  this.addClusterServer(this.getDefaultPm10ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
2203
1496
  }
2204
- /**
2205
- * Returns the default Ozone Concentration Measurement Cluster Server.
2206
- *
2207
- * @param {number} measuredValue - The measured value of the concentration.
2208
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2209
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2210
- * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2211
- */
2212
1497
  getDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2213
1498
  return ClusterServer(OzoneConcentrationMeasurementCluster.with('NumericMeasurement'), {
2214
1499
  measuredValue,
@@ -2219,24 +1504,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
2219
1504
  measurementMedium,
2220
1505
  }, {}, {});
2221
1506
  }
2222
- /**
2223
- * Create the default Ozone Concentration Measurement Cluster Server.
2224
- *
2225
- * @param {number} measuredValue - The measured value of the concentration.
2226
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2227
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2228
- */
2229
1507
  createDefaulOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2230
1508
  this.addClusterServer(this.getDefaultOzoneConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
2231
1509
  }
2232
- /**
2233
- * Returns the default Radon Concentration Measurement Cluster Server.
2234
- *
2235
- * @param {number} measuredValue - The measured value of the concentration.
2236
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2237
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2238
- * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2239
- */
2240
1510
  getDefaultRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2241
1511
  return ClusterServer(RadonConcentrationMeasurementCluster.with('NumericMeasurement'), {
2242
1512
  measuredValue,
@@ -2247,24 +1517,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
2247
1517
  measurementMedium,
2248
1518
  }, {}, {});
2249
1519
  }
2250
- /**
2251
- * Create the default Radon Concentration Measurement Cluster Server.
2252
- *
2253
- * @param {number} measuredValue - The measured value of the concentration.
2254
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2255
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2256
- */
2257
1520
  createDefaulRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2258
1521
  this.addClusterServer(this.getDefaultRadonConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
2259
1522
  }
2260
- /**
2261
- * Returns the default Nitrogen Dioxide Concentration Measurement Cluster Server.
2262
- *
2263
- * @param {number} measuredValue - The measured value of the concentration.
2264
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2265
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2266
- * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2267
- */
2268
1523
  getDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2269
1524
  return ClusterServer(NitrogenDioxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
2270
1525
  measuredValue,
@@ -2275,22 +1530,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
2275
1530
  measurementMedium,
2276
1531
  }, {}, {});
2277
1532
  }
2278
- /**
2279
- * Create the default Nitrogen Dioxide Concentration Measurement Cluster Server.
2280
- *
2281
- * @param {number} measuredValue - The measured value of the concentration.
2282
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2283
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2284
- */
2285
1533
  createDefaulNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2286
1534
  this.addClusterServer(this.getDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
2287
1535
  }
2288
- /**
2289
- * Returns the default fan control cluster server rev 2.
2290
- *
2291
- * @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
2292
- * @returns The default fan control cluster server.
2293
- */
2294
1536
  getDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
2295
1537
  return ClusterServer(FanControlCluster.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
2296
1538
  fanMode,
@@ -2307,16 +1549,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
2307
1549
  },
2308
1550
  }, {});
2309
1551
  }
2310
- /**
2311
- * Create the default fan control cluster server rev 2.
2312
- *
2313
- * @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
2314
- * @returns The default fan control cluster server.
2315
- */
2316
1552
  createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
2317
1553
  this.addClusterServer(this.getDefaultFanControlClusterServer(fanMode));
2318
1554
  }
2319
- // NOTE Support of Device Energy Management Cluster is provisional.
2320
1555
  getDefaultDeviceEnergyManagementClusterServer() {
2321
1556
  return ClusterServer(DeviceEnergyManagementCluster.with(DeviceEnergyManagement.Feature.Pausable, DeviceEnergyManagement.Feature.PowerForecastReporting, DeviceEnergyManagement.Feature.StateForecastReporting), {
2322
1557
  esaType: DeviceEnergyManagement.EsaType.Other,
@@ -2340,7 +1575,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
2340
1575
  resumed: true,
2341
1576
  });
2342
1577
  }
2343
- // NOTE Support of Device Energy Management Mode Cluster is provisional.
2344
1578
  getDefaultDeviceEnergyManagementModeClusterServer() {
2345
1579
  return ClusterServer(DeviceEnergyManagementModeCluster, {
2346
1580
  supportedModes: [
@@ -2357,4 +1591,3 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
2357
1591
  }, {});
2358
1592
  }
2359
1593
  }
2360
- //# sourceMappingURL=matterbridgeDevice.js.map