matterbridge 3.0.5 → 3.0.6-dev-20250611-6f49811

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 (174) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +1 -1
  3. package/dist/cli.js +2 -62
  4. package/dist/cluster/export.js +0 -2
  5. package/dist/defaultConfigSchema.js +0 -23
  6. package/dist/deviceManager.js +1 -94
  7. package/dist/evse.js +16 -67
  8. package/dist/frontend.js +22 -379
  9. package/dist/helpers.js +0 -51
  10. package/dist/index.js +1 -28
  11. package/dist/laundryWasher.js +7 -92
  12. package/dist/logger/export.js +0 -1
  13. package/dist/matter/behaviors.js +0 -2
  14. package/dist/matter/clusters.js +0 -2
  15. package/dist/matter/devices.js +0 -2
  16. package/dist/matter/endpoints.js +0 -2
  17. package/dist/matter/export.js +0 -2
  18. package/dist/matter/types.js +0 -2
  19. package/dist/matterbridge.js +103 -879
  20. package/dist/matterbridgeAccessoryPlatform.js +0 -34
  21. package/dist/matterbridgeBehaviors.js +1 -49
  22. package/dist/matterbridgeDeviceTypes.js +15 -578
  23. package/dist/matterbridgeDynamicPlatform.js +0 -34
  24. package/dist/matterbridgeEndpoint.js +30 -930
  25. package/dist/matterbridgeEndpointHelpers.js +10 -172
  26. package/dist/matterbridgePlatform.js +7 -225
  27. package/dist/matterbridgeTypes.js +0 -24
  28. package/dist/pluginManager.js +5 -272
  29. package/dist/roboticVacuumCleaner.js +6 -81
  30. package/dist/shelly.js +8 -156
  31. package/dist/storage/export.js +0 -1
  32. package/dist/update.js +0 -53
  33. package/dist/utils/colorUtils.js +2 -205
  34. package/dist/utils/commandLine.js +0 -53
  35. package/dist/utils/copyDirectory.js +16 -37
  36. package/dist/utils/createDirectory.js +21 -0
  37. package/dist/utils/createZip.js +2 -42
  38. package/dist/utils/deepCopy.js +0 -38
  39. package/dist/utils/deepEqual.js +1 -71
  40. package/dist/utils/export.js +1 -1
  41. package/dist/utils/hex.js +0 -57
  42. package/dist/utils/isvalid.js +0 -100
  43. package/dist/utils/network.js +5 -76
  44. package/dist/utils/spawn.js +68 -0
  45. package/dist/utils/wait.js +11 -59
  46. package/dist/waterHeater.js +2 -62
  47. package/npm-shrinkwrap.json +2 -2
  48. package/package.json +1 -2
  49. package/dist/cli.d.ts +0 -29
  50. package/dist/cli.d.ts.map +0 -1
  51. package/dist/cli.js.map +0 -1
  52. package/dist/cluster/export.d.ts +0 -2
  53. package/dist/cluster/export.d.ts.map +0 -1
  54. package/dist/cluster/export.js.map +0 -1
  55. package/dist/defaultConfigSchema.d.ts +0 -27
  56. package/dist/defaultConfigSchema.d.ts.map +0 -1
  57. package/dist/defaultConfigSchema.js.map +0 -1
  58. package/dist/deviceManager.d.ts +0 -114
  59. package/dist/deviceManager.d.ts.map +0 -1
  60. package/dist/deviceManager.js.map +0 -1
  61. package/dist/evse.d.ts +0 -63
  62. package/dist/evse.d.ts.map +0 -1
  63. package/dist/evse.js.map +0 -1
  64. package/dist/frontend.d.ts +0 -256
  65. package/dist/frontend.d.ts.map +0 -1
  66. package/dist/frontend.js.map +0 -1
  67. package/dist/helpers.d.ts +0 -47
  68. package/dist/helpers.d.ts.map +0 -1
  69. package/dist/helpers.js.map +0 -1
  70. package/dist/index.d.ts +0 -37
  71. package/dist/index.d.ts.map +0 -1
  72. package/dist/index.js.map +0 -1
  73. package/dist/laundryWasher.d.ts +0 -243
  74. package/dist/laundryWasher.d.ts.map +0 -1
  75. package/dist/laundryWasher.js.map +0 -1
  76. package/dist/logger/export.d.ts +0 -2
  77. package/dist/logger/export.d.ts.map +0 -1
  78. package/dist/logger/export.js.map +0 -1
  79. package/dist/matter/behaviors.d.ts +0 -2
  80. package/dist/matter/behaviors.d.ts.map +0 -1
  81. package/dist/matter/behaviors.js.map +0 -1
  82. package/dist/matter/clusters.d.ts +0 -2
  83. package/dist/matter/clusters.d.ts.map +0 -1
  84. package/dist/matter/clusters.js.map +0 -1
  85. package/dist/matter/devices.d.ts +0 -2
  86. package/dist/matter/devices.d.ts.map +0 -1
  87. package/dist/matter/devices.js.map +0 -1
  88. package/dist/matter/endpoints.d.ts +0 -2
  89. package/dist/matter/endpoints.d.ts.map +0 -1
  90. package/dist/matter/endpoints.js.map +0 -1
  91. package/dist/matter/export.d.ts +0 -5
  92. package/dist/matter/export.d.ts.map +0 -1
  93. package/dist/matter/export.js.map +0 -1
  94. package/dist/matter/types.d.ts +0 -3
  95. package/dist/matter/types.d.ts.map +0 -1
  96. package/dist/matter/types.js.map +0 -1
  97. package/dist/matterbridge.d.ts +0 -449
  98. package/dist/matterbridge.d.ts.map +0 -1
  99. package/dist/matterbridge.js.map +0 -1
  100. package/dist/matterbridgeAccessoryPlatform.d.ts +0 -40
  101. package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
  102. package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
  103. package/dist/matterbridgeBehaviors.d.ts +0 -1379
  104. package/dist/matterbridgeBehaviors.d.ts.map +0 -1
  105. package/dist/matterbridgeBehaviors.js.map +0 -1
  106. package/dist/matterbridgeDeviceTypes.d.ts +0 -644
  107. package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
  108. package/dist/matterbridgeDeviceTypes.js.map +0 -1
  109. package/dist/matterbridgeDynamicPlatform.d.ts +0 -40
  110. package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
  111. package/dist/matterbridgeDynamicPlatform.js.map +0 -1
  112. package/dist/matterbridgeEndpoint.d.ts +0 -1079
  113. package/dist/matterbridgeEndpoint.d.ts.map +0 -1
  114. package/dist/matterbridgeEndpoint.js.map +0 -1
  115. package/dist/matterbridgeEndpointHelpers.d.ts +0 -2749
  116. package/dist/matterbridgeEndpointHelpers.d.ts.map +0 -1
  117. package/dist/matterbridgeEndpointHelpers.js.map +0 -1
  118. package/dist/matterbridgePlatform.d.ts +0 -294
  119. package/dist/matterbridgePlatform.d.ts.map +0 -1
  120. package/dist/matterbridgePlatform.js.map +0 -1
  121. package/dist/matterbridgeTypes.d.ts +0 -196
  122. package/dist/matterbridgeTypes.d.ts.map +0 -1
  123. package/dist/matterbridgeTypes.js.map +0 -1
  124. package/dist/pluginManager.d.ts +0 -273
  125. package/dist/pluginManager.d.ts.map +0 -1
  126. package/dist/pluginManager.js.map +0 -1
  127. package/dist/roboticVacuumCleaner.d.ts +0 -102
  128. package/dist/roboticVacuumCleaner.d.ts.map +0 -1
  129. package/dist/roboticVacuumCleaner.js.map +0 -1
  130. package/dist/shelly.d.ts +0 -153
  131. package/dist/shelly.d.ts.map +0 -1
  132. package/dist/shelly.js.map +0 -1
  133. package/dist/storage/export.d.ts +0 -2
  134. package/dist/storage/export.d.ts.map +0 -1
  135. package/dist/storage/export.js.map +0 -1
  136. package/dist/update.d.ts +0 -58
  137. package/dist/update.d.ts.map +0 -1
  138. package/dist/update.js.map +0 -1
  139. package/dist/utils/colorUtils.d.ts +0 -61
  140. package/dist/utils/colorUtils.d.ts.map +0 -1
  141. package/dist/utils/colorUtils.js.map +0 -1
  142. package/dist/utils/commandLine.d.ts +0 -58
  143. package/dist/utils/commandLine.d.ts.map +0 -1
  144. package/dist/utils/commandLine.js.map +0 -1
  145. package/dist/utils/copyDirectory.d.ts +0 -32
  146. package/dist/utils/copyDirectory.d.ts.map +0 -1
  147. package/dist/utils/copyDirectory.js.map +0 -1
  148. package/dist/utils/createZip.d.ts +0 -38
  149. package/dist/utils/createZip.d.ts.map +0 -1
  150. package/dist/utils/createZip.js.map +0 -1
  151. package/dist/utils/deepCopy.d.ts +0 -31
  152. package/dist/utils/deepCopy.d.ts.map +0 -1
  153. package/dist/utils/deepCopy.js.map +0 -1
  154. package/dist/utils/deepEqual.d.ts +0 -53
  155. package/dist/utils/deepEqual.d.ts.map +0 -1
  156. package/dist/utils/deepEqual.js.map +0 -1
  157. package/dist/utils/export.d.ts +0 -11
  158. package/dist/utils/export.d.ts.map +0 -1
  159. package/dist/utils/export.js.map +0 -1
  160. package/dist/utils/hex.d.ts +0 -48
  161. package/dist/utils/hex.d.ts.map +0 -1
  162. package/dist/utils/hex.js.map +0 -1
  163. package/dist/utils/isvalid.d.ts +0 -102
  164. package/dist/utils/isvalid.d.ts.map +0 -1
  165. package/dist/utils/isvalid.js.map +0 -1
  166. package/dist/utils/network.d.ts +0 -69
  167. package/dist/utils/network.d.ts.map +0 -1
  168. package/dist/utils/network.js.map +0 -1
  169. package/dist/utils/wait.d.ts +0 -52
  170. package/dist/utils/wait.d.ts.map +0 -1
  171. package/dist/utils/wait.js.map +0 -1
  172. package/dist/waterHeater.d.ts +0 -90
  173. package/dist/waterHeater.d.ts.map +0 -1
  174. package/dist/waterHeater.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, CYAN, YELLOW, db, debugStringify, hk, or, zb } from './logger/export.js';
25
- // Matterbridge
26
2
  import { bridgedNode } from './matterbridgeDeviceTypes.js';
27
3
  import { isValidNumber, isValidObject, isValidString } from './utils/export.js';
