matterbridge 2.2.0-dev.5 → 2.2.0-dev.7

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 (127) hide show
  1. package/CHANGELOG.md +1 -8
  2. package/dist/cli.js +2 -37
  3. package/dist/cluster/export.js +0 -2
  4. package/dist/defaultConfigSchema.js +0 -23
  5. package/dist/deviceManager.js +1 -94
  6. package/dist/frontend.js +42 -265
  7. package/dist/index.js +2 -29
  8. package/dist/logger/export.js +0 -1
  9. package/dist/matter/behaviors.js +0 -2
  10. package/dist/matter/clusters.js +0 -2
  11. package/dist/matter/devices.js +0 -2
  12. package/dist/matter/endpoints.js +0 -2
  13. package/dist/matter/export.js +0 -2
  14. package/dist/matter/types.js +1 -3
  15. package/dist/matterbridge.js +51 -720
  16. package/dist/matterbridgeAccessoryPlatform.js +0 -33
  17. package/dist/matterbridgeBehaviors.js +1 -32
  18. package/dist/matterbridgeDeviceTypes.js +11 -112
  19. package/dist/matterbridgeDynamicPlatform.js +0 -33
  20. package/dist/matterbridgeEndpoint.js +6 -690
  21. package/dist/matterbridgeEndpointHelpers.js +9 -118
  22. package/dist/matterbridgePlatform.js +7 -140
  23. package/dist/matterbridgeTypes.js +0 -24
  24. package/dist/pluginManager.js +3 -229
  25. package/dist/shelly.js +33 -136
  26. package/dist/storage/export.js +0 -1
  27. package/dist/update.js +0 -45
  28. package/dist/utils/colorUtils.js +2 -205
  29. package/dist/utils/copyDirectory.js +1 -37
  30. package/dist/utils/createZip.js +2 -42
  31. package/dist/utils/deepCopy.js +0 -40
  32. package/dist/utils/deepEqual.js +1 -65
  33. package/dist/utils/export.js +0 -1
  34. package/dist/utils/isvalid.js +0 -86
  35. package/dist/utils/network.js +5 -77
  36. package/dist/utils/parameter.js +0 -41
  37. package/dist/utils/wait.js +5 -48
  38. package/frontend/build/asset-manifest.json +3 -3
  39. package/frontend/build/index.html +1 -1
  40. package/frontend/build/static/js/{main.f60aae10.js → main.8240902c.js} +3 -3
  41. package/frontend/build/static/js/main.8240902c.js.map +1 -0
  42. package/npm-shrinkwrap.json +44 -44
  43. package/package.json +2 -2
  44. package/dist/cli.d.ts +0 -28
  45. package/dist/cli.d.ts.map +0 -1
  46. package/dist/cli.js.map +0 -1
  47. package/dist/cluster/export.d.ts.map +0 -1
  48. package/dist/cluster/export.js.map +0 -1
  49. package/dist/defaultConfigSchema.d.ts.map +0 -1
  50. package/dist/defaultConfigSchema.js.map +0 -1
  51. package/dist/deviceManager.d.ts +0 -109
  52. package/dist/deviceManager.d.ts.map +0 -1
  53. package/dist/deviceManager.js.map +0 -1
  54. package/dist/frontend.d.ts +0 -172
  55. package/dist/frontend.d.ts.map +0 -1
  56. package/dist/frontend.js.map +0 -1
  57. package/dist/index.d.ts.map +0 -1
  58. package/dist/index.js.map +0 -1
  59. package/dist/logger/export.d.ts.map +0 -1
  60. package/dist/logger/export.js.map +0 -1
  61. package/dist/matter/behaviors.d.ts.map +0 -1
  62. package/dist/matter/behaviors.js.map +0 -1
  63. package/dist/matter/clusters.d.ts.map +0 -1
  64. package/dist/matter/clusters.js.map +0 -1
  65. package/dist/matter/devices.d.ts.map +0 -1
  66. package/dist/matter/devices.js.map +0 -1
  67. package/dist/matter/endpoints.d.ts.map +0 -1
  68. package/dist/matter/endpoints.js.map +0 -1
  69. package/dist/matter/export.d.ts.map +0 -1
  70. package/dist/matter/export.js.map +0 -1
  71. package/dist/matter/types.d.ts.map +0 -1
  72. package/dist/matter/types.js.map +0 -1
  73. package/dist/matterbridge.d.ts +0 -410
  74. package/dist/matterbridge.d.ts.map +0 -1
  75. package/dist/matterbridge.js.map +0 -1
  76. package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
  77. package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
  78. package/dist/matterbridgeBehaviors.d.ts +0 -148
  79. package/dist/matterbridgeBehaviors.d.ts.map +0 -1
  80. package/dist/matterbridgeBehaviors.js.map +0 -1
  81. package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
  82. package/dist/matterbridgeDeviceTypes.js.map +0 -1
  83. package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
  84. package/dist/matterbridgeDynamicPlatform.js.map +0 -1
  85. package/dist/matterbridgeEndpoint.d.ts +0 -827
  86. package/dist/matterbridgeEndpoint.d.ts.map +0 -1
  87. package/dist/matterbridgeEndpoint.js.map +0 -1
  88. package/dist/matterbridgeEndpointHelpers.d.ts +0 -123
  89. package/dist/matterbridgeEndpointHelpers.d.ts.map +0 -1
  90. package/dist/matterbridgeEndpointHelpers.js.map +0 -1
  91. package/dist/matterbridgePlatform.d.ts +0 -159
  92. package/dist/matterbridgePlatform.d.ts.map +0 -1
  93. package/dist/matterbridgePlatform.js.map +0 -1
  94. package/dist/matterbridgeTypes.d.ts.map +0 -1
  95. package/dist/matterbridgeTypes.js.map +0 -1
  96. package/dist/pluginManager.d.ts +0 -236
  97. package/dist/pluginManager.d.ts.map +0 -1
  98. package/dist/pluginManager.js.map +0 -1
  99. package/dist/shelly.d.ts.map +0 -1
  100. package/dist/shelly.js.map +0 -1
  101. package/dist/storage/export.d.ts.map +0 -1
  102. package/dist/storage/export.js.map +0 -1
  103. package/dist/update.d.ts.map +0 -1
  104. package/dist/update.js.map +0 -1
  105. package/dist/utils/colorUtils.d.ts.map +0 -1
  106. package/dist/utils/colorUtils.js.map +0 -1
  107. package/dist/utils/copyDirectory.d.ts.map +0 -1
  108. package/dist/utils/copyDirectory.js.map +0 -1
  109. package/dist/utils/createZip.d.ts.map +0 -1
  110. package/dist/utils/createZip.js.map +0 -1
  111. package/dist/utils/deepCopy.d.ts.map +0 -1
  112. package/dist/utils/deepCopy.js.map +0 -1
  113. package/dist/utils/deepEqual.d.ts.map +0 -1
  114. package/dist/utils/deepEqual.js.map +0 -1
  115. package/dist/utils/export.d.ts.map +0 -1
  116. package/dist/utils/export.js.map +0 -1
  117. package/dist/utils/isvalid.d.ts.map +0 -1
  118. package/dist/utils/isvalid.js.map +0 -1
  119. package/dist/utils/network.d.ts.map +0 -1
  120. package/dist/utils/network.js.map +0 -1
  121. package/dist/utils/parameter.d.ts.map +0 -1
  122. package/dist/utils/parameter.js.map +0 -1
  123. package/dist/utils/wait.d.ts +0 -43
  124. package/dist/utils/wait.d.ts.map +0 -1
  125. package/dist/utils/wait.js.map +0 -1
  126. package/frontend/build/static/js/main.f60aae10.js.map +0 -1
  127. /package/frontend/build/static/js/{main.f60aae10.js.LICENSE.txt → main.8240902c.js.LICENSE.txt} +0 -0
