matterbridge 3.1.0-dev-20250627-2b5adba → 3.1.0

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 (187) hide show
  1. package/CHANGELOG.md +4 -8
  2. package/dist/cli.d.ts +29 -0
  3. package/dist/cli.d.ts.map +1 -0
  4. package/dist/cli.js +91 -2
  5. package/dist/cli.js.map +1 -0
  6. package/dist/clusters/export.d.ts +2 -0
  7. package/dist/clusters/export.d.ts.map +1 -0
  8. package/dist/clusters/export.js +2 -0
  9. package/dist/clusters/export.js.map +1 -0
  10. package/dist/defaultConfigSchema.d.ts +28 -0
  11. package/dist/defaultConfigSchema.d.ts.map +1 -0
  12. package/dist/defaultConfigSchema.js +24 -0
  13. package/dist/defaultConfigSchema.js.map +1 -0
  14. package/dist/deviceManager.d.ts +112 -0
  15. package/dist/deviceManager.d.ts.map +1 -0
  16. package/dist/deviceManager.js +94 -1
  17. package/dist/deviceManager.js.map +1 -0
  18. package/dist/devices/export.d.ts +5 -0
  19. package/dist/devices/export.d.ts.map +1 -0
  20. package/dist/devices/export.js +2 -0
  21. package/dist/devices/export.js.map +1 -0
  22. package/dist/evse.d.ts +72 -0
  23. package/dist/evse.d.ts.map +1 -0
  24. package/dist/evse.js +70 -9
  25. package/dist/evse.js.map +1 -0
  26. package/dist/frontend.d.ts +285 -0
  27. package/dist/frontend.d.ts.map +1 -0
  28. package/dist/frontend.js +413 -16
  29. package/dist/frontend.js.map +1 -0
  30. package/dist/globalMatterbridge.d.ts +59 -0
  31. package/dist/globalMatterbridge.d.ts.map +1 -0
  32. package/dist/globalMatterbridge.js +47 -0
  33. package/dist/globalMatterbridge.js.map +1 -0
  34. package/dist/helpers.d.ts +48 -0
  35. package/dist/helpers.d.ts.map +1 -0
  36. package/dist/helpers.js +53 -0
  37. package/dist/helpers.js.map +1 -0
  38. package/dist/index.d.ts +38 -0
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.js +32 -1
  41. package/dist/index.js.map +1 -0
  42. package/dist/laundryWasher.d.ts +243 -0
  43. package/dist/laundryWasher.d.ts.map +1 -0
  44. package/dist/laundryWasher.js +92 -7
  45. package/dist/laundryWasher.js.map +1 -0
  46. package/dist/logger/export.d.ts +2 -0
  47. package/dist/logger/export.d.ts.map +1 -0
  48. package/dist/logger/export.js +1 -0
  49. package/dist/logger/export.js.map +1 -0
  50. package/dist/matter/behaviors.d.ts +2 -0
  51. package/dist/matter/behaviors.d.ts.map +1 -0
  52. package/dist/matter/behaviors.js +2 -0
  53. package/dist/matter/behaviors.js.map +1 -0
  54. package/dist/matter/clusters.d.ts +2 -0
  55. package/dist/matter/clusters.d.ts.map +1 -0
  56. package/dist/matter/clusters.js +2 -0
  57. package/dist/matter/clusters.js.map +1 -0
  58. package/dist/matter/devices.d.ts +2 -0
  59. package/dist/matter/devices.d.ts.map +1 -0
  60. package/dist/matter/devices.js +2 -0
  61. package/dist/matter/devices.js.map +1 -0
  62. package/dist/matter/endpoints.d.ts +2 -0
  63. package/dist/matter/endpoints.d.ts.map +1 -0
  64. package/dist/matter/endpoints.js +2 -0
  65. package/dist/matter/endpoints.js.map +1 -0
  66. package/dist/matter/export.d.ts +5 -0
  67. package/dist/matter/export.d.ts.map +1 -0
  68. package/dist/matter/export.js +3 -0
  69. package/dist/matter/export.js.map +1 -0
  70. package/dist/matter/types.d.ts +3 -0
  71. package/dist/matter/types.d.ts.map +1 -0
  72. package/dist/matter/types.js +3 -0
  73. package/dist/matter/types.js.map +1 -0
  74. package/dist/matterbridge.d.ts +450 -0
  75. package/dist/matterbridge.d.ts.map +1 -0
  76. package/dist/matterbridge.js +810 -56
  77. package/dist/matterbridge.js.map +1 -0
  78. package/dist/matterbridgeAccessoryPlatform.d.ts +42 -0
  79. package/dist/matterbridgeAccessoryPlatform.d.ts.map +1 -0
  80. package/dist/matterbridgeAccessoryPlatform.js +36 -0
  81. package/dist/matterbridgeAccessoryPlatform.js.map +1 -0
  82. package/dist/matterbridgeBehaviors.d.ts +1334 -0
  83. package/dist/matterbridgeBehaviors.d.ts.map +1 -0
  84. package/dist/matterbridgeBehaviors.js +55 -1
  85. package/dist/matterbridgeBehaviors.js.map +1 -0
  86. package/dist/matterbridgeDeviceTypes.d.ts +709 -0
  87. package/dist/matterbridgeDeviceTypes.d.ts.map +1 -0
  88. package/dist/matterbridgeDeviceTypes.js +579 -15
  89. package/dist/matterbridgeDeviceTypes.js.map +1 -0
  90. package/dist/matterbridgeDynamicPlatform.d.ts +42 -0
  91. package/dist/matterbridgeDynamicPlatform.d.ts.map +1 -0
  92. package/dist/matterbridgeDynamicPlatform.js +36 -0
  93. package/dist/matterbridgeDynamicPlatform.js.map +1 -0
  94. package/dist/matterbridgeEndpoint.d.ts +1173 -0
  95. package/dist/matterbridgeEndpoint.d.ts.map +1 -0
  96. package/dist/matterbridgeEndpoint.js +1023 -41
  97. package/dist/matterbridgeEndpoint.js.map +1 -0
  98. package/dist/matterbridgeEndpointHelpers.d.ts +3198 -0
  99. package/dist/matterbridgeEndpointHelpers.d.ts.map +1 -0
  100. package/dist/matterbridgeEndpointHelpers.js +322 -12
  101. package/dist/matterbridgeEndpointHelpers.js.map +1 -0
  102. package/dist/matterbridgePlatform.d.ts +310 -0
  103. package/dist/matterbridgePlatform.d.ts.map +1 -0
  104. package/dist/matterbridgePlatform.js +233 -0
  105. package/dist/matterbridgePlatform.js.map +1 -0
  106. package/dist/matterbridgeTypes.d.ts +184 -0
  107. package/dist/matterbridgeTypes.d.ts.map +1 -0
  108. package/dist/matterbridgeTypes.js +25 -0
  109. package/dist/matterbridgeTypes.js.map +1 -0
  110. package/dist/pluginManager.d.ts +291 -0
  111. package/dist/pluginManager.d.ts.map +1 -0
  112. package/dist/pluginManager.js +269 -3
  113. package/dist/pluginManager.js.map +1 -0
  114. package/dist/roboticVacuumCleaner.d.ts +104 -0
  115. package/dist/roboticVacuumCleaner.d.ts.map +1 -0
  116. package/dist/roboticVacuumCleaner.js +83 -6
  117. package/dist/roboticVacuumCleaner.js.map +1 -0
  118. package/dist/shelly.d.ts +174 -0
  119. package/dist/shelly.d.ts.map +1 -0
  120. package/dist/shelly.js +168 -7
  121. package/dist/shelly.js.map +1 -0
  122. package/dist/storage/export.d.ts +2 -0
  123. package/dist/storage/export.d.ts.map +1 -0
  124. package/dist/storage/export.js +1 -0
  125. package/dist/storage/export.js.map +1 -0
  126. package/dist/update.d.ts +59 -0
  127. package/dist/update.d.ts.map +1 -0
  128. package/dist/update.js +54 -0
  129. package/dist/update.js.map +1 -0
  130. package/dist/utils/colorUtils.d.ts +117 -0
  131. package/dist/utils/colorUtils.d.ts.map +1 -0
  132. package/dist/utils/colorUtils.js +263 -2
  133. package/dist/utils/colorUtils.js.map +1 -0
  134. package/dist/utils/commandLine.d.ts +59 -0
  135. package/dist/utils/commandLine.d.ts.map +1 -0
  136. package/dist/utils/commandLine.js +54 -0
  137. package/dist/utils/commandLine.js.map +1 -0
  138. package/dist/utils/copyDirectory.d.ts +33 -0
  139. package/dist/utils/copyDirectory.d.ts.map +1 -0
  140. package/dist/utils/copyDirectory.js +38 -1
  141. package/dist/utils/copyDirectory.js.map +1 -0
  142. package/dist/utils/createDirectory.d.ts +34 -0
  143. package/dist/utils/createDirectory.d.ts.map +1 -0
  144. package/dist/utils/createDirectory.js +33 -0
  145. package/dist/utils/createDirectory.js.map +1 -0
  146. package/dist/utils/createZip.d.ts +39 -0
  147. package/dist/utils/createZip.d.ts.map +1 -0
  148. package/dist/utils/createZip.js +47 -2
  149. package/dist/utils/createZip.js.map +1 -0
  150. package/dist/utils/deepCopy.d.ts +32 -0
  151. package/dist/utils/deepCopy.d.ts.map +1 -0
  152. package/dist/utils/deepCopy.js +39 -0
  153. package/dist/utils/deepCopy.js.map +1 -0
  154. package/dist/utils/deepEqual.d.ts +54 -0
  155. package/dist/utils/deepEqual.d.ts.map +1 -0
  156. package/dist/utils/deepEqual.js +72 -1
  157. package/dist/utils/deepEqual.js.map +1 -0
  158. package/dist/utils/export.d.ts +12 -0
  159. package/dist/utils/export.d.ts.map +1 -0
  160. package/dist/utils/export.js +1 -0
  161. package/dist/utils/export.js.map +1 -0
  162. package/dist/utils/hex.d.ts +49 -0
  163. package/dist/utils/hex.d.ts.map +1 -0
  164. package/dist/utils/hex.js +58 -0
  165. package/dist/utils/hex.js.map +1 -0
  166. package/dist/utils/isvalid.d.ts +103 -0
  167. package/dist/utils/isvalid.d.ts.map +1 -0
  168. package/dist/utils/isvalid.js +101 -0
  169. package/dist/utils/isvalid.js.map +1 -0
  170. package/dist/utils/network.d.ts +76 -0
  171. package/dist/utils/network.d.ts.map +1 -0
  172. package/dist/utils/network.js +83 -5
  173. package/dist/utils/network.js.map +1 -0
  174. package/dist/utils/spawn.d.ts +14 -0
  175. package/dist/utils/spawn.d.ts.map +1 -0
  176. package/dist/utils/spawn.js +18 -0
  177. package/dist/utils/spawn.js.map +1 -0
  178. package/dist/utils/wait.d.ts +56 -0
  179. package/dist/utils/wait.d.ts.map +1 -0
  180. package/dist/utils/wait.js +62 -9
  181. package/dist/utils/wait.js.map +1 -0
  182. package/dist/waterHeater.d.ts +106 -0
  183. package/dist/waterHeater.d.ts.map +1 -0
  184. package/dist/waterHeater.js +77 -2
  185. package/dist/waterHeater.js.map +1 -0
  186. package/npm-shrinkwrap.json +2 -2
  187. package/package.json +2 -1
@@ -1,5 +1,30 @@
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
+ * @created 2024-10-01
7
+ * @version 2.1.1
8
+ * @license Apache-2.0
9
+ *
10
+ * Copyright 2024, 2025, 2026 Luca Liguori.
11
+ *
12
+ * Licensed under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License.
14
+ * You may obtain a copy of the License at
15
+ *
16
+ * http://www.apache.org/licenses/LICENSE-2.0
17
+ *
18
+ * Unless required by applicable law or agreed to in writing, software
19
+ * distributed under the License is distributed on an "AS IS" BASIS,
20
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ * See the License for the specific language governing permissions and
22
+ * limitations under the License.
23
+ */
24
+ // @matter
1
25
  import { Endpoint, Lifecycle, MutableEndpoint, NamedHandler, SupportedBehaviors, UINT16_MAX, UINT32_MAX, VendorId, } from '@matter/main';
2
26
  import { getClusterNameById, MeasurementType } from '@matter/main/types';
27
+ // @matter clusters
3
28
  import { Descriptor } from '@matter/main/clusters/descriptor';
4
29
  import { PowerSource } from '@matter/main/clusters/power-source';
5
30
  import { BridgedDeviceBasicInformation } from '@matter/main/clusters/bridged-device-basic-information';