28
4
  import { MatterbridgeServer, MatterbridgeServerDevice, MatterbridgeIdentifyServer, MatterbridgeOnOffServer, MatterbridgeLevelControlServer, MatterbridgeColorControlServer, MatterbridgeLiftWindowCoveringServer, MatterbridgeLiftTiltWindowCoveringServer, MatterbridgeThermostatServer, MatterbridgeFanControlServer, MatterbridgeDoorLockServer, MatterbridgeModeSelectServer, MatterbridgeValveConfigurationAndControlServer, MatterbridgeSmokeCoAlarmServer, MatterbridgeBooleanStateConfigurationServer, MatterbridgeSwitchServer, MatterbridgeOperationalStateServer, MatterbridgeDeviceEnergyManagementModeServer, } from './matterbridgeBehaviors.js';
29
5
  import { addClusterServers, addFixedLabel, addOptionalClusterServers, addRequiredClusterServers, addUserLabel, createUniqueId, getBehavior, getBehaviourTypesFromClusterClientIds, getBehaviourTypesFromClusterServerIds, getDefaultOperationalStateClusterServer, getDefaultFlowMeasurementClusterServer, getDefaultIlluminanceMeasurementClusterServer, getDefaultPressureMeasurementClusterServer, getDefaultRelativeHumidityMeasurementClusterServer, getDefaultTemperatureMeasurementClusterServer, getDefaultOccupancySensingClusterServer, lowercaseFirstLetter, updateAttribute, getClusterId, getAttributeId, setAttribute, getAttribute, checkNotLatinCharacters, generateUniqueId, subscribeAttribute, invokeBehaviorCommand, triggerEvent, } from './matterbridgeEndpointHelpers.js';