@@ -1,36 +1,10 @@
1
- /**
2
- * This file contains the class MatterbridgeEndpoint that extends the Endpoint class from the Matter.js library.
3
- *
4
- * @file matterbridgeEndpoint.ts
5
- * @author Luca Liguori
6
- * @date 2024-10-01
7
- * @version 2.0.0
8
- *
9
- * Copyright 2024, 2025, 2026 Luca Liguori.
10
- *
11
- * Licensed under the Apache License, Version 2.0 (the "License");
12
- * you may not use this file except in compliance with the License.
13
- * You may obtain a copy of the License at
14
- *
15
- * http://www.apache.org/licenses/LICENSE-2.0
16
- *
17
- * Unless required by applicable law or agreed to in writing, software
18
- * distributed under the License is distributed on an "AS IS" BASIS,
19
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
- * See the License for the specific language governing permissions and
21
- * limitations under the License. *
22
- */
23
- // AnsiLogger module
24
1
  import { AnsiLogger, BLUE, CYAN, YELLOW, db, debugStringify, er, hk, or, zb } from './logger/export.js';
25
- // Matterbridge
26
2
  import { bridgedNode } from './matterbridgeDeviceTypes.js';
27
3
  import { isValidNumber, isValidObject } from './utils/export.js';
28
4
  import { MatterbridgeBehavior, MatterbridgeBehaviorDevice, MatterbridgeIdentifyServer, MatterbridgeOnOffServer, MatterbridgeLevelControlServer, MatterbridgeColorControlServer, MatterbridgeWindowCoveringServer, MatterbridgeThermostatServer, MatterbridgeFanControlServer, MatterbridgeDoorLockServer, MatterbridgeModeSelectServer, MatterbridgeValveConfigurationAndControlServer, MatterbridgeSmokeCoAlarmServer, MatterbridgeBooleanStateConfigurationServer, MatterbridgeSwitchServer, } from './matterbridgeBehaviors.js';
29
5
  import { addClusterServers, addFixedLabel, addOptionalClusterServers, addRequiredClusterServers, addUserLabel, capitalizeFirstLetter, createUniqueId, getBehavior, getBehaviourTypesFromClusterClientIds, getBehaviourTypesFromClusterServerIds, getDefaultFlowMeasurementClusterServer, getDefaultIlluminanceMeasurementClusterServer, getDefaultPressureMeasurementClusterServer, getDefaultRelativeHumidityMeasurementClusterServer, getDefaultTemperatureMeasurementClusterServer, getDefaultOccupancySensingClusterServer, lowercaseFirstLetter, updateAttribute, getClusterId, getAttributeId, setAttribute, getAttribute, checkNotLatinCharacters, generateUniqueId, subscribeAttribute, } from './matterbridgeEndpointHelpers.js';
30
- // @matter
31
6
  import { Endpoint, Lifecycle, MutableEndpoint, NamedHandler, SupportedBehaviors, VendorId } from '@matter/main';
32
7
  import { getClusterNameById, MeasurementType } from '@matter/main/types';
33
- // @matter clusters
34
8
  import { Descriptor } from '@matter/main/clusters/descriptor';
35
9
  import { PowerSource } from '@matter/main/clusters/power-source';
36
10
  import { BridgedDeviceBasicInformation } from '@matter/main/clusters/bridged-device-basic-information';
@@ -52,7 +26,6 @@ import { ElectricalPowerMeasurement } from '@matter/main/clusters/electrical-pow
52
26
  import { ElectricalEnergyMeasurement } from '@matter/main/clusters/electrical-energy-measurement';
53
27
  import { AirQuality } from '@matter/main/clusters/air-quality';
54
28
  import { ConcentrationMeasurement } from '@matter/main/clusters/concentration-measurement';
55
- // @matter behaviors
56
29
  import { DescriptorServer } from '@matter/main/behaviors/descriptor';
57
30
  import { PowerSourceServer } from '@matter/main/behaviors/power-source';
58
31
  import { BridgedDeviceBasicInformationServer } from '@matter/main/behaviors/bridged-device-basic-information';
@@ -83,7 +56,7 @@ import { RadonConcentrationMeasurementServer } from '@matter/main/behaviors/rado
83
56
  import { TotalVolatileOrganicCompoundsConcentrationMeasurementServer } from '@matter/main/behaviors/total-volatile-organic-compounds-concentration-measurement';
