matterbridge 2.1.4 → 2.1.5-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/CHANGELOG.md +14 -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 -94
  6. package/dist/frontend.js +23 -232
  7. package/dist/index.js +0 -28
  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 +0 -2
  15. package/dist/matterbridge.js +55 -761
  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 -691
  21. package/dist/matterbridgeEndpointHelpers.js +9 -105
  22. package/dist/matterbridgePlatform.js +5 -121
  23. package/dist/matterbridgeTypes.js +0 -24
  24. package/dist/pluginManager.js +3 -230
  25. package/dist/storage/export.js +0 -1
  26. package/dist/utils/colorUtils.js +2 -205
  27. package/dist/utils/export.js +0 -1
  28. package/dist/utils/utils.js +10 -264
  29. package/npm-shrinkwrap.json +2 -2
  30. package/package.json +1 -2
  31. package/dist/cli.d.ts +0 -25
  32. package/dist/cli.d.ts.map +0 -1
  33. package/dist/cli.js.map +0 -1
  34. package/dist/cluster/export.d.ts +0 -2
  35. package/dist/cluster/export.d.ts.map +0 -1
  36. package/dist/cluster/export.js.map +0 -1
  37. package/dist/defaultConfigSchema.d.ts +0 -27
  38. package/dist/defaultConfigSchema.d.ts.map +0 -1
  39. package/dist/defaultConfigSchema.js.map +0 -1
  40. package/dist/deviceManager.d.ts +0 -114
  41. package/dist/deviceManager.d.ts.map +0 -1
  42. package/dist/deviceManager.js.map +0 -1
  43. package/dist/frontend.d.ts +0 -110
  44. package/dist/frontend.d.ts.map +0 -1
  45. package/dist/frontend.js.map +0 -1
  46. package/dist/index.d.ts +0 -35
  47. package/dist/index.d.ts.map +0 -1
  48. package/dist/index.js.map +0 -1
  49. package/dist/logger/export.d.ts +0 -2
  50. package/dist/logger/export.d.ts.map +0 -1
  51. package/dist/logger/export.js.map +0 -1
  52. package/dist/matter/behaviors.d.ts +0 -2
  53. package/dist/matter/behaviors.d.ts.map +0 -1
  54. package/dist/matter/behaviors.js.map +0 -1
  55. package/dist/matter/clusters.d.ts +0 -2
  56. package/dist/matter/clusters.d.ts.map +0 -1
  57. package/dist/matter/clusters.js.map +0 -1
  58. package/dist/matter/devices.d.ts +0 -2
  59. package/dist/matter/devices.d.ts.map +0 -1
  60. package/dist/matter/devices.js.map +0 -1
  61. package/dist/matter/endpoints.d.ts +0 -2
  62. package/dist/matter/endpoints.d.ts.map +0 -1
  63. package/dist/matter/endpoints.js.map +0 -1
  64. package/dist/matter/export.d.ts +0 -5
  65. package/dist/matter/export.d.ts.map +0 -1
  66. package/dist/matter/export.js.map +0 -1
  67. package/dist/matter/types.d.ts +0 -3
  68. package/dist/matter/types.d.ts.map +0 -1
  69. package/dist/matter/types.js.map +0 -1
  70. package/dist/matterbridge.d.ts +0 -409
  71. package/dist/matterbridge.d.ts.map +0 -1
  72. package/dist/matterbridge.js.map +0 -1
  73. package/dist/matterbridgeAccessoryPlatform.d.ts +0 -39
  74. package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
  75. package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
  76. package/dist/matterbridgeBehaviors.d.ts +0 -1056
  77. package/dist/matterbridgeBehaviors.d.ts.map +0 -1
  78. package/dist/matterbridgeBehaviors.js.map +0 -1
  79. package/dist/matterbridgeDeviceTypes.d.ts +0 -177
  80. package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
  81. package/dist/matterbridgeDeviceTypes.js.map +0 -1
  82. package/dist/matterbridgeDynamicPlatform.d.ts +0 -39
  83. package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
  84. package/dist/matterbridgeDynamicPlatform.js.map +0 -1
  85. package/dist/matterbridgeEndpoint.d.ts +0 -834
  86. package/dist/matterbridgeEndpoint.d.ts.map +0 -1
  87. package/dist/matterbridgeEndpoint.js.map +0 -1
  88. package/dist/matterbridgeEndpointHelpers.d.ts +0 -2264
  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 +0 -167
  95. package/dist/matterbridgeTypes.d.ts.map +0 -1
  96. package/dist/matterbridgeTypes.js.map +0 -1
  97. package/dist/pluginManager.d.ts +0 -236
  98. package/dist/pluginManager.d.ts.map +0 -1
  99. package/dist/pluginManager.js.map +0 -1
  100. package/dist/storage/export.d.ts +0 -2
  101. package/dist/storage/export.d.ts.map +0 -1
  102. package/dist/storage/export.js.map +0 -1
  103. package/dist/utils/colorUtils.d.ts +0 -61
  104. package/dist/utils/colorUtils.d.ts.map +0 -1
  105. package/dist/utils/colorUtils.js.map +0 -1
  106. package/dist/utils/export.d.ts +0 -3
  107. package/dist/utils/export.d.ts.map +0 -1
  108. package/dist/utils/export.js.map +0 -1
  109. package/dist/utils/utils.d.ts +0 -231
  110. package/dist/utils/utils.d.ts.map +0 -1
  111. package/dist/utils/utils.js.map +0 -1