30
- // @matter
31
6
  import { Endpoint, Lifecycle, MutableEndpoint, NamedHandler, SupportedBehaviors, UINT16_MAX, UINT32_MAX, 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';
@@ -57,7 +31,6 @@ import { ThermostatUserInterfaceConfiguration } from '@matter/main/clusters/ther
57
31
  import { OperationalState } from '@matter/main/clusters/operational-state';
58
32
  import { DeviceEnergyManagement } from '@matter/main/clusters/device-energy-management';
59
33
  import { DeviceEnergyManagementMode } from '@matter/main/clusters/device-energy-management-mode';
60
- // @matter behaviors
61
34
  import { DescriptorServer } from '@matter/main/behaviors/descriptor';
62
35
  import { PowerSourceServer } from '@matter/main/behaviors/power-source';
63
36
  import { BridgedDeviceBasicInformationServer } from '@matter/main/behaviors/bridged-device-basic-information';
@@ -94,7 +67,7 @@ import { ThermostatUserInterfaceConfigurationServer } from '@matter/main/behavio
94
67
  import { DeviceEnergyManagementServer } from '@matter/main/behaviors/device-energy-management';
95
68
  export class MatterbridgeEndpoint extends Endpoint {
96
69
  static bridgeMode = '';
97
- static logLevel = "info" /* LogLevel.INFO */;
70
+ static logLevel = "info";
98
71
  log;
99
72
  plugin = undefined;
100
73
  configUrl = undefined;
@@ -110,25 +83,14 @@ export class MatterbridgeEndpoint extends Endpoint {
110
83
  hardwareVersion = undefined;
111
84
  hardwareVersionString = undefined;
112
85
  productUrl = 'https://www.npmjs.com/package/matterbridge';
113
- // The first device type of the endpoint
114
86
  name = undefined;
115
87
  deviceType;
116
88
  uniqueStorageKey = undefined;
117
89
  tagList = undefined;
118
- // Maps matter deviceTypes
119
90
  deviceTypes = new Map();
120
- // Command handler
121
91
  commandHandler = new NamedHandler();
122
- /**
123
- * Represents a MatterbridgeEndpoint.
124
- * @constructor
125
- * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the endpoint.
126
- * @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
127
- * @param {boolean} [debug=false] - Debug flag.
128
- */
129
92
  constructor(definition, options = {}, debug = false) {
130
93
  let deviceTypeList = [];
131
- // Get the first DeviceTypeDefinition
132
94
  let firstDefinition;
133
95
  if (Array.isArray(definition)) {
134
96
  firstDefinition = definition[0];
@@ -141,7 +103,6 @@ export class MatterbridgeEndpoint extends Endpoint {
141
103
  firstDefinition = definition;
142
104
  deviceTypeList = [{ deviceType: firstDefinition.code, revision: firstDefinition.revision }];
143
105
  }
144
- // Convert the first DeviceTypeDefinition to an EndpointType.Options
145
106
  const deviceTypeDefinitionV8 = {
146
107
  name: firstDefinition.name.replace('-', '_'),
147
108
  deviceType: firstDefinition.code,
@@ -160,11 +121,9 @@ export class MatterbridgeEndpoint extends Endpoint {
160
121
  behaviors: options.tagList ? SupportedBehaviors(DescriptorServer.with(Descriptor.Feature.TagList)) : {},
161
122
  };
162
123
  const endpointV8 = MutableEndpoint(deviceTypeDefinitionV8);
163
- // Check if the uniqueStorageKey is valid
164
124
  if (options.uniqueStorageKey && checkNotLatinCharacters(options.uniqueStorageKey)) {
165
125
  options.uniqueStorageKey = generateUniqueId(options.uniqueStorageKey);
166
126
  }
167
- // Convert the options to an Endpoint.Options
168
127
  const optionsV8 = {
169
128
  id: options.uniqueStorageKey?.replace(/[ .]/g, ''),
170
129
  number: options.endpointId,
@@ -182,40 +141,16 @@ export class MatterbridgeEndpoint extends Endpoint {
182
141
  }
183
142
  else
184
143
  this.deviceTypes.set(firstDefinition.code, firstDefinition);
185
- // console.log('MatterbridgeEndpoint.option', options);
186
- // console.log('MatterbridgeEndpoint.endpointV8', endpointV8);
187
- // console.log('MatterbridgeEndpoint.optionsV8', optionsV8);
188
- // Create the logger
189
- this.log = new AnsiLogger({ logName: options.uniqueStorageKey ?? 'MatterbridgeEndpoint', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: debug === true ? "debug" /* LogLevel.DEBUG */ : MatterbridgeEndpoint.logLevel });
144
+ this.log = new AnsiLogger({ logName: options.uniqueStorageKey ?? 'MatterbridgeEndpoint', logTimestampFormat: 4, logLevel: debug === true ? "debug" : MatterbridgeEndpoint.logLevel });
190
145
  this.log.debug(`${YELLOW}new${db} MatterbridgeEndpoint: ${zb}${'0x' + firstDefinition.code.toString(16).padStart(4, '0')}${db}-${zb}${firstDefinition.name}${db} id: ${CYAN}${options.uniqueStorageKey}${db} number: ${CYAN}${options.endpointId}${db} taglist: ${CYAN}${options.tagList ? debugStringify(options.tagList) : 'undefined'}${db}`);
191
- // Add MatterbridgeBehavior with MatterbridgeBehaviorDevice
192
146
  this.behaviors.require(MatterbridgeServer, { deviceCommand: new MatterbridgeServerDevice(this.log, this.commandHandler, undefined) });
193
147
  }
194
- /**
195
- * Loads an instance of the MatterbridgeEndpoint class.
196
- *
197
- * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the device.
198
- * @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
199
- * @param {boolean} [debug=false] - Debug flag.
200
- * @returns {Promise<MatterbridgeEndpoint>} MatterbridgeEndpoint instance.
201
- */
202
148
  static async loadInstance(definition, options = {}, debug = false) {
203
149
  return new MatterbridgeEndpoint(definition, options, debug);
204
150
  }
205
- /**
206
- * Get all the device types of this endpoint.
207
- *
208
- * @returns {DeviceTypeDefinition[]} The device types of this endpoint.
209
- */
210
151
  getDeviceTypes() {
211
152
  return Array.from(this.deviceTypes.values());
212
153
  }
213
- /**
214
- * Checks if the provided cluster server is supported by this endpoint.
215
- *
216
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
217
- * @returns {boolean} True if the cluster server is supported, false otherwise.
218
- */
219
154
  hasClusterServer(cluster) {
220
155
  const behavior = getBehavior(this, cluster);
221
156
  if (behavior)
@@ -223,13 +158,6 @@ export class MatterbridgeEndpoint extends Endpoint {
223
158
  else
224
159
  return false;
225
160
  }
226
- /**
227
- * Checks if the provided attribute server is supported for a given cluster of this endpoint.
228
- *
229
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
230
- * @param {string} attribute - The attribute name to check.
231
- * @returns {boolean} True if the attribute server is supported, false otherwise.
232
- */
233
161
  hasAttributeServer(cluster, attribute) {
234
162
  const behavior = getBehavior(this, cluster);
235
163
  if (!behavior || !this.behaviors.supported[behavior.id])
@@ -238,228 +166,82 @@ export class MatterbridgeEndpoint extends Endpoint {
238
166
  const defaults = this.behaviors.defaultsFor(behavior);
239
167
  return lowercaseFirstLetter(attribute) in options || lowercaseFirstLetter(attribute) in defaults;
240
168
  }
241
- /**
242
- * Retrieves the initial options for the provided cluster server.
243
- *
244
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to get options for.
245
- * @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.
246
- */
247
169
  getClusterServerOptions(cluster) {
248
170
  const behavior = getBehavior(this, cluster);
249
171
  if (!behavior)
250
172
  return undefined;
251
173
  return this.behaviors.optionsFor(behavior);
252
174
  }
253
- /**
254
- * Retrieves the value of the provided attribute from the given cluster.
255
- *
256
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to retrieve the attribute from.
257
- * @param {string} attribute - The name of the attribute to retrieve.
258
- * @param {AnsiLogger} [log] - Optional logger for error and info messages.
259
- * @returns {any} The value of the attribute, or undefined if the attribute is not found.
260
- */
261
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
262
175
  getAttribute(cluster, attribute, log) {
263
176
  return getAttribute(this, cluster, attribute, log);
264
177
  }
265
- /**
266
- * Sets the value of an attribute on a cluster server.
267
- *
268
- * @param {Behavior.Type | ClusterType | ClusterId | string} clusterId - The ID of the cluster.
269
- * @param {string} attribute - The name of the attribute.
270
- * @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
271
- * @param {AnsiLogger} [log] - (Optional) The logger to use for logging errors and information.
272
- * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
273
- */
274
178
  async setAttribute(clusterId, attribute, value, log) {
275
179
  return await setAttribute(this, clusterId, attribute, value, log);
276
180
  }
277
- /**
278
- * Update the value of an attribute on a cluster server only if the value is different.
279
- *
280
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to set the attribute on.
281
- * @param {string} attribute - The name of the attribute.
282
- * @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
283
- * @param {AnsiLogger} [log] - (Optional) The logger to use for logging the update. Errors are logged to the endpoint logger.
284
- * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
285
- */
286
181
  async updateAttribute(cluster, attribute, value, log) {
287
182
  return await updateAttribute(this, cluster, attribute, value, log);
288
183
  }
289
- /**
290
- * Subscribes to the provided attribute on a cluster.
291
- *
292
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to subscribe the attribute to.
293
- * @param {string} attribute - The name of the attribute to subscribe to.
294
- * @param {(newValue: any, oldValue: any, context: ActionContext) => void} listener - A callback function that will be called when the attribute value changes. When context.offline === true then the change is locally generated and not from the controller.
295
- * @param {AnsiLogger} [log] - Optional logger for logging errors and information.
296
- * @returns {Promise<boolean>} - A boolean indicating whether the subscription was successful.
297
- *
298
- * @remarks The listener function (cannot be async) will receive three parameters:
299
- * - `newValue`: The new value of the attribute.
300
- * - `oldValue`: The old value of the attribute.
301
- * - `context`: The action context, which includes information about the action that triggered the change. When context.offline === true then the change is locally generated and not from the controller.
302
- */
303
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
304
184
  async subscribeAttribute(cluster, attribute, listener, log) {
305
185
  return await subscribeAttribute(this, cluster, attribute, listener, log);
306
186
  }
307
- /**
308
- * Triggers an event on the specified cluster.
309
- * @param {ClusterId} cluster - 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
187
  async triggerEvent(cluster, event, payload, log) {
316
188
  return await triggerEvent(this, cluster, event, payload, log);
317
189
  }
318
- /**
319
- * Adds cluster servers from the provided server list.
320
- *
321
- * @param {ClusterId[]} serverList - The list of cluster IDs to add.
322
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
323
- */
324
190
  addClusterServers(serverList) {
325
191
  addClusterServers(this, serverList);
326
192
  return this;
327
193
  }
328
- /**
329
- * Adds a fixed label to the FixedLabel cluster. If the cluster server is not present, it will be added.
330
- *
331
- * @param {string} label - The label to add.
332
- * @param {string} value - The value of the label.
333
- * @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
334
- */
335
194
  async addFixedLabel(label, value) {
336
195
  await addFixedLabel(this, label, value);
337
196
  return this;
338
197
  }
339
- /**
340
- * Adds a user label to the UserLabel cluster. If the cluster server is not present, it will be added.
341
- *
342
- * @param {string} label - The label to add.
343
- * @param {string} value - The value of the label.
344
- * @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
345
- */
346
198
  async addUserLabel(label, value) {
347
199
  await addUserLabel(this, label, value);
348
200
  return this;
349
201
  }
350
- /**
351
- * Adds a command handler for the specified command.
352
- *
353
- * @param {keyof MatterbridgeEndpointCommands} command - The command to add the handler for.
354
- * @param {HandlerFunction} handler - The handler function to execute when the command is received.
355
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
356
- */
357
202
  addCommandHandler(command, handler) {
358
203
  this.commandHandler.addHandler(command, handler);
359
204
  return this;
360
205
  }
361
- /**
362
- * Execute the command handler for the specified command. Used ONLY in Jest tests.
363
- *
364
- * @param {keyof MatterbridgeEndpointCommands} command - The command to execute.
365
- * @param {Record<string, boolean | number | bigint | string | object | null>} [request] - The optional request to pass to the handler function.
366
- *
367
- * @deprecated Used ONLY in Jest tests.
368
- */
369
206
  async executeCommandHandler(command, request) {
370
207
  await this.commandHandler.executeHandler(command, { request });
371
208
  }
372
- /**
373
- * Invokes a behavior command on the specified cluster. Used ONLY in Jest tests.
374
- *
375
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to invoke the command on.
376
- * @param {string} command - The command to invoke.
377
- * @param {Record<string, boolean | number | bigint | string | object | null>} [params] - The optional parameters to pass to the command.
378
- *
379
- * @deprecated Used ONLY in Jest tests.
380
- */
381
209
  async invokeBehaviorCommand(cluster, command, params) {
382
210
  await invokeBehaviorCommand(this, cluster, command, params);
383
211
  }
384
- /**
385
- * Adds the required cluster servers (only if they are not present) for the device types of the specified endpoint.
386
- *
387
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
388
- */
389
212
  addRequiredClusterServers() {
390
213
  addRequiredClusterServers(this);
391
214
  return this;
392
215
  }
393
- /**
394
- * Adds the optional cluster servers (only if they are not present) for the device types of the specified endpoint.
395
- *
396
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
397
- */
398
216
  addOptionalClusterServers() {
399
217
  addOptionalClusterServers(this);
400
218
  return this;
401
219
  }
402
- /**
403
- * Retrieves all cluster servers.
404
- *
405
- * @returns {Behavior.Type[]} An array of all cluster servers.
406
- */
407
220
  getAllClusterServers() {
408
221
  return Object.values(this.behaviors.supported);
409
222
  }
410
- /**
411
- * Retrieves the names of all cluster servers.
412
- *
413
- * @returns {string[]} An array of all cluster server names.
414
- */
415
223
  getAllClusterServerNames() {
416
224
  return Object.keys(this.behaviors.supported);
417
225
  }
418
- /**
419
- * Iterates over each attribute of each cluster server of the device state and calls the provided callback function.
420
- *
421
- * @param {Function} callback - The callback function to call with the cluster name, cluster id, attribute name, attribute id and attribute value.
422
- */
423
226
  forEachAttribute(callback) {
424
227
  if (!this.lifecycle.isReady || this.construction.status !== Lifecycle.Status.Active)
425
228
  return;
426
229
  for (const [clusterName, clusterAttributes] of Object.entries(this.state)) {
427
- // Skip if the key / cluster name is a number, cause they are double indexed.
428
230
  if (!isNaN(Number(clusterName)))
429
231
  continue;
430
232
  for (const [attributeName, attributeValue] of Object.entries(clusterAttributes)) {
431
- // Skip if the behavior has no associated cluster (i.e. matterbridge server)
432
233
  const clusterId = getClusterId(this, clusterName);
433
234
  if (clusterId === undefined) {
434
- // this.log.debug(`***forEachAttribute: cluster ${clusterName} not found`);
435
235
  continue;
436
236
  }
437
- // Skip if the attribute is not present in the ClusterBehavior.Type. Also skip if the attribute it is an internal state.
438
237
  const attributeId = getAttributeId(this, clusterName, attributeName);
439
238
  if (attributeId === undefined) {
440
- // this.log.debug(`***forEachAttribute: attribute ${clusterName}.${attributeName} not found`);
441
239
  continue;
442
240
  }
443
241
  callback(clusterName, clusterId, attributeName, attributeId, attributeValue);
444
242
  }
445
243
  }
446
244
  }
447
- /**
448
- * Adds a child endpoint with the specified device types and options.
449
- * If the child endpoint is not already present, it will be created and added.
450
- * If the child endpoint is already present, the existing child endpoint will be returned.
451
- *
452
- * @param {string} endpointName - The name of the new endpoint to add.
453
- * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
454
- * @param {MatterbridgeEndpointOptions} [options={}] - The options for the endpoint.
455
- * @param {boolean} [debug=false] - Whether to enable debug logging.
456
- * @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
457
- *
458
- * @example
459
- * ```typescript
460
- * const endpoint = device.addChildDeviceType('Temperature', [temperatureSensor], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
461
- * ```
462
- */
463
245
  addChildDeviceType(endpointName, definition, options = {}, debug = false) {
464
246
  this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
465
247
  let alreadyAdded = false;
@@ -499,23 +281,6 @@ export class MatterbridgeEndpoint extends Endpoint {
499
281
  }
500
282
  return child;
501
283
  }
502
- /**
503
- * Adds a child endpoint with one or more device types with the required cluster servers and the specified cluster servers.
504
- * If the child endpoint is not already present in the childEndpoints, it will be added.
505
- * If the child endpoint is already present in the childEndpoints, the device types and cluster servers will be added to the existing child endpoint.
506
- *
507
- * @param {string} endpointName - The name of the new enpoint to add.
508
- * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
509
- * @param {ClusterId[]} [serverList=[]] - The list of cluster IDs to include.
510
- * @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
511
- * @param {boolean} [debug=false] - Whether to enable debug logging.
512
- * @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
513
- *
514
- * @example
515
- * ```typescript
516
- * const endpoint = device.addChildDeviceTypeWithClusterServer('Temperature', [temperatureSensor], [], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
517
- * ```
518
- */
519
284
  addChildDeviceTypeWithClusterServer(endpointName, definition, serverList = [], options = {}, debug = false) {
520
285
  this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
521
286
  let alreadyAdded = false;
@@ -578,38 +343,15 @@ export class MatterbridgeEndpoint extends Endpoint {
578
343
  }
579
344
  return child;
580
345
  }
581
- /**
582
- * Retrieves a child endpoint by its name.
583
- *
584
- * @param {string} endpointName - The name of the endpoint to retrieve.
585
- * @returns {Endpoint | undefined} The child endpoint with the specified name, or undefined if not found.
586
- */
587
346
  getChildEndpointByName(endpointName) {
588
347
  return this.parts.find((part) => part.id === endpointName);
589
348
  }
590
- /**
591
- * Retrieves a child endpoint by its EndpointNumber.
592
- *
593
- * @param {EndpointNumber} endpointNumber - The EndpointNumber of the endpoint to retrieve.
594
- * @returns {MatterbridgeEndpoint | undefined} The child endpoint with the specified EndpointNumber, or undefined if not found.
595
- */
596
349
  getChildEndpoint(endpointNumber) {
597
350
  return this.parts.find((part) => part.number === endpointNumber);
598
351
  }
599
- /**
600
- * Get all the child endpoints of this endpoint.
601
- *
602
- * @returns {MatterbridgeEndpoint[]} The child endpoints.
603
- */
604
352
  getChildEndpoints() {
605
353
  return Array.from(this.parts);
606
354
  }
607
- /**
608
- * Serializes the Matterbridge device into a serialized object.
609
- *
610
- * @param pluginName - The name of the plugin.
611
- * @returns The serialized Matterbridge device object.
612
- */
613
355
  static serialize(device) {
614
356
  if (!device.serialNumber || !device.deviceName || !device.uniqueId)
615
357
  return;
@@ -632,15 +374,9 @@ export class MatterbridgeEndpoint extends Endpoint {
632
374
  serialized.clusterServersId.push(BridgedDeviceBasicInformation.Cluster.id);
633
375
  if (behaviorName === 'powerSource')
634
376
  serialized.clusterServersId.push(PowerSource.Cluster.id);
635
- // serialized.clusterServersId.push(this.behaviors.supported[behaviorName]cluster.id);
636
377
  });
637
378
  return serialized;
638
379
  }
639
- /**
640
- * Deserializes the device into a serialized object.
641
- *
642
- * @returns The deserialized MatterbridgeDevice.
643
- */
644
380
  static deserialize(serializedDevice) {
645
381
  const device = new MatterbridgeEndpoint(serializedDevice.deviceTypes, { uniqueStorageKey: serializedDevice.endpointName, endpointId: serializedDevice.endpoint }, false);
646
382
  device.plugin = serializedDevice.pluginName;
@@ -656,16 +392,9 @@ export class MatterbridgeEndpoint extends Endpoint {
656
392
  device.createDefaultBridgedDeviceBasicInformationClusterServer(serializedDevice.deviceName, serializedDevice.serialNumber, serializedDevice.vendorId ?? 0xfff1, serializedDevice.vendorName ?? 'Matterbridge', serializedDevice.productName ?? 'Matterbridge device');
657
393
  else if (clusterId === PowerSource.Cluster.id)
658
394
  device.createDefaultPowerSourceWiredClusterServer();
659
- // else addClusterServerFromList(device, [clusterId]);
660
395
  }
661
396
  return device;
662
397
  }
663
- /**
664
- * Creates a default power source wired cluster server.
665
- *
666
- * @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
667
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
668
- */
669
398
  createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
670
399
  this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Wired), {
671
400
  wiredCurrentType,
@@ -676,16 +405,6 @@ export class MatterbridgeEndpoint extends Endpoint {
676
405
  });
677
406
  return this;
678
407
  }
679
- /**
680
- * Creates a default power source replaceable battery cluster server.
681
- *
682
- * @param batPercentRemaining - The remaining battery percentage (default: 100).
683
- * @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
684
- * @param batVoltage - The battery voltage (default: 1500).
685
- * @param batReplacementDescription - The battery replacement description (default: 'Battery type').
686
- * @param batQuantity - The battery quantity (default: 1).
687
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
688
- */
689
408
  createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
690
409
  this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
691
410
  status: PowerSource.PowerSourceStatus.Active,
@@ -703,14 +422,6 @@ export class MatterbridgeEndpoint extends Endpoint {
703
422
  });
704
423
  return this;
705
424
  }
706
- /**
707
- * Creates a default power source rechargeable battery cluster server.
708
- *
709
- * @param batPercentRemaining - The remaining battery percentage (default: 100).
710
- * @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
711
- * @param batVoltage - The battery voltage (default: 1500).
712
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
713
- */
714
425
  createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
715
426
  this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
716
427
  status: PowerSource.PowerSourceStatus.Active,
@@ -729,21 +440,6 @@ export class MatterbridgeEndpoint extends Endpoint {
729
440
  });
730
441
  return this;
731
442
  }
732
- /**
733
- * Setup the default Basic Information Cluster Server attributes for the server node.
734
- *
735
- * @param deviceName - The name of the device.
736
- * @param serialNumber - The serial number of the device.
737
- * @param vendorId - The vendor ID of the device.
738
- * @param vendorName - The vendor name of the device.
739
- * @param productId - The product ID of the device.
740
- * @param productName - The product name of the device.
741
- * @param softwareVersion - The software version of the device. Default is 1.
742
- * @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
743
- * @param hardwareVersion - The hardware version of the device. Default is 1.
744
- * @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
745
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
746
- */
747
443
  createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
748
444
  this.log.logName = deviceName;
749
445
  this.deviceName = deviceName;
@@ -767,22 +463,6 @@ export class MatterbridgeEndpoint extends Endpoint {
767
463
  }
768
464
  return this;
769
465
  }