@@ -26,6 +51,7 @@ import { ThermostatUserInterfaceConfiguration } from '@matter/main/clusters/ther
26
51
  import { OperationalState } from '@matter/main/clusters/operational-state';
27
52
  import { DeviceEnergyManagement } from '@matter/main/clusters/device-energy-management';
28
53
  import { DeviceEnergyManagementMode } from '@matter/main/clusters/device-energy-management-mode';
54
+ // @matter behaviors
29
55
  import { DescriptorServer } from '@matter/main/behaviors/descriptor';
30
56
  import { PowerSourceServer } from '@matter/main/behaviors/power-source';
31
57
  import { BridgedDeviceBasicInformationServer } from '@matter/main/behaviors/bridged-device-basic-information';
@@ -60,19 +86,41 @@ import { HepaFilterMonitoringServer } from '@matter/main/behaviors/hepa-filter-m
60
86
  import { ActivatedCarbonFilterMonitoringServer } from '@matter/main/behaviors/activated-carbon-filter-monitoring';
61
87
  import { ThermostatUserInterfaceConfigurationServer } from '@matter/main/behaviors/thermostat-user-interface-configuration';
62
88
  import { DeviceEnergyManagementServer } from '@matter/main/behaviors/device-energy-management';
89
+ // AnsiLogger module
63
90
  import { AnsiLogger, CYAN, YELLOW, db, debugStringify, hk, or, zb } from './logger/export.js';
91
+ // Matterbridge
64
92
  import { bridgedNode } from './matterbridgeDeviceTypes.js';
65
93
  import { isValidNumber, isValidObject, isValidString } from './utils/export.js';
66
94
  import { MatterbridgeServer, MatterbridgeIdentifyServer, MatterbridgeOnOffServer, MatterbridgeLevelControlServer, MatterbridgeColorControlServer, MatterbridgeLiftWindowCoveringServer, MatterbridgeLiftTiltWindowCoveringServer, MatterbridgeThermostatServer, MatterbridgeFanControlServer, MatterbridgeDoorLockServer, MatterbridgeModeSelectServer, MatterbridgeValveConfigurationAndControlServer, MatterbridgeSmokeCoAlarmServer, MatterbridgeBooleanStateConfigurationServer, MatterbridgeSwitchServer, MatterbridgeOperationalStateServer, MatterbridgeDeviceEnergyManagementModeServer, } from './matterbridgeBehaviors.js';
67
95
  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';