84
57
  export class MatterbridgeEndpoint extends Endpoint {
85
58
  static bridgeMode = '';
86
- static logLevel = "info" /* LogLevel.INFO */;
59
+ static logLevel = "info";
87
60
  log;
88
61
  plugin = undefined;
89
62
  configUrl = undefined;
@@ -99,25 +72,14 @@ export class MatterbridgeEndpoint extends Endpoint {
99
72
  hardwareVersion = undefined;
100
73
  hardwareVersionString = undefined;
101
74
  productUrl = 'https://www.npmjs.com/package/matterbridge';
102
- // The first device type of the endpoint
103
75
  name = undefined;
104
76
  deviceType;
105
77
  uniqueStorageKey = undefined;
106
78
  tagList = undefined;
107
- // Maps matter deviceTypes
108
79
  deviceTypes = new Map();
109
- // Command handler
110
80
  commandHandler = new NamedHandler();
111
- /**
112
- * Represents a MatterbridgeEndpoint.
113
- * @constructor
114
- * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the endpoint.
115
- * @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
116
- * @param {boolean} [debug=false] - Debug flag.
117
- */
118
81
  constructor(definition, options = {}, debug = false) {
119
82
  let deviceTypeList = [];
120
- // Get the first DeviceTypeDefinition
121
83
  let firstDefinition;
122
84
  if (Array.isArray(definition)) {
123
85
  firstDefinition = definition[0];
@@ -130,7 +92,6 @@ export class MatterbridgeEndpoint extends Endpoint {
130
92
  firstDefinition = definition;
131
93
  deviceTypeList = [{ deviceType: firstDefinition.code, revision: firstDefinition.revision }];
132
94
  }
133
- // Convert the first DeviceTypeDefinition to an EndpointType.Options
134
95
  const deviceTypeDefinitionV8 = {
135
96
  name: firstDefinition.name.replace('-', '_'),
136
97
  deviceType: firstDefinition.code,
@@ -149,11 +110,9 @@ export class MatterbridgeEndpoint extends Endpoint {
149
110
  behaviors: options.tagList ? SupportedBehaviors(DescriptorServer.with(Descriptor.Feature.TagList)) : {},
150
111
  };
151
112
  const endpointV8 = MutableEndpoint(deviceTypeDefinitionV8);
152
- // Check if the uniqueStorageKey is valid
153
113
  if (options.uniqueStorageKey && checkNotLatinCharacters(options.uniqueStorageKey)) {
154
114
  options.uniqueStorageKey = generateUniqueId(options.uniqueStorageKey);
155
115
  }
156
- // Convert the options to an Endpoint.Options
157
116
  const optionsV8 = {
158
117
  id: options.uniqueStorageKey?.replace(/[ .]/g, ''),
159
118
  number: options.endpointId,
@@ -171,41 +130,17 @@ export class MatterbridgeEndpoint extends Endpoint {
171
130
  }
172
131
  else
173
132
  this.deviceTypes.set(firstDefinition.code, firstDefinition);
174
- // console.log('MatterbridgeEndpoint.option', options);
175
- // console.log('MatterbridgeEndpoint.endpointV8', endpointV8);
176
- // console.log('MatterbridgeEndpoint.optionsV8', optionsV8);
177
- // Create the logger
178
- this.log = new AnsiLogger({ logName: options.uniqueStorageKey ?? 'MatterbridgeEndpoint', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: debug === true ? "debug" /* LogLevel.DEBUG */ : MatterbridgeEndpoint.logLevel });
133
+ this.log = new AnsiLogger({ logName: options.uniqueStorageKey ?? 'MatterbridgeEndpoint', logTimestampFormat: 4, logLevel: debug === true ? "debug" : MatterbridgeEndpoint.logLevel });
179
134
  this.log.debug(`${YELLOW}new${db} MatterbridgeEndpoint: ${zb}${'0x' + firstDefinition.code.toString(16).padStart(4, '0')}${db}-${zb}${firstDefinition.name}${db} ` +
180
135
  `id: ${CYAN}${options.uniqueStorageKey}${db} number: ${CYAN}${options.endpointId}${db} taglist: ${CYAN}${options.tagList ? debugStringify(options.tagList) : 'undefined'}${db}`);
181
- // Add MatterbridgeBehavior with MatterbridgeBehaviorDevice
182
136
  this.behaviors.require(MatterbridgeBehavior, { deviceCommand: new MatterbridgeBehaviorDevice(this.log, this.commandHandler, undefined) });
183
137
  }
184
- /**
185
- * Loads an instance of the MatterbridgeEndpoint class.
186
- *
187
- * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the device.
188
- * @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
189
- * @param {boolean} [debug=false] - Debug flag.
190
- * @returns {Promise<MatterbridgeEndpoint>} MatterbridgeEndpoint instance.
191
- */
192
138
  static async loadInstance(definition, options = {}, debug = false) {
193
139
  return new MatterbridgeEndpoint(definition, options, debug);
194
140
  }
195
- /**
196
- * Get all the device types of this endpoint.
197
- *
198
- * @returns {DeviceTypeDefinition[]} The device types of this endpoint.
199
- */
200
141
  getDeviceTypes() {
201
142
  return Array.from(this.deviceTypes.values());
202
143
  }
203
- /**
204
- * Checks if the provided cluster server is supported by this endpoint.
205
- *
206
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
207
- * @returns {boolean} True if the cluster server is supported, false otherwise.
208
- */
209
144
  hasClusterServer(cluster) {
210
145
  const behavior = getBehavior(this, cluster);
211
146
  if (behavior)
@@ -213,13 +148,6 @@ export class MatterbridgeEndpoint extends Endpoint {
213
148
  else
214
149
  return false;
215
150
  }
216
- /**
217
- * Checks if the provided attribute server is supported for a given cluster of this endpoint.
218
- *
219
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
220
- * @param {string} attribute - The attribute name to check.
221
- * @returns {boolean} True if the attribute server is supported, false otherwise.
222
- */
223
151
  hasAttributeServer(cluster, attribute) {
224
152
  const behavior = getBehavior(this, cluster);
225
153
  if (!behavior || !this.behaviors.supported[behavior.id])
@@ -228,219 +156,87 @@ export class MatterbridgeEndpoint extends Endpoint {
228
156
  const defaults = this.behaviors.defaultsFor(behavior);
229
157
  return lowercaseFirstLetter(attribute) in options || lowercaseFirstLetter(attribute) in defaults;
230
158
  }
231
- /**
232
- * Retrieves the initial options for the provided cluster server.
233
- *
234
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to get options for.
235
- * @returns {Record<string, boolean | number | bigint | string | object | null> | undefined} The options for the provided cluster server, or undefined if the cluster is not supported.
236
- */
237
159
  getClusterServerOptions(cluster) {
238
160
  const behavior = getBehavior(this, cluster);
239
161
  if (!behavior)
240
162
  return undefined;
241
163
  return this.behaviors.optionsFor(behavior);
242
164
  }
243
- /**
244
- * Retrieves the value of the provided attribute from the given cluster.
245
- *
246
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to retrieve the attribute from.
247
- * @param {string} attribute - The name of the attribute to retrieve.
248
- * @param {AnsiLogger} [log] - Optional logger for error and info messages.
249
- * @returns {any} The value of the attribute, or undefined if the attribute is not found.
250
- */
251
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
252
165
  getAttribute(cluster, attribute, log) {
253
166
  return getAttribute(this, cluster, attribute, log);
254
167
  }
255
- /**
256
- * Sets the value of an attribute on a cluster server.
257
- *
258
- * @param {Behavior.Type | ClusterType | ClusterId | string} clusterId - The ID of the cluster.
259
- * @param {string} attribute - The name of the attribute.
260
- * @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
261
- * @param {AnsiLogger} [log] - (Optional) The logger to use for logging errors and information.
262
- * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
263
- */
264
168
  async setAttribute(clusterId, attribute, value, log) {
265
169
  return await setAttribute(this, clusterId, attribute, value, log);
266
170
  }
267
- /**
268
- * Update the value of an attribute on a cluster server only if the value is different.
269
- *
270
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to set the attribute on.
271
- * @param {string} attribute - The name of the attribute.
272
- * @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
273
- * @param {AnsiLogger} [log] - (Optional) The logger to use for logging the update. Errors are logged to the endpoint logger.
274
- * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
275
- */
276
171
  async updateAttribute(cluster, attribute, value, log) {
277
172
  return await updateAttribute(this, cluster, attribute, value, log);
278
173
  }
279
- /**
280
- * Subscribes to the provided attribute on a cluster.
281
- *
282
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to subscribe the attribute to.
283
- * @param {string} attribute - The name of the attribute to subscribe to.
284
- * @param {(newValue: any, oldValue: any) => void} listener - A callback function that will be called when the attribute value changes.
285
- * @param {AnsiLogger} [log] - Optional logger for logging errors and information.
286
- * @returns {Promise<boolean>} - A boolean indicating whether the subscription was successful.
287
- */
288
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
289
174
  async subscribeAttribute(cluster, attribute, listener, log) {
290
175
  return await subscribeAttribute(this, cluster, attribute, listener, log);
291
176
  }
292
- /**
293
- * Triggers an event on the specified cluster.
294
- *
295
- * @param {ClusterId} clusterId - The ID of the cluster.
296
- * @param {string} event - The name of the event to trigger.
297
- * @param {Record<string, boolean | number | bigint | string | object | undefined | null>} payload - The payload to pass to the event.
298
- * @param {AnsiLogger} [log] - Optional logger for logging information.
299
- * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the event was successfully triggered.
300
- */
301
177
  async triggerEvent(clusterId, event, payload, log) {
302
178
  const clusterName = lowercaseFirstLetter(getClusterNameById(clusterId));
303
179
  if (this.construction.status !== Lifecycle.Status.Active) {
304
180
  this.log.error(`triggerEvent ${hk}${clusterName}.${event}${er} error: Endpoint ${or}${this.maybeId}${er}:${or}${this.maybeNumber}${er} is in the ${BLUE}${this.construction.status}${er} state`);
305
181
  return false;
306
182
  }
307
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
308
183
  const events = this.events;
309
184
  if (!(clusterName in events) || !(event in events[clusterName])) {
310
185
  this.log.error(`triggerEvent ${hk}${event}${er} error: Cluster ${'0x' + clusterId.toString(16).padStart(4, '0')}:${clusterName} not found on endpoint ${or}${this.id}${er}:${or}${this.number}${er}`);
311
186
  return false;
312
187
  }
313
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
314
- // @ts-ignore
315
188
  await this.act((agent) => agent[clusterName].events[event].emit(payload, agent.context));
316
189
  log?.info(`${db}Trigger event ${hk}${capitalizeFirstLetter(clusterName)}${db}.${hk}${event}${db} with ${debugStringify(payload)}${db} on endpoint ${or}${this.id}${db}:${or}${this.number}${db} `);
317
190
  return true;
318
191
  }
319
- /**
320
- * Adds cluster servers from the provided server list.
321
- *
322
- * @param {ClusterId[]} serverList - The list of cluster IDs to add.
323
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
324
- */
325
192
  addClusterServers(serverList) {
326
193
  addClusterServers(this, serverList);
327
194
  return this;
328
195
  }
329
- /**
330
- * Adds a fixed label to the FixedLabel cluster. If the cluster server is not present, it will be added.
331
- *
332
- * @param {string} label - The label to add.
333
- * @param {string} value - The value of the label.
334
- * @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
335
- */
336
196
  async addFixedLabel(label, value) {
337
197
  await addFixedLabel(this, label, value);
338
198
  return this;
339
199
  }
340
- /**
341
- * Adds a user label to the UserLabel cluster. If the cluster server is not present, it will be added.
342
- *
343
- * @param {string} label - The label to add.
344
- * @param {string} value - The value of the label.
345
- * @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
346
- */
347
200
  async addUserLabel(label, value) {
348
201
  await addUserLabel(this, label, value);
349
202
  return this;
350
203
  }
351
- /**
352
- * Adds a command handler for the specified command.
353
- *
354
- * @param {keyof MatterbridgeEndpointCommands} command - The command to add the handler for.
355
- * @param {HandlerFunction} handler - The handler function to execute when the command is received.
356
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
357
- */
358
204
  addCommandHandler(command, handler) {
359
205
  this.commandHandler.addHandler(command, handler);
360
206
  return this;
361
207
  }
362
- /**
363
- * Execute the command handler for the specified command. Mainly used in Jest tests.
364
- *
365
- * @param {keyof MatterbridgeEndpointCommands} command - The command to execute.
366
- * @param {Record<string, boolean | number | bigint | string | object | null>} request - The optional request to pass to the handler function.
367
- * @returns {Promise<void>} A promise that resolves when the command handler has been executed
368
- */
369
208
  async executeCommandHandler(command, request) {
370
209
  await this.commandHandler.executeHandler(command, { request });
371
210
  }
372
- /**
373
- * Adds the required cluster servers (only if they are not present) for the device types of the specified endpoint.
374
- *
375
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
376
- */
377
211
  addRequiredClusterServers() {
378
212
  addRequiredClusterServers(this);
379
213
  return this;
380
214
  }
381
- /**
382
- * Adds the optional cluster servers (only if they are not present) for the device types of the specified endpoint.
383
- *
384
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
385
- */
386
215
  addOptionalClusterServers() {
387
216
  addOptionalClusterServers(this);
388
217
  return this;
389
218
  }
390
- /**
391
- * Retrieves all cluster servers.
392
- *
393
- * @returns {Behavior.Type[]} An array of all cluster servers.
394
- */
395
219
  getAllClusterServers() {
396
220
  return Object.values(this.behaviors.supported);
397
221
  }
398
- /**
399
- * Retrieves the names of all cluster servers.
400
- *
401
- * @returns {string[]} An array of all cluster server names.
402
- */
403
222
  getAllClusterServerNames() {
404
223
  return Object.keys(this.behaviors.supported);
405
224
  }
406
- /**
407
- * Iterates over each attribute of each cluster server of the device state and calls the provided callback function.
408
- *
409
- * @param {Function} callback - The callback function to call with the cluster name, cluster id, attribute name, attribute id and attribute value.
410
- */
411
225
  forEachAttribute(callback) {
412
226
  for (const [clusterName, clusterAttributes] of Object.entries(this.state)) {
413
227
  for (const [attributeName, attributeValue] of Object.entries(clusterAttributes)) {
414
228
  const clusterId = getClusterId(this, clusterName);
415
229
  if (clusterId === undefined) {
416
- // this.log.error(`forEachAttribute error: cluster ${clusterName} not found`);
417
230
  continue;
418
231
  }
419
232
  const attributeId = getAttributeId(this, clusterName, attributeName);
420
233
  if (attributeId === undefined) {
421
- // this.log.error(`forEachAttribute error: attribute ${clusterName}.${attributeName} not found`);
422
234
  continue;
423
235
  }
424
236
  callback(clusterName, clusterId, attributeName, attributeId, attributeValue);
425
237
  }
426
238
  }
427
239
  }
428
- /**
429
- * Adds a child endpoint with the specified device types and options.
430
- * If the child endpoint is not already present, it will be created and added.
431
- * If the child endpoint is already present, the existing child endpoint will be returned.
432
- *
433
- * @param {string} endpointName - The name of the new endpoint to add.
434
- * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
435
- * @param {MatterbridgeEndpointOptions} [options={}] - The options for the endpoint.
436
- * @param {boolean} [debug=false] - Whether to enable debug logging.
437
- * @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
438
- *
439
- * @example
440
- * ```typescript
441
- * const endpoint = device.addChildDeviceType('Temperature', [temperatureSensor], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
442
- * ```
443
- */
444
240
  addChildDeviceType(endpointName, definition, options = {}, debug = false) {
445
241
  this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
446
242
  let alreadyAdded = false;
@@ -480,23 +276,6 @@ export class MatterbridgeEndpoint extends Endpoint {
480
276
  }
481
277
  return child;
482
278
  }
483
- /**
484
- * Adds a child endpoint with one or more device types with the required cluster servers and the specified cluster servers.
485
- * If the child endpoint is not already present in the childEndpoints, it will be added.
486
- * If the child endpoint is already present in the childEndpoints, the device types and cluster servers will be added to the existing child endpoint.
487
- *
488
- * @param {string} endpointName - The name of the new enpoint to add.
489
- * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
490
- * @param {ClusterId[]} [serverList=[]] - The list of cluster IDs to include.
491
- * @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
492
- * @param {boolean} [debug=false] - Whether to enable debug logging.
493
- * @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
494
- *
495
- * @example
496
- * ```typescript
497
- * const endpoint = device.addChildDeviceTypeWithClusterServer('Temperature', [temperatureSensor], [], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
498
- * ```
499
- */
500
279
  addChildDeviceTypeWithClusterServer(endpointName, definition, serverList = [], options = {}, debug = false) {
501
280
  this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
502
281
  let alreadyAdded = false;
@@ -559,38 +338,15 @@ export class MatterbridgeEndpoint extends Endpoint {
559
338
  }
560
339
  return child;
561
340
  }
562
- /**
563
- * Retrieves a child endpoint by its name.
564
- *
565
- * @param {string} endpointName - The name of the endpoint to retrieve.
566
- * @returns {Endpoint | undefined} The child endpoint with the specified name, or undefined if not found.
567
- */
568
341
  getChildEndpointByName(endpointName) {
569
342
  return this.parts.find((part) => part.id === endpointName);
570
343
  }
571
- /**
572
- * Retrieves a child endpoint by its EndpointNumber.
573
- *
574
- * @param {EndpointNumber} endpointNumber - The EndpointNumber of the endpoint to retrieve.
575
- * @returns {MatterbridgeEndpoint | undefined} The child endpoint with the specified EndpointNumber, or undefined if not found.
576
- */
577
344
  getChildEndpoint(endpointNumber) {
578
345
  return this.parts.find((part) => part.number === endpointNumber);
579
346
  }
580
- /**
581
- * Get all the child endpoints of this endpoint.
582
- *
583
- * @returns {MatterbridgeEndpoint[]} The child endpoints.
584
- */
585
347
  getChildEndpoints() {
586
348
  return Array.from(this.parts);
587
349
  }
588
- /**
589
- * Serializes the Matterbridge device into a serialized object.
590
- *
591
- * @param pluginName - The name of the plugin.
592
- * @returns The serialized Matterbridge device object.
593
- */
594
350
  static serialize(device) {
595
351
  if (!device.serialNumber || !device.deviceName || !device.uniqueId)
596
352
  return;
@@ -613,15 +369,9 @@ export class MatterbridgeEndpoint extends Endpoint {
613
369
  serialized.clusterServersId.push(BridgedDeviceBasicInformation.Cluster.id);
614
370
  if (behaviorName === 'powerSource')
615
371
  serialized.clusterServersId.push(PowerSource.Cluster.id);
616
- // serialized.clusterServersId.push(this.behaviors.supported[behaviorName]cluster.id);
617
372
  });
618
373
  return serialized;
619
374
  }
620
- /**
621
- * Deserializes the device into a serialized object.
622
- *
623
- * @returns The deserialized MatterbridgeDevice.
624
- */
625
375
  static deserialize(serializedDevice) {
626
376
  const device = new MatterbridgeEndpoint(serializedDevice.deviceTypes, { uniqueStorageKey: serializedDevice.endpointName, endpointId: serializedDevice.endpoint }, false);
627
377
  device.plugin = serializedDevice.pluginName;
@@ -637,16 +387,9 @@ export class MatterbridgeEndpoint extends Endpoint {
637
387
  device.createDefaultBridgedDeviceBasicInformationClusterServer(serializedDevice.deviceName, serializedDevice.serialNumber, serializedDevice.vendorId ?? 0xfff1, serializedDevice.vendorName ?? 'Matterbridge', serializedDevice.productName ?? 'Matterbridge device');
638
388
  else if (clusterId === PowerSource.Cluster.id)
639
389
  device.createDefaultPowerSourceWiredClusterServer();
640
- // else addClusterServerFromList(device, [clusterId]);
641
390
  }
642
391
  return device;
643
392
  }
644
- /**
645
- * Creates a default power source wired cluster server.
646
- *
647
- * @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
648
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
649
- */
650
393
  createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
651
394
  this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Wired), {
652
395
  wiredCurrentType,
@@ -657,16 +400,6 @@ export class MatterbridgeEndpoint extends Endpoint {
657
400
  });
658
401
  return this;
659
402
  }
660
- /**
661
- * Creates a default power source replaceable battery cluster server.
662
- *
663
- * @param batPercentRemaining - The remaining battery percentage (default: 100).
664
- * @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
665
- * @param batVoltage - The battery voltage (default: 1500).
666
- * @param batReplacementDescription - The battery replacement description (default: 'Battery type').
667
- * @param batQuantity - The battery quantity (default: 1).
668
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
669
- */
670
403
  createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
671
404
  this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
672
405
  status: PowerSource.PowerSourceStatus.Active,
@@ -684,14 +417,6 @@ export class MatterbridgeEndpoint extends Endpoint {
684
417
  });
685
418
  return this;
686
419
  }
687
- /**
688
- * Creates a default power source rechargeable battery cluster server.
689
- *
690
- * @param batPercentRemaining - The remaining battery percentage (default: 100).
691
- * @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
692
- * @param batVoltage - The battery voltage (default: 1500).
693
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
694
- */
695
420
  createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
696
421
  this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
697
422
  status: PowerSource.PowerSourceStatus.Active,
@@ -710,21 +435,6 @@ export class MatterbridgeEndpoint extends Endpoint {
710
435
  });
711
436
  return this;
712
437
  }