770
- /**
771
- * Creates a default BridgedDeviceBasicInformationClusterServer for the aggregator endpoints.
772
- *
773
- * @param deviceName - The name of the device.
774
- * @param serialNumber - The serial number of the device.
775
- * @param vendorId - The vendor ID of the device.
776
- * @param vendorName - The name of the vendor.
777
- * @param productName - The name of the product.
778
- * @param softwareVersion - The software version of the device. Default is 1.
779
- * @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
780
- * @param hardwareVersion - The hardware version of the device. Default is 1.
781
- * @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
782
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
783
- *
784
- * @remarks The bridgedNode device type must be added to the deviceTypeList of the Descriptor cluster.
785
- */
786
466
  createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
787
467
  this.log.logName = deviceName;
788
468
  this.deviceName = deviceName;
@@ -799,7 +479,7 @@ export class MatterbridgeEndpoint extends Endpoint {
799
479
  this.behaviors.require(BridgedDeviceBasicInformationServer.enable({
800
480
  events: { leave: true, reachableChanged: true },
801
481
  }), {
802
- vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined, // 4874
482
+ vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
803
483
  vendorName: vendorName.slice(0, 32),
804
484
  productName: productName.slice(0, 32),
805
485
  productUrl: this.productUrl.slice(0, 256),
@@ -815,13 +495,6 @@ export class MatterbridgeEndpoint extends Endpoint {
815
495
  });
816
496
  return this;
817
497
  }
818
- /**
819
- * Creates a default identify cluster server with the specified identify time and type.
820
- *
821
- * @param {number} [identifyTime=0] - The time to identify the server. Defaults to 0.
822
- * @param {Identify.IdentifyType} [identifyType=Identify.IdentifyType.None] - The type of identification. Defaults to Identify.IdentifyType.None.
823
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
824
- */
825
498
  createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
826
499
  this.behaviors.require(MatterbridgeIdentifyServer, {
827
500
  identifyTime,
@@ -829,34 +502,14 @@ export class MatterbridgeEndpoint extends Endpoint {
829
502
  });
830
503
  return this;
831
504
  }
832
- /**
833
- * Creates a default groups cluster server.
834
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
835
- */
836
505
  createDefaultGroupsClusterServer() {
837
506
  this.behaviors.require(GroupsServer);
838
507
  return this;
839
508
  }
840
- /**
841
- * Creates a default scenes management cluster server.
842
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
843
- *
844
- * @remarks The scenes management cluster server is still provisional and so not yet implemented.
845
- */
846
509
  createDefaultScenesClusterServer() {
847
510
  this.behaviors.require(ScenesManagementServer);
848
511
  return this;
849
512
  }
850
- /**
851
- * Creates a default OnOff cluster server for light devices with feature Lighting.
852
- *
853
- * @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
854
- * @param {boolean} [globalSceneControl=false] - The global scene control state.
855
- * @param {number} [onTime=0] - The on time value.
856
- * @param {number} [offWaitTime=0] - The off wait time value.
857
- * @param {OnOff.StartUpOnOff | null} [startUpOnOff=null] - The start-up OnOff state. Null means previous state.
858
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
859
- */
860
513
  createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
861
514
  this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.Lighting), {
862
515
  onOff,
@@ -867,52 +520,24 @@ export class MatterbridgeEndpoint extends Endpoint {
867
520
  });
868
521
  return this;
869
522
  }
870
- /**
871
- * Creates an OnOff cluster server without features.
872
- *
873
- * @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
874
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
875
- */
876
523
  createOnOffClusterServer(onOff = false) {
877
524
  this.behaviors.require(MatterbridgeOnOffServer, {
878
525
  onOff,
879
526
  });
880
527
  return this;
881
528
  }
882
- /**
883
- * Creates a DeadFront OnOff cluster server with feature DeadFrontBehavior.
884
- *
885
- * @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
886
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
887
- */
888
529
  createDeadFrontOnOffClusterServer(onOff = false) {
889
530
  this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.DeadFrontBehavior), {
890
531
  onOff,
891
532
  });
892
533
  return this;
893
534
  }
894
- /**
895
- * Creates an OffOnly OnOff cluster server with feature OffOnly.
896
- *
897
- * @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
898
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
899
- */
900
535
  createOffOnlyOnOffClusterServer(onOff = false) {
901
536
  this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.OffOnly), {
902
537
  onOff,
903
538
  });
904
539
  return this;
905
540
  }
906
- /**
907
- * Creates a default level control cluster server for light devices with feature OnOff and Lighting.
908
- *
909
- * @param {number} [currentLevel=254] - The current level (default: 254).
910
- * @param {number} [minLevel=1] - The minimum level (default: 1).
911
- * @param {number} [maxLevel=254] - The maximum level (default: 254).
912
- * @param {number | null} [onLevel=null] - The on level (default: null).
913
- * @param {number | null} [startUpCurrentLevel=null] - The startUp on level (default: null).
914
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
915
- */
916
541
  createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
917
542
  this.behaviors.require(MatterbridgeLevelControlServer.with(LevelControl.Feature.OnOff, LevelControl.Feature.Lighting), {
918
543
  currentLevel,
@@ -928,13 +553,6 @@ export class MatterbridgeEndpoint extends Endpoint {
928
553
  });
929
554
  return this;
930
555
  }
931
- /**
932
- * Creates a level control cluster server without features.
933
- *
934
- * @param {number} [currentLevel=254] - The current level (default: 254).
935
- * @param {number | null} [onLevel=null] - The on level (default: null).
936
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
937
- */
938
556
  createLevelControlClusterServer(currentLevel = 254, onLevel = null) {
939
557
  this.behaviors.require(MatterbridgeLevelControlServer, {
940
558
  currentLevel,
@@ -946,25 +564,6 @@ export class MatterbridgeEndpoint extends Endpoint {
946
564
  });
947
565
  return this;
948
566
  }
949
- /**
950
- * Creates a default color control cluster server with features Xy, HueSaturation and ColorTemperature.
951
- *
952
- * @param currentX - The current X value (range 0-65279).
953
- * @param currentY - The current Y value (range 0-65279).
954
- * @param currentHue - The current hue value (range: 0-254).
955
- * @param currentSaturation - The current saturation value (range: 0-254).
956
- * @param colorTemperatureMireds - The color temperature in mireds (default range 147-500).
957
- * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds (default range 147).
958
- * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds (default range 500).
959
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
960
- *
961
- * @remarks colorMode and enhancedColorMode persist across restarts.
962
- * @remarks currentHue and currentSaturation persist across restarts.
963
- * @remarks currentX and currentY persist across restarts.
964
- * @remarks colorTemperatureMireds persists across restarts.
965
- * @remarks startUpColorTemperatureMireds persists across restarts.
966
- * @remarks coupleColorTempToLevelMinMireds persists across restarts.
967
- */
968
567
  createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
969
568
  this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
970
569
  colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
@@ -987,25 +586,6 @@ export class MatterbridgeEndpoint extends Endpoint {
987
586
  });
988
587
  return this;
989
588
  }
990
- /**
991
- * Creates a Xy color control cluster server with feature Xy and ColorTemperature.
992
- *
993
- * @param currentX - The current X value.
994
- * @param currentY - The current Y value.
995
- * @param colorTemperatureMireds - The color temperature in mireds.
996
- * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
997
- * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
998
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
999
- *
1000
- * @remarks
1001
- * From zigbee to matter = Math.max(Math.min(Math.round(x * 65536), 65279), 0)
1002
- *
1003
- * @remarks colorMode and enhancedColorMode persist across restarts.
1004
- * @remarks currentX and currentY persist across restarts.
1005
- * @remarks colorTemperatureMireds persists across restarts.
1006
- * @remarks startUpColorTemperatureMireds persists across restarts.
1007
- * @remarks coupleColorTempToLevelMinMireds persists across restarts.
1008
- */
1009
589
  createXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1010