68
96
  export class MatterbridgeEndpoint extends Endpoint {
97
+ /** The bridge mode of Matterbridge */
69
98
  static bridgeMode = '';
70
- static logLevel = "info";
99
+ /** The default log level of the new MatterbridgeEndpoints */
100
+ static logLevel = "info" /* LogLevel.INFO */;
101
+ /**
102
+ * Activates a special mode for this endpoint.
103
+ * - 'server': it creates the device server node and add the device as Matter device that needs to be paired individually.
104
+ * In this case the bridge mode is not relevant. The device is autonomous. The main use case is a workaround for the Apple Home rvc issue.
105
+ *
106
+ * - 'matter': it adds the device directly to the bridge server node as Matter device. In this case the implementation must respect
107
+ * the 9.2.3. Disambiguation rule (i.e. use taglist if needed cause the device doesn't have nodeLabel).
108
+ * Furthermore the device will be a part of the bridge (i.e. will have the same name and will be in the same room).
109
+ * See 9.12.2.2. Native Matter functionality in Bridge.
110
+ *
111
+ * @remarks
112
+ * Always use createDefaultBasicInformationClusterServer() to create the BasicInformation cluster server.
113
+ */
71
114
  mode = undefined;
115
+ /** The server context of the endpoint, if it is a single not bridged endpoint */
72
116
  serverContext;
117
+ /** The server node of the endpoint, if it is a single not bridged endpoint */
73
118
  serverNode;
119
+ /** The logger instance for the MatterbridgeEndpoint */
74
120
  log;
121
+ /** The plugin name this MatterbridgeEndpoint belongs to */
75
122
  plugin = undefined;
123
+ /** The configuration URL of the device, if available */
76
124
  configUrl = undefined;
77
125
  deviceName = undefined;
78
126
  serialNumber = undefined;
@@ -86,14 +134,28 @@ export class MatterbridgeEndpoint extends Endpoint {
86
134
  hardwareVersion = undefined;
87
135
  hardwareVersionString = undefined;
88
136
  productUrl = 'https://www.npmjs.com/package/matterbridge';
137
+ /** The name of the first device type of the endpoint (old api compatibility) */
89
138
  name = undefined;
139
+ /** The code of the first device type of the endpoint (old api compatibility) */
90
140
  deviceType = undefined;
141
+ /** The id of the endpoint (old api compatibility) */
91
142
  uniqueStorageKey = undefined;
92
143
  tagList = undefined;
144
+ /** Maps the DeviceTypeDefinitions with their code */
93
145
  deviceTypes = new Map();
146
+ /** Command handler for the MatterbridgeEndpoint commands */
94
147
  commandHandler = new NamedHandler();
148
+ /**
149
+ * Represents a MatterbridgeEndpoint.
150
+ *
151
+ * @class MatterbridgeEndpoint
152
+ * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the endpoint.
153
+ * @param {MatterbridgeEndpointOptions} [options] - The options for the device.
154
+ * @param {boolean} [debug] - Debug flag.
155
+ */
95
156
  constructor(definition, options = {}, debug = false) {
96
157
  let deviceTypeList = [];
158
+ // Get the first DeviceTypeDefinition
97
159
  let firstDefinition;
98
160
  if (Array.isArray(definition)) {
99
161
  firstDefinition = definition[0];
@@ -106,6 +168,7 @@ export class MatterbridgeEndpoint extends Endpoint {
106
168
  firstDefinition = definition;
107
169
  deviceTypeList = [{ deviceType: firstDefinition.code, revision: firstDefinition.revision }];
108
170
  }
171
+ // Convert the first DeviceTypeDefinition to an EndpointType.Options
109
172
  const deviceTypeDefinitionV8 = {
110
173
  name: firstDefinition.name.replace('-', '_'),
111
174
  deviceType: firstDefinition.code,
@@ -124,17 +187,20 @@ export class MatterbridgeEndpoint extends Endpoint {
124
187
  behaviors: options.tagList ? SupportedBehaviors(DescriptorServer.with(Descriptor.Feature.TagList)) : {},
125
188
  };
126
189
  const endpointV8 = MutableEndpoint(deviceTypeDefinitionV8);
190
+ // Check if the uniqueStorageKey is valid
127
191
  if (options.uniqueStorageKey && checkNotLatinCharacters(options.uniqueStorageKey)) {
128
192
  options.uniqueStorageKey = generateUniqueId(options.uniqueStorageKey);
129
193
  }
130
194
  if (options.id && checkNotLatinCharacters(options.id)) {
131
195
  options.id = generateUniqueId(options.id);
132
196
  }
197
+ // Convert the options to an Endpoint.Options
133
198
  const optionsV8 = {
134
199
  id: options.uniqueStorageKey?.replace(/[ .]/g, ''),
135
200
  number: options.endpointId,
136
201
  descriptor: options.tagList ? { tagList: options.tagList, deviceTypeList } : { deviceTypeList },
137
202
  };
203
+ // Override the deprecated uniqueStorageKey && endpointId with id and number if provided
138
204
  if (options.id !== undefined) {
139
205
  optionsV8.id = options.id.replace(/[ .]/g, '');
140
206
  }
@@ -154,16 +220,40 @@ export class MatterbridgeEndpoint extends Endpoint {
154
220
  }
155
221
  else
156
222
  this.deviceTypes.set(firstDefinition.code, firstDefinition);
157
- this.log = new AnsiLogger({ logName: options.uniqueStorageKey ?? 'MatterbridgeEndpoint', logTimestampFormat: 4, logLevel: debug === true ? "debug" : MatterbridgeEndpoint.logLevel });
158
- 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}`);
223
+ // console.log('MatterbridgeEndpoint.option', options);
224
+ // console.log('MatterbridgeEndpoint.endpointV8', endpointV8);
225
+ // console.log('MatterbridgeEndpoint.optionsV8', optionsV8);
226
+ // Create the logger
227
+ this.log = new AnsiLogger({ logName: options.uniqueStorageKey ?? 'MatterbridgeEndpoint', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: debug === true ? "debug" /* LogLevel.DEBUG */ : MatterbridgeEndpoint.logLevel });
228
+ this.log.debug(`${YELLOW}new${db} MatterbridgeEndpoint: ${zb}${'0x' + firstDefinition.code.toString(16).padStart(4, '0')}${db}-${zb}${firstDefinition.name}${db} mode: ${CYAN}${this.mode}${db} id: ${CYAN}${optionsV8.id}${db} number: ${CYAN}${optionsV8.number}${db} taglist: ${CYAN}${options.tagList ? debugStringify(options.tagList) : 'undefined'}${db}`);
229
+ // Add MatterbridgeServer
159
230
  this.behaviors.require(MatterbridgeServer, { log: this.log, commandHandler: this.commandHandler });
160
231
  }
232
+ /**
233
+ * Loads an instance of the MatterbridgeEndpoint class.
234
+ *
235
+ * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the device.
236
+ * @param {MatterbridgeEndpointOptions} [options] - The options for the device.
237
+ * @param {boolean} [debug] - Debug flag.
238
+ * @returns {Promise<MatterbridgeEndpoint>} MatterbridgeEndpoint instance.
239
+ */
161
240
  static async loadInstance(definition, options = {}, debug = false) {
162
241
  return new MatterbridgeEndpoint(definition, options, debug);
163
242
  }
243
+ /**
244
+ * Get all the device types of this endpoint.
245
+ *
246
+ * @returns {DeviceTypeDefinition[]} The device types of this endpoint.
247
+ */
164
248
  getDeviceTypes() {
165
249
  return Array.from(this.deviceTypes.values());
166
250
  }
251
+ /**
252
+ * Checks if the provided cluster server is supported by this endpoint.
253
+ *
254
+ * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
255
+ * @returns {boolean} True if the cluster server is supported, false otherwise.
256
+ */
167
257
  hasClusterServer(cluster) {
168
258
  const behavior = getBehavior(this, cluster);
169
259
  if (behavior)
@@ -171,6 +261,13 @@ export class MatterbridgeEndpoint extends Endpoint {
171
261
  else
172
262
  return false;
173
263
  }
264
+ /**
265
+ * Checks if the provided attribute server is supported for a given cluster of this endpoint.
266
+ *
267
+ * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
268
+ * @param {string} attribute - The attribute name to check.
269
+ * @returns {boolean} True if the attribute server is supported, false otherwise.
270
+ */
174
271
  hasAttributeServer(cluster, attribute) {
175
272
  const behavior = getBehavior(this, cluster);
176
273
  if (!behavior || !this.behaviors.supported[behavior.id])
@@ -179,82 +276,236 @@ export class MatterbridgeEndpoint extends Endpoint {
179
276
  const defaults = this.behaviors.defaultsFor(behavior);
180
277
  return lowercaseFirstLetter(attribute) in options || lowercaseFirstLetter(attribute) in defaults;
181
278
  }
279
+ /**
280
+ * Retrieves the initial options for the provided cluster server.
281
+ *
282
+ * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to get options for.
283
+ * @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.
284
+ */
182
285
  getClusterServerOptions(cluster) {
183
286
  const behavior = getBehavior(this, cluster);
184
287
  if (!behavior)
185
288
  return undefined;
186
289
  return this.behaviors.optionsFor(behavior);
187
290
  }
291
+ /**
292
+ * Retrieves the value of the provided attribute from the given cluster.
293
+ *
294
+ * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to retrieve the attribute from.
295
+ * @param {string} attribute - The name of the attribute to retrieve.
296
+ * @param {AnsiLogger} [log] - Optional logger for error and info messages.
297
+ * @returns {any} The value of the attribute, or undefined if the attribute is not found.
298
+ */
299
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
188
300
  getAttribute(cluster, attribute, log) {
189
301
  return getAttribute(this, cluster, attribute, log);
190
302
  }
303
+ /**
304
+ * Sets the value of an attribute on a cluster server.
305
+ *
306
+ * @param {Behavior.Type | ClusterType | ClusterId | string} clusterId - The ID of the cluster.
307
+ * @param {string} attribute - The name of the attribute.
308
+ * @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
309
+ * @param {AnsiLogger} [log] - (Optional) The logger to use for logging errors and information.
310
+ * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
311
+ */
191
312
  async setAttribute(clusterId, attribute, value, log) {
192
313
  return await setAttribute(this, clusterId, attribute, value, log);
193
314
  }
315
+ /**
316
+ * Update the value of an attribute on a cluster server only if the value is different.
317
+ *
318
+ * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to set the attribute on.
319
+ * @param {string} attribute - The name of the attribute.
320
+ * @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
321
+ * @param {AnsiLogger} [log] - (Optional) The logger to use for logging the update. Errors are logged to the endpoint logger.
322
+ * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
323
+ */
194
324
  async updateAttribute(cluster, attribute, value, log) {
195
325
  return await updateAttribute(this, cluster, attribute, value, log);
196
326
  }
327
+ /**
328
+ * Subscribes to the provided attribute on a cluster.
329
+ *
330
+ * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to subscribe the attribute to.
331
+ * @param {string} attribute - The name of the attribute to subscribe to.
332
+ * @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.
333
+ * @param {AnsiLogger} [log] - Optional logger for logging errors and information.
334
+ * @returns {Promise<boolean>} - A boolean indicating whether the subscription was successful.
335
+ *
336
+ * @remarks The listener function (cannot be async) will receive three parameters:
337
+ * - `newValue`: The new value of the attribute.
338
+ * - `oldValue`: The old value of the attribute.
339
+ * - `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.
340
+ */
341
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
197
342
  async subscribeAttribute(cluster, attribute, listener, log) {
198
343
  return await subscribeAttribute(this, cluster, attribute, listener, log);
199
344
  }
345
+ /**
346
+ * Triggers an event on the specified cluster.
347
+ *
348
+ * @param {ClusterId} cluster - The ID of the cluster.
349
+ * @param {string} event - The name of the event to trigger.
350
+ * @param {Record<string, boolean | number | bigint | string | object | undefined | null>} payload - The payload to pass to the event.
351
+ * @param {AnsiLogger} [log] - Optional logger for logging information.
352
+ * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the event was successfully triggered.
353
+ */
200
354
  async triggerEvent(cluster, event, payload, log) {
201
355
  return await triggerEvent(this, cluster, event, payload, log);
202
356
  }
357
+ /**
358
+ * Adds cluster servers from the provided server list.
359
+ *
360
+ * @param {ClusterId[]} serverList - The list of cluster IDs to add.
361
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
362
+ */
203
363
  addClusterServers(serverList) {
204
364
  addClusterServers(this, serverList);
205
365
  return this;
206
366
  }
367
+ /**
368
+ * Adds a fixed label to the FixedLabel cluster. If the cluster server is not present, it will be added.
369
+ *
370
+ * @param {string} label - The label to add.
371
+ * @param {string} value - The value of the label.
372
+ * @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
373
+ */
207
374
  async addFixedLabel(label, value) {
208
375
  await addFixedLabel(this, label, value);
209
376
  return this;
210
377
  }
378
+ /**
379
+ * Adds a user label to the UserLabel cluster. If the cluster server is not present, it will be added.
380
+ *
381
+ * @param {string} label - The label to add.
382
+ * @param {string} value - The value of the label.
383
+ * @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
384
+ */
211
385
  async addUserLabel(label, value) {
212
386
  await addUserLabel(this, label, value);
213
387
  return this;
214
388
  }
389
+ /**
390
+ * Adds a command handler for the specified command.
391
+ *
392
+ * @param {keyof MatterbridgeEndpointCommands} command - The command to add the handler for.
393
+ * @param {CommandHandlerFunction} handler - The handler function to execute when the command is received.
394
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
395
+ *
396
+ * @remarks
397
+ * The handler function will receive an object with the following properties:
398
+ * - `request`: The request object sent with the command.
399
+ * - `cluster`: The id of the cluster that received the command (i.e. "onOff").
400
+ * - `attributes`: The current attributes of the cluster that received the command (i.e. { onOff: true}).
401
+ * - `endpoint`: The MatterbridgeEndpoint instance that received the command.
402
+ */
215
403
  addCommandHandler(command, handler) {
216
404
  this.commandHandler.addHandler(command, handler);
217
405
  return this;
218
406
  }
407
+ /**
408
+ * Execute the command handler for the specified command. Used ONLY in Jest tests.
409
+ *
410
+ * @param {keyof MatterbridgeEndpointCommands} command - The command to execute.
411
+ * @param {Record<string, boolean | number | bigint | string | object | null>} [request] - The optional request to pass to the handler function.
412
+ *
413
+ * @deprecated Used ONLY in Jest tests.
414
+ */
219
415
  async executeCommandHandler(command, request) {
220
416
  await this.commandHandler.executeHandler(command, { request });
221
417
  }
418
+ /**
419
+ * Invokes a behavior command on the specified cluster. Used ONLY in Jest tests.
420
+ *
421
+ * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to invoke the command on.
422
+ * @param {string} command - The command to invoke.
423
+ * @param {Record<string, boolean | number | bigint | string | object | null>} [params] - The optional parameters to pass to the command.
424
+ *
425
+ * @deprecated Used ONLY in Jest tests.
426
+ */
222
427
  async invokeBehaviorCommand(cluster, command, params) {
223
428
  await invokeBehaviorCommand(this, cluster, command, params);
224
429
  }
430
+ /**
431
+ * Adds the required cluster servers (only if they are not present) for the device types of the specified endpoint.
432
+ *
433
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
434
+ */
225
435
  addRequiredClusterServers() {
226
436
  addRequiredClusterServers(this);
227
437
  return this;
228
438
  }
439
+ /**
440
+ * Adds the optional cluster servers (only if they are not present) for the device types of the specified endpoint.
441
+ *
442
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
443
+ */
229
444
  addOptionalClusterServers() {
230
445
  addOptionalClusterServers(this);
231
446
  return this;
232
447
  }
448
+ /**
449
+ * Retrieves all cluster servers.
450
+ *
451
+ * @returns {Behavior.Type[]} An array of all cluster servers.
452
+ */
233
453
  getAllClusterServers() {
234
454
  return Object.values(this.behaviors.supported);
235
455
  }
456
+ /**
457
+ * Retrieves the names of all cluster servers.
458
+ *
459
+ * @returns {string[]} An array of all cluster server names.
460
+ */
236
461
  getAllClusterServerNames() {
237
462
  return Object.keys(this.behaviors.supported);
238
463
  }
464
+ /**
465
+ * Iterates over each attribute of each cluster server of the device state and calls the provided callback function.
466
+ *
467
+ * @param {Function} callback - The callback function to call with the cluster name, cluster id, attribute name, attribute id and attribute value.
468
+ */
239
469
  forEachAttribute(callback) {
240
470
  if (!this.lifecycle.isReady || this.construction.status !== Lifecycle.Status.Active)
241
471
  return;
242
472
  for (const [clusterName, clusterAttributes] of Object.entries(this.state)) {
473
+ // Skip if the key / cluster name is a number, cause they are double indexed.
243
474
  if (!isNaN(Number(clusterName)))
244
475
  continue;
245
476
  for (const [attributeName, attributeValue] of Object.entries(clusterAttributes)) {
477
+ // Skip if the behavior has no associated cluster (i.e. matterbridge server)
246
478
  const clusterId = getClusterId(this, clusterName);
247
479
  if (clusterId === undefined) {
480
+ // this.log.debug(`***forEachAttribute: cluster ${clusterName} not found`);
248
481
  continue;
249
482
  }
483
+ // Skip if the attribute is not present in the ClusterBehavior.Type. Also skip if the attribute it is an internal state.
250
484
  const attributeId = getAttributeId(this, clusterName, attributeName);
251
485
  if (attributeId === undefined) {
486
+ // this.log.debug(`***forEachAttribute: attribute ${clusterName}.${attributeName} not found`);
252
487
  continue;
253
488
  }
254
489
  callback(clusterName, clusterId, attributeName, attributeId, attributeValue);
255
490
  }
256
491
  }
257
492
  }
493
+ /**
494
+ * Adds a child endpoint with the specified device types and options.
495
+ * If the child endpoint is not already present, it will be created and added.
496
+ * If the child endpoint is already present, the existing child endpoint will be returned.
497
+ *
498
+ * @param {string} endpointName - The name of the new endpoint to add.
499
+ * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
500
+ * @param {MatterbridgeEndpointOptions} [options] - The options for the endpoint.
501
+ * @param {boolean} [debug] - Whether to enable debug logging.
502
+ * @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
503
+ *
504
+ * @example
505
+ * ```typescript
506
+ * const endpoint = device.addChildDeviceType('Temperature', [temperatureSensor], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
507
+ * ```
508
+ */
258
509
  addChildDeviceType(endpointName, definition, options = {}, debug = false) {
259
510
  this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
260
511
  let alreadyAdded = false;
@@ -294,6 +545,23 @@ export class MatterbridgeEndpoint extends Endpoint {
294
545
  }
295
546
  return child;
296
547
  }
548
+ /**
549
+ * Adds a child endpoint with one or more device types with the required cluster servers and the specified cluster servers.
550
+ * If the child endpoint is not already present in the childEndpoints, it will be added.
551
+ * If the child endpoint is already present in the childEndpoints, the device types and cluster servers will be added to the existing child endpoint.
552
+ *
553
+ * @param {string} endpointName - The name of the new enpoint to add.
554
+ * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
555
+ * @param {ClusterId[]} [serverList] - The list of cluster IDs to include.
556
+ * @param {MatterbridgeEndpointOptions} [options] - The options for the device.
557
+ * @param {boolean} [debug] - Whether to enable debug logging.
558
+ * @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
559
+ *
560
+ * @example
561
+ * ```typescript
562
+ * const endpoint = device.addChildDeviceTypeWithClusterServer('Temperature', [temperatureSensor], [], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
563
+ * ```
564
+ */
297
565
  addChildDeviceTypeWithClusterServer(endpointName, definition, serverList = [], options = {}, debug = false) {
298
566
  this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
299
567
  let alreadyAdded = false;
@@ -356,15 +624,39 @@ export class MatterbridgeEndpoint extends Endpoint {
356
624
  }
357
625
  return child;
358
626
  }
627
+ /**
628
+ * Retrieves a child endpoint by its name.
629
+ *
630
+ * @param {string} endpointName - The name of the endpoint to retrieve.
631
+ * @returns {Endpoint | undefined} The child endpoint with the specified name, or undefined if not found.
632
+ */
359
633
  getChildEndpointByName(endpointName) {
360
634
  return this.parts.find((part) => part.id === endpointName);
361
635
  }
636
+ /**
637
+ * Retrieves a child endpoint by its EndpointNumber.
638
+ *
639
+ * @param {EndpointNumber} endpointNumber - The EndpointNumber of the endpoint to retrieve.
640
+ * @returns {MatterbridgeEndpoint | undefined} The child endpoint with the specified EndpointNumber, or undefined if not found.
641
+ */
362
642
  getChildEndpoint(endpointNumber) {
363
643
  return this.parts.find((part) => part.number === endpointNumber);
364
644
  }
645
+ /**
646
+ * Get all the child endpoints of this endpoint.
647
+ *
648
+ * @returns {MatterbridgeEndpoint[]} The child endpoints.
649
+ */
365
650
  getChildEndpoints() {
366
651
  return Array.from(this.parts);
367
652
  }
653
+ /**
654
+ * Serializes the Matterbridge device into a serialized object.
655
+ *
656
+ * @param {MatterbridgeEndpoint} device - The Matterbridge device to serialize.
657
+ *
658
+ * @returns {SerializedMatterbridgeEndpoint | undefined} The serialized Matterbridge device object.
659
+ */
368
660
  static serialize(device) {
369
661
  if (!device.serialNumber || !device.deviceName || !device.uniqueId)
370
662
  return;
@@ -387,9 +679,16 @@ export class MatterbridgeEndpoint extends Endpoint {
387
679
  serialized.clusterServersId.push(BridgedDeviceBasicInformation.Cluster.id);
388
680
  if (behaviorName === 'powerSource')
389
681
  serialized.clusterServersId.push(PowerSource.Cluster.id);
682
+ // serialized.clusterServersId.push(this.behaviors.supported[behaviorName]cluster.id);
390
683
  });
391
684
  return serialized;
392
685
  }
686
+ /**
687
+ * Deserializes the device into a serialized object.
688
+ *
689
+ * @param {SerializedMatterbridgeEndpoint} serializedDevice - The serialized Matterbridge device object.
690
+ * @returns {MatterbridgeEndpoint | undefined} The deserialized Matterbridge device.
691
+ */
393
692
  static deserialize(serializedDevice) {
394
693
  const device = new MatterbridgeEndpoint(serializedDevice.deviceTypes, { uniqueStorageKey: serializedDevice.endpointName, endpointId: serializedDevice.endpoint }, false);
395
694
  device.plugin = serializedDevice.pluginName;
@@ -405,9 +704,16 @@ export class MatterbridgeEndpoint extends Endpoint {
405
704
  device.createDefaultBridgedDeviceBasicInformationClusterServer(serializedDevice.deviceName, serializedDevice.serialNumber, serializedDevice.vendorId ?? 0xfff1, serializedDevice.vendorName ?? 'Matterbridge', serializedDevice.productName ?? 'Matterbridge device');
406
705
  else if (clusterId === PowerSource.Cluster.id)
407
706
  device.createDefaultPowerSourceWiredClusterServer();
707
+ // else addClusterServerFromList(device, [clusterId]);
408
708
  }
409
709
  return device;
410
710
  }
711
+ /**
712
+ * Creates a default power source wired cluster server.
713
+ *
714
+ * @param {PowerSource.WiredCurrentType} wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
715
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
716
+ */
411
717
  createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
412
718
  this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Wired), {
413
719
  wiredCurrentType,
@@ -418,6 +724,16 @@ export class MatterbridgeEndpoint extends Endpoint {
418
724
  });
419
725
  return this;
420
726
  }
727
+ /**
728
+ * Creates a default power source replaceable battery cluster server.
729
+ *
730
+ * @param {number} batPercentRemaining - The remaining battery percentage (default: 100).
731
+ * @param {PowerSource.BatChargeLevel} batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
732
+ * @param {number} batVoltage - The battery voltage (default: 1500).
733
+ * @param {string} batReplacementDescription - The description of the battery replacement (default: 'Battery type').
734
+ * @param {number} batQuantity - The quantity of the battery (default: 1).
735
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
736
+ */
421
737
  createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
422
738
  this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
423
739
  status: PowerSource.PowerSourceStatus.Active,
@@ -435,6 +751,14 @@ export class MatterbridgeEndpoint extends Endpoint {
435
751
  });
