matterbridge 2.1.3 → 2.1.4-dev.2

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