713
- /**
714
- * Creates a default Basic Information Cluster Server for the server node.
715
- *
716
- * @param deviceName - The name of the device.
717
- * @param serialNumber - The serial number of the device.
718
- * @param vendorId - The vendor ID of the device.
719
- * @param vendorName - The vendor name of the device.
720
- * @param productId - The product ID of the device.
721
- * @param productName - The product name of the device.
722
- * @param softwareVersion - The software version of the device. Default is 1.
723
- * @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
724
- * @param hardwareVersion - The hardware version of the device. Default is 1.
725
- * @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
726
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
727
- */
728
438
  createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
729
439
  this.log.logName = deviceName;
730
440
  this.deviceName = deviceName;
@@ -748,20 +458,6 @@ export class MatterbridgeEndpoint extends Endpoint {
748
458
  }
749
459
  return this;
750
460
  }
751
- /**
752
- * Creates a default BridgedDeviceBasicInformationClusterServer for the aggregator endpoints.
753
- *
754
- * @param deviceName - The name of the device.
755
- * @param serialNumber - The serial number of the device.
756
- * @param vendorId - The vendor ID of the device.
757
- * @param vendorName - The name of the vendor.
758
- * @param productName - The name of the product.
759
- * @param softwareVersion - The software version of the device. Default is 1.
760
- * @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
761
- * @param hardwareVersion - The hardware version of the device. Default is 1.
762
- * @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
763
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
764
- */
765
461
  createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