436
752
  return this;
437
753
  }
754
+ /**
755
+ * Creates a default power source rechargeable battery cluster server.
756
+ *
757
+ * @param {number} [batPercentRemaining] - The remaining battery percentage (default: 100).
758
+ * @param {PowerSource.BatChargeLevel} [batChargeLevel] - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
759
+ * @param {number} [batVoltage] - The battery voltage (default: 1500).
760
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
761
+ */
438
762
  createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
439
763
  this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
440
764
  status: PowerSource.PowerSourceStatus.Active,
@@ -453,6 +777,21 @@ export class MatterbridgeEndpoint extends Endpoint {
453
777
  });
454
778
  return this;
455
779
  }
780
+ /**
781
+ * Setup the default Basic Information Cluster Server attributes for the server node.
782
+ *
783
+ * @param {string} deviceName - The name of the device.
784
+ * @param {string} serialNumber - The serial number of the device.
785
+ * @param {number} [vendorId] - The vendor ID of the device. Default is 0xfff1 (Matter Test VendorId).
786
+ * @param {string} [vendorName] - The name of the vendor. Default is 'Matterbridge'.
787
+ * @param {number} [productId] - The product ID of the device. Default is 0x8000 (Matter Test ProductId).
788
+ * @param {string} [productName] - The name of the product. Default is 'Matterbridge device'.
789
+ * @param {number} [softwareVersion] - The software version of the device. Default is 1.
790
+ * @param {string} [softwareVersionString] - The software version string of the device. Default is '1.0.0'.
791
+ * @param {number} [hardwareVersion] - The hardware version of the device. Default is 1.
792
+ * @param {string} [hardwareVersionString] - The hardware version string of the device. Default is '1.0.0'.
793
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
794
+ */
456
795
  createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId = 0xfff1, vendorName = 'Matterbridge', productId = 0x8000, productName = 'Matterbridge device', softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
457
796
  this.log.logName = deviceName;
458
797
  this.deviceName = deviceName;
@@ -476,6 +815,22 @@ export class MatterbridgeEndpoint extends Endpoint {
476
815
  }
477
816
  return this;
478
817
  }
818
+ /**
819
+ * Creates a default BridgedDeviceBasicInformationClusterServer for the aggregator endpoints.
820
+ *
821
+ * @param {string} deviceName - The name of the device.
822
+ * @param {string} serialNumber - The serial number of the device.
823
+ * @param {number} [vendorId] - The vendor ID of the device. Default is 0xfff1 (Matter Test VendorId).
824
+ * @param {string} [vendorName] - The name of the vendor. Default is 'Matterbridge'.
825
+ * @param {string} [productName] - The name of the product. Default is 'Matterbridge device'.
826
+ * @param {number} [softwareVersion] - The software version of the device. Default is 1.
827
+ * @param {string} [softwareVersionString] - The software version string of the device. Default is '1.0.0'.
828
+ * @param {number} [hardwareVersion] - The hardware version of the device. Default is 1.
829
+ * @param {string} [hardwareVersionString] - The hardware version string of the device. Default is '1.0.0'.
830
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
831
+ *
832
+ * @remarks The bridgedNode device type must be added to the deviceTypeList of the Descriptor cluster.
833
+ */
479
834
  createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId = 0xfff1, vendorName = 'Matterbridge', productName = 'Matterbridge device', softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
480
835
  this.log.logName = deviceName;
481
836
  this.deviceName = deviceName;
@@ -508,6 +863,13 @@ export class MatterbridgeEndpoint extends Endpoint {
508
863
  });
509
864
  return this;
510
865
  }
866
+ /**
867
+ * Creates a default identify cluster server with the specified identify time and type.
868
+ *
869
+ * @param {number} [identifyTime] - The time to identify the server. Defaults to 0.
870
+ * @param {Identify.IdentifyType} [identifyType] - The type of identification. Defaults to Identify.IdentifyType.None.
871
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
872
+ */
511
873
  createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
512
874
  this.behaviors.require(MatterbridgeIdentifyServer, {
513
875
  identifyTime,
@@ -515,14 +877,36 @@ export class MatterbridgeEndpoint extends Endpoint {
515
877
  });
516
878
  return this;
517
879
  }
880
+ /**
881
+ * Creates a default groups cluster server.
882
+ *
883
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
884
+ */
518
885
  createDefaultGroupsClusterServer() {
519
886
  this.behaviors.require(GroupsServer);
520
887
  return this;
521
888
  }
889
+ /**
890
+ * Creates a default scenes management cluster server.
891
+ *
892
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
893
+ *
894
+ * @remarks The scenes management cluster server is still provisional and so not yet implemented.
895
+ */
522
896
  createDefaultScenesClusterServer() {
523
897
  this.behaviors.require(ScenesManagementServer);
524
898
  return this;
525
899
  }
900
+ /**
901
+ * Creates a default OnOff cluster server for light devices with feature Lighting.
902
+ *
903
+ * @param {boolean} [onOff] - The initial state of the OnOff cluster.
904
+ * @param {boolean} [globalSceneControl] - The global scene control state.
905
+ * @param {number} [onTime] - The on time value.
906
+ * @param {number} [offWaitTime] - The off wait time value.
907
+ * @param {OnOff.StartUpOnOff | null} [startUpOnOff] - The start-up OnOff state. Null means previous state.
908
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
909
+ */
526
910
  createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
527
911
  this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.Lighting), {
528
912
  onOff,
@@ -533,24 +917,52 @@ export class MatterbridgeEndpoint extends Endpoint {
533
917
  });
534
918
  return this;
535
919
  }
920
+ /**
921
+ * Creates an OnOff cluster server without features.
922
+ *
923
+ * @param {boolean} [onOff] - The initial state of the OnOff cluster.
924
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
925
+ */
536
926
  createOnOffClusterServer(onOff = false) {
537
927
  this.behaviors.require(MatterbridgeOnOffServer, {
538
928
  onOff,
539
929
  });
540
930
  return this;
541
931
  }
932
+ /**
933
+ * Creates a DeadFront OnOff cluster server with feature DeadFrontBehavior.
934
+ *
935
+ * @param {boolean} [onOff] - The initial state of the OnOff cluster.
936
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
937
+ */
542
938
  createDeadFrontOnOffClusterServer(onOff = false) {
543
939
  this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.DeadFrontBehavior), {
544
940
  onOff,
545
941
  });
546
942
  return this;
547
943
  }
944
+ /**
945
+ * Creates an OffOnly OnOff cluster server with feature OffOnly.
946
+ *
947
+ * @param {boolean} [onOff] - The initial state of the OnOff cluster.
948
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
949
+ */
548
950
  createOffOnlyOnOffClusterServer(onOff = false) {
549
951
  this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.OffOnly), {
550
952
  onOff,
551
953
  });
552
954
  return this;
553
955
  }
956
+ /**
957
+ * Creates a default level control cluster server for light devices with feature OnOff and Lighting.
958
+ *
959
+ * @param {number} [currentLevel] - The current level (default: 254).
960
+ * @param {number} [minLevel] - The minimum level (default: 1).
961
+ * @param {number} [maxLevel] - The maximum level (default: 254).
962
+ * @param {number | null} [onLevel] - The on level (default: null).
963
+ * @param {number | null} [startUpCurrentLevel] - The startUp on level (default: null).
964
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
965
+ */
554
966
  createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
555
967
  this.behaviors.require(MatterbridgeLevelControlServer.with(LevelControl.Feature.OnOff, LevelControl.Feature.Lighting), {
556
968
  currentLevel,
@@ -566,6 +978,13 @@ export class MatterbridgeEndpoint extends Endpoint {
566
978
  });
567
979
  return this;
568
980
  }
981
+ /**
982
+ * Creates a level control cluster server without features.
983
+ *
984
+ * @param {number} [currentLevel] - The current level (default: 254).
985
+ * @param {number | null} [onLevel] - The on level (default: null).
986
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
987
+ */
569
988
  createLevelControlClusterServer(currentLevel = 254, onLevel = null) {
570
989
  this.behaviors.require(MatterbridgeLevelControlServer, {
571
990
  currentLevel,
@@ -577,6 +996,25 @@ export class MatterbridgeEndpoint extends Endpoint {
577
996
  });
578
997
  return this;
579
998
  }
999
+ /**
1000
+ * Creates a default color control cluster server with features Xy, HueSaturation and ColorTemperature.
1001
+ *
1002
+ * @param {number} currentX - The current X value (range 0-65279).
1003
+ * @param {number} currentY - The current Y value (range 0-65279).
1004
+ * @param {number} currentHue - The current hue value (range: 0-254).
1005
+ * @param {number} currentSaturation - The current saturation value (range: 0-254).
1006
+ * @param {number} colorTemperatureMireds - The color temperature in mireds (default range 147-500).
1007
+ * @param {number} colorTempPhysicalMinMireds - The physical minimum color temperature in mireds (default range 147).
1008
+ * @param {number} colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds (default range 500).
1009
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1010
+ *
1011
+ * @remarks colorMode and enhancedColorMode persist across restarts.
1012
+ * @remarks currentHue and currentSaturation persist across restarts.
1013
+ * @remarks currentX and currentY persist across restarts.
1014
+ * @remarks colorTemperatureMireds persists across restarts.
1015
+ * @remarks startUpColorTemperatureMireds persists across restarts.
1016
+ * @remarks coupleColorTempToLevelMinMireds persists across restarts.
1017
+ */
580
1018
  createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
581
1019
  this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
582
1020
  colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
@@ -599,6 +1037,25 @@ export class MatterbridgeEndpoint extends Endpoint {
599
1037
  });
600
1038
  return this;
601
1039
  }
1040
+ /**
1041
+ * Creates a Xy color control cluster server with feature Xy and ColorTemperature.
1042
+ *
1043
+ * @param {number} currentX - The current X value (range 0-65279).
1044
+ * @param {number} currentY - The current Y value (range 0-65279).
1045
+ * @param {number} colorTemperatureMireds - The color temperature in mireds (default range 147-500).
1046
+ * @param {number} colorTempPhysicalMinMireds - The physical minimum color temperature in mireds (default range 147).
1047
+ * @param {number} colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds (default range 500).
1048
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1049
+ *
1050
+ * @remarks
1051
+ * From zigbee to matter = Math.max(Math.min(Math.round(x * 65536), 65279), 0)
1052
+ *
1053
+ * @remarks colorMode and enhancedColorMode persist across restarts.
1054
+ * @remarks currentX and currentY persist across restarts.
1055
+ * @remarks colorTemperatureMireds persists across restarts.
1056
+ * @remarks startUpColorTemperatureMireds persists across restarts.
1057
+ * @remarks coupleColorTempToLevelMinMireds persists across restarts.
1058
+ */
602
1059
  createXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
603
1060
  this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature), {
604
1061
  colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
@@ -619,6 +1076,22 @@ export class MatterbridgeEndpoint extends Endpoint {
619
1076
  });
620
1077
  return this;
621
1078
  }
