matterbridge 3.1.1-dev-20250703-80c685d → 3.1.1

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