766
462
  this.log.logName = deviceName;
767
463
  this.deviceName = deviceName;
@@ -778,7 +474,7 @@ export class MatterbridgeEndpoint extends Endpoint {
778
474
  this.behaviors.require(BridgedDeviceBasicInformationServer.enable({
779
475
  events: { leave: true, reachableChanged: true },
780
476
  }), {
781
- vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined, // 4874
477
+ vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
782
478
  vendorName: vendorName.slice(0, 32),
783
479
  productName: productName.slice(0, 32),
784
480
  productUrl: this.productUrl,
@@ -794,13 +490,6 @@ export class MatterbridgeEndpoint extends Endpoint {
794
490
  });
795
491
  return this;
796
492
  }
797
- /**
798
- * Creates a default identify cluster server with the specified identify time and type.
799
- *
800
- * @param {number} [identifyTime=0] - The time to identify the server. Defaults to 0.
801
- * @param {Identify.IdentifyType} [identifyType=Identify.IdentifyType.None] - The type of identification. Defaults to Identify.IdentifyType.None.
802
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
803
- */
804
493
  createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
805
494
  this.behaviors.require(MatterbridgeIdentifyServer, {
806
495
  identifyTime,
@@ -808,32 +497,14 @@ export class MatterbridgeEndpoint extends Endpoint {
808
497
  });
809
498
  return this;
810
499
  }
811
- /**
812
- * Creates a default groups cluster server.
813
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
814
- */
815
500
  createDefaultGroupsClusterServer() {
816
501
  this.behaviors.require(GroupsServer);
817
502
  return this;
818
503
  }
819
- /**
820
- * Creates a default scenes management cluster server.
821
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
822
- */
823
504
  createDefaultScenesClusterServer() {
824
505
  this.behaviors.require(ScenesManagementServer);
825
506
  return this;
826
507
  }
827
- /**
828
- * Creates a default OnOff cluster server for light devices.
829
- *
830
- * @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
831
- * @param {boolean} [globalSceneControl=false] - The global scene control state.
832
- * @param {number} [onTime=0] - The on time value.
833
- * @param {number} [offWaitTime=0] - The off wait time value.
834
- * @param {OnOff.StartUpOnOff | null} [startUpOnOff=null] - The start-up OnOff state. Null means previous state.
835
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
836
- */
837
508
  createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
838
509
  this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.Lighting), {
839
510
  onOff,
@@ -844,40 +515,18 @@ export class MatterbridgeEndpoint extends Endpoint {
844
515
  });
845
516
  return this;
846
517
  }
847
- /**
848
- * Creates an OnOff cluster server without features.
849
- *
850
- * @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
851
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
852
- */
853
518
  createOnOffClusterServer(onOff = false) {
854
519
  this.behaviors.require(MatterbridgeOnOffServer, {
855
520
  onOff,
856
521
  });
857
522
  return this;
858
523
  }
859
- /**
860
- * Creates a DeadFront OnOff cluster server.
861
- *
862
- * @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
863
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
864
- */
865
524
  createDeadFrontOnOffClusterServer(onOff = false) {
866
525
  this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.DeadFrontBehavior), {
867
526
  onOff,
868
527
  });
869
528
  return this;
870
529
  }
871
- /**
872
- * Creates a default level control cluster server for light devices.
873
- *
874
- * @param {number} [currentLevel=254] - The current level (default: 254).
875
- * @param {number} [minLevel=1] - The minimum level (default: 1).
876
- * @param {number} [maxLevel=254] - The maximum level (default: 254).
877
- * @param {number | null} [onLevel=null] - The on level (default: null).
878
- * @param {number | null} [startUpCurrentLevel=null] - The startUp on level (default: null).
879
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
880
- */
881
530
  createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
882
531
  this.behaviors.require(MatterbridgeLevelControlServer.with(LevelControl.Feature.OnOff, LevelControl.Feature.Lighting), {
883
532
  currentLevel,
@@ -893,18 +542,6 @@ export class MatterbridgeEndpoint extends Endpoint {
893
542
  });
894
543
  return this;
895
544
  }
896
- /**
897
- * Creates a default color control cluster server with Xy, HueSaturation and ColorTemperature.
898
- *
899
- * @param currentX - The current X value.
900
- * @param currentY - The current Y value.
901
- * @param currentHue - The current hue value.
902
- * @param currentSaturation - The current saturation value.
903
- * @param colorTemperatureMireds - The color temperature in mireds.
904
- * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
905
- * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
906
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
907
- */
908
545
  createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
909
546
  this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
910
547
  colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
@@ -927,19 +564,6 @@ export class MatterbridgeEndpoint extends Endpoint {
927
564
  });
928
565
  return this;
929
566
  }
930
- /**
931
- * Creates a Xy color control cluster server with Xy and ColorTemperature.
932
- *
933
- * @param currentX - The current X value.
934
- * @param currentY - The current Y value.
935
- * @param colorTemperatureMireds - The color temperature in mireds.
936
- * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
937
- * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
938
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
939
- *
940
- * @remarks
941
- * From zigbee to matter = Math.max(Math.min(Math.round(x * 65536), 65279), 0)
942
- */
943
567
  createXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
944
568
  this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature), {
945
569
  colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
@@ -960,16 +584,6 @@ export class MatterbridgeEndpoint extends Endpoint {
960
584
  });
961
585
  return this;