590
  this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature), {
1011
591
  colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
@@ -1026,22 +606,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1026
606
  });
1027
607
  return this;
1028
608
  }
1029
- /**
1030
- * Creates a default hue and saturation control cluster server with feature HueSaturation and ColorTemperature.
1031
- *
1032
- * @param currentHue - The current hue value.
1033
- * @param currentSaturation - The current saturation value.
1034
- * @param colorTemperatureMireds - The color temperature in mireds.
1035
- * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1036
- * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1037
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1038
- *
1039
- * @remarks colorMode and enhancedColorMode persist across restarts.
1040
- * @remarks currentHue and currentSaturation persist across restarts.
1041
- * @remarks colorTemperatureMireds persists across restarts.
1042
- * @remarks startUpColorTemperatureMireds persists across restarts.
1043
- * @remarks coupleColorTempToLevelMinMireds persists across restarts.
1044
- */
1045
609
  createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1046
610
  this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
1047
611
  colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
@@ -1062,20 +626,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1062
626
  });
1063
627
  return this;
1064
628
  }
1065
- /**
1066
- * Creates a color temperature color control cluster server with feature ColorTemperature.
1067
- * This cluster server is used for devices that only support color temperature control.
1068
- *
1069
- * @param colorTemperatureMireds - The color temperature in mireds. Defaults to 250.
1070
- * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds. Defaults to 147.
1071
- * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds. Defaults to 500.
1072
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1073
- *
1074
- * @remarks colorMode and enhancedColorMode persist across restarts.
1075
- * @remarks colorTemperatureMireds persists across restarts.
1076
- * @remarks startUpColorTemperatureMireds persists across restarts.
1077
- * @remarks coupleColorTempToLevelMinMireds persists across restarts.
1078
- */
1079
629
  createCtColorControlClusterServer(colorTemperatureMireds = 250, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1080
630
  this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.ColorTemperature), {
1081
631
  colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
@@ -1094,34 +644,15 @@ export class MatterbridgeEndpoint extends Endpoint {
1094
644
  });
1095
645
  return this;
1096
646
  }
1097
- /**
1098
- * Configures the color control mode for the device.
1099
- *
1100
- * @param {ColorControl.ColorMode} colorMode - The color mode to set.
1101
- *
1102
- * @remarks colorMode and enhancedColorMode persist across restarts.
1103
- */
1104
647
  async configureColorControlMode(colorMode) {
1105
648
  if (isValidNumber(colorMode, ColorControl.ColorMode.CurrentHueAndCurrentSaturation, ColorControl.ColorMode.ColorTemperatureMireds)) {
1106
649
  await this.setAttribute(ColorControl.Cluster.id, 'colorMode', colorMode, this.log);
1107
650
  await this.setAttribute(ColorControl.Cluster.id, 'enhancedColorMode', colorMode, this.log);
1108
651
  }
1109
652
  }
1110
- /**
1111
- * Creates a default window covering cluster server with feature Lift and PositionAwareLift.
1112
- *
1113
- * @param {number} positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
1114
- * @param {WindowCovering.WindowCoveringType} type - The type of window covering (default: WindowCovering.WindowCoveringType.Rollershade). Must support feature Lift.
1115
- * @param {WindowCovering.EndProductType} endProductType - The end product type (default: WindowCovering.EndProductType.RollerShade). Must support feature Lift.
1116
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1117
- *
1118
- * @remarks mode attributes is writable and persists across restarts.
1119
- * currentPositionLiftPercent100ths persists across restarts.
1120
- * configStatus attributes persists across restarts.
1121
- */
1122
653
  createDefaultWindowCoveringClusterServer(positionPercent100ths, type = WindowCovering.WindowCoveringType.Rollershade, endProductType = WindowCovering.EndProductType.RollerShade) {
1123
654
  this.behaviors.require(MatterbridgeLiftWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
1124
- type, // Must support feature Lift
655
+ type,
1125
656
  numberOfActuationsLift: 0,
1126
657
  configStatus: {
1127
658
  operational: true,
@@ -1129,33 +660,20 @@ export class MatterbridgeEndpoint extends Endpoint {
1129
660
  liftMovementReversed: false,
1130
661
  liftPositionAware: true,
1131
662
  tiltPositionAware: false,
1132
- liftEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
1133
- tiltEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
663
+ liftEncoderControlled: false,
664
+ tiltEncoderControlled: false,
1134
665
  },
1135
666
  operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
1136
- endProductType, // Must support feature Lift
667
+ endProductType,
1137
668
  mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
1138
- targetPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
1139
- currentPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
669
+ targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
670
+ currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
1140
671
  });
1141
672
  return this;
1142
673
  }
1143
- /**
1144
- * Creates a default window covering cluster server with features Lift, PositionAwareLift, Tilt, PositionAwareTilt.
1145
- *
1146
- * @param {number} positionLiftPercent100ths - The lift position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
1147
- * @param {number} positionTiltPercent100ths - The tilt position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
1148
- * @param {WindowCovering.WindowCoveringType} type - The type of window covering (default: WindowCovering.WindowCoveringType.TiltBlindLift). Must support features Lift and Tilt.
1149
- * @param {WindowCovering.EndProductType} endProductType - The end product type (default: WindowCovering.EndProductType.InteriorBlind). Must support features Lift and Tilt.
1150
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1151
- *
1152
- * @remarks mode attributes is writable and persists across restarts.
1153
- * currentPositionTiltPercent100ths persists across restarts.
1154
- * configStatus attributes persists across restarts.
1155
- */
1156
674
  createDefaultLiftTiltWindowCoveringClusterServer(positionLiftPercent100ths, positionTiltPercent100ths, type = WindowCovering.WindowCoveringType.TiltBlindLift, endProductType = WindowCovering.EndProductType.InteriorBlind) {
1157
675
  this.behaviors.require(MatterbridgeLiftTiltWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift, WindowCovering.Feature.Tilt, WindowCovering.Feature.PositionAwareTilt), {
1158
- type, // Must support features Lift and Tilt
676
+ type,
1159
677
  numberOfActuationsLift: 0,
1160
678
  numberOfActuationsTilt: 0,
1161
679
  configStatus: {
@@ -1164,23 +682,19 @@ export class MatterbridgeEndpoint extends Endpoint {
1164
682
  liftMovementReversed: false,
1165
683
  liftPositionAware: true,
1166
684
  tiltPositionAware: true,
1167
- liftEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
1168
- tiltEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
685
+ liftEncoderControlled: false,
686
+ tiltEncoderControlled: false,
1169
687
  },
1170
688
  operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
1171
- endProductType, // Must support features Lift and Tilt
689
+ endProductType,
1172
690
  mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
1173
- targetPositionLiftPercent100ths: positionLiftPercent100ths ?? 0, // 0 Fully open 10000 fully closed
1174
- currentPositionLiftPercent100ths: positionLiftPercent100ths ?? 0, // 0 Fully open 10000 fully closed
1175
- targetPositionTiltPercent100ths: positionTiltPercent100ths ?? 0, // 0 Fully open 10000 fully closed
1176
- currentPositionTiltPercent100ths: positionTiltPercent100ths ?? 0, // 0 Fully open 10000 fully closed
691
+ targetPositionLiftPercent100ths: positionLiftPercent100ths ?? 0,
692
+ currentPositionLiftPercent100ths: positionLiftPercent100ths ?? 0,
693
+ targetPositionTiltPercent100ths: positionTiltPercent100ths ?? 0,
694
+ currentPositionTiltPercent100ths: positionTiltPercent100ths ?? 0,
1177
695
  });
1178
696
  return this;
1179
697
  }
1180
- /**
1181
- * Sets the window covering lift target position as the current position and stops the movement.
1182
- *
1183
- */
1184
698
  async setWindowCoveringTargetAsCurrentAndStopped() {
1185
699
  const position = this.getAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', this.log);
1186
700
  if (isValidNumber(position, 0, 10000)) {
@@ -1200,12 +714,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1200
714
  this.log.debug(`Set WindowCovering currentPositionTiltPercent100ths and targetPositionTiltPercent100ths to ${position} and operationalStatus to Stopped.`);
1201
715
  }
1202
716
  }
1203
- /**
1204
- * Sets the lift current and target position and the status of a window covering.
1205
- * @param {number} current - The current position of the window covering.
1206
- * @param {number} target - The target position of the window covering.
1207
- * @param {WindowCovering.MovementStatus} status - The movement status of the window covering.
1208
- */
1209
717
  async setWindowCoveringCurrentTargetStatus(current, target, status) {
1210
718
  await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', current, this.log);
1211
719
  await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', target, this.log);
@@ -1216,10 +724,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1216
724
  }, this.log);
1217
725
  this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
1218
726
  }
1219
- /**
1220
- * Sets the status of the window covering.
1221
- * @param {WindowCovering.MovementStatus} status - The movement status to set.
1222
- */
1223
727
  async setWindowCoveringStatus(status) {
1224
728
  await this.setAttribute(WindowCovering.Cluster.id, 'operationalStatus', {
1225
729
  global: status,
@@ -1228,11 +732,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1228
732
  }, this.log);
1229
733
  this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
1230
734
  }
1231
- /**
1232
- * Retrieves the status of the window covering.
1233
- *
1234
- * @returns The global operational status of the window covering or undefined.
1235
- */
1236
735
  getWindowCoveringStatus() {
1237
736
  const status = this.getAttribute(WindowCovering.Cluster.id, 'operationalStatus', this.log);
1238
737
  if (isValidObject(status, 3) && 'global' in status && typeof status.global === 'number') {
@@ -1240,12 +739,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1240
739
  return status.global;
1241
740
  }
1242
741
  }
1243
- /**
1244
- * Sets the lift target and current position of the window covering.
1245
- *
1246
- * @param {number} liftPosition - The position to set, specified as a number.
1247
- * @param {number} [tiltPosition] - The tilt position to set, specified as a number.
1248
- */
1249
742
  async setWindowCoveringTargetAndCurrentPosition(liftPosition, tiltPosition) {
1250
743
  await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', liftPosition, this.log);
1251
744
  await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', liftPosition, this.log);
@@ -1256,56 +749,31 @@ export class MatterbridgeEndpoint extends Endpoint {
1256
749
  this.log.debug(`Set WindowCovering currentPositionTiltPercent100ths: ${tiltPosition} and targetPositionTiltPercent100ths: ${tiltPosition}.`);
1257
750
  }
1258
751
  }
1259
- /**
1260
- * Creates a default thermostat cluster server with features Heating, Cooling and AutoMode.
1261
- *
1262
- * @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
1263
- * @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
1264
- * @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
1265
- * @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
1266
- * @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
1267
- * @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
1268
- * @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
1269
- * @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
1270
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1271
- */
1272
752
  createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