1079
+ /**
1080
+ * Creates a default hue and saturation control cluster server with feature HueSaturation and ColorTemperature.
1081
+ *
1082
+ * @param {number} currentHue - The current hue value (range: 0-254).
1083
+ * @param {number} currentSaturation - The current saturation value (range: 0-254).
1084
+ * @param {number} colorTemperatureMireds - The color temperature in mireds (default range 147-500).
1085
+ * @param {number} colorTempPhysicalMinMireds - The physical minimum color temperature in mireds (default range 147).
1086
+ * @param {number} colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds (default range 500).
1087
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1088
+ *
1089
+ * @remarks colorMode and enhancedColorMode persist across restarts.
1090
+ * @remarks currentHue and currentSaturation persist across restarts.
1091
+ * @remarks colorTemperatureMireds persists across restarts.
1092
+ * @remarks startUpColorTemperatureMireds persists across restarts.
1093
+ * @remarks coupleColorTempToLevelMinMireds persists across restarts.
1094
+ */
622
1095
  createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
623
1096
  this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
624
1097
  colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
@@ -639,6 +1112,20 @@ export class MatterbridgeEndpoint extends Endpoint {
639
1112
  });
640
1113
  return this;
641
1114
  }
1115
+ /**
1116
+ * Creates a color temperature color control cluster server with feature ColorTemperature.
1117
+ * This cluster server is used for devices that only support color temperature control.
1118
+ *
1119
+ * @param {number} colorTemperatureMireds - The color temperature in mireds (default range 147-500).
1120
+ * @param {number} colorTempPhysicalMinMireds - The physical minimum color temperature in mireds (default range 147).
1121
+ * @param {number} colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds (default range 500).
1122
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1123
+ *
1124
+ * @remarks colorMode and enhancedColorMode persist across restarts.
1125
+ * @remarks colorTemperatureMireds persists across restarts.
1126
+ * @remarks startUpColorTemperatureMireds persists across restarts.
1127
+ * @remarks coupleColorTempToLevelMinMireds persists across restarts.
1128
+ */
642
1129
  createCtColorControlClusterServer(colorTemperatureMireds = 250, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
643
1130
  this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.ColorTemperature), {
644
1131
  colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
@@ -657,15 +1144,34 @@ export class MatterbridgeEndpoint extends Endpoint {
657
1144
  });
658
1145
  return this;
659
1146
  }
1147
+ /**
1148
+ * Configures the color control mode for the device.
1149
+ *
1150
+ * @param {ColorControl.ColorMode} colorMode - The color mode to set.
1151
+ *
1152
+ * @remarks colorMode and enhancedColorMode persist across restarts.
1153
+ */
660
1154
  async configureColorControlMode(colorMode) {
661
1155
  if (isValidNumber(colorMode, ColorControl.ColorMode.CurrentHueAndCurrentSaturation, ColorControl.ColorMode.ColorTemperatureMireds)) {
662
1156
  await this.setAttribute(ColorControl.Cluster.id, 'colorMode', colorMode, this.log);
663
1157
  await this.setAttribute(ColorControl.Cluster.id, 'enhancedColorMode', colorMode, this.log);
664
1158
  }
665
1159
  }
1160
+ /**
1161
+ * Creates a default window covering cluster server with feature Lift and PositionAwareLift.
1162
+ *
1163
+ * @param {number} positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
1164
+ * @param {WindowCovering.WindowCoveringType} type - The type of window covering (default: WindowCovering.WindowCoveringType.Rollershade). Must support feature Lift.
1165
+ * @param {WindowCovering.EndProductType} endProductType - The end product type (default: WindowCovering.EndProductType.RollerShade). Must support feature Lift.
1166
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1167
+ *
1168
+ * @remarks mode attributes is writable and persists across restarts.
1169
+ * currentPositionLiftPercent100ths persists across restarts.
1170
+ * configStatus attributes persists across restarts.
1171
+ */
666
1172
  createDefaultWindowCoveringClusterServer(positionPercent100ths, type = WindowCovering.WindowCoveringType.Rollershade, endProductType = WindowCovering.EndProductType.RollerShade) {
667
1173
  this.behaviors.require(MatterbridgeLiftWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
668
- type,
1174
+ type, // Must support feature Lift
669
1175
  numberOfActuationsLift: 0,
670
1176
  configStatus: {
671
1177
  operational: true,
@@ -673,20 +1179,33 @@ export class MatterbridgeEndpoint extends Endpoint {
673
1179
  liftMovementReversed: false,
674
1180
  liftPositionAware: true,
675
1181
  tiltPositionAware: false,
676
- liftEncoderControlled: false,
677
- tiltEncoderControlled: false,
1182
+ liftEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
1183
+ tiltEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
678
1184
  },
679
1185
  operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
680
- endProductType,
1186
+ endProductType, // Must support feature Lift
681
1187
  mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
682
- targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
683
- currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
1188
+ targetPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
1189
+ currentPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
684
1190
  });
685
1191
  return this;
686
1192
  }
1193
+ /**
1194
+ * Creates a default window covering cluster server with features Lift, PositionAwareLift, Tilt, PositionAwareTilt.
1195
+ *
1196
+ * @param {number} positionLiftPercent100ths - The lift position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
1197
+ * @param {number} positionTiltPercent100ths - The tilt position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
1198
+ * @param {WindowCovering.WindowCoveringType} type - The type of window covering (default: WindowCovering.WindowCoveringType.TiltBlindLift). Must support features Lift and Tilt.
1199
+ * @param {WindowCovering.EndProductType} endProductType - The end product type (default: WindowCovering.EndProductType.InteriorBlind). Must support features Lift and Tilt.
1200
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1201
+ *
1202
+ * @remarks mode attributes is writable and persists across restarts.
1203
+ * currentPositionTiltPercent100ths persists across restarts.
1204
+ * configStatus attributes persists across restarts.
1205
+ */
687
1206
  createDefaultLiftTiltWindowCoveringClusterServer(positionLiftPercent100ths, positionTiltPercent100ths, type = WindowCovering.WindowCoveringType.TiltBlindLift, endProductType = WindowCovering.EndProductType.InteriorBlind) {
688
1207
  this.behaviors.require(MatterbridgeLiftTiltWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift, WindowCovering.Feature.Tilt, WindowCovering.Feature.PositionAwareTilt), {
689
- type,
1208
+ type, // Must support features Lift and Tilt
690
1209
  numberOfActuationsLift: 0,
691
1210
  numberOfActuationsTilt: 0,
692
1211
  configStatus: {
@@ -695,19 +1214,23 @@ export class MatterbridgeEndpoint extends Endpoint {
695
1214
  liftMovementReversed: false,
696
1215
  liftPositionAware: true,
697
1216
  tiltPositionAware: true,
698
- liftEncoderControlled: false,
699
- tiltEncoderControlled: false,
1217
+ liftEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
1218
+ tiltEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
700
1219
  },
701
1220
  operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
702
- endProductType,
1221
+ endProductType, // Must support features Lift and Tilt
703
1222
  mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
704
- targetPositionLiftPercent100ths: positionLiftPercent100ths ?? 0,
705
- currentPositionLiftPercent100ths: positionLiftPercent100ths ?? 0,
706
- targetPositionTiltPercent100ths: positionTiltPercent100ths ?? 0,
707
- currentPositionTiltPercent100ths: positionTiltPercent100ths ?? 0,
1223
+ targetPositionLiftPercent100ths: positionLiftPercent100ths ?? 0, // 0 Fully open 10000 fully closed
1224
+ currentPositionLiftPercent100ths: positionLiftPercent100ths ?? 0, // 0 Fully open 10000 fully closed
1225
+ targetPositionTiltPercent100ths: positionTiltPercent100ths ?? 0, // 0 Fully open 10000 fully closed
1226
+ currentPositionTiltPercent100ths: positionTiltPercent100ths ?? 0, // 0 Fully open 10000 fully closed
708
1227
  });
709
1228
  return this;
710
1229
  }
1230
+ /**
1231
+ * Sets the window covering lift target position as the current position and stops the movement.
1232
+ *
1233
+ */
711
1234
  async setWindowCoveringTargetAsCurrentAndStopped() {
712
1235
  const position = this.getAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', this.log);
713
1236
  if (isValidNumber(position, 0, 10000)) {
@@ -727,6 +1250,13 @@ export class MatterbridgeEndpoint extends Endpoint {
727
1250
  this.log.debug(`Set WindowCovering currentPositionTiltPercent100ths and targetPositionTiltPercent100ths to ${position} and operationalStatus to Stopped.`);
728
1251
  }
729
1252
  }
1253
+ /**
1254
+ * Sets the lift current and target position and the status of a window covering.
1255
+ *
1256
+ * @param {number} current - The current position of the window covering.
1257
+ * @param {number} target - The target position of the window covering.
1258
+ * @param {WindowCovering.MovementStatus} status - The movement status of the window covering.
1259
+ */
730
1260
  async setWindowCoveringCurrentTargetStatus(current, target, status) {
731
1261
  await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', current, this.log);
732
1262
  await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', target, this.log);
@@ -737,6 +1267,11 @@ export class MatterbridgeEndpoint extends Endpoint {
737
1267
  }, this.log);
738
1268
  this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
739
1269
  }
1270
+ /**
1271
+ * Sets the status of the window covering.
1272
+ *
1273
+ * @param {WindowCovering.MovementStatus} status - The movement status to set.
1274
+ */
740
1275
  async setWindowCoveringStatus(status) {
741
1276
  await this.setAttribute(WindowCovering.Cluster.id, 'operationalStatus', {
742
1277
  global: status,
@@ -745,6 +1280,11 @@ export class MatterbridgeEndpoint extends Endpoint {
745
1280
  }, this.log);
746
1281
  this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
747
1282
  }
1283
+ /**
1284
+ * Retrieves the status of the window covering.
1285
+ *
1286
+ * @returns {WindowCovering.MovementStatus | undefined} The movement status of the window covering, or undefined if not available.
1287
+ */
748
1288
  getWindowCoveringStatus() {
749
1289
  const status = this.getAttribute(WindowCovering.Cluster.id, 'operationalStatus', this.log);
750
1290
  if (isValidObject(status, 3) && 'global' in status && typeof status.global === 'number') {
@@ -752,6 +1292,12 @@ export class MatterbridgeEndpoint extends Endpoint {
752
1292
  return status.global;
753
1293
  }
754
1294
  }
1295
+ /**
1296
+ * Sets the lift target and current position of the window covering.
1297
+ *
1298
+ * @param {number} liftPosition - The position to set, specified as a number.
1299
+ * @param {number} [tiltPosition] - The tilt position to set, specified as a number.
1300
+ */
755
1301
  async setWindowCoveringTargetAndCurrentPosition(liftPosition, tiltPosition) {
756
1302
  await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', liftPosition, this.log);
757
1303
  await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', liftPosition, this.log);
@@ -762,31 +1308,57 @@ export class MatterbridgeEndpoint extends Endpoint {
762
1308
  this.log.debug(`Set WindowCovering currentPositionTiltPercent100ths: ${tiltPosition} and targetPositionTiltPercent100ths: ${tiltPosition}.`);
763
1309
  }
764
1310
  }
1311
+ /**
1312
+ * Creates a default thermostat cluster server with features Heating, Cooling and AutoMode.
1313
+ *
1314
+ * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
1315
+ * @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
1316
+ * @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
1317
+ * @param {number} [minSetpointDeadBand] - The minimum setpoint dead band value. Defaults to 1°.
1318
+ * @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
1319
+ * @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
1320
+ * @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
1321
+ * @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
1322
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1323
+ */
765
1324
  createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
766
1325
  this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
767
1326
  localTemperature: localTemperature * 100,
768
1327
  systemMode: Thermostat.SystemMode.Auto,
769
1328
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
1329
+ // Thermostat.Feature.Heating
770
1330
  occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
771
1331
  minHeatSetpointLimit: minHeatSetpointLimit * 100,
772
1332
  maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
773
1333
  absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
774
1334
  absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
1335
+ // Thermostat.Feature.Cooling
775
1336
  occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
776
1337
  minCoolSetpointLimit: minCoolSetpointLimit * 100,
777
1338
  maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
778
1339
  absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
779
1340
  absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
1341
+ // Thermostat.Feature.AutoMode
780
1342
  minSetpointDeadBand: minSetpointDeadBand * 100,
781
1343
  thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
782
1344
  });
783
1345
  return this;
784
1346
  }
1347
+ /**
1348
+ * Creates a default heating thermostat cluster server with feature Heating.
1349
+ *
1350
+ * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
1351
+ * @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
1352
+ * @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
1353
+ * @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
1354
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1355
+ */
785
1356
  createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
786
1357
  this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating), {
787
1358
  localTemperature: localTemperature * 100,
788
1359
  systemMode: Thermostat.SystemMode.Heat,
789
1360
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
1361
+ // Thermostat.Feature.Heating
790
1362
  occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
791
1363
  minHeatSetpointLimit: minHeatSetpointLimit * 100,
792
1364
  maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
@@ -795,11 +1367,21 @@ export class MatterbridgeEndpoint extends Endpoint {
795
1367
  });