962
586
  }
963
- /**
964
- * Creates a default hue and saturation control cluster server with HueSaturation and ColorTemperature.
965
- *
966
- * @param currentHue - The current hue value.
967
- * @param currentSaturation - The current saturation value.
968
- * @param colorTemperatureMireds - The color temperature in mireds.
969
- * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
970
- * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
971
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
972
- */
973
587
  createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
974
588
  this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
975
589
  colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
@@ -990,14 +604,6 @@ export class MatterbridgeEndpoint extends Endpoint {
990
604
  });
991
605
  return this;
992
606
  }
993
- /**
994
- * Creates a color temperature color control cluster server.
995
- *
996
- * @param colorTemperatureMireds - The color temperature in mireds.
997
- * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
998
- * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
999
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1000
- */
1001
607
  createCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1002
608
  this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.ColorTemperature), {
1003
609
  colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
@@ -1016,23 +622,12 @@ export class MatterbridgeEndpoint extends Endpoint {
1016
622
  });
1017
623
  return this;
1018
624
  }
1019
- /**
1020
- * Configures the color control mode for the device.
1021
- *
1022
- * @param {ColorControl.ColorMode} colorMode - The color mode to set.
1023
- */
1024
625
  async configureColorControlMode(colorMode) {
1025
626
  if (isValidNumber(colorMode, ColorControl.ColorMode.CurrentHueAndCurrentSaturation, ColorControl.ColorMode.ColorTemperatureMireds)) {
1026
627
  await this.setAttribute(ColorControl.Cluster.id, 'colorMode', colorMode, this.log);
1027
628
  await this.setAttribute(ColorControl.Cluster.id, 'enhancedColorMode', colorMode, this.log);
1028
629
  }
1029
630
  }
1030
- /**
1031
- * Creates a default window covering cluster server (Lift and PositionAwareLift).
1032
- *
1033
- * @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
1034
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1035
- */
1036
631
  createDefaultWindowCoveringClusterServer(positionPercent100ths) {
1037
632
  this.behaviors.require(MatterbridgeWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
1038
633
  type: WindowCovering.WindowCoveringType.Rollershade,
@@ -1048,15 +643,11 @@ export class MatterbridgeEndpoint extends Endpoint {
1048
643
  operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
1049
644
  endProductType: WindowCovering.EndProductType.RollerShade,
1050
645
  mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
1051
- targetPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
1052
- currentPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
646
+ targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
647
+ currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
1053
648
  });
1054
649
  return this;
1055
650
  }
1056
- /**
1057
- * Sets the window covering target position as the current position and stops the movement.
1058
- *
1059
- */
1060
651
  async setWindowCoveringTargetAsCurrentAndStopped() {
1061
652
  const position = this.getAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', this.log);
1062
653
  if (isValidNumber(position, 0, 10000)) {
@@ -1069,12 +660,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1069
660
  }
1070
661
  this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths and targetPositionLiftPercent100ths to ${position} and operationalStatus to Stopped.`);
1071
662
  }
1072
- /**
1073
- * Sets the current and target status of a window covering.
1074
- * @param {number} current - The current position of the window covering.
1075
- * @param {number} target - The target position of the window covering.
1076
- * @param {WindowCovering.MovementStatus} status - The movement status of the window covering.
1077
- */
1078
663
  async setWindowCoveringCurrentTargetStatus(current, target, status) {
1079
664
  await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', current, this.log);
1080
665
  await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', target, this.log);
@@ -1085,10 +670,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1085
670
  }, this.log);
1086
671
  this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
1087
672
  }
1088
- /**
1089
- * Sets the status of the window covering.
1090
- * @param {WindowCovering.MovementStatus} status - The movement status to set.
1091
- */
1092
673
  async setWindowCoveringStatus(status) {
1093
674
  await this.setAttribute(WindowCovering.Cluster.id, 'operationalStatus', {
1094
675
  global: status,
@@ -1097,11 +678,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1097
678
  }, this.log);
1098
679
  this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
1099
680
  }
1100
- /**
1101
- * Retrieves the status of the window covering.
1102
- *
1103
- * @returns The global operational status of the window covering or undefined.
1104
- */
1105
681
  getWindowCoveringStatus() {
1106
682
  const status = this.getAttribute(WindowCovering.Cluster.id, 'operationalStatus', this.log);
1107
683
  if (isValidObject(status, 3) && 'global' in status && typeof status.global === 'number') {
@@ -1109,66 +685,36 @@ export class MatterbridgeEndpoint extends Endpoint {
1109
685
  return status.global;
1110
686
  }
1111
687
  }
1112
- /**
1113
- * Sets the target and current position of the window covering.
1114
- *
1115
- * @param position - The position to set, specified as a number.
1116
- */
1117
688
  async setWindowCoveringTargetAndCurrentPosition(position) {
1118
689
  await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', position, this.log);
1119
690
  await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', position, this.log);
1120
691
  this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${position} and targetPositionLiftPercent100ths: ${position}.`);
1121
692
  }
1122
- /**
1123
- * Creates a default thermostat cluster server with Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode.
1124
- *
1125
- * @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
1126
- * @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
1127
- * @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
1128
- * @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
1129
- * @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
1130
- * @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
1131
- * @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
1132
- * @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
1133
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1134
- */
1135
693
  createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
1136
694
  this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
1137
695
  localTemperature: localTemperature * 100,
1138
696
  systemMode: Thermostat.SystemMode.Auto,
1139
697
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
1140
- // Thermostat.Feature.Heating
1141
698
  occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
1142
699
  minHeatSetpointLimit: minHeatSetpointLimit * 100,
1143
700
  maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
1144
701
  absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
1145
702
  absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
1146
- // Thermostat.Feature.Cooling
1147
703
  occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
1148
704
  minCoolSetpointLimit: minCoolSetpointLimit * 100,
1149
705
  maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
1150
706
  absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
1151
707
  absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
1152
- // Thermostat.Feature.AutoMode
1153
708
  minSetpointDeadBand: minSetpointDeadBand * 100,
1154
709
  thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
1155
710
  });
1156
711
  return this;
1157
712
  }
1158
- /**
1159
- * Creates a default heating thermostat cluster server with Thermostat.Feature.Heating.
1160
- * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
1161
- * @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
1162
- * @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
1163
- * @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
1164
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1165
- */
1166
713
  createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
1167
714
  this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating), {
1168
715
  localTemperature: localTemperature * 100,
1169
716
  systemMode: Thermostat.SystemMode.Heat,
1170
717
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
1171
- // Thermostat.Feature.Heating
1172
718
  occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
1173
719
  minHeatSetpointLimit: minHeatSetpointLimit * 100,
1174
720
  maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
@@ -1177,20 +723,11 @@ export class MatterbridgeEndpoint extends Endpoint {
1177
723
  });
1178
724
  return this;
1179
725
  }
1180
- /**
1181
- * Creates a default cooling thermostat cluster server with Thermostat.Feature.Cooling.
1182
- * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
1183
- * @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
1184
- * @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
1185
- * @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
1186
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1187
- */
1188
726
  createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
1189
727
  this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Cooling), {
1190
728
  localTemperature: localTemperature * 100,
1191
729
  systemMode: Thermostat.SystemMode.Cool,
1192
730
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
1193
- // Thermostat.Feature.Cooling
1194
731
  occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
1195
732
  minCoolSetpointLimit: minCoolSetpointLimit * 100,
1196
733
  maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
@@ -1199,12 +736,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1199
736
  });
1200
737
  return this;
1201
738
  }
1202
- /**
1203
- * Creates a default fan control cluster server.
1204
- *
1205
- * @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
1206
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1207
- */
1208
739
  createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
1209
740
  this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
1210
741
  fanMode,
@@ -1217,13 +748,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1217
748
  });
1218
749
  return this;
1219
750
  }
1220
- /**
1221
- * Creates a default door lock cluster server.
1222
- *
1223
- * @param {DoorLock.LockState} [lockState=DoorLock.LockState.Locked] - The initial state of the lock (default: Locked).
1224
- * @param {DoorLock.LockType} [lockType=DoorLock.LockType.DeadBolt] - The type of the lock (default: DeadBolt).
1225
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1226
- */
1227
751
  createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