1273
753
  this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
1274
754
  localTemperature: localTemperature * 100,
1275
755
  systemMode: Thermostat.SystemMode.Auto,
1276
756
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
1277
- // Thermostat.Feature.Heating
1278
757
  occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
1279
758
  minHeatSetpointLimit: minHeatSetpointLimit * 100,
1280
759
  maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
1281
760
  absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
1282
761
  absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
1283
- // Thermostat.Feature.Cooling
1284
762
  occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
1285
763
  minCoolSetpointLimit: minCoolSetpointLimit * 100,
1286
764
  maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
1287
765
  absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
1288
766
  absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
1289
- // Thermostat.Feature.AutoMode
1290
767
  minSetpointDeadBand: minSetpointDeadBand * 100,
1291
768
  thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
1292
769
  });
1293
770
  return this;
1294
771
  }
1295
- /**
1296
- * Creates a default heating thermostat cluster server with feature Heating.
1297
- * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
1298
- * @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
1299
- * @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
1300
- * @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
1301
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1302
- */
1303
772
  createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
1304
773
  this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating), {
1305
774
  localTemperature: localTemperature * 100,
1306
775
  systemMode: Thermostat.SystemMode.Heat,
1307
776
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
1308
- // Thermostat.Feature.Heating
1309
777
  occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
1310
778
  minHeatSetpointLimit: minHeatSetpointLimit * 100,
1311
779
  maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
@@ -1314,20 +782,11 @@ export class MatterbridgeEndpoint extends Endpoint {
1314
782
  });
1315
783
  return this;
1316
784
  }
1317
- /**
1318
- * Creates a default cooling thermostat cluster server with feature Cooling.
1319
- * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
1320
- * @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
1321
- * @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
1322
- * @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
1323
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1324
- */
1325
785
  createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
1326
786
  this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Cooling), {
1327
787
  localTemperature: localTemperature * 100,
1328
788
  systemMode: Thermostat.SystemMode.Cool,
1329
789
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
1330
- // Thermostat.Feature.Cooling
1331
790
  occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
1332
791
  minCoolSetpointLimit: minCoolSetpointLimit * 100,
1333
792
  maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
@@ -1336,15 +795,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1336
795
  });
1337
796
  return this;
1338
797
  }
1339
- /**
1340
- * Creates a default thermostat user interface configuration cluster server.
1341
- *
1342
- * @remarks
1343
- * The default values are:
1344
- * - temperatureDisplayMode: ThermostatUserInterfaceConfiguration.TemperatureDisplayMode.Celsius (writeble).
1345
- * - keypadLockout: ThermostatUserInterfaceConfiguration.KeypadLockout.NoLockout (writeble).
1346
- * - scheduleProgrammingVisibility: ThermostatUserInterfaceConfiguration.ScheduleProgrammingVisibility.ScheduleProgrammingPermitted (writeble).
1347
- */
1348
798
  createDefaultThermostatUserInterfaceConfigurationClusterServer() {
1349
799
  this.behaviors.require(ThermostatUserInterfaceConfigurationServer, {
1350
800
  temperatureDisplayMode: ThermostatUserInterfaceConfiguration.TemperatureDisplayMode.Celsius,
@@ -1353,17 +803,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1353
803
  });
1354
804
  return this;
1355
805
  }
1356
- /**
1357
- * Creates a default fan control cluster server with features MultiSpeed, Auto, and Step.
1358
- *
1359
- * @param {FanControl.FanMode} [fanMode=FanControl.FanMode.Off] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
1360
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1361
- *
1362
- * @remarks
1363
- * fanmode is writable and persists across reboots.
1364
- * percentSetting is writable.
1365
- * speedSetting is writable.
1366
- */
1367
806
  createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
1368
807
  this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
1369
808
  fanMode,
@@ -1376,16 +815,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1376
815
  });
1377
816
  return this;
1378
817
  }
1379
- /**
1380
- * Creates a base fan control cluster server without features.
1381
- *
1382
- * @param {FanControl.FanMode} [fanMode=FanControl.FanMode.Off] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
1383
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1384
- *
1385
- * @remarks
1386
- * fanmode is writable and persists across reboots.
1387
- * percentSetting is writable.
1388
- */
1389
818
  createBaseFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
1390
819
  this.behaviors.require(FanControlServer, {
1391
820
  fanMode,
@@ -1395,81 +824,39 @@ export class MatterbridgeEndpoint extends Endpoint {
1395
824
  });
1396
825
  return this;
1397
826
  }
1398
- /**
1399
- * Creates a default HEPA Filter Monitoring Cluster Server with features Condition and ReplacementProductList.
1400
- * It supports ResourceMonitoring.Feature.Condition and ResourceMonitoring.Feature.ReplacementProductList.
1401
- *
1402
- * @param {ResourceMonitoring.ChangeIndication} changeIndication - The initial change indication. Default is ResourceMonitoring.ChangeIndication.Ok.
1403
- * @param {boolean | undefined} inPlaceIndicator - The in-place indicator. Default is undefined.
1404
- * @param {number | undefined} lastChangedTime - The last changed time (EpochS). Default is undefined.
1405
- *
1406
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1407
- */
1408
827
  createDefaultHepaFilterMonitoringClusterServer(changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = undefined, lastChangedTime = undefined) {
1409
828
  this.behaviors.require(HepaFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.ReplacementProductList), {
1410
- condition: 100, // Feature.Condition
1411
- degradationDirection: ResourceMonitoring.DegradationDirection.Down, // Feature.Condition
829
+ condition: 100,
830
+ degradationDirection: ResourceMonitoring.DegradationDirection.Down,
1412
831
  changeIndication,
1413
832
  inPlaceIndicator,
1414
833
  lastChangedTime,
1415
- replacementProductList: [], // Feature.ReplacementProductList
834
+ replacementProductList: [],
1416
835
  });
1417
836
  return this;
1418
837
  }
1419
- /**
1420
- * Creates a default Activated Carbon Filter Monitoring Cluster Server with features Condition and ReplacementProductList.
1421
- *
1422
- * @param {ResourceMonitoring.ChangeIndication} changeIndication - The initial change indication. Default is ResourceMonitoring.ChangeIndication.Ok.
1423
- * @param {boolean | undefined} inPlaceIndicator - The in-place indicator. Default is undefined.
1424
- * @param {number | undefined} lastChangedTime - The last changed time (EpochS). Default is undefined.
1425
- *
1426
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1427
- */
1428
838
  createDefaultActivatedCarbonFilterMonitoringClusterServer(changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = undefined, lastChangedTime = undefined) {
1429
839
  this.behaviors.require(ActivatedCarbonFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.ReplacementProductList), {
1430
- condition: 100, // Feature.Condition
1431
- degradationDirection: ResourceMonitoring.DegradationDirection.Down, // Feature.Condition
840
+ condition: 100,
841
+ degradationDirection: ResourceMonitoring.DegradationDirection.Down,
1432
842
  changeIndication,
1433
843
  inPlaceIndicator,
1434
844
  lastChangedTime,
1435
- replacementProductList: [], // Feature.ReplacementProductList
845
+ replacementProductList: [],
1436
846
  });
1437
847
  return this;
1438
848
  }
1439
- /**
1440
- * Creates a default door lock cluster server.
1441
- *
1442
- * @param {DoorLock.LockState} [lockState=DoorLock.LockState.Locked] - The initial state of the lock (default: Locked).
1443
- * @param {DoorLock.LockType} [lockType=DoorLock.LockType.DeadBolt] - The type of the lock (default: DeadBolt).
1444
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1445
- *
1446
- * @remarks
1447
- * All operating modes NOT supported by a lock SHALL be set to one. The value of the OperatingMode enumeration defines the related bit to be set.
1448
- */
1449
849
  createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
1450
850
  this.behaviors.require(MatterbridgeDoorLockServer.enable({ events: { doorLockAlarm: true, lockOperation: true, lockOperationError: true } }), {
1451
851
  lockState,
1452
852
  lockType,
1453
853
  actuatorEnabled: false,
1454
854
  operatingMode: DoorLock.OperatingMode.Normal,
1455
- // Special case of inverted bitmap: add also alwaysSet = 2047
1456
855
  supportedOperatingModes: { normal: false, vacation: true, privacy: true, noRemoteLockUnlock: true, passage: true, alwaysSet: 2047 },
1457
856
  alarmMask: { lockJammed: false, lockFactoryReset: false, lockRadioPowerCycled: false, wrongCodeEntryLimit: false, frontEscutcheonRemoved: false, doorForcedOpen: false },
1458
857
  });
1459
858
  return this;
1460
859
  }
1461
- /**
1462
- * Creates a default Mode Select cluster server.
1463
- *
1464
- * @param {string} description - The description of the mode select cluster.
1465
- * @param {ModeSelect.ModeOption[]} supportedModes - The list of supported modes.
1466
- * @param {number} [currentMode=0] - The current mode (default: 0).
1467
- * @param {number} [startUpMode=0] - The startup mode (default: 0).
1468
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1469
- *
1470
- * @remarks
1471
- * endpoint.createDefaultModeSelectClusterServer('Night mode', [{ label: 'Led ON', mode: 0, semanticTags: [] }, { label: 'Led OFF', mode: 1, semanticTags: [] }], 0, 0);
1472
- */
1473
860
  createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
1474
861
  this.behaviors.require(MatterbridgeModeSelectServer, {
1475
862
  description: description,
@@ -1480,13 +867,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1480
867
  });
1481
868
  return this;
1482
869
  }
1483
- /**
1484
- * Creates the default Valve Configuration And Control cluster server with features Level.
1485
- *
1486
- * @param {ValveConfigurationAndControl.ValveState} [valveState=ValveConfigurationAndControl.ValveState.Closed] - The valve state to set. Defaults to `ValveConfigurationAndControl.ValveState.Closed`.
1487
- * @param {number} [valveLevel=0] - The valve level to set. Defaults to 0.
1488
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1489
- */
1490
870
  createDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
1491
871
  this.behaviors.require(MatterbridgeValveConfigurationAndControlServer.with(ValveConfigurationAndControl.Feature.Level), {
1492
872
  currentState: valveState,
@@ -1502,12 +882,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1502
882
  });
1503
883
  return this;
1504
884
  }
1505
- /**
1506
- * Creates the default PumpConfigurationAndControl cluster server with features ConstantSpeed.
1507
- *
1508
- * @param {PumpConfigurationAndControl.OperationMode} [pumpMode=PumpConfigurationAndControl.OperationMode.Normal] - The pump mode to set. Defaults to `PumpConfigurationAndControl.OperationMode.Normal`.
1509
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1510
- */
1511
885
  createDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
1512
886
  this.behaviors.require(PumpConfigurationAndControlServer.with(PumpConfigurationAndControl.Feature.ConstantSpeed), {
1513
887
  minConstSpeed: null,
@@ -1522,13 +896,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1522
896
  });