796
1368
  return this;
797
1369
  }
1370
+ /**
1371
+ * Creates a default cooling thermostat cluster server with feature Cooling.
1372
+ *
1373
+ * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
1374
+ * @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
1375
+ * @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
1376
+ * @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
1377
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1378
+ */
798
1379
  createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
799
1380
  this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Cooling), {
800
1381
  localTemperature: localTemperature * 100,
801
1382
  systemMode: Thermostat.SystemMode.Cool,
802
1383
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
1384
+ // Thermostat.Feature.Cooling
803
1385
  occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
804
1386
  minCoolSetpointLimit: minCoolSetpointLimit * 100,
805
1387
  maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
@@ -808,6 +1390,16 @@ export class MatterbridgeEndpoint extends Endpoint {
808
1390
  });
809
1391
  return this;
810
1392
  }
1393
+ /**
1394
+ * Creates a default thermostat user interface configuration cluster server.
1395
+ *
1396
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1397
+ * @remarks
1398
+ * The default values are:
1399
+ * - temperatureDisplayMode: ThermostatUserInterfaceConfiguration.TemperatureDisplayMode.Celsius (writeble).
1400
+ * - keypadLockout: ThermostatUserInterfaceConfiguration.KeypadLockout.NoLockout (writeble).
1401
+ * - scheduleProgrammingVisibility: ThermostatUserInterfaceConfiguration.ScheduleProgrammingVisibility.ScheduleProgrammingPermitted (writeble).
1402
+ */
811
1403
  createDefaultThermostatUserInterfaceConfigurationClusterServer() {
812
1404
  this.behaviors.require(ThermostatUserInterfaceConfigurationServer, {
813
1405
  temperatureDisplayMode: ThermostatUserInterfaceConfiguration.TemperatureDisplayMode.Celsius,
@@ -816,69 +1408,159 @@ export class MatterbridgeEndpoint extends Endpoint {
816
1408
  });
817
1409
  return this;
818
1410
  }
1411
+ /**
1412
+ * Creates a default fan control cluster server with features Auto, and Step.
1413
+ *
1414
+ * @param {FanControl.FanMode} [fanMode] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
1415
+ * @param {FanControl.FanModeSequence} [fanModeSequence] - The fan mode sequence to set. Defaults to `FanControl.FanModeSequence.OffLowMedHighAuto`.
1416
+ * @param {number} [percentSetting] - The initial percent setting. Defaults to 0.
1417
+ * @param {number} [percentCurrent] - The initial percent current. Defaults to 0.
1418
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1419
+ *
1420
+ * @remarks
1421
+ * - fanmode is writable and persists across reboots.
1422
+ * - fanModeSequence is fixed.
1423
+ * - percentSetting is writable.
1424
+ */
819
1425
  createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHighAuto, percentSetting = 0, percentCurrent = 0) {
820
1426
  this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.Auto, FanControl.Feature.Step), {
821
- fanMode,
822
- fanModeSequence,
823
- percentSetting,
1427
+ fanMode, // Writable and persistent attribute
1428
+ fanModeSequence, // Fixed attribute
1429
+ percentSetting, // Writable attribute
824
1430
  percentCurrent,
825
1431
  });
826
1432
  return this;
827
1433
  }
1434
+ /**
1435
+ * Creates a fan control cluster server with features MultiSpeed, Auto, and Step.
1436
+ *
1437
+ * @param {FanControl.FanMode} [fanMode] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
1438
+ * @param {FanControl.FanModeSequence} [fanModeSequence] - The fan mode sequence to set. Defaults to `FanControl.FanModeSequence.OffLowMedHighAuto`.
1439
+ * @param {number} [percentSetting] - The initial percent setting. Defaults to 0.
1440
+ * @param {number} [percentCurrent] - The initial percent current. Defaults to 0.
1441
+ * @param {number} [speedMax] - The maximum speed setting. Defaults to 10.
1442
+ * @param {number} [speedSetting] - The initial speed setting. Defaults to 0.
1443
+ * @param {number} [speedCurrent] - The initial speed current. Defaults to 0.
1444
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1445
+ *
1446
+ * @remarks
1447
+ * - fanmode is writable and persists across reboots.
1448
+ * - fanModeSequence is fixed.
1449
+ * - percentSetting is writable.
1450
+ * - speedMax is fixed.
1451
+ * - speedSetting is writable.
1452
+ */
828
1453
  createMultiSpeedFanControlClusterServer(fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHighAuto, percentSetting = 0, percentCurrent = 0, speedMax = 10, speedSetting = 0, speedCurrent = 0) {
829
1454
  this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
830
- fanMode,
831
- fanModeSequence,
832
- percentSetting,
1455
+ fanMode, // Writable and persistent attribute
1456
+ fanModeSequence, // Fixed attribute
1457
+ percentSetting, // Writable attribute
833
1458
  percentCurrent,
834
- speedMax,
835
- speedSetting,
1459
+ // MultiSpeed feature
1460
+ speedMax, // Fixed attribute
1461
+ speedSetting, // Writable attribute
836
1462
  speedCurrent,
837
1463
  });
838
1464
  return this;
839
1465
  }
1466
+ /**
1467
+ * Creates a base fan control cluster server without features.
1468
+ *
1469
+ * @param {FanControl.FanMode} [fanMode] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
1470
+ * @param {FanControl.FanModeSequence} [fanModeSequence] - The fan mode sequence to set. Defaults to `FanControl.FanModeSequence.OffLowMedHigh`.
1471
+ * @param {number} [percentSetting] - The initial percent setting. Defaults to 0.
1472
+ * @param {number} [percentCurrent] - The initial percent current. Defaults to 0.
1473
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1474
+ *
1475
+ * @remarks
1476
+ * fanmode is writable and persists across reboots.
1477
+ * fanModeSequence is fixed.
1478
+ * percentSetting is writable.
1479
+ */
840
1480
  createBaseFanControlClusterServer(fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHigh, percentSetting = 0, percentCurrent = 0) {
841
1481
  this.behaviors.require(FanControlServer, {
842
- fanMode,
843
- fanModeSequence,
844
- percentSetting,
1482
+ fanMode, // Writable and persistent attribute
1483
+ fanModeSequence, // Fixed attribute
1484
+ percentSetting, // Writable attribute
845
1485
  percentCurrent,
846
1486
  });
847
1487
  return this;
848
1488
  }
1489
+ /**
1490
+ * Creates a default HEPA Filter Monitoring Cluster Server with features Condition and ReplacementProductList.
1491
+ * It supports ResourceMonitoring.Feature.Condition and ResourceMonitoring.Feature.ReplacementProductList.
1492
+ *
1493
+ * @param {ResourceMonitoring.ChangeIndication} changeIndication - The initial change indication. Default is ResourceMonitoring.ChangeIndication.Ok.
1494
+ * @param {boolean | undefined} inPlaceIndicator - The in-place indicator. Default is undefined.
1495
+ * @param {number | undefined} lastChangedTime - The last changed time (EpochS). Default is undefined.
1496
+ *
1497
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1498
+ */
849
1499
  createDefaultHepaFilterMonitoringClusterServer(changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = undefined, lastChangedTime = undefined) {
850
1500
  this.behaviors.require(HepaFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.ReplacementProductList), {
851
- condition: 100,
852
- degradationDirection: ResourceMonitoring.DegradationDirection.Down,
1501
+ condition: 100, // Feature.Condition
1502
+ degradationDirection: ResourceMonitoring.DegradationDirection.Down, // Feature.Condition
853
1503
  changeIndication,
854
1504
  inPlaceIndicator,
855
1505
  lastChangedTime,
856
- replacementProductList: [],
1506
+ replacementProductList: [], // Feature.ReplacementProductList
857
1507
  });
858
1508
  return this;
859
1509
  }
1510
+ /**
1511
+ * Creates a default Activated Carbon Filter Monitoring Cluster Server with features Condition and ReplacementProductList.
1512
+ *
1513
+ * @param {ResourceMonitoring.ChangeIndication} changeIndication - The initial change indication. Default is ResourceMonitoring.ChangeIndication.Ok.
1514
+ * @param {boolean | undefined} inPlaceIndicator - The in-place indicator. Default is undefined.
1515
+ * @param {number | undefined} lastChangedTime - The last changed time (EpochS). Default is undefined.
1516
+ *
1517
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1518
+ */
860
1519
  createDefaultActivatedCarbonFilterMonitoringClusterServer(changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = undefined, lastChangedTime = undefined) {
861
1520
  this.behaviors.require(ActivatedCarbonFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.ReplacementProductList), {
862
- condition: 100,
863
- degradationDirection: ResourceMonitoring.DegradationDirection.Down,
1521
+ condition: 100, // Feature.Condition
1522
+ degradationDirection: ResourceMonitoring.DegradationDirection.Down, // Feature.Condition
864
1523
  changeIndication,
865
1524
  inPlaceIndicator,
866
1525
  lastChangedTime,
867
- replacementProductList: [],
1526
+ replacementProductList: [], // Feature.ReplacementProductList
868
1527
  });
869
1528
  return this;
870
1529
  }
1530
+ /**
1531
+ * Creates a default door lock cluster server.
1532
+ *
1533
+ * @param {DoorLock.LockState} [lockState] - The initial state of the lock (default: Locked).
1534
+ * @param {DoorLock.LockType} [lockType] - The type of the lock (default: DeadBolt).
1535
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1536
+ *
1537
+ * @remarks
1538
+ * 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.
1539
+ */
871
1540
  createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
872
1541
  this.behaviors.require(MatterbridgeDoorLockServer.enable({ events: { doorLockAlarm: true, lockOperation: true, lockOperationError: true } }), {
873
1542
  lockState,
874
1543
  lockType,
875
1544
  actuatorEnabled: false,
876
1545
  operatingMode: DoorLock.OperatingMode.Normal,
1546
+ // Special case of inverted bitmap: add also alwaysSet = 2047
877
1547
  supportedOperatingModes: { normal: false, vacation: true, privacy: true, noRemoteLockUnlock: true, passage: true, alwaysSet: 2047 },
878
1548
  alarmMask: { lockJammed: false, lockFactoryReset: false, lockRadioPowerCycled: false, wrongCodeEntryLimit: false, frontEscutcheonRemoved: false, doorForcedOpen: false },
879
1549
  });
880
1550
  return this;
881
1551
  }
1552
+ /**
1553
+ * Creates a default Mode Select cluster server.
1554
+ *
1555
+ * @param {string} description - The description of the mode select cluster.
1556
+ * @param {ModeSelect.ModeOption[]} supportedModes - The list of supported modes.
1557
+ * @param {number} [currentMode] - The current mode (default: 0).
1558
+ * @param {number} [startUpMode] - The startup mode (default: 0).
1559
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1560
+ *
1561
+ * @remarks
1562
+ * endpoint.createDefaultModeSelectClusterServer('Night mode', [{ label: 'Led ON', mode: 0, semanticTags: [] }, { label: 'Led OFF', mode: 1, semanticTags: [] }], 0, 0);
1563
+ */
882
1564
  createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
883
1565
  this.behaviors.require(MatterbridgeModeSelectServer, {
884
1566
  description: description,
@@ -889,21 +1571,35 @@ export class MatterbridgeEndpoint extends Endpoint {
889
1571
  });
890
1572
  return this;
891
1573
  }
1574
+ /**
1575
+ * Creates the default Valve Configuration And Control cluster server with features Level.
1576
+ *
1577
+ * @param {ValveConfigurationAndControl.ValveState} [valveState] - The valve state to set. Defaults to `ValveConfigurationAndControl.ValveState.Closed`.
1578
+ * @param {number} [valveLevel] - The valve level to set. Defaults to 0.
1579
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1580
+ */
892
1581
  createDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
893
1582
  this.behaviors.require(MatterbridgeValveConfigurationAndControlServer.with(ValveConfigurationAndControl.Feature.Level), {
894
1583
  currentState: valveState,
895
1584
  targetState: valveState,
896
1585
  openDuration: null,
897
- defaultOpenDuration: null,
1586
+ defaultOpenDuration: null, // Writable and persistent across restarts
898
1587
  remainingDuration: null,
899
1588
  valveFault: { generalFault: false, blocked: false, leaking: false, notConnected: false, shortCircuit: false, currentExceeded: false },
1589
+ // Feature.Level
900
1590
  currentLevel: valveLevel,
901
1591
  targetLevel: valveLevel,
902
- defaultOpenLevel: 100,
903
- levelStep: 1,
1592
+ defaultOpenLevel: 100, // Writable and persistent across restarts
1593
+ levelStep: 1, // Fixed
904
1594
  });
905
1595
  return this;