1228
752
  this.behaviors.require(MatterbridgeDoorLockServer.enable({ events: { doorLockAlarm: true, lockOperation: true, lockOperationError: true } }), {
1229
753
  operatingMode: DoorLock.OperatingMode.Normal,
@@ -1234,18 +758,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1234
758
  });
1235
759
  return this;
1236
760
  }
1237
- /**
1238
- * Creates a default Mode Select cluster server.
1239
- *
1240
- * @param {string} description - The description of the mode select cluster.
1241
- * @param {ModeSelect.ModeOption[]} supportedModes - The list of supported modes.
1242
- * @param {number} [currentMode=0] - The current mode (default: 0).
1243
- * @param {number} [startUpMode=0] - The startup mode (default: 0).
1244
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1245
- *
1246
- * @remarks
1247
- * endpoint.createDefaultModeSelectClusterServer('Night mode', [{ label: 'Led ON', mode: 0, semanticTags: [] }, { label: 'Led OFF', mode: 1, semanticTags: [] }], 0, 0);
1248
- */
1249
761
  createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
1250
762
  this.behaviors.require(MatterbridgeModeSelectServer, {
1251
763
  description: description,
@@ -1256,13 +768,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1256
768
  });
1257
769
  return this;
1258
770
  }
1259
- /**
1260
- * Creates the default Valve Configuration And Control cluster server.
1261
- *
1262
- * @param {ValveConfigurationAndControl.ValveState} [valveState=ValveConfigurationAndControl.ValveState.Closed] - The valve state to set. Defaults to `ValveConfigurationAndControl.ValveState.Closed`.
1263
- * @param {number} [valveLevel=0] - The valve level to set. Defaults to 0.
1264
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1265
- */
1266
771
  createDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
1267
772
  this.behaviors.require(MatterbridgeValveConfigurationAndControlServer.with(ValveConfigurationAndControl.Feature.Level), {
1268
773
  currentState: valveState,
@@ -1275,12 +780,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1275
780
  });
1276
781
  return this;
1277
782
  }
1278
- /**
1279
- * Creates the default PumpConfigurationAndControl cluster server.
1280
- *
1281
- * @param {PumpConfigurationAndControl.OperationMode} [pumpMode=PumpConfigurationAndControl.OperationMode.Normal] - The pump mode to set. Defaults to `PumpConfigurationAndControl.OperationMode.Normal`.
1282
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1283
- */
1284
783
  createDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
1285
784
  this.behaviors.require(PumpConfigurationAndControlServer.with(PumpConfigurationAndControl.Feature.ConstantSpeed), {
1286
785
  minConstSpeed: null,
@@ -1295,13 +794,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1295
794
  });
1296
795
  return this;
1297
796
  }
1298
- /**
1299
- * Creates the default SmokeCOAlarm Cluster Server.
1300
- *
1301
- * @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
1302
- * @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
1303
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1304
- */
1305
797
  createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
1306
798
  this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm).enable({
1307
799
  events: { smokeAlarm: true, interconnectSmokeAlarm: true, coAlarm: true, interconnectCoAlarm: true, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
@@ -1319,13 +811,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1319
811
  });
1320
812
  return this;
1321
813
  }
1322
- /**
1323
- * Creates a default momentary switch cluster server.
1324
- *
1325
- * @remarks
1326
- * This method adds a cluster server with default momentary switch features and configuration suitable for (AppleHome) Single Double Long automations.
1327
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1328
- */
1329
814
  createDefaultSwitchClusterServer() {
1330
815
  this.behaviors.require(MatterbridgeSwitchServer.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress).enable({
1331
816
  events: { initialPress: true, longPress: true, shortRelease: true, longRelease: true, multiPressOngoing: true, multiPressComplete: true },
@@ -1336,13 +821,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1336
821
  });
1337
822
  return this;
1338
823
  }
1339
- /**
1340
- * Creates a default latching switch cluster server.
1341
- *
1342
- * @remarks
1343
- * This method adds a cluster server with default latching switch features and configuration suitable for a latching switch with 2 positions.
1344
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1345
- */
1346
824
  createDefaultLatchingSwitchClusterServer() {
1347
825
  this.behaviors.require(SwitchServer.with(Switch.Feature.LatchingSwitch).enable({
1348
826
  events: { switchLatched: true },
@@ -1352,13 +830,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1352
830
  });
1353
831
  return this;
1354
832
  }
1355
- /**
1356
- * Triggers a switch event on the specified endpoint.
1357
- *
1358
- * @param {string} event - The type of event to trigger. Possible values are 'Single', 'Double', 'Long' for momentarySwitch and 'Press', 'Release' for latchingSwitch.
1359
- * @param {Endpoint} endpoint - The endpoint on which to trigger the event (default the device endpoint).
1360
- * @returns {boolean} - A boolean indicating whether the event was successfully triggered.
1361
- */
1362
833
  async triggerSwitchEvent(event, log) {
1363
834
  if (this.maybeNumber === undefined) {
1364
835
  this.log.error(`triggerSwitchEvent ${event} error: Endpoint number not assigned on endpoint ${this.maybeId}:${this.maybeNumber}`);
@@ -1418,31 +889,14 @@ export class MatterbridgeEndpoint extends Endpoint {
1418
889
  }
1419
890
  return true;
1420
891
  }
1421
- /**
1422
- * Creates a default boolean state cluster server.
1423
- *
1424
- * @param {boolean} contact - The state of the cluster. Defaults to true (true = contact).
1425
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1426
- */
1427
892
  createDefaultBooleanStateClusterServer(contact) {
1428
893
  this.behaviors.require(BooleanStateServer.enable({
1429
894
  events: { stateChange: true },
1430
895
  }), {
1431
- stateValue: contact ?? true, // true=contact false=no_contact
896
+ stateValue: contact ?? true,
1432
897
  });
1433
898
  return this;
1434
899
  }
1435
- /**
1436
- * Creates a default boolean state configuration cluster server to be used with the waterFreezeDetector, waterLeakDetector, and rainSensor device types.
1437
- *
1438
- * @remarks Supports the enableDisableAlarm command.
1439
- *
1440
- * @param {boolean} [sensorFault=false] - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
1441
- * @param {number} [currentSensitivityLevel=0] - The current sensitivity level. Defaults to `0` if not provided.
1442
- * @param {number} [supportedSensitivityLevels=2] - The number of supported sensitivity levels. Defaults to `2` if not provided (min 2, max 10).
1443
- * @param {number} [defaultSensitivityLevel=0] - The default sensitivity level. Defaults to `0` if not provided.
1444
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1445
- */
1446
900
  createDefaultBooleanStateConfigurationClusterServer(sensorFault = false, currentSensitivityLevel = 0, supportedSensitivityLevels = 2, defaultSensitivityLevel = 0) {
1447
901
  this.behaviors.require(MatterbridgeBooleanStateConfigurationServer.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel).enable({
1448
902
  events: { alarmsStateChanged: true, sensorFault: true },
@@ -1457,21 +911,10 @@ export class MatterbridgeEndpoint extends Endpoint {
1457
911
  });
1458
912
  return this;
1459
913
  }
1460
- /**
1461
- * Creates a default Power Topology Cluster Server with feature TreeTopology. Only needed for an electricalSensor device type.
1462
- *
1463
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1464
- */
1465
914
  createDefaultPowerTopologyClusterServer() {
1466
915
  this.behaviors.require(PowerTopologyServer.with(PowerTopology.Feature.TreeTopology));
1467
916
  return this;
1468
917
  }
1469
- /**
1470
- * Creates a default Electrical Energy Measurement Cluster Server.
1471
- *
1472
- * @param {number} energy - The total consumption value in mW/h.
1473
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1474
- */
1475
918
  createDefaultElectricalEnergyMeasurementClusterServer(energy = null) {
1476
919
  this.behaviors.require(ElectricalEnergyMeasurementServer.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
1477
920
  accuracy: {
@@ -1487,15 +930,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1487
930
  });
1488
931
  return this;
1489
932
  }
1490
- /**
1491
- * Creates a default Electrical Power Measurement Cluster Server.
1492
- *
1493
- * @param {number} voltage - The voltage value in millivolts.
1494
- * @param {number} current - The current value in milliamperes.
1495
- * @param {number} power - The power value in milliwatts.
1496
- * @param {number} frequency - The frequency value in millihertz.
1497
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1498
- */
1499
933
  createDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
1500
934
  this.behaviors.require(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
1501
935
  powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
@@ -1537,90 +971,36 @@ export class MatterbridgeEndpoint extends Endpoint {
1537
971
  });
1538
972
  return this;
1539
973
  }
1540
- /**
1541
- * Creates a default TemperatureMeasurement cluster server.
1542
- *
1543
- * @param {number} measuredValue - The measured value of the temperature x 100.
1544
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1545
- */
1546
974
  createDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
1547
975
  this.behaviors.require(TemperatureMeasurementServer, getDefaultTemperatureMeasurementClusterServer(measuredValue));
1548
976
  return this;
1549
977
  }
1550
- /**
1551
- * Creates a default RelativeHumidityMeasurement cluster server.
1552
- *
1553
- * @param {number} measuredValue - The measured value of the relative humidity x 100.
1554
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1555
- */
1556
978
  createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
1557
979
  this.behaviors.require(RelativeHumidityMeasurementServer, getDefaultRelativeHumidityMeasurementClusterServer(measuredValue));
1558
980
  return this;
1559
981
  }