1523
897
  return this;
1524
898
  }
1525
- /**
1526
- * Creates the default SmokeCOAlarm Cluster Server with features SmokeAlarm and CoAlarm.
1527
- *
1528
- * @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
1529
- * @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
1530
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1531
- */
1532
899
  createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
1533
900
  this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm).enable({
1534
901
  events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
@@ -1544,12 +911,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1544
911
  });
1545
912
  return this;
1546
913
  }
1547
- /**
1548
- * Creates a smoke only SmokeCOAlarm Cluster Server with features SmokeAlarm.
1549
- *
1550
- * @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
1551
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1552
- */
1553
914
  createSmokeOnlySmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal) {
1554
915
  this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm).enable({
1555
916
  events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: false, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
@@ -1564,12 +925,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1564
925
  });
1565
926
  return this;
1566
927
  }
1567
- /**
1568
- * Creates a co only SmokeCOAlarm Cluster Server with features CoAlarm.
1569
- *
1570
- * @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
1571
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1572
- */
1573
928
  createCoOnlySmokeCOAlarmClusterServer(coState = SmokeCoAlarm.AlarmState.Normal) {
1574
929
  this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.CoAlarm).enable({
1575
930
  events: { smokeAlarm: false, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
@@ -1584,13 +939,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1584
939
  });
1585
940
  return this;
1586
941
  }
1587
- /**
1588
- * Creates a default momentary switch cluster server with features MomentarySwitch, MomentarySwitchRelease, MomentarySwitchLongPress and MomentarySwitchMultiPress.
1589
- *
1590
- * @remarks
1591
- * This method adds a cluster server with default momentary switch features and configuration suitable for (AppleHome) Single Double Long automations.
1592
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1593
- */
1594
942
  createDefaultSwitchClusterServer() {
1595
943
  this.behaviors.require(MatterbridgeSwitchServer.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress).enable({
1596
944
  events: { initialPress: true, longPress: true, shortRelease: true, longRelease: true, multiPressOngoing: true, multiPressComplete: true },
@@ -1601,13 +949,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1601
949
  });
1602
950
  return this;
1603
951
  }
1604
- /**
1605
- * Creates a default latching switch cluster server with features LatchingSwitch.
1606
- *
1607
- * @remarks
1608
- * This method adds a cluster server with default latching switch features and configuration suitable for a latching switch with 2 positions.
1609
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1610
- */
1611
952
  createDefaultLatchingSwitchClusterServer() {
1612
953
  this.behaviors.require(SwitchServer.with(Switch.Feature.LatchingSwitch).enable({
1613
954
  events: { switchLatched: true },
@@ -1617,13 +958,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1617
958
  });
1618
959
  return this;
1619
960
  }
1620
- /**
1621
- * Triggers a switch event on the specified endpoint.
1622
- *
1623
- * @param {string} event - The type of event to trigger. Possible values are 'Single', 'Double', 'Long' for momentarySwitch and 'Press', 'Release' for latchingSwitch.
1624
- * @param {Endpoint} endpoint - The endpoint on which to trigger the event (default the device endpoint).
1625
- * @returns {boolean} - A boolean indicating whether the event was successfully triggered.
1626
- */
1627
961
  async triggerSwitchEvent(event, log) {
1628
962
  if (this.maybeNumber === undefined) {
1629
963
  this.log.error(`triggerSwitchEvent ${event} error: Endpoint number not assigned on endpoint ${this.maybeId}:${this.maybeNumber}`);
@@ -1683,30 +1017,10 @@ export class MatterbridgeEndpoint extends Endpoint {
1683
1017
  }
1684
1018
  return true;
1685
1019
  }
1686
- /**
1687
- * Creates a default OperationalState Cluster Server.
1688
- *
1689
- * @param {OperationalState.OperationalStateEnum} operationalState - The initial operational state.
1690
- *
1691
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1692
- */
1693
1020
  createDefaultOperationalStateClusterServer(operationalState = OperationalState.OperationalStateEnum.Stopped) {
1694
1021
  this.behaviors.require(MatterbridgeOperationalStateServer, getDefaultOperationalStateClusterServer(operationalState));
1695
1022
  return this;
1696
1023
  }
1697
- /**
1698
- * Creates a default boolean state cluster server.
1699
- * The stateChange event is enabled.
1700
- *
1701
- * @param {boolean} contact - The state of the cluster. Defaults to true (true = contact).
1702
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1703
- *
1704
- * @remarks
1705
- * Water Leak Detector: true = leak, false = no leak
1706
- * Water Freeze Detector: true = freeze, false = no freeze
1707
- * Rain Sensor: true = rain, false = no rain
1708
- * Contact Sensor: true = closed or contact, false = open or no contact
1709
- */
1710
1024
  createDefaultBooleanStateClusterServer(contact) {
1711
1025
  this.behaviors.require(BooleanStateServer.enable({
1712
1026
  events: { stateChange: true },
@@ -1715,23 +1029,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1715
1029
  });
1716
1030
  return this;
1717
1031
  }
1718
- /**
1719
- * Creates a default boolean state configuration cluster server to be used with the waterFreezeDetector, waterLeakDetector, and rainSensor device types.
1720
- *
1721
- * Features:
1722
- * - Visual
1723
- * - Audible
1724
- * - SensitivityLevel
1725
- *
1726
- * @remarks Supports the enableDisableAlarm command.
1727
- *
1728
- * @param {boolean} [sensorFault=false] - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
1729
- * @param {number} [currentSensitivityLevel=0] - The current sensitivity level. Defaults to `0` if not provided.
1730
- * @param {number} [supportedSensitivityLevels=2] - The number of supported sensitivity levels. Defaults to `2` if not provided (min 2, max 10).
1731
- * @param {number} [defaultSensitivityLevel=0] - The default sensitivity level. Defaults to `0` if not provided.
1732
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1733
- *
1734
- */
1735
1032
  createDefaultBooleanStateConfigurationClusterServer(sensorFault = false, currentSensitivityLevel = 0, supportedSensitivityLevels = 2, defaultSensitivityLevel = 0) {
1736
1033
  this.behaviors.require(MatterbridgeBooleanStateConfigurationServer.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel).enable({
1737
1034
  events: { alarmsStateChanged: true, sensorFault: true },
@@ -1746,37 +1043,17 @@ export class MatterbridgeEndpoint extends Endpoint {
1746
1043
  });
1747
1044
  return this;
1748
1045
  }
1749
- /**
1750
- * Creates a default Device Energy Management Cluster Server with feature PowerForecastReporting. Only needed for an evse device type.
1751
- *
1752
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1753
- */
1754
- createDefaultDeviceEnergyManagementCluster() {
1046
+ createDefaultDeviceEnergyManagementCluster(esaType = DeviceEnergyManagement.EsaType.Other, esaCanGenerate = false, esaState = DeviceEnergyManagement.EsaState.Online, absMinPower = 0, absMaxPower = 0) {
1755
1047
  this.behaviors.require(DeviceEnergyManagementServer.with(DeviceEnergyManagement.Feature.PowerForecastReporting), {
1756
- forecast: null, // A null value indicates that there is no forecast currently available
1757
- esaType: DeviceEnergyManagement.EsaType.Other,
1758
- esaCanGenerate: false,
1759
- esaState: DeviceEnergyManagement.EsaState.Offline,
1760
- absMinPower: 0,
1761
- absMaxPower: 0,
1048
+ forecast: null,
1049
+ esaType,
1050
+ esaCanGenerate,
1051
+ esaState,
1052
+ absMinPower,
1053
+ absMaxPower,
1762
1054
  });
1763
1055
  return this;
1764
1056
  }
1765
- /**
1766
- * Creates a default EnergyManagementMode Cluster Server.
1767
- *
1768
- * A few examples of Device Energy Management modes and their mode tags are provided below.
1769
- * - For the "No Energy Management (Forecast reporting only)" mode, tags: 0x4000 (NoOptimization).
1770
- * - For the "Device Energy Management" mode, tags: 0x4001 (DeviceOptimization).
1771
- * - For the "Home Energy Management" mode, tags: 0x4001 (DeviceOptimization), 0x4002 (LocalOptimization).
1772
- * - For the "Grid Energy Management" mode, tags: 0x4003 (GridOptimization).
1773
- * - For the "Full Energy Management" mode, tags: 0x4001 (DeviceOptimization), 0x4002 (LocalOptimization), 0x4003 (GridOptimization).
1774
- *
1775
- * @param {number} [currentMode] - The current mode of the EnergyManagementMode cluster. Defaults to mode 1 (DeviceEnergyManagementMode.ModeTag.NoOptimization).
1776
- * @param {EnergyManagementMode.ModeOption[]} [supportedModes] - The supported modes for the DeviceEnergyManagementMode cluster. Defaults all cluster modes.
1777
- *
1778
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1779
- */
1780
1057
  createDefaultDeviceEnergyManagementModeCluster(currentMode, supportedModes) {
1781
1058
  this.behaviors.require(MatterbridgeDeviceEnergyManagementModeServer, {
1782
1059
  supportedModes: supportedModes ?? [
@@ -1802,21 +1079,10 @@ export class MatterbridgeEndpoint extends Endpoint {
1802
1079
  });
1803
1080
  return this;
1804
1081
  }
1805
- /**
1806
- * Creates a default Power Topology Cluster Server with feature TreeTopology. Only needed for an electricalSensor device type.
1807
- *
1808
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1809
- */
1810
1082
  createDefaultPowerTopologyClusterServer() {
1811
1083
  this.behaviors.require(PowerTopologyServer.with(PowerTopology.Feature.TreeTopology));
1812
1084
  return this;
1813
1085
  }
1814
- /**
1815
- * Creates a default Electrical Energy Measurement Cluster Server with features ImportedEnergy, ExportedEnergy, and CumulativeEnergy.
1816
- *
1817
- * @param {number} energy - The total consumption value in mW/h.
1818
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1819
- */
1820
1086
  createDefaultElectricalEnergyMeasurementClusterServer(energy = null) {
1821
1087
  this.behaviors.require(ElectricalEnergyMeasurementServer.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
1822
1088
  accuracy: {
@@ -1832,15 +1098,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1832
1098
  });
1833
1099
  return this;
1834
1100
  }
1835
- /**
1836
- * Creates a default Electrical Power Measurement Cluster Server with features AlternatingCurrent.
1837
- *
1838
- * @param {number} voltage - The voltage value in millivolts.
1839
- * @param {number} current - The current value in milliamperes.
1840
- * @param {number} power - The power value in milliwatts.
1841
- * @param {number} frequency - The frequency value in millihertz.
1842
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1843
- */
1844
1101
  createDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
1845
1102
  this.behaviors.require(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
1846
1103
  powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
@@ -1882,113 +1139,36 @@ export class MatterbridgeEndpoint extends Endpoint {
1882
1139
  });
1883
1140
  return this;
1884
1141
  }
1885
- /**
1886
- * Creates a default TemperatureMeasurement cluster server.
1887
- *
1888
- * @param {number | null} measuredValue - The measured value of the temperature x 100.
1889
- * @param {number | null} minMeasuredValue - The minimum measured value of the temperature x 100.
1890
- * @param {number | null} maxMeasuredValue - The maximum measured value of the temperature x 100.
1891
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1892
- */
1893
1142
  createDefaultTemperatureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
1894
1143
  this.behaviors.require(TemperatureMeasurementServer, getDefaultTemperatureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
1895
1144
  return this;
1896
1145
  }
1897
- /**
1898
- * Creates a default RelativeHumidityMeasurement cluster server.
1899
- *
1900
- * @param {number | null} measuredValue - The measured value of the relative humidity x 100.
1901
- * @param {number | null} minMeasuredValue - The minimum measured value of the relative humidity x 100.
1902
- * @param {number | null} maxMeasuredValue - The maximum measured value of the relative humidity x 100.
1903
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1904
- */
1905
1146
  createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
1906
1147
  this.behaviors.require(RelativeHumidityMeasurementServer, getDefaultRelativeHumidityMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
1907
1148
  return this;
1908
1149
  }
1909
- /**
1910
- * Creates a default PressureMeasurement cluster server.
1911
- *
1912
- * @param {number | null} measuredValue - The measured value for the pressure.
1913
- * @param {number | null} minMeasuredValue - The minimum measured value for the pressure.
1914
- * @param {number | null} maxMeasuredValue - The maximum measured value for the pressure.
1915
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1916
- */
1917
1150
  createDefaultPressureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
1918
1151
  this.behaviors.require(PressureMeasurementServer, getDefaultPressureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
1919
1152
  return this;
1920
1153
  }
1921
- /**
1922
- * Creates a default IlluminanceMeasurement cluster server.
1923
- *
1924
- * @param {number | null} measuredValue - The measured value of illuminance.
1925
- * @param {number | null} minMeasuredValue - The minimum measured value of illuminance.
1926
- * @param {number | null} maxMeasuredValue - The maximum measured value of illuminance.
1927
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1928
- *
1929
- * @remark The default value for the illuminance measurement is null.
1930
- * This attribute SHALL indicate the illuminance in Lux (symbol lx) as follows:
1931
- * • MeasuredValue = 10,000 x log10(illuminance) + 1,
1932
- * where 1 lx <= illuminance <= 3.576 Mlx, corresponding to a MeasuredValue in the range 1 to 0xFFFE.
1933
- * • 0 indicates a value of illuminance that is too low to be measured
1934
- * • null indicates that the illuminance measurement is invalid.
1935
- *
1936
- * @remarks
1937
- * Lux to matter = Math.round(Math.max(Math.min(10000 * Math.log10(lux), 0xfffe), 0))
1938
- * Matter to Lux = Math.round(Math.max(Math.pow(10, value / 10000), 0))
1939
- */
1940
1154
  createDefaultIlluminanceMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
1941
1155
  this.behaviors.require(IlluminanceMeasurementServer, getDefaultIlluminanceMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
1942
1156
  return this;
1943
1157
  }
1944
- /**
1945
- * Creates a default FlowMeasurement cluster server.
1946
- *
1947
- * @param {number | null} measuredValue - The measured value of the flow in 10 x m3/h.
1948
- * @param {number | null} minMeasuredValue - The minimum measured value of the flow in 10 x m3/h.
1949
- * @param {number | null} maxMeasuredValue - The maximum measured value of the flow in 10 x m3/h.
1950
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1951
- */
1952
1158
  createDefaultFlowMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
1953
1159
  this.behaviors.require(FlowMeasurementServer, getDefaultFlowMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
1954
1160
  return this;
1955
1161
  }
1956
- /**
1957
- * Creates a default OccupancySensing cluster server with feature PassiveInfrared.
1958
- *
1959
- * @param {boolean} occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
1960
- * @param {number} holdTime - The hold time in seconds. Default is 30.
1961
- * @param {number} holdTimeMin - The minimum hold time in seconds. Default is 1.
1962
- * @param {number} holdTimeMax - The maximum hold time in seconds. Default is 300.
1963
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1964
- *
1965
- * @remark The default value for the occupancy sensor type is PIR.
1966
- */
1967
1162
  createDefaultOccupancySensingClusterServer(occupied = false, holdTime = 30, holdTimeMin = 1, holdTimeMax = 300) {
1968
1163
  this.behaviors.require(OccupancySensingServer.with(OccupancySensing.Feature.PassiveInfrared), getDefaultOccupancySensingClusterServer(occupied, holdTime, holdTimeMin, holdTimeMax));
1969
1164
  return this;
1970
1165
  }
1971
- /**
1972
- * Creates a default AirQuality cluster server.
1973
- *
1974
- * @param {AirQuality.AirQualityEnum} airQuality The air quality level. Defaults to `AirQuality.AirQualityType.Unknown`.
1975
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1976
- */
1977
1166
  createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
1978
1167
  this.behaviors.require(AirQualityServer.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
1979
1168
  airQuality,
1980
1169
  });
1981
1170
  return this;
1982
1171
  }
1983
- /**
1984
- * Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server with feature NumericMeasurement.
1985
- *
1986
- * @param {number | null} measuredValue - The measured value of the concentration.
1987
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
1988
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
1989
- * @param {number} [uncertainty] - The uncertainty value (optional).
1990
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1991
- */
1992
1172
  createDefaultTvocMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air, uncertainty) {
1993
1173
  this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1994
1174
  measuredValue,
@@ -2000,13 +1180,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2000
1180
  });
2001
1181
  return this;
2002
1182
  }
2003
- /**
2004
- * Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server with feature LevelIndication.
2005
-
2006
- * @param {ConcentrationMeasurement.LevelValue} levelValue - The level value of the measurement (default to ConcentrationMeasurement.LevelValue.Unknown).
2007
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The measurement medium (default to ConcentrationMeasurement.MeasurementMedium.Air).
2008
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2009
- */
2010
1183
  createLevelTvocMeasurementClusterServer(levelValue = ConcentrationMeasurement.LevelValue.Unknown, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2011
1184
  this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.LevelIndication, ConcentrationMeasurement.Feature.MediumLevel, ConcentrationMeasurement.Feature.CriticalLevel), {
2012
1185
  levelValue,
@@ -2014,14 +1187,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2014
1187
  });