906
1596
  }
1597
+ /**
1598
+ * Creates the default PumpConfigurationAndControl cluster server with features ConstantSpeed.
1599
+ *
1600
+ * @param {PumpConfigurationAndControl.OperationMode} [pumpMode] - The pump mode to set. Defaults to `PumpConfigurationAndControl.OperationMode.Normal`.
1601
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1602
+ */
907
1603
  createDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
908
1604
  this.behaviors.require(PumpConfigurationAndControlServer.with(PumpConfigurationAndControl.Feature.ConstantSpeed), {
909
1605
  minConstSpeed: null,
@@ -918,6 +1614,13 @@ export class MatterbridgeEndpoint extends Endpoint {
918
1614
  });
919
1615
  return this;
920
1616
  }
1617
+ /**
1618
+ * Creates the default SmokeCOAlarm Cluster Server with features SmokeAlarm and CoAlarm.
1619
+ *
1620
+ * @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
1621
+ * @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
1622
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1623
+ */
921
1624
  createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
922
1625
  this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm).enable({
923
1626
  events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
@@ -933,6 +1636,12 @@ export class MatterbridgeEndpoint extends Endpoint {
933
1636
  });
934
1637
  return this;
935
1638
  }
1639
+ /**
1640
+ * Creates a smoke only SmokeCOAlarm Cluster Server with features SmokeAlarm.
1641
+ *
1642
+ * @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
1643
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1644
+ */
936
1645
  createSmokeOnlySmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal) {
937
1646
  this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm).enable({
938
1647
  events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: false, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
@@ -947,6 +1656,12 @@ export class MatterbridgeEndpoint extends Endpoint {
947
1656
  });
948
1657
  return this;
949
1658
  }
1659
+ /**
1660
+ * Creates a co only SmokeCOAlarm Cluster Server with features CoAlarm.
1661
+ *
1662
+ * @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
1663
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1664
+ */
950
1665
  createCoOnlySmokeCOAlarmClusterServer(coState = SmokeCoAlarm.AlarmState.Normal) {
951
1666
  this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.CoAlarm).enable({
952
1667
  events: { smokeAlarm: false, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
@@ -961,6 +1676,13 @@ export class MatterbridgeEndpoint extends Endpoint {
961
1676
  });
962
1677
  return this;
963
1678
  }
1679
+ /**
1680
+ * Creates a default momentary switch cluster server with features MomentarySwitch, MomentarySwitchRelease, MomentarySwitchLongPress and MomentarySwitchMultiPress.
1681
+ *
1682
+ * @remarks
1683
+ * This method adds a cluster server with default momentary switch features and configuration suitable for (AppleHome) Single Double Long automations.
1684
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1685
+ */
964
1686
  createDefaultSwitchClusterServer() {
965
1687
  this.behaviors.require(MatterbridgeSwitchServer.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress).enable({
966
1688
  events: { initialPress: true, longPress: true, shortRelease: true, longRelease: true, multiPressOngoing: true, multiPressComplete: true },
@@ -971,6 +1693,13 @@ export class MatterbridgeEndpoint extends Endpoint {
971
1693
  });
972
1694
  return this;
973
1695
  }
1696
+ /**
1697
+ * Creates a default latching switch cluster server with features LatchingSwitch.
1698
+ *
1699
+ * @remarks
1700
+ * This method adds a cluster server with default latching switch features and configuration suitable for a latching switch with 2 positions.
1701
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1702
+ */
974
1703
  createDefaultLatchingSwitchClusterServer() {
975
1704
  this.behaviors.require(SwitchServer.with(Switch.Feature.LatchingSwitch).enable({
976
1705
  events: { switchLatched: true },
@@ -980,6 +1709,13 @@ export class MatterbridgeEndpoint extends Endpoint {
980
1709
  });
981
1710
  return this;
982
1711
  }
1712
+ /**
1713
+ * Triggers a switch event on the specified endpoint.
1714
+ *
1715
+ * @param {string} event - The type of event to trigger. Possible values are 'Single', 'Double', 'Long' for momentarySwitch and 'Press', 'Release' for latchingSwitch.
1716
+ * @param {AnsiLogger} log - Optional logger to log the event.
1717
+ * @returns {boolean} - A boolean indicating whether the event was successfully triggered.
1718
+ */
983
1719
  async triggerSwitchEvent(event, log) {
984
1720
  if (this.maybeNumber === undefined) {
985
1721
  this.log.error(`triggerSwitchEvent ${event} error: Endpoint number not assigned on endpoint ${this.maybeId}:${this.maybeNumber}`);
@@ -1039,10 +1775,30 @@ export class MatterbridgeEndpoint extends Endpoint {
1039
1775
  }
1040
1776
  return true;
1041
1777
  }
1778
+ /**
1779
+ * Creates a default OperationalState Cluster Server.
1780
+ *
1781
+ * @param {OperationalState.OperationalStateEnum} operationalState - The initial operational state.
1782
+ *
1783
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1784
+ */
1042
1785
  createDefaultOperationalStateClusterServer(operationalState = OperationalState.OperationalStateEnum.Stopped) {
1043
1786
  this.behaviors.require(MatterbridgeOperationalStateServer, getDefaultOperationalStateClusterServer(operationalState));
1044
1787
  return this;
1045
1788
  }
1789
+ /**
1790
+ * Creates a default boolean state cluster server.
1791
+ * The stateChange event is enabled.
1792
+ *
1793
+ * @param {boolean} contact - The state of the cluster. Defaults to true (true = contact).
1794
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1795
+ *
1796
+ * @remarks
1797
+ * Water Leak Detector: true = leak, false = no leak
1798
+ * Water Freeze Detector: true = freeze, false = no freeze
1799
+ * Rain Sensor: true = rain, false = no rain
1800
+ * Contact Sensor: true = closed or contact, false = open or no contact
1801
+ */
1046
1802
  createDefaultBooleanStateClusterServer(contact) {
1047
1803
  this.behaviors.require(BooleanStateServer.enable({
1048
1804
  events: { stateChange: true },
@@ -1051,6 +1807,22 @@ export class MatterbridgeEndpoint extends Endpoint {
1051
1807
  });
1052
1808
  return this;
1053
1809
  }
1810
+ /**
1811
+ * Creates a default boolean state configuration cluster server to be used with the waterFreezeDetector, waterLeakDetector, and rainSensor device types.
1812
+ *
1813
+ * Features:
1814
+ * - Visual
1815
+ * - Audible
1816
+ * - SensitivityLevel
1817
+ *
1818
+ * @remarks Supports the enableDisableAlarm command.
1819
+ *
1820
+ * @param {boolean} [sensorFault] - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
1821
+ * @param {number} [currentSensitivityLevel] - The current sensitivity level. Defaults to `0` if not provided.
1822
+ * @param {number} [supportedSensitivityLevels] - The number of supported sensitivity levels. Defaults to `2` if not provided (min 2, max 10).
1823
+ * @param {number} [defaultSensitivityLevel] - The default sensitivity level. Defaults to `0` if not provided.
1824
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1825
+ */
1054
1826
  createDefaultBooleanStateConfigurationClusterServer(sensorFault = false, currentSensitivityLevel = 0, supportedSensitivityLevels = 2, defaultSensitivityLevel = 0) {
1055
1827
  this.behaviors.require(MatterbridgeBooleanStateConfigurationServer.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel).enable({
1056
1828
  events: { alarmsStateChanged: true, sensorFault: true },
@@ -1065,17 +1837,50 @@ export class MatterbridgeEndpoint extends Endpoint {
1065
1837
  });
1066
1838
  return this;
1067
1839
  }
1840
+ /**
1841
+ * Creates a default Device Energy Management Cluster Server with feature PowerForecastReporting and with the specified ESA type, ESA canGenerate, ESA state, and power limits.
1842
+ *
1843
+ * @param {DeviceEnergyManagement.EsaType} [esaType] - The ESA type. Defaults to `DeviceEnergyManagement.EsaType.Other`.
1844
+ * @param {boolean} [esaCanGenerate] - Indicates if the ESA can generate energy. Defaults to `false`.
1845
+ * @param {DeviceEnergyManagement.EsaState} [esaState] - The ESA state. Defaults to `DeviceEnergyManagement.EsaState.Online`.
1846
+ * @param {number} [absMinPower] - The absolute minimum power in mW. Defaults to `0`.
1847
+ * @param {number} [absMaxPower] - The absolute maximum power in mW. Defaults to `0`.
1848
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1849
+ *
1850
+ * @remarks
1851
+ * - The forecast attribute is set to null, indicating that there is no forecast currently available.
1852
+ * - The ESA type and canGenerate attributes are fixed and cannot be changed after creation.
1853
+ * - The ESA state is set to Online by default.
1854
+ * - The absolute minimum and maximum power attributes are set to 0 by default.
1855
+ * - For example, a battery storage inverter that can charge its battery at a maximum power of 2000W and can
1856
+ * discharge the battery at a maximum power of 3000W, would have a absMinPower: -3000W, absMaxPower: 2000W.
1857
+ */
1068
1858
  createDefaultDeviceEnergyManagementClusterServer(esaType = DeviceEnergyManagement.EsaType.Other, esaCanGenerate = false, esaState = DeviceEnergyManagement.EsaState.Online, absMinPower = 0, absMaxPower = 0) {
1069
1859
  this.behaviors.require(DeviceEnergyManagementServer.with(DeviceEnergyManagement.Feature.PowerForecastReporting), {
1070
- forecast: null,
1071
- esaType,
1072
- esaCanGenerate,
1860
+ forecast: null, // A null value indicates that there is no forecast currently available
1861
+ esaType, // Fixed attribute
1862
+ esaCanGenerate, // Fixed attribute
1073
1863
  esaState,
1074
1864
  absMinPower,
1075
1865
  absMaxPower,
1076
1866
  });
1077
1867
  return this;
1078
1868
  }
1869
+ /**
1870
+ * Creates a default EnergyManagementMode Cluster Server.
1871
+ *
1872
+ * @param {number} [currentMode] - The current mode of the EnergyManagementMode cluster. Defaults to mode 1 (DeviceEnergyManagementMode.ModeTag.NoOptimization).
1873
+ * @param {EnergyManagementMode.ModeOption[]} [supportedModes] - The supported modes for the DeviceEnergyManagementMode cluster. The attribute is fixed and defaults to a predefined set of cluster modes.
1874
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1875
+ *
1876
+ * @remarks
1877
+ * A few examples of Device Energy Management modes and their mode tags are provided below.
1878
+ * - For the "No Energy Management (Forecast reporting only)" mode, tags: 0x4000 (NoOptimization).
1879
+ * - For the "Device Energy Management" mode, tags: 0x4001 (DeviceOptimization).
1880
+ * - For the "Home Energy Management" mode, tags: 0x4001 (DeviceOptimization), 0x4002 (LocalOptimization).
1881
+ * - For the "Grid Energy Management" mode, tags: 0x4003 (GridOptimization).
1882
+ * - For the "Full Energy Management" mode, tags: 0x4001 (DeviceOptimization), 0x4002 (LocalOptimization), 0x4003 (GridOptimization).
1883
+ */
1079
1884
  createDefaultDeviceEnergyManagementModeClusterServer(currentMode, supportedModes) {
1080
1885
  this.behaviors.require(MatterbridgeDeviceEnergyManagementModeServer, {
1081
1886
  supportedModes: supportedModes ?? [
@@ -1096,15 +1901,27 @@ export class MatterbridgeEndpoint extends Endpoint {
1096
1901
  mode: 5,
1097
1902
  modeTags: [{ value: DeviceEnergyManagementMode.ModeTag.DeviceOptimization }, { value: DeviceEnergyManagementMode.ModeTag.LocalOptimization }, { value: DeviceEnergyManagementMode.ModeTag.GridOptimization }],
1098
1903
  },
1099
- ],
1904
+ ], // Fixed attribute
1100
1905
  currentMode: currentMode ?? 1,
1101
1906
  });
1102
1907
  return this;
1103
1908
  }
1909
+ /**
1910
+ * Creates a default Power Topology Cluster Server with feature TreeTopology. Only needed for an electricalSensor device type.
1911
+ *
1912
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1913
+ */
1104
1914
  createDefaultPowerTopologyClusterServer() {
1105
1915
  this.behaviors.require(PowerTopologyServer.with(PowerTopology.Feature.TreeTopology));
1106
1916
  return this;
1107
1917
  }
1918
+ /**
1919
+ * Creates a default Electrical Energy Measurement Cluster Server with features ImportedEnergy, ExportedEnergy, and CumulativeEnergy.
1920
+ *
1921
+ * @param {number} energyImported - The total consumption value in mW/h.
1922
+ * @param {number} energyExported - The total production value in mW/h.
1923
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1924
+ */
1108
1925
  createDefaultElectricalEnergyMeasurementClusterServer(energyImported = null, energyExported = null) {
1109
1926
  this.behaviors.require(ElectricalEnergyMeasurementServer.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
1110
1927
  accuracy: {
@@ -1120,6 +1937,15 @@ export class MatterbridgeEndpoint extends Endpoint {
1120
1937
  });
1121
1938
  return this;
1122
1939
  }
1940
+ /**
1941
+ * Creates a default Electrical Power Measurement Cluster Server with features AlternatingCurrent.
1942
+ *
1943
+ * @param {number} voltage - The voltage value in millivolts.
1944
+ * @param {number} current - The current value in milliamperes.
1945
+ * @param {number} power - The power value in milliwatts.
1946
+ * @param {number} frequency - The frequency value in millihertz.
1947
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1948
+ */
1123
1949
  createDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
1124
1950
  this.behaviors.require(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
1125
1951
  powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
@@ -1161,36 +1987,112 @@ export class MatterbridgeEndpoint extends Endpoint {
1161
1987
  });
1162
1988
  return this;
1163
1989
  }
1990
+ /**
1991
+ * Creates a default TemperatureMeasurement cluster server.
1992
+ *
1993
+ * @param {number | null} measuredValue - The measured value of the temperature x 100.
1994
+ * @param {number | null} minMeasuredValue - The minimum measured value of the temperature x 100.
1995
+ * @param {number | null} maxMeasuredValue - The maximum measured value of the temperature x 100.
1996
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1997
+ */
1164
1998
  createDefaultTemperatureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
1165
1999
  this.behaviors.require(TemperatureMeasurementServer, getDefaultTemperatureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
1166
2000
  return this;
1167
2001
  }
2002
+ /**
2003
+ * Creates a default RelativeHumidityMeasurement cluster server.
2004
+ *
2005
+ * @param {number | null} measuredValue - The measured value of the relative humidity x 100.
2006
+ * @param {number | null} minMeasuredValue - The minimum measured value of the relative humidity x 100.
2007
+ * @param {number | null} maxMeasuredValue - The maximum measured value of the relative humidity x 100.
2008
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2009
+ */
1168
2010
  createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
1169
2011
  this.behaviors.require(RelativeHumidityMeasurementServer, getDefaultRelativeHumidityMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
1170
2012
  return this;
1171
2013
  }
2014
+ /**
2015
+ * Creates a default PressureMeasurement cluster server.
2016
+ *
2017
+ * @param {number | null} measuredValue - The measured value for the pressure.
2018
+ * @param {number | null} minMeasuredValue - The minimum measured value for the pressure.
2019
+ * @param {number | null} maxMeasuredValue - The maximum measured value for the pressure.
2020
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2021
+ */
1172
2022
  createDefaultPressureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
1173
2023
  this.behaviors.require(PressureMeasurementServer, getDefaultPressureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
1174
2024
  return this;
1175
2025
  }
2026
+ /**
2027
+ * Creates a default IlluminanceMeasurement cluster server.
2028
+ *
2029
+ * @param {number | null} measuredValue - The measured value of illuminance.
2030
+ * @param {number | null} minMeasuredValue - The minimum measured value of illuminance.
2031
+ * @param {number | null} maxMeasuredValue - The maximum measured value of illuminance.
2032
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2033
+ *
2034
+ * @remarks The default value for the illuminance measurement is null.
2035
+ * This attribute SHALL indicate the illuminance in Lux (symbol lx) as follows:
2036
+ * • MeasuredValue = 10,000 x log10(illuminance) + 1,
2037
+ * where 1 lx <= illuminance <= 3.576 Mlx, corresponding to a MeasuredValue in the range 1 to 0xFFFE.
2038
+ * • 0 indicates a value of illuminance that is too low to be measured
2039
+ * • null indicates that the illuminance measurement is invalid.
2040
+ *
2041
+ * - Lux to matter = Math.round(Math.max(Math.min(10000 * Math.log10(lux), 0xfffe), 0))
2042
+ * - Matter to Lux = Math.round(Math.max(Math.pow(10, value / 10000), 0))
2043
+ */
1176
2044
  createDefaultIlluminanceMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
1177
2045
  this.behaviors.require(IlluminanceMeasurementServer, getDefaultIlluminanceMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
1178
2046
  return this;
1179
2047
  }
2048
+ /**
2049
+ * Creates a default FlowMeasurement cluster server.
2050
+ *
2051
+ * @param {number | null} measuredValue - The measured value of the flow in 10 x m3/h.
2052
+ * @param {number | null} minMeasuredValue - The minimum measured value of the flow in 10 x m3/h.
2053
+ * @param {number | null} maxMeasuredValue - The maximum measured value of the flow in 10 x m3/h.
2054
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2055
+ */
1180
2056
  createDefaultFlowMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
1181
2057
  this.behaviors.require(FlowMeasurementServer, getDefaultFlowMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
1182
2058
  return this;
1183
2059
  }
2060
+ /**
2061
+ * Creates a default OccupancySensing cluster server with feature PassiveInfrared.
2062
+ *
2063
+ * @param {boolean} occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
2064
+ * @param {number} holdTime - The hold time in seconds. Default is 30.
2065
+ * @param {number} holdTimeMin - The minimum hold time in seconds. Default is 1.
2066
+ * @param {number} holdTimeMax - The maximum hold time in seconds. Default is 300.
2067
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2068
+ *
2069
+ * @remarks The default value for the occupancy sensor type is PIR.
2070
+ */
1184
2071
  createDefaultOccupancySensingClusterServer(occupied = false, holdTime = 30, holdTimeMin = 1, holdTimeMax = 300) {
1185
2072
  this.behaviors.require(OccupancySensingServer.with(OccupancySensing.Feature.PassiveInfrared), getDefaultOccupancySensingClusterServer(occupied, holdTime, holdTimeMin, holdTimeMax));
1186
2073
  return this;
1187
2074
  }
2075
+ /**
2076
+ * Creates a default AirQuality cluster server.
2077
+ *
2078
+ * @param {AirQuality.AirQualityEnum} airQuality The air quality level. Defaults to `AirQuality.AirQualityType.Unknown`.
2079
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2080
+ */
1188
2081
  createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
1189
2082
  this.behaviors.require(AirQualityServer.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
1190
2083
  airQuality,
1191
2084
  });
1192
2085
  return this;
1193
2086
  }
2087
+ /**
2088
+ * Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server with feature NumericMeasurement.
2089
+ *
2090
+ * @param {number | null} measuredValue - The measured value of the concentration.
2091
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2092
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2093
+ * @param {number} [uncertainty] - The uncertainty value (optional).
2094
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2095
+ */
1194
2096
  createDefaultTvocMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air, uncertainty) {
1195
2097
  this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1196
2098
  measuredValue,
@@ -1202,6 +2104,13 @@ export class MatterbridgeEndpoint extends Endpoint {
1202
2104
  });
1203
2105
  return this;
1204
2106
  }
2107
+ /**
2108
+ * Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server with feature LevelIndication.
2109
+
2110
+ * @param {ConcentrationMeasurement.LevelValue} levelValue - The level value of the measurement (default to ConcentrationMeasurement.LevelValue.Unknown).
2111
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The measurement medium (default to ConcentrationMeasurement.MeasurementMedium.Air).
2112
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2113
+ */
1205
2114
  createLevelTvocMeasurementClusterServer(levelValue = ConcentrationMeasurement.LevelValue.Unknown, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1206
2115
  this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.LevelIndication, ConcentrationMeasurement.Feature.MediumLevel, ConcentrationMeasurement.Feature.CriticalLevel), {
1207
2116
  levelValue,
@@ -1209,6 +2118,14 @@ export class MatterbridgeEndpoint extends Endpoint {
1209
2118
  });
1210
2119
  return this;
1211
2120
  }
2121
+ /**
2122
+ * Create a default CarbonMonoxideConcentrationMeasurement cluster server with feature NumericMeasurement.
2123
+ *
2124
+ * @param {number | null} measuredValue - The measured value of the concentration.
2125
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2126
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2127
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2128
+ */
1212
2129
  createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1213
2130
  this.behaviors.require(CarbonMonoxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1214
2131
  measuredValue,
@@ -1220,6 +2137,14 @@ export class MatterbridgeEndpoint extends Endpoint {
1220
2137
  });
1221
2138
  return this;
1222
2139
  }
2140
+ /**
2141
+ * Create a default CarbonDioxideConcentrationMeasurement cluster server with feature NumericMeasurement.
2142
+ *
2143
+ * @param {number | null} measuredValue - The measured value of the concentration.
2144
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2145
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2146
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2147
+ */
1223
2148
  createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1224
2149
  this.behaviors.require(CarbonDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1225
2150
  measuredValue,
@@ -1231,6 +2156,14 @@ export class MatterbridgeEndpoint extends Endpoint {
1231
2156
  });
1232
2157
  return this;
1233
2158
  }