1560
- /**
1561
- * Creates a default PressureMeasurement cluster server.
1562
- *
1563
- * @param {number} measuredValue - The measured value for the pressure.
1564
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1565
- */
1566
982
  createDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
1567
983
  this.behaviors.require(PressureMeasurementServer, getDefaultPressureMeasurementClusterServer(measuredValue));
1568
984
  return this;
1569
985
  }
1570
- /**
1571
- * Creates a default IlluminanceMeasurement cluster server.
1572
- *
1573
- * @param {number} measuredValue - The measured value of illuminance.
1574
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1575
- *
1576
- * @remarks
1577
- * Lux to matter = Math.round(Math.max(Math.min(10000 * Math.log10(lux), 0xfffe), 0))
1578
- * Matter to Lux = Math.round(Math.max(Math.pow(10, value / 10000), 0))
1579
- */
1580
986
  createDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
1581
987
  this.behaviors.require(IlluminanceMeasurementServer, getDefaultIlluminanceMeasurementClusterServer(measuredValue));
1582
988
  return this;
1583
989
  }
1584
- /**
1585
- * Creates a default FlowMeasurement cluster server.
1586
- *
1587
- * @param {number} measuredValue - The measured value of the flow in 10 x m/h.
1588
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1589
- */
1590
990
  createDefaultFlowMeasurementClusterServer(measuredValue = 0) {
1591
991
  this.behaviors.require(FlowMeasurementServer, getDefaultFlowMeasurementClusterServer(measuredValue));
1592
992
  return this;
1593
993
  }
1594
- /**
1595
- * Creates a default OccupancySensing cluster server.
1596
- *
1597
- * @param {boolean} occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
1598
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1599
- */
1600
994
  createDefaultOccupancySensingClusterServer(occupied = false) {
1601
995
  this.behaviors.require(OccupancySensingServer, getDefaultOccupancySensingClusterServer(occupied));
1602
996
  return this;
1603
997
  }
1604
- /**
1605
- * Creates a default AirQuality cluster server.
1606
- *
1607
- * @param {AirQuality.AirQualityEnum} airQuality The air quality level. Defaults to `AirQuality.AirQualityType.Unknown`.
1608
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1609
- */
1610
998
  createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
1611
999
  this.behaviors.require(AirQualityServer.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
1612
1000
  airQuality,
1613
1001
  });
1614
1002
  return this;
1615
1003
  }
1616
- /**
1617
- * Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server.
1618
- *
1619
- * @param {number} measuredValue - The measured value of the concentration.
1620
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
1621
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1622
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1623
- */
1624
1004
  createDefaultTvocMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1625
1005
  this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1626
1006
  measuredValue,
@@ -1632,13 +1012,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1632
1012
  });
1633
1013
  return this;
1634
1014
  }
1635
- /**
1636
- * Create a default CarbonMonoxideConcentrationMeasurement cluster server.
1637
- *
1638
- * @param {number} measuredValue - The measured value of the concentration.
1639
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
1640
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1641
- */
1642
1015
  createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1643
1016
  this.behaviors.require(CarbonMonoxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1644
1017
  measuredValue,
@@ -1650,13 +1023,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1650
1023
  });
1651
1024
  return this;
1652
1025
  }
1653
- /**
1654
- * Create a default CarbonDioxideConcentrationMeasurement cluster server.
1655
- *
1656
- * @param {number} measuredValue - The measured value of the concentration.
1657
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
1658
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1659
- */
1660
1026
  createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1661
1027
  this.behaviors.require(CarbonDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1662
1028
  measuredValue,
@@ -1668,13 +1034,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1668
1034
  });
1669
1035
  return this;
1670
1036
  }
1671
- /**
1672
- * Create a default FormaldehydeConcentrationMeasurement cluster server.
1673
- *
1674
- * @param {number} measuredValue - The measured value of the concentration.
1675
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
1676
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1677
- */
1678
1037
  createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1679
1038
  this.behaviors.require(FormaldehydeConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1680
1039
  measuredValue,
@@ -1686,13 +1045,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1686
1045
  });
1687
1046
  return this;
1688
1047
  }
1689
- /**
1690
- * Create a default Pm1ConcentrationMeasurement cluster server.
1691
- *
1692
- * @param {number} measuredValue - The measured value of the concentration.
1693
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
1694
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1695
- */
1696
1048
  createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1697
1049
  this.behaviors.require(Pm1ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1698
1050
  measuredValue,
@@ -1704,13 +1056,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1704
1056
  });
1705
1057
  return this;
1706
1058
  }
1707
- /**
1708
- * Create a default Pm25ConcentrationMeasurement cluster server.
1709
- *
1710
- * @param {number} measuredValue - The measured value of the concentration.
1711
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
1712
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1713
- */
1714
1059
  createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1715
1060
  this.behaviors.require(Pm25ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1716
1061
  measuredValue,
@@ -1722,13 +1067,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1722
1067
  });
1723
1068
  return this;
1724
1069
  }
1725
- /**
1726
- * Create a default Pm10ConcentrationMeasurement cluster server.
1727
- *
1728
- * @param {number} measuredValue - The measured value of the concentration.
1729
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
1730
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1731
- */
1732
1070
  createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1733
1071
  this.behaviors.require(Pm10ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1734
1072
  measuredValue,
@@ -1740,13 +1078,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1740
1078
  });
1741
1079
  return this;
1742
1080
  }
1743
- /**
1744
- * Create a default OzoneConcentrationMeasurement cluster server.
1745
- *
1746
- * @param {number} measuredValue - The measured value of the concentration.
1747
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
1748
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1749
- */
1750
1081
  createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1751
1082
  this.behaviors.require(OzoneConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1752
1083
  measuredValue,
@@ -1758,13 +1089,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1758
1089
  });
1759
1090
  return this;
1760
1091
  }
1761
- /**
1762
- * Create a default RadonConcentrationMeasurement cluster server.
1763
- *
1764
- * @param {number} measuredValue - The measured value of the concentration.
1765
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
1766
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1767
- */
1768
1092
  createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1769
1093
  this.behaviors.require(RadonConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1770
1094
  measuredValue,
@@ -1776,13 +1100,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1776
1100
  });
1777
1101
  return this;
1778
1102
  }
1779
- /**
1780
- * Create a default NitrogenDioxideConcentrationMeasurement cluster server.
1781
- *
1782
- * @param {number} measuredValue - The measured value of the concentration.
1783
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
1784
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1785
- */
1786
1103
  createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1787
1104
  this.behaviors.require(NitrogenDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1788
1105
  measuredValue,
@@ -1795,4 +1112,3 @@ export class MatterbridgeEndpoint extends Endpoint {
1795
1112
  return this;
1796
1113
  }
1797
1114
  }
1798
- //# sourceMappingURL=matterbridgeEndpoint.js.map