@@ -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/utils.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, } 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: 'MatterbridgeEndpoint', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: debug === true ? "debug" /* LogLevel.DEBUG */ : MatterbridgeEndpoint.logLevel });
133
+ this.log = new AnsiLogger({ logName: '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,71 +156,26 @@ 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 {ClusterId} clusterId - The ID of the cluster.
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 {boolean} - A boolean indicating whether the subscription was successful.
287
- */
288
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
289
174
  async subscribeAttribute(clusterId, attribute, listener, log) {
290
175
  const clusterName = lowercaseFirstLetter(getClusterNameById(clusterId));
291
176
  if (this.construction.status !== Lifecycle.Status.Active) {
292
- // this.log.error(`subscribeAttribute ${hk}${clusterName}.${attribute}${er} error: Endpoint ${or}${endpoint.maybeId}${er}:${or}${endpoint.maybeNumber}${er} is in the ${BLUE}${endpoint.construction.status}${er} state`);
293
177
  await this.construction.ready;
294
178
  }
295
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
296
179
  const events = this.events;
297
180
  if (!(clusterName in events)) {
298
181
  this.log.error(`subscribeAttribute ${hk}${attribute}${er} error: Cluster ${'0x' + clusterId.toString(16).padStart(4, '0')}:${clusterName} not found on endpoint ${or}${this.maybeId}${er}:${or}${this.maybeNumber}${er}`);
@@ -307,157 +190,68 @@ export class MatterbridgeEndpoint extends Endpoint {
307
190
  log?.info(`${db}Subscribed endpoint ${or}${this.id}${db}:${or}${this.number}${db} attribute ${hk}${capitalizeFirstLetter(clusterName)}${db}.${hk}${attribute}${db}`);
308
191
  return true;
309
192
  }
310
- /**
311
- * Triggers an event on the specified cluster.
312
- *
313
- * @param {ClusterId} clusterId - The ID of the cluster.
314
- * @param {string} event - The name of the event to trigger.
315
- * @param {Record<string, boolean | number | bigint | string | object | undefined | null>} payload - The payload to pass to the event.
316
- * @param {AnsiLogger} [log] - Optional logger for logging information.
317
- * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the event was successfully triggered.
318
- */
319
193
  async triggerEvent(clusterId, event, payload, log) {
320
194
  const clusterName = lowercaseFirstLetter(getClusterNameById(clusterId));
321
195
  if (this.construction.status !== Lifecycle.Status.Active) {
322
196
  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`);
323
197
  return false;
324
198
  }
325
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
326
199
  const events = this.events;
327
200
  if (!(clusterName in events) || !(event in events[clusterName])) {
328
201
  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}`);
329
202
  return false;
330
203
  }
331
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
332
- // @ts-ignore
333
204
  await this.act((agent) => agent[clusterName].events[event].emit(payload, agent.context));
334
205
  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} `);
335
206
  return true;
336
207
  }
337
- /**
338
- * Adds cluster servers from the provided server list.
339
- *
340
- * @param {ClusterId[]} serverList - The list of cluster IDs to add.
341
- * @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
342
- */
343
208
  addClusterServers(serverList) {
344
209
  addClusterServers(this, serverList);
345
210
  }
346
- /**
347
- * Adds a fixed label to the FixedLabel cluster. If the cluster server is not present, it will be added.
348
- *
349
- * @param {string} label - The label to add.
350
- * @param {string} value - The value of the label.
351
- * @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
352
- */
353
211
  async addFixedLabel(label, value) {
354
212
  await addFixedLabel(this, label, value);
355
213
  return this;
356
214
  }
357
- /**
358
- * Adds a user label to the UserLabel cluster. If the cluster server is not present, it will be added.
359
- *
360
- * @param {string} label - The label to add.
361
- * @param {string} value - The value of the label.
362
- * @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
363
- */
364
215
  async addUserLabel(label, value) {
365
216
  await addUserLabel(this, label, value);
366
217
  return this;
367
218
  }
368
- /**
369
- * Adds a command handler for the specified command.
370
- *
371
- * @param {keyof MatterbridgeEndpointCommands} command - The command to add the handler for.
372
- * @param {HandlerFunction} handler - The handler function to execute when the command is received.
373
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
374
- */
375
219
  addCommandHandler(command, handler) {
376
220
  this.commandHandler.addHandler(command, handler);
377
221
  return this;
378
222
  }
379
- /**
380
- * Execute the command handler for the specified command. Mainly used in Jest tests.
381
- *
382
- * @param {keyof MatterbridgeEndpointCommands} command - The command to execute.
383
- * @param {Record<string, boolean | number | bigint | string | object | null>} request - The optional request to pass to the handler function.
384
- * @returns {Promise<void>} A promise that resolves when the command handler has been executed
385
- */
386
223
  async executeCommandHandler(command, request) {
387
224
  await this.commandHandler.executeHandler(command, { request });
388
225
  }
389
- /**
390
- * Adds the required cluster servers (only if they are not present) for the device types of the specified endpoint.
391
- *
392
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
393
- */
394
226
  addRequiredClusterServers() {
395
227
  addRequiredClusterServers(this);
396
228
  return this;
397
229
  }
398
- /**
399
- * Adds the optional cluster servers (only if they are not present) for the device types of the specified endpoint.
400
- *
401
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
402
- */
403
230
  addOptionalClusterServers() {
404
231
  addOptionalClusterServers(this);
405
232
  return this;
406
233
  }
407
- /**
408
- * Retrieves all cluster servers.
409
- *
410
- * @returns {Behavior.Type[]} An array of all cluster servers.
411
- */
412
234
  getAllClusterServers() {
413
235
  return Object.values(this.behaviors.supported);
414
236
  }
415
- /**
416
- * Retrieves the names of all cluster servers.
417
- *
418
- * @returns {string[]} An array of all cluster server names.
419
- */
420
237
  getAllClusterServerNames() {
421
238
  return Object.keys(this.behaviors.supported);
422
239
  }
423
- /**
424
- * Iterates over each attribute of each cluster server of the device state and calls the provided callback function.
425
- *
426
- * @param {Function} callback - The callback function to call with the cluster name, cluster id, attribute name, attribute id and attribute value.
427
- */
428
240
  forEachAttribute(callback) {
429
241
  for (const [clusterName, clusterAttributes] of Object.entries(this.state)) {
430
242
  for (const [attributeName, attributeValue] of Object.entries(clusterAttributes)) {
431
243
  const clusterId = getClusterId(this, clusterName);
432
244
  if (clusterId === undefined) {
433
- // this.log.error(`forEachAttribute error: cluster ${clusterName} not found`);
434
245
  continue;
435
246
  }
436
247
  const attributeId = getAttributeId(this, clusterName, attributeName);
437
248
  if (attributeId === undefined) {
438
- // this.log.error(`forEachAttribute error: attribute ${clusterName}.${attributeName} not found`);
439
249
  continue;
440
250
  }
441
251
  callback(clusterName, clusterId, attributeName, attributeId, attributeValue);
442
252
  }
443
253
  }
444
254
  }
445
- /**
446
- * Adds a child endpoint with the specified device types and options.
447
- * If the child endpoint is not already present, it will be created and added.
448
- * If the child endpoint is already present, the device types will be added to the existing child endpoint.
449
- *
450
- * @param {string} endpointName - The name of the new endpoint to add.
451
- * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
452
- * @param {MatterbridgeEndpointOptions} [options={}] - The options for the endpoint.
453
- * @param {boolean} [debug=false] - Whether to enable debug logging.
454
- * @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
455
- *
456
- * @example
457
- * ```typescript
458
- * const endpoint = device.addChildDeviceType('Temperature', [temperatureSensor], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
459
- * ```
460
- */
461
255
  addChildDeviceType(endpointName, definition, options = {}, debug = false) {
462
256
  this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
463
257
  let alreadyAdded = false;
@@ -497,23 +291,6 @@ export class MatterbridgeEndpoint extends Endpoint {
497
291
  }
498
292
  return child;
499
293
  }
500
- /**
501
- * Adds a child endpoint with one or more device types with the required cluster servers and the specified cluster servers.
502
- * If the child endpoint is not already present in the childEndpoints, it will be added.
503
- * If the child endpoint is already present in the childEndpoints, the device types and cluster servers will be added to the existing child endpoint.
504
- *
505
- * @param {string} endpointName - The name of the new enpoint to add.
506
- * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
507
- * @param {ClusterId[]} [serverList=[]] - The list of cluster IDs to include.
508
- * @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
509
- * @param {boolean} [debug=false] - Whether to enable debug logging.
510
- * @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
511
- *
512
- * @example
513
- * ```typescript
514
- * const endpoint = device.addChildDeviceTypeWithClusterServer('Temperature', [temperatureSensor], [], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
515
- * ```
516
- */
517
294
  addChildDeviceTypeWithClusterServer(endpointName, definition, serverList = [], options = {}, debug = false) {
518
295
  this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
519
296
  let alreadyAdded = false;
@@ -576,38 +353,15 @@ export class MatterbridgeEndpoint extends Endpoint {
576
353
  }
577
354
  return child;
578
355
  }
579
- /**
580
- * Retrieves a child endpoint by its name.
581
- *
582
- * @param {string} endpointName - The name of the endpoint to retrieve.
583
- * @returns {Endpoint | undefined} The child endpoint with the specified name, or undefined if not found.
584
- */
585
356
  getChildEndpointByName(endpointName) {
586
357
  return this.parts.find((part) => part.id === endpointName);
587
358
  }
588
- /**
589
- * Retrieves a child endpoint by its EndpointNumber.
590
- *
591
- * @param {EndpointNumber} endpointNumber - The EndpointNumber of the endpoint to retrieve.
592
- * @returns {MatterbridgeEndpoint | undefined} The child endpoint with the specified EndpointNumber, or undefined if not found.
593
- */
594
359
  getChildEndpoint(endpointNumber) {
595
360
  return this.parts.find((part) => part.number === endpointNumber);
596
361
  }
597
- /**
598
- * Get all the child endpoints of this endpoint.
599
- *
600
- * @returns {MatterbridgeEndpoint[]} The child endpoints.
601
- */
602
362
  getChildEndpoints() {
603
363
  return Array.from(this.parts);
604
364
  }
605
- /**
606
- * Serializes the Matterbridge device into a serialized object.
607
- *
608
- * @param pluginName - The name of the plugin.
609
- * @returns The serialized Matterbridge device object.
610
- */
611
365
  static serialize(device) {
612
366
  if (!device.serialNumber || !device.deviceName || !device.uniqueId)
613
367
  return;
@@ -630,15 +384,9 @@ export class MatterbridgeEndpoint extends Endpoint {
630
384
  serialized.clusterServersId.push(BridgedDeviceBasicInformation.Cluster.id);
631
385
  if (behaviorName === 'powerSource')
632
386
  serialized.clusterServersId.push(PowerSource.Cluster.id);
633
- // serialized.clusterServersId.push(this.behaviors.supported[behaviorName]cluster.id);
634
387
  });
635
388
  return serialized;
636
389
  }
637
- /**
638
- * Deserializes the device into a serialized object.
639
- *
640
- * @returns The deserialized MatterbridgeDevice.
641
- */
642
390
  static deserialize(serializedDevice) {
643
391
  const device = new MatterbridgeEndpoint(serializedDevice.deviceTypes, { uniqueStorageKey: serializedDevice.endpointName, endpointId: serializedDevice.endpoint }, false);
644
392
  device.plugin = serializedDevice.pluginName;
@@ -654,16 +402,9 @@ export class MatterbridgeEndpoint extends Endpoint {
654
402
  device.createDefaultBridgedDeviceBasicInformationClusterServer(serializedDevice.deviceName, serializedDevice.serialNumber, serializedDevice.vendorId ?? 0xfff1, serializedDevice.vendorName ?? 'Matterbridge', serializedDevice.productName ?? 'Matterbridge device');
655
403
  else if (clusterId === PowerSource.Cluster.id)
656
404
  device.createDefaultPowerSourceWiredClusterServer();
657
- // else addClusterServerFromList(device, [clusterId]);
658
405
  }
659
406
  return device;
660
407
  }
661
- /**
662
- * Creates a default power source wired cluster server.
663
- *
664
- * @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
665
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
666
- */
667
408
  createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
668
409
  this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Wired), {
669
410
  wiredCurrentType,
@@ -674,16 +415,6 @@ export class MatterbridgeEndpoint extends Endpoint {
674
415
  });
675
416
  return this;
676
417
  }
677
- /**
678
- * Creates a default power source replaceable battery cluster server.
679
- *
680
- * @param batPercentRemaining - The remaining battery percentage (default: 100).
681
- * @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
682
- * @param batVoltage - The battery voltage (default: 1500).
683
- * @param batReplacementDescription - The battery replacement description (default: 'Battery type').
684
- * @param batQuantity - The battery quantity (default: 1).
685
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
686
- */
687
418
  createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
688
419
  this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
689
420
  status: PowerSource.PowerSourceStatus.Active,
@@ -701,14 +432,6 @@ export class MatterbridgeEndpoint extends Endpoint {
701
432
  });
702
433
  return this;
703
434
  }
704
- /**
705
- * Creates a default power source rechargeable battery cluster server.
706
- *
707
- * @param batPercentRemaining - The remaining battery percentage (default: 100).
708
- * @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
709
- * @param batVoltage - The battery voltage (default: 1500).
710
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
711
- */
712
435
  createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
713
436
  this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
714
437
  status: PowerSource.PowerSourceStatus.Active,
@@ -727,21 +450,6 @@ export class MatterbridgeEndpoint extends Endpoint {
727
450
  });
728
451
  return this;
729
452
  }
730
- /**
731
- * Creates a default Basic Information Cluster Server for the server node.
732
- *
733
- * @param deviceName - The name of the device.
734
- * @param serialNumber - The serial number of the device.
735
- * @param vendorId - The vendor ID of the device.
736
- * @param vendorName - The vendor name of the device.
737
- * @param productId - The product ID of the device.
738
- * @param productName - The product name of the device.
739
- * @param softwareVersion - The software version of the device. Default is 1.
740
- * @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
741
- * @param hardwareVersion - The hardware version of the device. Default is 1.
742
- * @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
743
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
744
- */
745
453
  createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
746
454
  this.log.logName = deviceName;
747
455
  this.deviceName = deviceName;
@@ -765,20 +473,6 @@ export class MatterbridgeEndpoint extends Endpoint {
765
473
  }
766
474
  return this;
767
475
  }
768
- /**
769
- * Creates a default BridgedDeviceBasicInformationClusterServer for the aggregator endpoints.
770
- *
771
- * @param deviceName - The name of the device.
772
- * @param serialNumber - The serial number of the device.
773
- * @param vendorId - The vendor ID of the device.
774
- * @param vendorName - The name of the vendor.
775
- * @param productName - The name of the product.
776
- * @param softwareVersion - The software version of the device. Default is 1.
777
- * @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
778
- * @param hardwareVersion - The hardware version of the device. Default is 1.
779
- * @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
780
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
781
- */
782
476
  createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
783
477
  this.log.logName = deviceName;
784
478
  this.deviceName = deviceName;
@@ -795,7 +489,7 @@ export class MatterbridgeEndpoint extends Endpoint {
795
489
  this.behaviors.require(BridgedDeviceBasicInformationServer.enable({
796
490
  events: { leave: true, reachableChanged: true },
797
491
  }), {
798
- vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined, // 4874
492
+ vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
799
493
  vendorName: vendorName.slice(0, 32),
800
494
  productName: productName.slice(0, 32),
801
495
  productUrl: this.productUrl,
@@ -811,13 +505,6 @@ export class MatterbridgeEndpoint extends Endpoint {
811
505
  });
812
506
  return this;
813
507
  }
814
- /**
815
- * Creates a default identify cluster server with the specified identify time and type.
816
- *
817
- * @param {number} [identifyTime=0] - The time to identify the server. Defaults to 0.
818
- * @param {Identify.IdentifyType} [identifyType=Identify.IdentifyType.None] - The type of identification. Defaults to Identify.IdentifyType.None.
819
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
820
- */
821
508
  createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
822
509
  this.behaviors.require(MatterbridgeIdentifyServer, {
823
510
  identifyTime,
@@ -825,32 +512,14 @@ export class MatterbridgeEndpoint extends Endpoint {
825
512
  });
826
513
  return this;
827
514
  }
828
- /**
829
- * Creates a default groups cluster server.
830
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
831
- */
832
515
  createDefaultGroupsClusterServer() {
833
516
  this.behaviors.require(GroupsServer);
834
517
  return this;
835
518
  }
836
- /**
837
- * Creates a default scenes management cluster server.
838
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
839
- */
840
519
  createDefaultScenesClusterServer() {
841
520
  this.behaviors.require(ScenesManagementServer);
842
521
  return this;
843
522
  }
844
- /**
845
- * Creates a default OnOff cluster server for light devices.
846
- *
847
- * @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
848
- * @param {boolean} [globalSceneControl=false] - The global scene control state.
849
- * @param {number} [onTime=0] - The on time value.
850
- * @param {number} [offWaitTime=0] - The off wait time value.
851
- * @param {OnOff.StartUpOnOff | null} [startUpOnOff=null] - The start-up OnOff state. Null means previous state.
852
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
853
- */
854
523
  createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
855
524
  this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.Lighting), {
856
525
  onOff,
@@ -861,40 +530,18 @@ export class MatterbridgeEndpoint extends Endpoint {
861
530
  });
862
531
  return this;
863
532
  }
864
- /**
865
- * Creates an OnOff cluster server without features.
866
- *
867
- * @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
868
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
869
- */
870
533
  createOnOffClusterServer(onOff = false) {
871
534
  this.behaviors.require(MatterbridgeOnOffServer, {
872
535
  onOff,
873
536
  });
874
537
  return this;
875
538
  }
876
- /**
877
- * Creates a DeadFront OnOff cluster server.
878
- *
879
- * @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
880
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
881
- */
882
539
  createDeadFrontOnOffClusterServer(onOff = false) {
883
540
  this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.DeadFrontBehavior), {
884
541
  onOff,
885
542
  });
886
543
  return this;
887
544
  }
888
- /**
889
- * Creates a default level control cluster server for light devices.
890
- *
891
- * @param {number} [currentLevel=254] - The current level (default: 254).
892
- * @param {number} [minLevel=1] - The minimum level (default: 1).
893
- * @param {number} [maxLevel=254] - The maximum level (default: 254).
894
- * @param {number | null} [onLevel=null] - The on level (default: null).
895
- * @param {number | null} [startUpCurrentLevel=null] - The startUp on level (default: null).
896
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
897
- */
898
545
  createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
899
546
  this.behaviors.require(MatterbridgeLevelControlServer.with(LevelControl.Feature.OnOff, LevelControl.Feature.Lighting), {
900
547
  currentLevel,
@@ -910,18 +557,6 @@ export class MatterbridgeEndpoint extends Endpoint {
910
557
  });
911
558
  return this;
912
559
  }
913
- /**
914
- * Creates a default color control cluster server with Xy, HueSaturation and ColorTemperature.
915
- *
916
- * @param currentX - The current X value.
917
- * @param currentY - The current Y value.
918
- * @param currentHue - The current hue value.
919
- * @param currentSaturation - The current saturation value.
920
- * @param colorTemperatureMireds - The color temperature in mireds.
921
- * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
922
- * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
923
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
924
- */
925
560
  createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
926
561
  this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
927
562
  colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
@@ -944,19 +579,6 @@ export class MatterbridgeEndpoint extends Endpoint {
944
579
  });
945
580
  return this;
946
581
  }
947
- /**
948
- * Creates a Xy color control cluster server with Xy and ColorTemperature.
949
- *
950
- * @param currentX - The current X value.
951
- * @param currentY - The current Y value.
952
- * @param colorTemperatureMireds - The color temperature in mireds.
953
- * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
954
- * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
955
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
956
- *
957
- * @remarks
958
- * From zigbee to matter = Math.max(Math.min(Math.round(x * 65536), 65279), 0)
959
- */
960
582
  createXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
961
583
  this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature), {
962
584
  colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
@@ -977,16 +599,6 @@ export class MatterbridgeEndpoint extends Endpoint {
977
599
  });
978
600
  return this;
979
601
  }
980
- /**
981
- * Creates a default hue and saturation control cluster server with HueSaturation and ColorTemperature.
982
- *
983
- * @param currentHue - The current hue value.
984
- * @param currentSaturation - The current saturation value.
985
- * @param colorTemperatureMireds - The color temperature in mireds.
986
- * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
987
- * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
988
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
989
- */
990
602
  createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
991
603
  this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
992
604
  colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
@@ -1007,14 +619,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1007
619
  });
1008
620
  return this;
1009
621
  }
1010
- /**
1011
- * Creates a color temperature color control cluster server.
1012
- *
1013
- * @param colorTemperatureMireds - The color temperature in mireds.
1014
- * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1015
- * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1016
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1017
- */
1018
622
  createCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1019
623
  this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.ColorTemperature), {
1020
624
  colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
@@ -1033,23 +637,12 @@ export class MatterbridgeEndpoint extends Endpoint {
1033
637
  });
1034
638
  return this;
1035
639
  }
1036
- /**
1037
- * Configures the color control mode for the device.
1038
- *
1039
- * @param {ColorControl.ColorMode} colorMode - The color mode to set.
1040
- */
1041
640
  async configureColorControlMode(colorMode) {
1042
641
  if (isValidNumber(colorMode, ColorControl.ColorMode.CurrentHueAndCurrentSaturation, ColorControl.ColorMode.ColorTemperatureMireds)) {
1043
642
  await this.setAttribute(ColorControl.Cluster.id, 'colorMode', colorMode, this.log);
1044
643
  await this.setAttribute(ColorControl.Cluster.id, 'enhancedColorMode', colorMode, this.log);
1045
644
  }
1046
645
  }
1047
- /**
1048
- * Creates a default window covering cluster server (Lift and PositionAwareLift).
1049
- *
1050
- * @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
1051
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1052
- */
1053
646
  createDefaultWindowCoveringClusterServer(positionPercent100ths) {
1054
647
  this.behaviors.require(MatterbridgeWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
1055
648
  type: WindowCovering.WindowCoveringType.Rollershade,
@@ -1065,15 +658,11 @@ export class MatterbridgeEndpoint extends Endpoint {
1065
658
  operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
1066
659
  endProductType: WindowCovering.EndProductType.RollerShade,
1067
660
  mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
1068
- targetPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
1069
- currentPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
661
+ targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
662
+ currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
1070
663
  });
1071
664
  return this;
1072
665
  }
1073
- /**
1074
- * Sets the window covering target position as the current position and stops the movement.
1075
- *
1076
- */
1077
666
  async setWindowCoveringTargetAsCurrentAndStopped() {
1078
667
  const position = this.getAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', this.log);
1079
668
  if (isValidNumber(position, 0, 10000)) {
@@ -1086,12 +675,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1086
675
  }
1087
676
  this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths and targetPositionLiftPercent100ths to ${position} and operationalStatus to Stopped.`);
1088
677
  }
1089
- /**
1090
- * Sets the current and target status of a window covering.
1091
- * @param {number} current - The current position of the window covering.
1092
- * @param {number} target - The target position of the window covering.
1093
- * @param {WindowCovering.MovementStatus} status - The movement status of the window covering.
1094
- */
1095
678
  async setWindowCoveringCurrentTargetStatus(current, target, status) {
1096
679
  await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', current, this.log);
1097
680
  await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', target, this.log);
@@ -1102,10 +685,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1102
685
  }, this.log);
1103
686
  this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
1104
687
  }
1105
- /**
1106
- * Sets the status of the window covering.
1107
- * @param {WindowCovering.MovementStatus} status - The movement status to set.
1108
- */
1109
688
  async setWindowCoveringStatus(status) {
1110
689
  await this.setAttribute(WindowCovering.Cluster.id, 'operationalStatus', {
1111
690
  global: status,
@@ -1114,11 +693,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1114
693
  }, this.log);
1115
694
  this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
1116
695
  }
1117
- /**
1118
- * Retrieves the status of the window covering.
1119
- *
1120
- * @returns The global operational status of the window covering or undefined.
1121
- */
1122
696
  getWindowCoveringStatus() {
1123
697
  const status = this.getAttribute(WindowCovering.Cluster.id, 'operationalStatus', this.log);
1124
698
  if (isValidObject(status, 3) && 'global' in status && typeof status.global === 'number') {
@@ -1126,66 +700,36 @@ export class MatterbridgeEndpoint extends Endpoint {
1126
700
  return status.global;
1127
701
  }
1128
702
  }
1129
- /**
1130
- * Sets the target and current position of the window covering.
1131
- *
1132
- * @param position - The position to set, specified as a number.
1133
- */
1134
703
  async setWindowCoveringTargetAndCurrentPosition(position) {
1135
704
  await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', position, this.log);
1136
705
  await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', position, this.log);
1137
706
  this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${position} and targetPositionLiftPercent100ths: ${position}.`);
1138
707
  }
1139
- /**
1140
- * Creates a default thermostat cluster server with Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode.
1141
- *
1142
- * @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
1143
- * @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
1144
- * @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
1145
- * @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
1146
- * @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
1147
- * @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
1148
- * @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
1149
- * @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
1150
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1151
- */
1152
708
  createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
1153
709
  this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
1154
710
  localTemperature: localTemperature * 100,
1155
711
  systemMode: Thermostat.SystemMode.Auto,
1156
712
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
1157
- // Thermostat.Feature.Heating
1158
713
  occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
1159
714
  minHeatSetpointLimit: minHeatSetpointLimit * 100,
1160
715
  maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
1161
716
  absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
1162
717
  absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
1163
- // Thermostat.Feature.Cooling
1164
718
  occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
1165
719
  minCoolSetpointLimit: minCoolSetpointLimit * 100,
1166
720
  maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
1167
721
  absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
1168
722
  absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
1169
- // Thermostat.Feature.AutoMode
1170
723
  minSetpointDeadBand: minSetpointDeadBand * 100,
1171
724
  thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
1172
725
  });
1173
726
  return this;
1174
727
  }
1175
- /**
1176
- * Creates a default heating thermostat cluster server with Thermostat.Feature.Heating.
1177
- * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
1178
- * @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
1179
- * @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
1180
- * @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
1181
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1182
- */
1183
728
  createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
1184
729
  this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating), {
1185
730
  localTemperature: localTemperature * 100,
1186
731
  systemMode: Thermostat.SystemMode.Heat,
1187
732
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
1188
- // Thermostat.Feature.Heating
1189
733
  occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
1190
734
  minHeatSetpointLimit: minHeatSetpointLimit * 100,
1191
735
  maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
@@ -1194,20 +738,11 @@ export class MatterbridgeEndpoint extends Endpoint {
1194
738
  });
1195
739
  return this;
1196
740
  }
1197
- /**
1198
- * Creates a default cooling thermostat cluster server with Thermostat.Feature.Cooling.
1199
- * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
1200
- * @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
1201
- * @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
1202
- * @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
1203
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1204
- */
1205
741
  createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
1206
742
  this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Cooling), {
1207
743
  localTemperature: localTemperature * 100,
1208
744
  systemMode: Thermostat.SystemMode.Cool,
1209
745
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
1210
- // Thermostat.Feature.Cooling
1211
746
  occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
1212
747
  minCoolSetpointLimit: minCoolSetpointLimit * 100,
1213
748
  maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
@@ -1216,12 +751,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1216
751
  });
1217
752
  return this;
1218
753
  }
1219
- /**
1220
- * Creates a default fan control cluster server.
1221
- *
1222
- * @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
1223
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1224
- */
1225
754
  createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
1226
755
  this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
1227
756
  fanMode,
@@ -1234,13 +763,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1234
763
  });
1235
764
  return this;
1236
765
  }
1237
- /**
1238
- * Creates a default door lock cluster server.
1239
- *
1240
- * @param {DoorLock.LockState} [lockState=DoorLock.LockState.Locked] - The initial state of the lock (default: Locked).
1241
- * @param {DoorLock.LockType} [lockType=DoorLock.LockType.DeadBolt] - The type of the lock (default: DeadBolt).
1242
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1243
- */
1244
766
  createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
1245
767
  this.behaviors.require(MatterbridgeDoorLockServer.enable({ events: { doorLockAlarm: true, lockOperation: true, lockOperationError: true } }), {
1246
768
  operatingMode: DoorLock.OperatingMode.Normal,
@@ -1251,18 +773,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1251
773
  });
1252
774
  return this;
1253
775
  }
1254
- /**
1255
- * Creates a default Mode Select cluster server.
1256
- *
1257
- * @param {string} description - The description of the mode select cluster.
1258
- * @param {ModeSelect.ModeOption[]} supportedModes - The list of supported modes.
1259
- * @param {number} [currentMode=0] - The current mode (default: 0).
1260
- * @param {number} [startUpMode=0] - The startup mode (default: 0).
1261
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1262
- *
1263
- * @remarks
1264
- * endpoint.createDefaultModeSelectClusterServer('Night mode', [{ label: 'Led ON', mode: 0, semanticTags: [] }, { label: 'Led OFF', mode: 1, semanticTags: [] }], 0, 0);
1265
- */
1266
776
  createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
1267
777
  this.behaviors.require(MatterbridgeModeSelectServer, {
1268
778
  description: description,
@@ -1273,13 +783,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1273
783
  });
1274
784
  return this;
1275
785
  }
1276
- /**
1277
- * Creates the default Valve Configuration And Control cluster server.
1278
- *
1279
- * @param {ValveConfigurationAndControl.ValveState} [valveState=ValveConfigurationAndControl.ValveState.Closed] - The valve state to set. Defaults to `ValveConfigurationAndControl.ValveState.Closed`.
1280
- * @param {number} [valveLevel=0] - The valve level to set. Defaults to 0.
1281
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1282
- */
1283
786
  createDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
1284
787
  this.behaviors.require(MatterbridgeValveConfigurationAndControlServer.with(ValveConfigurationAndControl.Feature.Level), {
1285
788
  currentState: valveState,
@@ -1292,12 +795,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1292
795
  });
1293
796
  return this;
1294
797
  }
1295
- /**
1296
- * Creates the default PumpConfigurationAndControl cluster server.
1297
- *
1298
- * @param {PumpConfigurationAndControl.OperationMode} [pumpMode=PumpConfigurationAndControl.OperationMode.Normal] - The pump mode to set. Defaults to `PumpConfigurationAndControl.OperationMode.Normal`.
1299
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1300
- */
1301
798
  createDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
1302
799
  this.behaviors.require(PumpConfigurationAndControlServer.with(PumpConfigurationAndControl.Feature.ConstantSpeed), {
1303
800
  minConstSpeed: null,
@@ -1312,13 +809,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1312
809
  });
1313
810
  return this;
1314
811
  }
1315
- /**
1316
- * Creates the default SmokeCOAlarm Cluster Server.
1317
- *
1318
- * @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
1319
- * @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
1320
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1321
- */
1322
812
  createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
1323
813
  this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm).enable({
1324
814
  events: { smokeAlarm: true, interconnectSmokeAlarm: true, coAlarm: true, interconnectCoAlarm: true, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
@@ -1336,13 +826,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1336
826
  });
1337
827
  return this;
1338
828
  }
1339
- /**
1340
- * Creates a default momentary switch cluster server.
1341
- *
1342
- * @remarks
1343
- * This method adds a cluster server with default momentary switch features and configurations suitable for (AppleHome) Single Double Long automations.
1344
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1345
- */
1346
829
  createDefaultSwitchClusterServer() {
1347
830
  this.behaviors.require(MatterbridgeSwitchServer.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress).enable({
1348
831
  events: { initialPress: true, longPress: true, shortRelease: true, longRelease: true, multiPressOngoing: true, multiPressComplete: true },
@@ -1353,12 +836,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1353
836
  });
1354
837
  return this;
1355
838
  }
1356
- /**
1357
- * Creates a default latching switch cluster server.
1358
- *
1359
- * @remarks
1360
- * This method adds a cluster server with default latching switch features and configuration suitable for a latching switch with 2 positions.
1361
- */
1362
839
  createDefaultLatchingSwitchClusterServer() {
1363
840
  this.behaviors.require(SwitchServer.with(Switch.Feature.LatchingSwitch).enable({
1364
841
  events: { switchLatched: true },
@@ -1368,13 +845,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1368
845
  });
1369
846
  return this;
1370
847
  }
1371
- /**
1372
- * Triggers a switch event on the specified endpoint.
1373
- *
1374
- * @param {string} event - The type of event to trigger. Possible values are 'Single', 'Double', 'Long' for momentarySwitch and 'Press', 'Release' for latchingSwitch.
1375
- * @param {Endpoint} endpoint - The endpoint on which to trigger the event (default the device endpoint).
1376
- * @returns {boolean} - A boolean indicating whether the event was successfully triggered.
1377
- */
1378
848
  async triggerSwitchEvent(event, log) {
1379
849
  if (this.maybeNumber === undefined) {
1380
850
  this.log.error(`triggerSwitchEvent ${event} error: Endpoint number not assigned on endpoint ${this.maybeId}:${this.maybeNumber}`);
@@ -1434,31 +904,14 @@ export class MatterbridgeEndpoint extends Endpoint {
1434
904
  }
1435
905
  return true;
1436
906
  }
1437
- /**
1438
- * Creates a default boolean state cluster server.
1439
- *
1440
- * @param {boolean} contact - The state of the cluster. Defaults to true (true = contact).
1441
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1442
- */
1443
907
  createDefaultBooleanStateClusterServer(contact) {
1444
908
  this.behaviors.require(BooleanStateServer.enable({
1445
909
  events: { stateChange: true },
1446
910
  }), {
1447
- stateValue: contact ?? true, // true=contact false=no_contact
911
+ stateValue: contact ?? true,
1448
912
  });
1449
913
  return this;
1450
914
  }
1451
- /**
1452
- * Creates a default boolean state configuration cluster server to be used with the waterFreezeDetector, waterLeakDetector, and rainSensor device types.
1453
- *
1454
- * @remarks Supports the enableDisableAlarm command.
1455
- *
1456
- * @param {boolean} [sensorFault=false] - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
1457
- * @param {number} [currentSensitivityLevel=0] - The current sensitivity level. Defaults to `0` if not provided.
1458
- * @param {number} [supportedSensitivityLevels=2] - The number of supported sensitivity levels. Defaults to `2` if not provided (min 2, max 10).
1459
- * @param {number} [defaultSensitivityLevel=0] - The default sensitivity level. Defaults to `0` if not provided.
1460
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1461
- */
1462
915
  createDefaultBooleanStateConfigurationClusterServer(sensorFault = false, currentSensitivityLevel = 0, supportedSensitivityLevels = 2, defaultSensitivityLevel = 0) {
1463
916
  this.behaviors.require(MatterbridgeBooleanStateConfigurationServer.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel).enable({
1464
917
  events: { alarmsStateChanged: true, sensorFault: true },
@@ -1473,21 +926,10 @@ export class MatterbridgeEndpoint extends Endpoint {
1473
926
  });
1474
927
  return this;
1475
928
  }
1476
- /**
1477
- * Creates a default Power Topology Cluster Server with feature TreeTopology. Only needed for an electricalSensor device type.
1478
- *
1479
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1480
- */
1481
929
  createDefaultPowerTopologyClusterServer() {
1482
930
  this.behaviors.require(PowerTopologyServer.with(PowerTopology.Feature.TreeTopology));
1483
931
  return this;
1484
932
  }
1485
- /**
1486
- * Creates a default Electrical Energy Measurement Cluster Server.
1487
- *
1488
- * @param {number} energy - The total consumption value in mW/h.
1489
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1490
- */
1491
933
  createDefaultElectricalEnergyMeasurementClusterServer(energy = null) {
1492
934
  this.behaviors.require(ElectricalEnergyMeasurementServer.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
1493
935
  accuracy: {
@@ -1503,15 +945,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1503
945
  });
1504
946
  return this;
1505
947
  }
1506
- /**
1507
- * Creates a default Electrical Power Measurement Cluster Server.
1508
- *
1509
- * @param {number} voltage - The voltage value in millivolts.
1510
- * @param {number} current - The current value in milliamperes.
1511
- * @param {number} power - The power value in milliwatts.
1512
- * @param {number} frequency - The frequency value in millihertz.
1513
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1514
- */
1515
948
  createDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
1516
949
  this.behaviors.require(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
1517
950
  powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
@@ -1553,90 +986,36 @@ export class MatterbridgeEndpoint extends Endpoint {
1553
986
  });
1554
987
  return this;
1555
988
  }
1556
- /**
1557
- * Creates a default TemperatureMeasurement cluster server.
1558
- *
1559
- * @param {number} measuredValue - The measured value of the temperature x 100.
1560
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1561
- */
1562
989
  createDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
1563
990
  this.behaviors.require(TemperatureMeasurementServer, getDefaultTemperatureMeasurementClusterServer(measuredValue));
1564
991
  return this;
1565
992
  }
1566
- /**
1567
- * Creates a default RelativeHumidityMeasurement cluster server.
1568
- *
1569
- * @param {number} measuredValue - The measured value of the relative humidity x 100.
1570
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1571
- */
1572
993
  createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
1573
994
  this.behaviors.require(RelativeHumidityMeasurementServer, getDefaultRelativeHumidityMeasurementClusterServer(measuredValue));
1574
995
  return this;
1575
996
  }
1576
- /**
1577
- * Creates a default PressureMeasurement cluster server.
1578
- *
1579
- * @param {number} measuredValue - The measured value for the pressure.
1580
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1581
- */
1582
997
  createDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
1583
998
  this.behaviors.require(PressureMeasurementServer, getDefaultPressureMeasurementClusterServer(measuredValue));
1584
999
  return this;
1585
1000
  }
1586
- /**
1587
- * Creates a default IlluminanceMeasurement cluster server.
1588
- *
1589
- * @param {number} measuredValue - The measured value of illuminance.
1590
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1591
- *
1592
- * @remarks
1593
- * Lux to matter = Math.round(Math.max(Math.min(10000 * Math.log10(lux), 0xfffe), 0))
1594
- * Matter to Lux = Math.round(Math.max(Math.pow(10, value / 10000), 0))
1595
- */
1596
1001
  createDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
1597
1002
  this.behaviors.require(IlluminanceMeasurementServer, getDefaultIlluminanceMeasurementClusterServer(measuredValue));
1598
1003
  return this;
1599
1004
  }
1600
- /**
1601
- * Creates a default FlowMeasurement cluster server.
1602
- *
1603
- * @param {number} measuredValue - The measured value of the flow in 10 x m/h.
1604
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1605
- */
1606
1005
  createDefaultFlowMeasurementClusterServer(measuredValue = 0) {
1607
1006
  this.behaviors.require(FlowMeasurementServer, getDefaultFlowMeasurementClusterServer(measuredValue));
1608
1007
  return this;
1609
1008
  }
1610
- /**
1611
- * Creates a default OccupancySensing cluster server.
1612
- *
1613
- * @param {boolean} occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
1614
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1615
- */
1616
1009
  createDefaultOccupancySensingClusterServer(occupied = false) {
1617
1010
  this.behaviors.require(OccupancySensingServer, getDefaultOccupancySensingClusterServer(occupied));
1618
1011
  return this;
1619
1012
  }
1620
- /**
1621
- * Creates a default AirQuality cluster server.
1622
- *
1623
- * @param {AirQuality.AirQualityEnum} airQuality The air quality level. Defaults to `AirQuality.AirQualityType.Unknown`.
1624
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1625
- */
1626
1013
  createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
1627
1014
  this.behaviors.require(AirQualityServer.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
1628
1015
  airQuality,
1629
1016
  });
1630
1017
  return this;
1631
1018
  }
1632
- /**
1633
- * Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server.
1634
- *
1635
- * @param {number} measuredValue - The measured value of the concentration.
1636
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
1637
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1638
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1639
- */
1640
1019
  createDefaultTvocMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1641
1020
  this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1642
1021
  measuredValue,
@@ -1648,13 +1027,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1648
1027
  });
1649
1028
  return this;
1650
1029
  }
1651
- /**
1652
- * Create a default CarbonMonoxideConcentrationMeasurement cluster server.
1653
- *
1654
- * @param {number} measuredValue - The measured value of the concentration.
1655
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
1656
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1657
- */
1658
1030
  createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1659
1031
  this.behaviors.require(CarbonMonoxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1660
1032
  measuredValue,
@@ -1666,13 +1038,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1666
1038
  });
1667
1039
  return this;
1668
1040
  }
1669
- /**
1670
- * Create a default CarbonDioxideConcentrationMeasurement cluster server.
1671
- *
1672
- * @param {number} measuredValue - The measured value of the concentration.
1673
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
1674
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1675
- */
1676
1041
  createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1677
1042
  this.behaviors.require(CarbonDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1678
1043
  measuredValue,
@@ -1684,13 +1049,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1684
1049
  });
1685
1050
  return this;
1686
1051
  }
1687
- /**
1688
- * Create a default FormaldehydeConcentrationMeasurement cluster server.
1689
- *
1690
- * @param {number} measuredValue - The measured value of the concentration.
1691
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
1692
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1693
- */
1694
1052
  createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1695
1053
  this.behaviors.require(FormaldehydeConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1696
1054
  measuredValue,
@@ -1702,13 +1060,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1702
1060
  });
1703
1061
  return this;
1704
1062
  }
1705
- /**
1706
- * Create a default Pm1ConcentrationMeasurement cluster server.
1707
- *
1708
- * @param {number} measuredValue - The measured value of the concentration.
1709
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
1710
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1711
- */
1712
1063
  createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1713
1064
  this.behaviors.require(Pm1ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1714
1065
  measuredValue,
@@ -1720,13 +1071,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1720
1071
  });
1721
1072
  return this;
1722
1073
  }
1723
- /**
1724
- * Create a default Pm25ConcentrationMeasurement cluster server.
1725
- *
1726
- * @param {number} measuredValue - The measured value of the concentration.
1727
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
1728
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1729
- */
1730
1074
  createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1731
1075
  this.behaviors.require(Pm25ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1732
1076
  measuredValue,
@@ -1738,13 +1082,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1738
1082
  });
1739
1083
  return this;
1740
1084
  }
1741
- /**
1742
- * Create a default Pm10ConcentrationMeasurement cluster server.
1743
- *
1744
- * @param {number} measuredValue - The measured value of the concentration.
1745
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
1746
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1747
- */
1748
1085
  createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1749
1086
  this.behaviors.require(Pm10ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1750
1087
  measuredValue,
@@ -1756,13 +1093,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1756
1093
  });
1757
1094
  return this;
1758
1095
  }
1759
- /**
1760
- * Create a default OzoneConcentrationMeasurement cluster server.
1761
- *
1762
- * @param {number} measuredValue - The measured value of the concentration.
1763
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
1764
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1765
- */
1766
1096
  createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1767
1097
  this.behaviors.require(OzoneConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1768
1098
  measuredValue,
@@ -1774,13 +1104,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1774
1104
  });
1775
1105
  return this;
1776
1106
  }
1777
- /**
1778
- * Create a default RadonConcentrationMeasurement cluster server.
1779
- *
1780
- * @param {number} measuredValue - The measured value of the concentration.
1781
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
1782
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1783
- */
1784
1107
  createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1785
1108
  this.behaviors.require(RadonConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1786
1109
  measuredValue,
@@ -1792,13 +1115,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1792
1115
  });
1793
1116
  return this;
1794
1117
  }
1795
- /**
1796
- * Create a default NitrogenDioxideConcentrationMeasurement cluster server.
1797
- *
1798
- * @param {number} measuredValue - The measured value of the concentration.
1799
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
1800
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1801
- */
1802
1118
  createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1803
1119
  this.behaviors.require(NitrogenDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1804
1120
  measuredValue,
@@ -1811,4 +1127,3 @@ export class MatterbridgeEndpoint extends Endpoint {
1811
1127
  return this;
1812
1128
  }
1813
1129
  }
1814
- //# sourceMappingURL=matterbridgeEndpoint.js.map