2159
+ /**
2160
+ * Create a default FormaldehydeConcentrationMeasurement cluster server with feature NumericMeasurement.
2161
+ *
2162
+ * @param {number | null} measuredValue - The measured value of the concentration.
2163
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2164
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2165
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2166
+ */
1234
2167
  createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1235
2168
  this.behaviors.require(FormaldehydeConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1236
2169
  measuredValue,
@@ -1242,6 +2175,14 @@ export class MatterbridgeEndpoint extends Endpoint {
1242
2175
  });
1243
2176
  return this;
1244
2177
  }
2178
+ /**
2179
+ * Create a default Pm1ConcentrationMeasurement cluster server with feature NumericMeasurement.
2180
+ *
2181
+ * @param {number | null} measuredValue - The measured value of the concentration.
2182
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2183
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2184
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2185
+ */
1245
2186
  createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1246
2187
  this.behaviors.require(Pm1ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1247
2188
  measuredValue,
@@ -1253,6 +2194,14 @@ export class MatterbridgeEndpoint extends Endpoint {
1253
2194
  });
1254
2195
  return this;
1255
2196
  }
2197
+ /**
2198
+ * Create a default Pm25ConcentrationMeasurement cluster server with feature NumericMeasurement.
2199
+ *
2200
+ * @param {number | null} measuredValue - The measured value of the concentration.
2201
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2202
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2203
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2204
+ */
1256
2205
  createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1257
2206
  this.behaviors.require(Pm25ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1258
2207
  measuredValue,
@@ -1264,6 +2213,14 @@ export class MatterbridgeEndpoint extends Endpoint {
1264
2213
  });
1265
2214
  return this;
1266
2215
  }
2216
+ /**
2217
+ * Create a default Pm10ConcentrationMeasurement cluster server with feature NumericMeasurement.
2218
+ *
2219
+ * @param {number | null} measuredValue - The measured value of the concentration.
2220
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2221
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2222
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2223
+ */
1267
2224
  createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1268
2225
  this.behaviors.require(Pm10ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1269
2226
  measuredValue,
@@ -1275,6 +2232,14 @@ export class MatterbridgeEndpoint extends Endpoint {
1275
2232
  });
1276
2233
  return this;
1277
2234
  }
2235
+ /**
2236
+ * Create a default OzoneConcentrationMeasurement cluster server with feature NumericMeasurement.
2237
+ *
2238
+ * @param {number | null} measuredValue - The measured value of the concentration.
2239
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
2240
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2241
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2242
+ */
1278
2243
  createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1279
2244
  this.behaviors.require(OzoneConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1280
2245
  measuredValue,
@@ -1286,6 +2251,14 @@ export class MatterbridgeEndpoint extends Endpoint {
1286
2251
  });
1287
2252
  return this;
1288
2253
  }
2254
+ /**
2255
+ * Create a default RadonConcentrationMeasurement cluster server with feature NumericMeasurement.
2256
+ *
2257
+ * @param {number | null} measuredValue - The measured value of the concentration.
2258
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2259
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2260
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2261
+ */
1289
2262
  createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1290
2263
  this.behaviors.require(RadonConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1291
2264
  measuredValue,
@@ -1297,6 +2270,14 @@ export class MatterbridgeEndpoint extends Endpoint {
1297
2270
  });
1298
2271
  return this;
1299
2272
  }
2273
+ /**
2274
+ * Create a default NitrogenDioxideConcentrationMeasurement cluster server with feature NumericMeasurement.
2275
+ *
2276
+ * @param {number | null} measuredValue - The measured value of the concentration.
2277
+ * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
2278
+ * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2279
+ * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2280
+ */
1300
2281
  createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1301
2282
  this.behaviors.require(NitrogenDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
1302
2283
  measuredValue,
@@ -1309,3 +2290,4 @@ export class MatterbridgeEndpoint extends Endpoint {
1309
2290
  return this;
1310
2291
  }
1311
2292
  }
2293
+ //# sourceMappingURL=matterbridgeEndpoint.js.map