2015
1188
  return this;
2016
1189
  }
2017
- /**
2018
- * Create a default CarbonMonoxideConcentrationMeasurement cluster server with feature NumericMeasurement.
2019
- *
2020
- * @param {number | null} measuredValue - The measured value of the concentration.
2021
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2022
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2023
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2024
- */
2025
1190
  createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2026
1191
  this.behaviors.require(CarbonMonoxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
2027
1192
  measuredValue,
@@ -2033,14 +1198,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2033
1198
  });
2034
1199
  return this;
2035
1200
  }
2036
- /**
2037
- * Create a default CarbonDioxideConcentrationMeasurement cluster server with feature NumericMeasurement.
2038
- *
2039
- * @param {number | null} measuredValue - The measured value of the concentration.
2040
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2041
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2042
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2043
- */
2044
1201
  createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2045
1202
  this.behaviors.require(CarbonDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
2046
1203
  measuredValue,
@@ -2052,14 +1209,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2052
1209
  });
2053
1210
  return this;
2054
1211
  }
2055
- /**
2056
- * Create a default FormaldehydeConcentrationMeasurement cluster server with feature NumericMeasurement.
2057
- *
2058
- * @param {number | null} measuredValue - The measured value of the concentration.
2059
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2060
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2061
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2062
- */
2063
1212
  createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2064
1213
  this.behaviors.require(FormaldehydeConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
2065
1214
  measuredValue,
@@ -2071,14 +1220,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2071
1220
  });
2072
1221
  return this;
2073
1222
  }
2074
- /**
2075
- * Create a default Pm1ConcentrationMeasurement cluster server with feature NumericMeasurement.
2076
- *
2077
- * @param {number | null} measuredValue - The measured value of the concentration.
2078
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2079
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2080
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2081
- */
2082
1223
  createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2083
1224
  this.behaviors.require(Pm1ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
2084
1225
  measuredValue,
@@ -2090,14 +1231,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2090
1231
  });
2091
1232
  return this;
2092
1233
  }
2093
- /**
2094
- * Create a default Pm25ConcentrationMeasurement cluster server with feature NumericMeasurement.
2095
- *
2096
- * @param {number | null} measuredValue - The measured value of the concentration.
2097
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2098
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2099
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2100
- */
2101
1234
  createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2102
1235
  this.behaviors.require(Pm25ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
2103
1236
  measuredValue,
@@ -2109,14 +1242,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2109
1242
  });
2110
1243
  return this;
2111
1244
  }
2112
- /**
2113
- * Create a default Pm10ConcentrationMeasurement cluster server with feature NumericMeasurement.
2114
- *
2115
- * @param {number | null} measuredValue - The measured value of the concentration.
2116
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2117
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2118
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2119
- */
2120
1245
  createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2121
1246
  this.behaviors.require(Pm10ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
2122
1247
  measuredValue,
@@ -2128,14 +1253,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2128
1253
  });
2129
1254
  return this;
2130
1255
  }
2131
- /**
2132
- * Create a default OzoneConcentrationMeasurement cluster server with feature NumericMeasurement.
2133
- *
2134
- * @param {number | null} measuredValue - The measured value of the concentration.
2135
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
2136
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2137
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2138
- */
2139
1256
  createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2140
1257
  this.behaviors.require(OzoneConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
2141
1258
  measuredValue,
@@ -2147,14 +1264,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2147
1264
  });
2148
1265
  return this;
2149
1266
  }
2150
- /**
2151
- * Create a default RadonConcentrationMeasurement cluster server with feature NumericMeasurement.
2152
- *
2153
- * @param {number | null} measuredValue - The measured value of the concentration.
2154
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2155
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2156
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2157
- */
2158
1267
  createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2159
1268
  this.behaviors.require(RadonConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
2160
1269
  measuredValue,
@@ -2166,14 +1275,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2166
1275
  });
2167
1276
  return this;
2168
1277
  }
2169
- /**
2170
- * Create a default NitrogenDioxideConcentrationMeasurement cluster server with feature NumericMeasurement.
2171
- *
2172
- * @param {number | null} measuredValue - The measured value of the concentration.
2173
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
2174
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2175
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2176
- */
2177
1278
  createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2178
1279
  this.behaviors.require(NitrogenDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
2179
1280
  measuredValue,
@@ -2186,4 +1287,3 @@ export class MatterbridgeEndpoint extends Endpoint {
2186
1287
  return this;
2187
1288
  }
2188
1289
  }
2189
- //# sourceMappingURL=matterbridgeEndpoint.js.map