matterbridge 3.2.4 → 3.2.5-dev-20250831-218c05f

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 (267) hide show
  1. package/CHANGELOG.md +19 -2
  2. package/dist/cli.js +2 -91
  3. package/dist/cliEmitter.js +0 -30
  4. package/dist/clusters/export.js +0 -2
  5. package/dist/defaultConfigSchema.js +0 -24
  6. package/dist/deviceManager.js +1 -94
  7. package/dist/devices/batteryStorage.js +1 -48
  8. package/dist/devices/cooktop.js +0 -55
  9. package/dist/devices/dishwasher.js +0 -57
  10. package/dist/devices/evse.js +10 -74
  11. package/dist/devices/export.js +0 -4
  12. package/dist/devices/extractorHood.js +0 -42
  13. package/dist/devices/heatPump.js +2 -50
  14. package/dist/devices/laundryDryer.js +3 -62
  15. package/dist/devices/laundryWasher.js +4 -70
  16. package/dist/devices/microwaveOven.js +5 -88
  17. package/dist/devices/oven.js +0 -85
  18. package/dist/devices/refrigerator.js +13 -83
  19. package/dist/devices/roboticVacuumCleaner.js +7 -93
  20. package/dist/devices/solarPower.js +0 -38
  21. package/dist/devices/temperatureControl.js +3 -25
  22. package/dist/devices/waterHeater.js +2 -82
  23. package/dist/dgram/coap.js +13 -126
  24. package/dist/dgram/dgram.js +2 -113
  25. package/dist/dgram/mb_coap.js +3 -41
  26. package/dist/dgram/mb_mdns.js +13 -51
  27. package/dist/dgram/mdns.js +137 -298
  28. package/dist/dgram/multicast.js +1 -60
  29. package/dist/dgram/unicast.js +0 -54
  30. package/dist/frontend.js +24 -451
  31. package/dist/globalMatterbridge.js +0 -47
  32. package/dist/helpers.js +0 -53
  33. package/dist/index.js +1 -30
  34. package/dist/logger/export.js +0 -1
  35. package/dist/matter/behaviors.js +0 -2
  36. package/dist/matter/clusters.js +0 -2
  37. package/dist/matter/devices.js +0 -2
  38. package/dist/matter/endpoints.js +0 -2
  39. package/dist/matter/export.js +0 -3
  40. package/dist/matter/types.js +0 -3
  41. package/dist/matterbridge.js +50 -789
  42. package/dist/matterbridgeAccessoryPlatform.js +0 -36
  43. package/dist/matterbridgeBehaviors.js +5 -65
  44. package/dist/matterbridgeDeviceTypes.js +15 -579
  45. package/dist/matterbridgeDynamicPlatform.js +0 -36
  46. package/dist/matterbridgeEndpoint.js +54 -1220
  47. package/dist/matterbridgeEndpointHelpers.js +12 -345
  48. package/dist/matterbridgePlatform.js +0 -256
  49. package/dist/matterbridgeTypes.js +0 -25
  50. package/dist/pluginManager.js +3 -249
  51. package/dist/shelly.js +7 -168
  52. package/dist/storage/export.js +0 -1
  53. package/dist/update.js +0 -69
  54. package/dist/utils/colorUtils.js +2 -97
  55. package/dist/utils/commandLine.js +0 -54
  56. package/dist/utils/copyDirectory.js +1 -38
  57. package/dist/utils/createDirectory.js +0 -33
  58. package/dist/utils/createZip.js +2 -47
  59. package/dist/utils/deepCopy.js +0 -39
  60. package/dist/utils/deepEqual.js +1 -72
  61. package/dist/utils/error.js +0 -41
  62. package/dist/utils/export.js +0 -1
  63. package/dist/utils/hex.js +0 -124
  64. package/dist/utils/isvalid.js +0 -101
  65. package/dist/utils/network.js +5 -91
  66. package/dist/utils/spawn.js +0 -40
  67. package/dist/utils/wait.js +8 -60
  68. package/npm-shrinkwrap.json +2 -2
  69. package/package.json +1 -2
  70. package/dist/cli.d.ts +0 -26
  71. package/dist/cli.d.ts.map +0 -1
  72. package/dist/cli.js.map +0 -1
  73. package/dist/cliEmitter.d.ts +0 -34
  74. package/dist/cliEmitter.d.ts.map +0 -1
  75. package/dist/cliEmitter.js.map +0 -1
  76. package/dist/clusters/export.d.ts +0 -2
  77. package/dist/clusters/export.d.ts.map +0 -1
  78. package/dist/clusters/export.js.map +0 -1
  79. package/dist/defaultConfigSchema.d.ts +0 -28
  80. package/dist/defaultConfigSchema.d.ts.map +0 -1
  81. package/dist/defaultConfigSchema.js.map +0 -1
  82. package/dist/deviceManager.d.ts +0 -112
  83. package/dist/deviceManager.d.ts.map +0 -1
  84. package/dist/deviceManager.js.map +0 -1
  85. package/dist/devices/batteryStorage.d.ts +0 -48
  86. package/dist/devices/batteryStorage.d.ts.map +0 -1
  87. package/dist/devices/batteryStorage.js.map +0 -1
  88. package/dist/devices/cooktop.d.ts +0 -60
  89. package/dist/devices/cooktop.d.ts.map +0 -1
  90. package/dist/devices/cooktop.js.map +0 -1
  91. package/dist/devices/dishwasher.d.ts +0 -71
  92. package/dist/devices/dishwasher.d.ts.map +0 -1
  93. package/dist/devices/dishwasher.js.map +0 -1
  94. package/dist/devices/evse.d.ts +0 -75
  95. package/dist/devices/evse.d.ts.map +0 -1
  96. package/dist/devices/evse.js.map +0 -1
  97. package/dist/devices/export.d.ts +0 -15
  98. package/dist/devices/export.d.ts.map +0 -1
  99. package/dist/devices/export.js.map +0 -1
  100. package/dist/devices/extractorHood.d.ts +0 -46
  101. package/dist/devices/extractorHood.d.ts.map +0 -1
  102. package/dist/devices/extractorHood.js.map +0 -1
  103. package/dist/devices/heatPump.d.ts +0 -47
  104. package/dist/devices/heatPump.d.ts.map +0 -1
  105. package/dist/devices/heatPump.js.map +0 -1
  106. package/dist/devices/laundryDryer.d.ts +0 -67
  107. package/dist/devices/laundryDryer.d.ts.map +0 -1
  108. package/dist/devices/laundryDryer.js.map +0 -1
  109. package/dist/devices/laundryWasher.d.ts +0 -81
  110. package/dist/devices/laundryWasher.d.ts.map +0 -1
  111. package/dist/devices/laundryWasher.js.map +0 -1
  112. package/dist/devices/microwaveOven.d.ts +0 -168
  113. package/dist/devices/microwaveOven.d.ts.map +0 -1
  114. package/dist/devices/microwaveOven.js.map +0 -1
  115. package/dist/devices/oven.d.ts +0 -105
  116. package/dist/devices/oven.d.ts.map +0 -1
  117. package/dist/devices/oven.js.map +0 -1
  118. package/dist/devices/refrigerator.d.ts +0 -93
  119. package/dist/devices/refrigerator.d.ts.map +0 -1
  120. package/dist/devices/refrigerator.js.map +0 -1
  121. package/dist/devices/roboticVacuumCleaner.d.ts +0 -112
  122. package/dist/devices/roboticVacuumCleaner.d.ts.map +0 -1
  123. package/dist/devices/roboticVacuumCleaner.js.map +0 -1
  124. package/dist/devices/solarPower.d.ts +0 -40
  125. package/dist/devices/solarPower.d.ts.map +0 -1
  126. package/dist/devices/solarPower.js.map +0 -1
  127. package/dist/devices/temperatureControl.d.ts +0 -166
  128. package/dist/devices/temperatureControl.d.ts.map +0 -1
  129. package/dist/devices/temperatureControl.js.map +0 -1
  130. package/dist/devices/waterHeater.d.ts +0 -111
  131. package/dist/devices/waterHeater.d.ts.map +0 -1
  132. package/dist/devices/waterHeater.js.map +0 -1
  133. package/dist/dgram/coap.d.ts +0 -205
  134. package/dist/dgram/coap.d.ts.map +0 -1
  135. package/dist/dgram/coap.js.map +0 -1
  136. package/dist/dgram/dgram.d.ts +0 -140
  137. package/dist/dgram/dgram.d.ts.map +0 -1
  138. package/dist/dgram/dgram.js.map +0 -1
  139. package/dist/dgram/mb_coap.d.ts +0 -24
  140. package/dist/dgram/mb_coap.d.ts.map +0 -1
  141. package/dist/dgram/mb_coap.js.map +0 -1
  142. package/dist/dgram/mb_mdns.d.ts +0 -24
  143. package/dist/dgram/mb_mdns.d.ts.map +0 -1
  144. package/dist/dgram/mb_mdns.js.map +0 -1
  145. package/dist/dgram/mdns.d.ts +0 -288
  146. package/dist/dgram/mdns.d.ts.map +0 -1
  147. package/dist/dgram/mdns.js.map +0 -1
  148. package/dist/dgram/multicast.d.ts +0 -65
  149. package/dist/dgram/multicast.d.ts.map +0 -1
  150. package/dist/dgram/multicast.js.map +0 -1
  151. package/dist/dgram/unicast.d.ts +0 -56
  152. package/dist/dgram/unicast.d.ts.map +0 -1
  153. package/dist/dgram/unicast.js.map +0 -1
  154. package/dist/frontend.d.ts +0 -313
  155. package/dist/frontend.d.ts.map +0 -1
  156. package/dist/frontend.js.map +0 -1
  157. package/dist/globalMatterbridge.d.ts +0 -59
  158. package/dist/globalMatterbridge.d.ts.map +0 -1
  159. package/dist/globalMatterbridge.js.map +0 -1
  160. package/dist/helpers.d.ts +0 -48
  161. package/dist/helpers.d.ts.map +0 -1
  162. package/dist/helpers.js.map +0 -1
  163. package/dist/index.d.ts +0 -33
  164. package/dist/index.d.ts.map +0 -1
  165. package/dist/index.js.map +0 -1
  166. package/dist/logger/export.d.ts +0 -2
  167. package/dist/logger/export.d.ts.map +0 -1
  168. package/dist/logger/export.js.map +0 -1
  169. package/dist/matter/behaviors.d.ts +0 -2
  170. package/dist/matter/behaviors.d.ts.map +0 -1
  171. package/dist/matter/behaviors.js.map +0 -1
  172. package/dist/matter/clusters.d.ts +0 -2
  173. package/dist/matter/clusters.d.ts.map +0 -1
  174. package/dist/matter/clusters.js.map +0 -1
  175. package/dist/matter/devices.d.ts +0 -2
  176. package/dist/matter/devices.d.ts.map +0 -1
  177. package/dist/matter/devices.js.map +0 -1
  178. package/dist/matter/endpoints.d.ts +0 -2
  179. package/dist/matter/endpoints.d.ts.map +0 -1
  180. package/dist/matter/endpoints.js.map +0 -1
  181. package/dist/matter/export.d.ts +0 -5
  182. package/dist/matter/export.d.ts.map +0 -1
  183. package/dist/matter/export.js.map +0 -1
  184. package/dist/matter/types.d.ts +0 -3
  185. package/dist/matter/types.d.ts.map +0 -1
  186. package/dist/matter/types.js.map +0 -1
  187. package/dist/matterbridge.d.ts +0 -462
  188. package/dist/matterbridge.d.ts.map +0 -1
  189. package/dist/matterbridge.js.map +0 -1
  190. package/dist/matterbridgeAccessoryPlatform.d.ts +0 -42
  191. package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
  192. package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
  193. package/dist/matterbridgeBehaviors.d.ts +0 -1351
  194. package/dist/matterbridgeBehaviors.d.ts.map +0 -1
  195. package/dist/matterbridgeBehaviors.js.map +0 -1
  196. package/dist/matterbridgeDeviceTypes.d.ts +0 -709
  197. package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
  198. package/dist/matterbridgeDeviceTypes.js.map +0 -1
  199. package/dist/matterbridgeDynamicPlatform.d.ts +0 -42
  200. package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
  201. package/dist/matterbridgeDynamicPlatform.js.map +0 -1
  202. package/dist/matterbridgeEndpoint.d.ts +0 -1356
  203. package/dist/matterbridgeEndpoint.d.ts.map +0 -1
  204. package/dist/matterbridgeEndpoint.js.map +0 -1
  205. package/dist/matterbridgeEndpointHelpers.d.ts +0 -407
  206. package/dist/matterbridgeEndpointHelpers.d.ts.map +0 -1
  207. package/dist/matterbridgeEndpointHelpers.js.map +0 -1
  208. package/dist/matterbridgePlatform.d.ts +0 -331
  209. package/dist/matterbridgePlatform.d.ts.map +0 -1
  210. package/dist/matterbridgePlatform.js.map +0 -1
  211. package/dist/matterbridgeTypes.d.ts +0 -198
  212. package/dist/matterbridgeTypes.d.ts.map +0 -1
  213. package/dist/matterbridgeTypes.js.map +0 -1
  214. package/dist/pluginManager.d.ts +0 -270
  215. package/dist/pluginManager.d.ts.map +0 -1
  216. package/dist/pluginManager.js.map +0 -1
  217. package/dist/shelly.d.ts +0 -174
  218. package/dist/shelly.d.ts.map +0 -1
  219. package/dist/shelly.js.map +0 -1
  220. package/dist/storage/export.d.ts +0 -2
  221. package/dist/storage/export.d.ts.map +0 -1
  222. package/dist/storage/export.js.map +0 -1
  223. package/dist/update.d.ts +0 -75
  224. package/dist/update.d.ts.map +0 -1
  225. package/dist/update.js.map +0 -1
  226. package/dist/utils/colorUtils.d.ts +0 -99
  227. package/dist/utils/colorUtils.d.ts.map +0 -1
  228. package/dist/utils/colorUtils.js.map +0 -1
  229. package/dist/utils/commandLine.d.ts +0 -59
  230. package/dist/utils/commandLine.d.ts.map +0 -1
  231. package/dist/utils/commandLine.js.map +0 -1
  232. package/dist/utils/copyDirectory.d.ts +0 -33
  233. package/dist/utils/copyDirectory.d.ts.map +0 -1
  234. package/dist/utils/copyDirectory.js.map +0 -1
  235. package/dist/utils/createDirectory.d.ts +0 -34
  236. package/dist/utils/createDirectory.d.ts.map +0 -1
  237. package/dist/utils/createDirectory.js.map +0 -1
  238. package/dist/utils/createZip.d.ts +0 -39
  239. package/dist/utils/createZip.d.ts.map +0 -1
  240. package/dist/utils/createZip.js.map +0 -1
  241. package/dist/utils/deepCopy.d.ts +0 -32
  242. package/dist/utils/deepCopy.d.ts.map +0 -1
  243. package/dist/utils/deepCopy.js.map +0 -1
  244. package/dist/utils/deepEqual.d.ts +0 -54
  245. package/dist/utils/deepEqual.d.ts.map +0 -1
  246. package/dist/utils/deepEqual.js.map +0 -1
  247. package/dist/utils/error.d.ts +0 -44
  248. package/dist/utils/error.d.ts.map +0 -1
  249. package/dist/utils/error.js.map +0 -1
  250. package/dist/utils/export.d.ts +0 -12
  251. package/dist/utils/export.d.ts.map +0 -1
  252. package/dist/utils/export.js.map +0 -1
  253. package/dist/utils/hex.d.ts +0 -89
  254. package/dist/utils/hex.d.ts.map +0 -1
  255. package/dist/utils/hex.js.map +0 -1
  256. package/dist/utils/isvalid.d.ts +0 -103
  257. package/dist/utils/isvalid.d.ts.map +0 -1
  258. package/dist/utils/isvalid.js.map +0 -1
  259. package/dist/utils/network.d.ts +0 -84
  260. package/dist/utils/network.d.ts.map +0 -1
  261. package/dist/utils/network.js.map +0 -1
  262. package/dist/utils/spawn.d.ts +0 -33
  263. package/dist/utils/spawn.d.ts.map +0 -1
  264. package/dist/utils/spawn.js.map +0 -1
  265. package/dist/utils/wait.d.ts +0 -54
  266. package/dist/utils/wait.d.ts.map +0 -1
  267. package/dist/utils/wait.js.map +0 -1
@@ -1,30 +1,5 @@
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
25
1
  import { Endpoint, Lifecycle, MutableEndpoint, NamedHandler, SupportedBehaviors, UINT16_MAX, UINT32_MAX, VendorId } from '@matter/main';
26
2
  import { getClusterNameById, MeasurementType } from '@matter/main/types';
27
- // @matter clusters
28
3
  import { Descriptor } from '@matter/main/clusters/descriptor';
29
4
  import { PowerSource } from '@matter/main/clusters/power-source';
30
5
  import { BridgedDeviceBasicInformation } from '@matter/main/clusters/bridged-device-basic-information';
@@ -51,7 +26,6 @@ import { ThermostatUserInterfaceConfiguration } from '@matter/main/clusters/ther
51
26
  import { OperationalState } from '@matter/main/clusters/operational-state';
52
27
  import { DeviceEnergyManagement } from '@matter/main/clusters/device-energy-management';
53
28
  import { DeviceEnergyManagementMode } from '@matter/main/clusters/device-energy-management-mode';
54
- // @matter behaviors
55
29
  import { DescriptorServer } from '@matter/main/behaviors/descriptor';
56
30
  import { PowerSourceServer } from '@matter/main/behaviors/power-source';
57
31
  import { BridgedDeviceBasicInformationServer } from '@matter/main/behaviors/bridged-device-basic-information';
@@ -83,35 +57,16 @@ import { TotalVolatileOrganicCompoundsConcentrationMeasurementServer } from '@ma
83
57
  import { FanControlServer } from '@matter/main/behaviors/fan-control';
84
58
  import { ResourceMonitoring } from '@matter/main/clusters/resource-monitoring';
85
59
  import { ThermostatUserInterfaceConfigurationServer } from '@matter/main/behaviors/thermostat-user-interface-configuration';
86
- // AnsiLogger module
87
60
  import { AnsiLogger, CYAN, YELLOW, db, debugStringify, hk, or, zb } from './logger/export.js';
88
61
  import { isValidNumber, isValidObject, isValidString } from './utils/export.js';
89
62
  import { MatterbridgeServer, MatterbridgeIdentifyServer, MatterbridgeOnOffServer, MatterbridgeLevelControlServer, MatterbridgeColorControlServer, MatterbridgeLiftWindowCoveringServer, MatterbridgeLiftTiltWindowCoveringServer, MatterbridgeThermostatServer, MatterbridgeFanControlServer, MatterbridgeDoorLockServer, MatterbridgeModeSelectServer, MatterbridgeValveConfigurationAndControlServer, MatterbridgeSmokeCoAlarmServer, MatterbridgeBooleanStateConfigurationServer, MatterbridgeSwitchServer, MatterbridgeOperationalStateServer, MatterbridgeDeviceEnergyManagementModeServer, MatterbridgeDeviceEnergyManagementServer, MatterbridgeActivatedCarbonFilterMonitoringServer, MatterbridgeHepaFilterMonitoringServer, } from './matterbridgeBehaviors.js';
90
63
  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, featuresFor, } from './matterbridgeEndpointHelpers.js';
91
64
  export class MatterbridgeEndpoint extends Endpoint {
92
- /** The default log level of the new MatterbridgeEndpoints */
93
- static logLevel = "info" /* LogLevel.INFO */;
94
- /**
95
- * Activates a special mode for this endpoint.
96
- * - 'server': it creates the device server node and add the device as Matter device that needs to be paired individually.
97
- * 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.
98
- *
99
- * - 'matter': it adds the device directly to the bridge server node as Matter device. In this case the implementation must respect
100
- * the 9.2.3. Disambiguation rule (i.e. use taglist if needed cause the device doesn't have nodeLabel).
101
- * Furthermore the device will be a part of the bridge (i.e. will have the same name and will be in the same room).
102
- * See 9.12.2.2. Native Matter functionality in Bridge.
103
- *
104
- * @remarks
105
- * Always use createDefaultBasicInformationClusterServer() to create the BasicInformation cluster server.
106
- */
65
+ static logLevel = "info";
107
66
  mode = undefined;
108
- /** The server node of the endpoint, if it is a single not bridged endpoint */
109
67
  serverNode;
110
- /** The logger instance for the MatterbridgeEndpoint */
111
68
  log;
112
- /** The plugin name this MatterbridgeEndpoint belongs to */
113
69
  plugin = undefined;
114
- /** The configuration URL of the device, if available */
115
70
  configUrl = undefined;
116
71
  deviceName = undefined;
117
72
  serialNumber = undefined;
@@ -125,28 +80,14 @@ export class MatterbridgeEndpoint extends Endpoint {
125
80
  hardwareVersion = undefined;
126
81
  hardwareVersionString = undefined;
127
82
  productUrl = 'https://www.npmjs.com/package/matterbridge';
128
- /** The name of the first device type of the endpoint (old api compatibility) */
129
83
  name = undefined;
130
- /** The code of the first device type of the endpoint (old api compatibility) */
131
84
  deviceType = undefined;
132
- /** The original id (with spaces and .) of the endpoint (old api compatibility) */
133
85
  uniqueStorageKey = undefined;
134
86
  tagList = undefined;
135
- /** Maps the DeviceTypeDefinitions with their code */
136
87
  deviceTypes = new Map();
137
- /** Command handler for the MatterbridgeEndpoint commands */
138
88
  commandHandler = new NamedHandler();
139
- /**
140
- * Represents a MatterbridgeEndpoint.
141
- *
142
- * @class MatterbridgeEndpoint
143
- * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the endpoint.
144
- * @param {MatterbridgeEndpointOptions} [options] - The options for the device.
145
- * @param {boolean} [debug] - Debug flag.
146
- */
147
89
  constructor(definition, options = {}, debug = false) {
148
90
  let deviceTypeList = [];
149
- // Get the first DeviceTypeDefinition
150
91
  let firstDefinition;
151
92
  if (Array.isArray(definition)) {
152
93
  firstDefinition = definition[0];
@@ -159,7 +100,6 @@ export class MatterbridgeEndpoint extends Endpoint {
159
100
  firstDefinition = definition;
160
101
  deviceTypeList = [{ deviceType: firstDefinition.code, revision: firstDefinition.revision }];
161
102
  }
162
- // Convert the first DeviceTypeDefinition to an EndpointType.Options
163
103
  const deviceTypeDefinitionV8 = {
164
104
  name: firstDefinition.name.replace('-', '_'),
165
105
  deviceType: firstDefinition.code,
@@ -178,20 +118,17 @@ export class MatterbridgeEndpoint extends Endpoint {
178
118
  behaviors: options.tagList ? SupportedBehaviors(DescriptorServer.with(Descriptor.Feature.TagList)) : SupportedBehaviors(DescriptorServer),
179
119
  };
180
120
  const endpointV8 = MutableEndpoint(deviceTypeDefinitionV8);
181
- // Check if the uniqueStorageKey is valid
182
121
  if (options.uniqueStorageKey && checkNotLatinCharacters(options.uniqueStorageKey)) {
183
122
  options.uniqueStorageKey = generateUniqueId(options.uniqueStorageKey);
184
123
  }
185
124
  if (options.id && checkNotLatinCharacters(options.id)) {
186
125
  options.id = generateUniqueId(options.id);
187
126
  }
188
- // Convert the options to an Endpoint.Options
189
127
  const optionsV8 = {
190
128
  id: options.uniqueStorageKey?.replace(/[ .]/g, ''),
191
129
  number: options.endpointId,
192
130
  descriptor: options.tagList ? { tagList: options.tagList, deviceTypeList } : { deviceTypeList },
193
131
  };
194
- // Override the deprecated uniqueStorageKey && endpointId with id and number if provided
195
132
  if (options.id !== undefined) {
196
133
  optionsV8.id = options.id.replace(/[ .]/g, '');
197
134
  }
@@ -211,40 +148,16 @@ export class MatterbridgeEndpoint extends Endpoint {
211
148
  }
212
149
  else
213
150
  this.deviceTypes.set(firstDefinition.code, firstDefinition);
214
- // console.log('MatterbridgeEndpoint.option', options);
215
- // console.log('MatterbridgeEndpoint.endpointV8', endpointV8);
216
- // console.log('MatterbridgeEndpoint.optionsV8', optionsV8);
217
- // Create the logger
218
- this.log = new AnsiLogger({ logName: options.uniqueStorageKey ?? 'MatterbridgeEndpoint', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: debug === true ? "debug" /* LogLevel.DEBUG */ : MatterbridgeEndpoint.logLevel });
151
+ this.log = new AnsiLogger({ logName: options.uniqueStorageKey ?? 'MatterbridgeEndpoint', logTimestampFormat: 4, logLevel: debug === true ? "debug" : MatterbridgeEndpoint.logLevel });
219
152
  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}`);
220
- // Add MatterbridgeServer
221
153
  this.behaviors.require(MatterbridgeServer, { log: this.log, commandHandler: this.commandHandler });
222
154
  }
223
- /**
224
- * Loads an instance of the MatterbridgeEndpoint class.
225
- *
226
- * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the device.
227
- * @param {MatterbridgeEndpointOptions} [options] - The options for the device.
228
- * @param {boolean} [debug] - Debug flag.
229
- * @returns {Promise<MatterbridgeEndpoint>} MatterbridgeEndpoint instance.
230
- */
231
155
  static async loadInstance(definition, options = {}, debug = false) {
232
156
  return new MatterbridgeEndpoint(definition, options, debug);
233
157
  }
234
- /**
235
- * Get all the device types of this endpoint.
236
- *
237
- * @returns {DeviceTypeDefinition[]} The device types of this endpoint.
238
- */
239
158
  getDeviceTypes() {
240
159
  return Array.from(this.deviceTypes.values());
241
160
  }
242
- /**
243
- * Checks if the provided cluster server is supported by this endpoint.
244
- *
245
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
246
- * @returns {boolean} True if the cluster server is supported, false otherwise.
247
- */
248
161
  hasClusterServer(cluster) {
249
162
  const behavior = getBehavior(this, cluster);
250
163
  if (behavior)
@@ -252,13 +165,6 @@ export class MatterbridgeEndpoint extends Endpoint {
252
165
  else
253
166
  return false;
254
167
  }
255
- /**
256
- * Checks if the provided attribute server is supported for a given cluster of this endpoint.
257
- *
258
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
259
- * @param {string} attribute - The attribute name to check.
260
- * @returns {boolean} True if the attribute server is supported, false otherwise.
261
- */
262
168
  hasAttributeServer(cluster, attribute) {
263
169
  const behavior = getBehavior(this, cluster);
264
170
  if (!behavior || !this.behaviors.supported[behavior.id])
@@ -267,239 +173,82 @@ export class MatterbridgeEndpoint extends Endpoint {
267
173
  const defaults = this.behaviors.defaultsFor(behavior);
268
174
  return lowercaseFirstLetter(attribute) in options || lowercaseFirstLetter(attribute) in defaults;
269
175
  }
270
- /**
271
- * Retrieves the initial options for the provided cluster server.
272
- *
273
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to get options for.
274
- * @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.
275
- */
276
176
  getClusterServerOptions(cluster) {
277
177
  const behavior = getBehavior(this, cluster);
278
178
  if (!behavior)
279
179
  return undefined;
280
180
  return this.behaviors.optionsFor(behavior);
281
181
  }
282
- /**
283
- * Retrieves the value of the provided attribute from the given cluster.
284
- *
285
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to retrieve the attribute from.
286
- * @param {string} attribute - The name of the attribute to retrieve.
287
- * @param {AnsiLogger} [log] - Optional logger for error and info messages.
288
- * @returns {any} The value of the attribute, or undefined if the attribute is not found.
289
- */
290
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
291
182
  getAttribute(cluster, attribute, log) {
292
183
  return getAttribute(this, cluster, attribute, log);
293
184
  }
294
- /**
295
- * Sets the value of an attribute on a cluster server.
296
- *
297
- * @param {Behavior.Type | ClusterType | ClusterId | string} clusterId - The ID of the cluster.
298
- * @param {string} attribute - The name of the attribute.
299
- * @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
300
- * @param {AnsiLogger} [log] - (Optional) The logger to use for logging errors and information.
301
- * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
302
- */
303
185
  async setAttribute(clusterId, attribute, value, log) {
304
186
  return await setAttribute(this, clusterId, attribute, value, log);
305
187
  }
306
- /**
307
- * Update the value of an attribute on a cluster server only if the value is different.
308
- *
309
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to set the attribute on.
310
- * @param {string} attribute - The name of the attribute.
311
- * @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
312
- * @param {AnsiLogger} [log] - (Optional) The logger to use for logging the update. Errors are logged to the endpoint logger.
313
- * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
314
- */
315
188
  async updateAttribute(cluster, attribute, value, log) {
316
189
  return await updateAttribute(this, cluster, attribute, value, log);
317
190
  }
318
- /**
319
- * Subscribes to the provided attribute on a cluster.
320
- *
321
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to subscribe the attribute to.
322
- * @param {string} attribute - The name of the attribute to subscribe to.
323
- * @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.
324
- * @param {AnsiLogger} [log] - Optional logger for logging errors and information.
325
- * @returns {Promise<boolean>} - A boolean indicating whether the subscription was successful.
326
- *
327
- * @remarks The listener function (cannot be async) will receive three parameters:
328
- * - `newValue`: The new value of the attribute.
329
- * - `oldValue`: The old value of the attribute.
330
- * - `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.
331
- */
332
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
333
191
  async subscribeAttribute(cluster, attribute, listener, log) {
334
192
  return await subscribeAttribute(this, cluster, attribute, listener, log);
335
193
  }
336
- /**
337
- * Triggers an event on the specified cluster.
338
- *
339
- * @param {ClusterId} cluster - The ID of the cluster.
340
- * @param {string} event - The name of the event to trigger.
341
- * @param {Record<string, boolean | number | bigint | string | object | undefined | null>} payload - The payload to pass to the event.
342
- * @param {AnsiLogger} [log] - Optional logger for logging information.
343
- * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the event was successfully triggered.
344
- */
345
194
  async triggerEvent(cluster, event, payload, log) {
346
195
  return await triggerEvent(this, cluster, event, payload, log);
347
196
  }
348
- /**
349
- * Adds cluster servers from the provided server list.
350
- *
351
- * @param {ClusterId[]} serverList - The list of cluster IDs to add.
352
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
353
- */
354
197
  addClusterServers(serverList) {
355
198
  addClusterServers(this, serverList);
356
199
  return this;
357
200
  }
358
- /**
359
- * Adds a fixed label to the FixedLabel cluster. If the cluster server is not present, it will be added.
360
- *
361
- * @param {string} label - The label to add.
362
- * @param {string} value - The value of the label.
363
- * @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
364
- */
365
201
  async addFixedLabel(label, value) {
366
202
  await addFixedLabel(this, label, value);
367
203
  return this;
368
204
  }
369
- /**
370
- * Adds a user label to the UserLabel cluster. If the cluster server is not present, it will be added.
371
- *
372
- * @param {string} label - The label to add.
373
- * @param {string} value - The value of the label.
374
- * @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
375
- */
376
205
  async addUserLabel(label, value) {
377
206
  await addUserLabel(this, label, value);
378
207
  return this;
379
208
  }
380
- /**
381
- * Adds a command handler for the specified command.
382
- *
383
- * @param {keyof MatterbridgeEndpointCommands} command - The command to add the handler for.
384
- * @param {CommandHandlerFunction} handler - The handler function to execute when the command is received.
385
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
386
- *
387
- * @remarks
388
- * The handler function will receive an object with the following properties:
389
- * - `request`: The request object sent with the command.
390
- * - `cluster`: The id of the cluster that received the command (i.e. "onOff").
391
- * - `attributes`: The current attributes of the cluster that received the command (i.e. { onOff: true}).
392
- * - `endpoint`: The MatterbridgeEndpoint instance that received the command.
393
- */
394
209
  addCommandHandler(command, handler) {
395
210
  this.commandHandler.addHandler(command, handler);
396
211
  return this;
397
212
  }
398
- /**
399
- * Execute the command handler for the specified command. Used ONLY in Jest tests.
400
- *
401
- * @param {keyof MatterbridgeEndpointCommands} command - The command to execute.
402
- * @param {Record<string, boolean | number | bigint | string | object | null>} [request] - The optional request to pass to the handler function.
403
- * @param {string} [cluster] - The optional cluster to pass to the handler function.
404
- * @param {Record<string, boolean | number | bigint | string | object | null>} [attributes] - The optional attributes to pass to the handler function.
405
- * @param {MatterbridgeEndpoint} [endpoint] - The optional MatterbridgeEndpoint instance to pass to the handler function
406
- *
407
- * @deprecated Used ONLY in Jest tests.
408
- */
409
213
  async executeCommandHandler(command, request, cluster, attributes, endpoint) {
410
214
  await this.commandHandler.executeHandler(command, { request, cluster, attributes, endpoint });
411
215
  }
412
- /**
413
- * Invokes a behavior command on the specified cluster. Used ONLY in Jest tests.
414
- *
415
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to invoke the command on.
416
- * @param {string} command - The command to invoke.
417
- * @param {Record<string, boolean | number | bigint | string | object | null>} [params] - The optional parameters to pass to the command.
418
- *
419
- * @deprecated Used ONLY in Jest tests.
420
- */
421
216
  async invokeBehaviorCommand(cluster, command, params) {
422
217
  await invokeBehaviorCommand(this, cluster, command, params);
423
218
  }
424
- /**
425
- * Adds the required cluster servers (only if they are not present) for the device types of the specified endpoint.
426
- *
427
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
428
- */
429
219
  addRequiredClusterServers() {
430
220
  addRequiredClusterServers(this);
431
221
  return this;
432
222
  }
433
- /**
434
- * Adds the optional cluster servers (only if they are not present) for the device types of the specified endpoint.
435
- *
436
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
437
- */
438
223
  addOptionalClusterServers() {
439
224
  addOptionalClusterServers(this);
440
225
  return this;
441
226
  }
442
- /**
443
- * Retrieves all cluster servers.
444
- *
445
- * @returns {Behavior.Type[]} An array of all cluster servers.
446
- */
447
227
  getAllClusterServers() {
448
228
  return Object.values(this.behaviors.supported);
449
229
  }
450
- /**
451
- * Retrieves the names of all cluster servers.
452
- *
453
- * @returns {string[]} An array of all cluster server names.
454
- */
455
230
  getAllClusterServerNames() {
456
231
  return Object.keys(this.behaviors.supported);
457
232
  }
458
- /**
459
- * Iterates over each attribute of each cluster server of the device state and calls the provided callback function.
460
- *
461
- * @param {Function} callback - The callback function to call with the cluster name, cluster id, attribute name, attribute id and attribute value.
462
- */
463
233
  forEachAttribute(callback) {
464
234
  if (!this.lifecycle.isReady || this.construction.status !== Lifecycle.Status.Active)
465
235
  return;
466
236
  for (const [clusterName, clusterAttributes] of Object.entries(this.state)) {
467
- // Skip if the key / cluster name is a number, cause they are double indexed.
468
237
  if (!isNaN(Number(clusterName)))
469
238
  continue;
470
239
  for (const [attributeName, attributeValue] of Object.entries(clusterAttributes)) {
471
- // Skip if the behavior has no associated cluster (i.e. matterbridge server)
472
240
  const clusterId = getClusterId(this, clusterName);
473
241
  if (clusterId === undefined) {
474
- // this.log.debug(`***forEachAttribute: cluster ${clusterName} not found`);
475
242
  continue;
476
243
  }
477
- // Skip if the attribute is not present in the ClusterBehavior.Type. Also skip if the attribute it is an internal state.
478
244
  const attributeId = getAttributeId(this, clusterName, attributeName);
479
245
  if (attributeId === undefined) {
480
- // this.log.debug(`***forEachAttribute: attribute ${clusterName}.${attributeName} not found`);
481
246
  continue;
482
247
  }
483
248
  callback(clusterName, clusterId, attributeName, attributeId, attributeValue);
484
249
  }
485
250
  }
486
251
  }
487
- /**
488
- * Adds a child endpoint with the specified device types and options.
489
- * If the child endpoint is not already present, it will be created and added.
490
- * If the child endpoint is already present, the existing child endpoint will be returned.
491
- *
492
- * @param {string} endpointName - The name of the new endpoint to add.
493
- * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
494
- * @param {MatterbridgeEndpointOptions} [options] - The options for the endpoint.
495
- * @param {boolean} [debug] - Whether to enable debug logging.
496
- * @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
497
- *
498
- * @example
499
- * ```typescript
500
- * const endpoint = device.addChildDeviceType('Temperature', [temperatureSensor], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
501
- * ```
502
- */
503
252
  addChildDeviceType(endpointName, definition, options = {}, debug = false) {
504
253
  this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
505
254
  let alreadyAdded = false;
@@ -539,23 +288,6 @@ export class MatterbridgeEndpoint extends Endpoint {
539
288
  }
540
289
  return child;
541
290
  }
542
- /**
543
- * Adds a child endpoint with one or more device types with the required cluster servers and the specified cluster servers.
544
- * If the child endpoint is not already present in the childEndpoints, it will be added.
545
- * If the child endpoint is already present in the childEndpoints, the device types and cluster servers will be added to the existing child endpoint.
546
- *
547
- * @param {string} endpointName - The name of the new enpoint to add.
548
- * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
549
- * @param {ClusterId[]} [serverList] - The list of cluster IDs to include.
550
- * @param {MatterbridgeEndpointOptions} [options] - The options for the device.
551
- * @param {boolean} [debug] - Whether to enable debug logging.
552
- * @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
553
- *
554
- * @example
555
- * ```typescript
556
- * const endpoint = device.addChildDeviceTypeWithClusterServer('Temperature', [temperatureSensor], [], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
557
- * ```
558
- */
559
291
  addChildDeviceTypeWithClusterServer(endpointName, definition, serverList = [], options = {}, debug = false) {
560
292
  this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
561
293
  let alreadyAdded = false;
@@ -618,39 +350,15 @@ export class MatterbridgeEndpoint extends Endpoint {
618
350
  }
619
351
  return child;
620
352
  }
621
- /**
622
- * Retrieves a child endpoint by its name.
623
- *
624
- * @param {string} endpointName - The name of the endpoint to retrieve.
625
- * @returns {Endpoint | undefined} The child endpoint with the specified name, or undefined if not found.
626
- */
627
353
  getChildEndpointByName(endpointName) {
628
354
  return this.parts.find((part) => part.id === endpointName);
629
355
  }
630
- /**
631
- * Retrieves a child endpoint by its EndpointNumber.
632
- *
633
- * @param {EndpointNumber} endpointNumber - The EndpointNumber of the endpoint to retrieve.
634
- * @returns {MatterbridgeEndpoint | undefined} The child endpoint with the specified EndpointNumber, or undefined if not found.
635
- */
636
356
  getChildEndpoint(endpointNumber) {
637
357
  return this.parts.find((part) => part.number === endpointNumber);
638
358
  }
639
- /**
640
- * Get all the child endpoints of this endpoint.
641
- *
642
- * @returns {MatterbridgeEndpoint[]} The child endpoints.
643
- */
644
359
  getChildEndpoints() {
645
360
  return Array.from(this.parts);
646
361
  }
647
- /**
648
- * Serializes the Matterbridge device into a serialized object.
649
- *
650
- * @param {MatterbridgeEndpoint} device - The Matterbridge device to serialize.
651
- *
652
- * @returns {SerializedMatterbridgeEndpoint | undefined} The serialized Matterbridge device object.
653
- */
654
362
  static serialize(device) {
655
363
  if (!device.serialNumber || !device.deviceName || !device.uniqueId)
656
364
  return;
@@ -673,16 +381,9 @@ export class MatterbridgeEndpoint extends Endpoint {
673
381
  serialized.clusterServersId.push(BridgedDeviceBasicInformation.Cluster.id);
674
382
  if (behaviorName === 'powerSource')
675
383
  serialized.clusterServersId.push(PowerSource.Cluster.id);
676
- // serialized.clusterServersId.push(this.behaviors.supported[behaviorName]cluster.id);
677
384
  });
678
385
  return serialized;
679
386
  }
680
- /**
681
- * Deserializes the device into a serialized object.
682
- *
683
- * @param {SerializedMatterbridgeEndpoint} serializedDevice - The serialized Matterbridge device object.
684
- * @returns {MatterbridgeEndpoint | undefined} The deserialized Matterbridge device.
685
- */
686
387
  static deserialize(serializedDevice) {
687
388
  const device = new MatterbridgeEndpoint(serializedDevice.deviceTypes, { uniqueStorageKey: serializedDevice.endpointName, endpointId: serializedDevice.endpoint }, false);
688
389
  device.plugin = serializedDevice.pluginName;
@@ -698,126 +399,55 @@ export class MatterbridgeEndpoint extends Endpoint {
698
399
  device.createDefaultBridgedDeviceBasicInformationClusterServer(serializedDevice.deviceName, serializedDevice.serialNumber, serializedDevice.vendorId ?? 0xfff1, serializedDevice.vendorName ?? 'Matterbridge', serializedDevice.productName ?? 'Matterbridge device');
699
400
  else if (clusterId === PowerSource.Cluster.id)
700
401
  device.createDefaultPowerSourceWiredClusterServer();
701
- // else addClusterServerFromList(device, [clusterId]);
702
402
  }
703
403
  return device;
704
404
  }
705
- /**
706
- * Creates a default power source wired cluster server.
707
- *
708
- * @param {PowerSource.WiredCurrentType} wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
709
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
710
- *
711
- * @remarks
712
- * - order: The order of the power source is a persisted attribute that indicates the order in which the power sources are used.
713
- * - description: The description of the power source is a fixed attribute that describes the power source type.
714
- * - wiredCurrentType: The type of wired current is a fixed attribute that indicates the type of wired current used by the power source (AC or DC).
715
- */
716
405
  createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
717
406
  this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Wired), {
718
- // Base attributes
719
407
  status: PowerSource.PowerSourceStatus.Active,
720
408
  order: 0,
721
409
  description: wiredCurrentType === PowerSource.WiredCurrentType.Ac ? 'AC Power' : 'DC Power',
722
410
  endpointList: [],
723
- // Wired feature attributes
724
411
  wiredCurrentType,
725
412
  });
726
413
  return this;
727
414
  }
728
- /**
729
- * Creates a default power source replaceable battery cluster server.
730
- *
731
- * @param {number} batPercentRemaining - The remaining battery percentage (default: 100).
732
- * @param {PowerSource.BatChargeLevel} batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
733
- * @param {number} batVoltage - The battery voltage (default: 1500).
734
- * @param {string} batReplacementDescription - The description of the battery replacement (default: 'Battery type').
735
- * @param {number} batQuantity - The quantity of the battery (default: 1).
736
- * @param {PowerSource.BatReplaceability} batReplaceability - The replaceability of the battery (default: PowerSource.BatReplaceability.Unspecified).
737
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
738
- *
739
- * @remarks
740
- * - order: The order of the power source is a persisted attribute that indicates the order in which the power sources are used.
741
- * - description: The description of the power source is a fixed attribute that describes the power source type.
742
- * - batReplaceability: The replaceability of the battery is a fixed attribute that indicates whether the battery is user-replaceable or not.
743
- * - batReplacementDescription: The description of the battery replacement is a fixed attribute that describes the battery type.
744
- * - batQuantity: The quantity of the battery is a fixed attribute that indicates how many batteries are present in the device.
745
- */
746
415
  createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1, batReplaceability = PowerSource.BatReplaceability.UserReplaceable) {
747
416
  this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
748
- // Base attributes
749
417
  status: PowerSource.PowerSourceStatus.Active,
750
418
  order: 0,
751
419
  description: 'Primary battery',
752
420
  endpointList: [],
753
- // Battery feature attributes
754
421
  batVoltage,
755
422
  batPercentRemaining: Math.min(Math.max(batPercentRemaining * 2, 0), 200),
756
423
  batChargeLevel,
757
424
  batReplacementNeeded: false,
758
425
  batReplaceability,
759
426
  activeBatFaults: undefined,
760
- // Replaceable feature attributes
761
427
  batReplacementDescription,
762
428
  batQuantity,
763
429
  });
764
430
  return this;
765
431
  }
766
- /**
767
- * Creates a default power source rechargeable battery cluster server.
768
- *
769
- * @param {number} [batPercentRemaining] - The remaining battery percentage (default: 100).
770
- * @param {PowerSource.BatChargeLevel} [batChargeLevel] - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
771
- * @param {number} [batVoltage] - The battery voltage in mV (default: 1500).
772
- * @param {PowerSource.BatReplaceability} [batReplaceability] - The replaceability of the battery (default: PowerSource.BatReplaceability.Unspecified).
773
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
774
- *
775
- * @remarks
776
- * - order: The order of the power source is a persisted attribute that indicates the order in which the power sources are used.
777
- * - description: The description of the power source is a fixed attribute that describes the power source type.
778
- * - batReplaceability: The replaceability of the battery is a fixed attribute that indicates whether the battery is user-replaceable or not.
779
- */
780
432
  createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplaceability = PowerSource.BatReplaceability.Unspecified) {
781
433
  this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
782
- // Base attributes
783
434
  status: PowerSource.PowerSourceStatus.Active,
784
435
  order: 0,
785
436
  description: 'Primary battery',
786
437
  endpointList: [],
787
- // Battery feature attributes
788
438
  batVoltage,
789
439
  batPercentRemaining: Math.min(Math.max(batPercentRemaining * 2, 0), 200),
790
- batTimeRemaining: null, // Indicates the estimated time in seconds before the battery will no longer be able to provide power to the Node
440
+ batTimeRemaining: null,
791
441
  batChargeLevel,
792
442
  batReplacementNeeded: false,
793
443
  batReplaceability,
794
444
  batPresent: true,
795
445
  activeBatFaults: [],
796
- // Rechargeable feature attributes
797
446
  batChargeState: PowerSource.BatChargeState.IsNotCharging,
798
447
  batFunctionalWhileCharging: true,
799
448
  });
800
449
  return this;
801
450
  }
802
- /**
803
- * Setup the default Basic Information Cluster Server attributes for the server node.
804
- *
805
- * This method sets the device name, serial number, unique ID, vendor ID, vendor name, product ID, product name, software version, software version string, hardware version and hardware version string.
806
- *
807
- * The actual BasicInformationClusterServer is created by the Matterbridge class for device.mode = 'server' and for the device of an AccessoryPlatform.
808
- *
809
- * @param {string} deviceName - The name of the device.
810
- * @param {string} serialNumber - The serial number of the device.
811
- * @param {number} [vendorId] - The vendor ID of the device. Default is 0xfff1 (Matter Test VendorId).
812
- * @param {string} [vendorName] - The name of the vendor. Default is 'Matterbridge'.
813
- * @param {number} [productId] - The product ID of the device. Default is 0x8000 (Matter Test ProductId).
814
- * @param {string} [productName] - The name of the product. Default is 'Matterbridge device'.
815
- * @param {number} [softwareVersion] - The software version of the device. Default is 1.
816
- * @param {string} [softwareVersionString] - The software version string of the device. Default is '1.0.0'.
817
- * @param {number} [hardwareVersion] - The hardware version of the device. Default is 1.
818
- * @param {string} [hardwareVersionString] - The hardware version string of the device. Default is '1.0.0'.
819
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
820
- */
821
451
  createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId = 0xfff1, vendorName = 'Matterbridge', productId = 0x8000, productName = 'Matterbridge device', softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
822
452
  this.log.logName = deviceName;
823
453
  this.deviceName = deviceName;
@@ -833,26 +463,6 @@ export class MatterbridgeEndpoint extends Endpoint {
833
463
  this.hardwareVersionString = hardwareVersionString;
834
464
  return this;
835
465
  }
836
- /**
837
- * Creates a default BridgedDeviceBasicInformationClusterServer for the aggregator endpoints.
838
- *
839
- * This method sets the device name, serial number, unique ID, vendor ID, vendor name, product name, software version, software version string, hardware version and hardware version string.
840
- *
841
- * @param {string} deviceName - The name of the device.
842
- * @param {string} serialNumber - The serial number of the device.
843
- * @param {number} [vendorId] - The vendor ID of the device. Default is 0xfff1 (Matter Test VendorId).
844
- * @param {string} [vendorName] - The name of the vendor. Default is 'Matterbridge'.
845
- * @param {string} [productName] - The name of the product. Default is 'Matterbridge device'.
846
- * @param {number} [softwareVersion] - The software version of the device. Default is 1.
847
- * @param {string} [softwareVersionString] - The software version string of the device. Default is '1.0.0'.
848
- * @param {number} [hardwareVersion] - The hardware version of the device. Default is 1.
849
- * @param {string} [hardwareVersionString] - The hardware version string of the device. Default is '1.0.0'.
850
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
851
- *
852
- * @remarks
853
- * - The productId doesn't exist on the BridgedDeviceBasicInformation cluster.
854
- * - The bridgedNode device type must be added to the deviceTypeList of the Descriptor cluster.
855
- */
856
466
  createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId = 0xfff1, vendorName = 'Matterbridge', productName = 'Matterbridge device', softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
857
467
  this.log.logName = deviceName;
858
468
  this.deviceName = deviceName;
@@ -885,13 +495,6 @@ export class MatterbridgeEndpoint extends Endpoint {
885
495
  });
886
496
  return this;
887
497
  }
888
- /**
889
- * Creates a default identify cluster server with the specified identify time and type.
890
- *
891
- * @param {number} [identifyTime] - The time to identify the server. Defaults to 0.
892
- * @param {Identify.IdentifyType} [identifyType] - The type of identification. Defaults to Identify.IdentifyType.None.
893
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
894
- */
895
498
  createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
896
499
  this.behaviors.require(MatterbridgeIdentifyServer, {
897
500
  identifyTime,
@@ -899,36 +502,14 @@ export class MatterbridgeEndpoint extends Endpoint {
899
502
  });
900
503
  return this;
901
504
  }
902
- /**
903
- * Creates a default groups cluster server.
904
- *
905
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
906
- */
907
505
  createDefaultGroupsClusterServer() {
908
506
  this.behaviors.require(GroupsServer);
909
507
  return this;
910
508
  }
911
- /**
912
- * Creates a default scenes management cluster server.
913
- *
914
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
915
- *
916
- * @remarks The scenes management cluster server is still provisional and so not yet implemented.
917
- */
918
509
  createDefaultScenesClusterServer() {
919
510
  this.behaviors.require(ScenesManagementServer);
920
511
  return this;
921
512
  }
922
- /**
923
- * Creates a default OnOff cluster server for light devices with feature Lighting.
924
- *
925
- * @param {boolean} [onOff] - The initial state of the OnOff cluster.
926
- * @param {boolean} [globalSceneControl] - The global scene control state.
927
- * @param {number} [onTime] - The on time value.
928
- * @param {number} [offWaitTime] - The off wait time value.
929
- * @param {OnOff.StartUpOnOff | null} [startUpOnOff] - The start-up OnOff state. Null means previous state.
930
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
931
- */
932
513
  createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
933
514
  this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.Lighting), {
934
515
  onOff,
@@ -939,52 +520,24 @@ export class MatterbridgeEndpoint extends Endpoint {
939
520
  });
940
521
  return this;
941
522
  }
942
- /**
943
- * Creates an OnOff cluster server without features.
944
- *
945
- * @param {boolean} [onOff] - The initial state of the OnOff cluster.
946
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
947
- */
948
523
  createOnOffClusterServer(onOff = false) {
949
524
  this.behaviors.require(MatterbridgeOnOffServer, {
950
525
  onOff,
951
526
  });
952
527
  return this;
953
528
  }
954
- /**
955
- * Creates a DeadFront OnOff cluster server with feature DeadFrontBehavior.
956
- *
957
- * @param {boolean} [onOff] - The initial state of the OnOff cluster.
958
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
959
- */
960
529
  createDeadFrontOnOffClusterServer(onOff = false) {
961
530
  this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.DeadFrontBehavior), {
962
531
  onOff,
963
532
  });
964
533
  return this;
965
534
  }
966
- /**
967
- * Creates an OffOnly OnOff cluster server with feature OffOnly.
968
- *
969
- * @param {boolean} [onOff] - The initial state of the OnOff cluster.
970
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
971
- */
972
535
  createOffOnlyOnOffClusterServer(onOff = false) {
973
536
  this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.OffOnly), {
974
537
  onOff,
975
538
  });
976
539
  return this;
977
540
  }
978
- /**
979
- * Creates a default level control cluster server for light devices with feature OnOff and Lighting.
980
- *
981
- * @param {number} [currentLevel] - The current level (default: 254).
982
- * @param {number} [minLevel] - The minimum level (default: 1).
983
- * @param {number} [maxLevel] - The maximum level (default: 254).
984
- * @param {number | null} [onLevel] - The on level (default: null).
985
- * @param {number | null} [startUpCurrentLevel] - The startUp on level (default: null).
986
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
987
- */
988
541
  createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
989
542
  this.behaviors.require(MatterbridgeLevelControlServer.with(LevelControl.Feature.OnOff, LevelControl.Feature.Lighting), {
990
543
  currentLevel,
@@ -1000,13 +553,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1000
553
  });
1001
554
  return this;
1002
555
  }
1003
- /**
1004
- * Creates a level control cluster server without features.
1005
- *
1006
- * @param {number} [currentLevel] - The current level (default: 254).
1007
- * @param {number | null} [onLevel] - The on level (default: null).
1008
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1009
- */
1010
556
  createLevelControlClusterServer(currentLevel = 254, onLevel = null) {
1011
557
  this.behaviors.require(MatterbridgeLevelControlServer, {
1012
558
  currentLevel,
@@ -1018,25 +564,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1018
564
  });
1019
565
  return this;
1020
566
  }
1021
- /**
1022
- * Creates a default color control cluster server with features Xy, HueSaturation and ColorTemperature.
1023
- *
1024
- * @param {number} currentX - The current X value (range 0-65279).
1025
- * @param {number} currentY - The current Y value (range 0-65279).
1026
- * @param {number} currentHue - The current hue value (range: 0-254).
1027
- * @param {number} currentSaturation - The current saturation value (range: 0-254).
1028
- * @param {number} colorTemperatureMireds - The color temperature in mireds (default range 147-500).
1029
- * @param {number} colorTempPhysicalMinMireds - The physical minimum color temperature in mireds (default range 147).
1030
- * @param {number} colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds (default range 500).
1031
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1032
- *
1033
- * @remarks colorMode and enhancedColorMode persist across restarts.
1034
- * @remarks currentHue and currentSaturation persist across restarts.
1035
- * @remarks currentX and currentY persist across restarts.
1036
- * @remarks colorTemperatureMireds persists across restarts.
1037
- * @remarks startUpColorTemperatureMireds persists across restarts.
1038
- * @remarks coupleColorTempToLevelMinMireds persists across restarts.
1039
- */
1040
567
  createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1041
568
  this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
1042
569
  colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
@@ -1059,25 +586,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1059
586
  });
1060
587
  return this;
1061
588
  }
1062
- /**
1063
- * Creates a Xy color control cluster server with feature Xy and ColorTemperature.
1064
- *
1065
- * @param {number} currentX - The current X value (range 0-65279).
1066
- * @param {number} currentY - The current Y value (range 0-65279).
1067
- * @param {number} colorTemperatureMireds - The color temperature in mireds (default range 147-500).
1068
- * @param {number} colorTempPhysicalMinMireds - The physical minimum color temperature in mireds (default range 147).
1069
- * @param {number} colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds (default range 500).
1070
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1071
- *
1072
- * @remarks
1073
- * From zigbee to matter = Math.max(Math.min(Math.round(x * 65536), 65279), 0)
1074
- *
1075
- * @remarks colorMode and enhancedColorMode persist across restarts.
1076
- * @remarks currentX and currentY persist across restarts.
1077
- * @remarks colorTemperatureMireds persists across restarts.
1078
- * @remarks startUpColorTemperatureMireds persists across restarts.
1079
- * @remarks coupleColorTempToLevelMinMireds persists across restarts.
1080
- */
1081
589
  createXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1082
590
  this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature), {
1083
591
  colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
@@ -1098,22 +606,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1098
606
  });
1099
607
  return this;
1100
608
  }
1101
- /**
1102
- * Creates a default hue and saturation control cluster server with feature HueSaturation and ColorTemperature.
1103
- *
1104
- * @param {number} currentHue - The current hue value (range: 0-254).
1105
- * @param {number} currentSaturation - The current saturation value (range: 0-254).
1106
- * @param {number} colorTemperatureMireds - The color temperature in mireds (default range 147-500).
1107
- * @param {number} colorTempPhysicalMinMireds - The physical minimum color temperature in mireds (default range 147).
1108
- * @param {number} colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds (default range 500).
1109
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1110
- *
1111
- * @remarks colorMode and enhancedColorMode persist across restarts.
1112
- * @remarks currentHue and currentSaturation persist across restarts.
1113
- * @remarks colorTemperatureMireds persists across restarts.
1114
- * @remarks startUpColorTemperatureMireds persists across restarts.
1115
- * @remarks coupleColorTempToLevelMinMireds persists across restarts.
1116
- */
1117
609
  createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1118
610
  this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
1119
611
  colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
@@ -1134,20 +626,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1134
626
  });
1135
627
  return this;
1136
628
  }
1137
- /**
1138
- * Creates a color temperature color control cluster server with feature ColorTemperature.
1139
- * This cluster server is used for devices that only support color temperature control.
1140
- *
1141
- * @param {number} colorTemperatureMireds - The color temperature in mireds (default range 147-500).
1142
- * @param {number} colorTempPhysicalMinMireds - The physical minimum color temperature in mireds (default range 147).
1143
- * @param {number} colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds (default range 500).
1144
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1145
- *
1146
- * @remarks colorMode and enhancedColorMode persist across restarts.
1147
- * @remarks colorTemperatureMireds persists across restarts.
1148
- * @remarks startUpColorTemperatureMireds persists across restarts.
1149
- * @remarks coupleColorTempToLevelMinMireds persists across restarts.
1150
- */
1151
629
  createCtColorControlClusterServer(colorTemperatureMireds = 250, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1152
630
  this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.ColorTemperature), {
1153
631
  colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
@@ -1166,34 +644,15 @@ export class MatterbridgeEndpoint extends Endpoint {
1166
644
  });
1167
645
  return this;
1168
646
  }
1169
- /**
1170
- * Configures the color control mode for the device.
1171
- *
1172
- * @param {ColorControl.ColorMode} colorMode - The color mode to set.
1173
- *
1174
- * @remarks colorMode and enhancedColorMode persist across restarts.
1175
- */
1176
647
  async configureColorControlMode(colorMode) {
1177
648
  if (isValidNumber(colorMode, ColorControl.ColorMode.CurrentHueAndCurrentSaturation, ColorControl.ColorMode.ColorTemperatureMireds)) {
1178
649
  await this.setAttribute(ColorControl.Cluster.id, 'colorMode', colorMode, this.log);
1179
650
  await this.setAttribute(ColorControl.Cluster.id, 'enhancedColorMode', colorMode, this.log);
1180
651
  }
1181
652
  }
1182
- /**
1183
- * Creates a default window covering cluster server with feature Lift and PositionAwareLift.
1184
- *
1185
- * @param {number} positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
1186
- * @param {WindowCovering.WindowCoveringType} type - The type of window covering (default: WindowCovering.WindowCoveringType.Rollershade). Must support feature Lift.
1187
- * @param {WindowCovering.EndProductType} endProductType - The end product type (default: WindowCovering.EndProductType.RollerShade). Must support feature Lift.
1188
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1189
- *
1190
- * @remarks mode attributes is writable and persists across restarts.
1191
- * currentPositionLiftPercent100ths persists across restarts.
1192
- * configStatus attributes persists across restarts.
1193
- */
1194
653
  createDefaultWindowCoveringClusterServer(positionPercent100ths, type = WindowCovering.WindowCoveringType.Rollershade, endProductType = WindowCovering.EndProductType.RollerShade) {
1195
654
  this.behaviors.require(MatterbridgeLiftWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
1196
- type, // Must support feature Lift
655
+ type,
1197
656
  numberOfActuationsLift: 0,
1198
657
  configStatus: {
1199
658
  operational: true,
@@ -1201,33 +660,20 @@ export class MatterbridgeEndpoint extends Endpoint {
1201
660
  liftMovementReversed: false,
1202
661
  liftPositionAware: true,
1203
662
  tiltPositionAware: false,
1204
- liftEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
1205
- tiltEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
663
+ liftEncoderControlled: false,
664
+ tiltEncoderControlled: false,
1206
665
  },
1207
666
  operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
1208
- endProductType, // Must support feature Lift
667
+ endProductType,
1209
668
  mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
1210
- targetPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
1211
- currentPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
669
+ targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
670
+ currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
1212
671
  });
1213
672
  return this;
1214
673
  }
1215
- /**
1216
- * Creates a default window covering cluster server with features Lift, PositionAwareLift, Tilt, PositionAwareTilt.
1217
- *
1218
- * @param {number} positionLiftPercent100ths - The lift position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
1219
- * @param {number} positionTiltPercent100ths - The tilt position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
1220
- * @param {WindowCovering.WindowCoveringType} type - The type of window covering (default: WindowCovering.WindowCoveringType.TiltBlindLift). Must support features Lift and Tilt.
1221
- * @param {WindowCovering.EndProductType} endProductType - The end product type (default: WindowCovering.EndProductType.InteriorBlind). Must support features Lift and Tilt.
1222
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1223
- *
1224
- * @remarks mode attributes is writable and persists across restarts.
1225
- * currentPositionTiltPercent100ths persists across restarts.
1226
- * configStatus attributes persists across restarts.
1227
- */
1228
674
  createDefaultLiftTiltWindowCoveringClusterServer(positionLiftPercent100ths, positionTiltPercent100ths, type = WindowCovering.WindowCoveringType.TiltBlindLift, endProductType = WindowCovering.EndProductType.InteriorBlind) {
1229
675
  this.behaviors.require(MatterbridgeLiftTiltWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift, WindowCovering.Feature.Tilt, WindowCovering.Feature.PositionAwareTilt), {
1230
- type, // Must support features Lift and Tilt
676
+ type,
1231
677
  numberOfActuationsLift: 0,
1232
678
  numberOfActuationsTilt: 0,
1233
679
  configStatus: {
@@ -1236,23 +682,19 @@ export class MatterbridgeEndpoint extends Endpoint {
1236
682
  liftMovementReversed: false,
1237
683
  liftPositionAware: true,
1238
684
  tiltPositionAware: true,
1239
- liftEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
1240
- tiltEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
685
+ liftEncoderControlled: false,
686
+ tiltEncoderControlled: false,
1241
687
  },
1242
688
  operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
1243
- endProductType, // Must support features Lift and Tilt
689
+ endProductType,
1244
690
  mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
1245
- targetPositionLiftPercent100ths: positionLiftPercent100ths ?? 0, // 0 Fully open 10000 fully closed
1246
- currentPositionLiftPercent100ths: positionLiftPercent100ths ?? 0, // 0 Fully open 10000 fully closed
1247
- targetPositionTiltPercent100ths: positionTiltPercent100ths ?? 0, // 0 Fully open 10000 fully closed
1248
- currentPositionTiltPercent100ths: positionTiltPercent100ths ?? 0, // 0 Fully open 10000 fully closed
691
+ targetPositionLiftPercent100ths: positionLiftPercent100ths ?? 0,
692
+ currentPositionLiftPercent100ths: positionLiftPercent100ths ?? 0,
693
+ targetPositionTiltPercent100ths: positionTiltPercent100ths ?? 0,
694
+ currentPositionTiltPercent100ths: positionTiltPercent100ths ?? 0,
1249
695
  });
1250
696
  return this;
1251
697
  }
1252
- /**
1253
- * Sets the window covering lift target position as the current position and stops the movement.
1254
- *
1255
- */
1256
698
  async setWindowCoveringTargetAsCurrentAndStopped() {
1257
699
  const position = this.getAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', this.log);
1258
700
  if (isValidNumber(position, 0, 10000)) {
@@ -1272,13 +714,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1272
714
  this.log.debug(`Set WindowCovering currentPositionTiltPercent100ths and targetPositionTiltPercent100ths to ${position} and operationalStatus to Stopped.`);
1273
715
  }
1274
716
  }
1275
- /**
1276
- * Sets the lift current and target position and the status of a window covering.
1277
- *
1278
- * @param {number} current - The current position of the window covering.
1279
- * @param {number} target - The target position of the window covering.
1280
- * @param {WindowCovering.MovementStatus} status - The movement status of the window covering.
1281
- */
1282
717
  async setWindowCoveringCurrentTargetStatus(current, target, status) {
1283
718
  await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', current, this.log);
1284
719
  await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', target, this.log);
@@ -1289,11 +724,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1289
724
  }, this.log);
1290
725
  this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
1291
726
  }
1292
- /**
1293
- * Sets the status of the window covering.
1294
- *
1295
- * @param {WindowCovering.MovementStatus} status - The movement status to set.
1296
- */
1297
727
  async setWindowCoveringStatus(status) {
1298
728
  await this.setAttribute(WindowCovering.Cluster.id, 'operationalStatus', {
1299
729
  global: status,
@@ -1302,11 +732,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1302
732
  }, this.log);
1303
733
  this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
1304
734
  }
1305
- /**
1306
- * Retrieves the status of the window covering.
1307
- *
1308
- * @returns {WindowCovering.MovementStatus | undefined} The movement status of the window covering, or undefined if not available.
1309
- */
1310
735
  getWindowCoveringStatus() {
1311
736
  const status = this.getAttribute(WindowCovering.Cluster.id, 'operationalStatus', this.log);
1312
737
  if (isValidObject(status, 3) && 'global' in status && typeof status.global === 'number') {
@@ -1314,12 +739,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1314
739
  return status.global;
1315
740
  }
1316
741
  }
1317
- /**
1318
- * Sets the lift target and current position of the window covering.
1319
- *
1320
- * @param {number} liftPosition - The position to set, specified as a number.
1321
- * @param {number} [tiltPosition] - The tilt position to set, specified as a number.
1322
- */
1323
742
  async setWindowCoveringTargetAndCurrentPosition(liftPosition, tiltPosition) {
1324
743
  await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', liftPosition, this.log);
1325
744
  await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', liftPosition, this.log);
@@ -1330,57 +749,31 @@ export class MatterbridgeEndpoint extends Endpoint {
1330
749
  this.log.debug(`Set WindowCovering currentPositionTiltPercent100ths: ${tiltPosition} and targetPositionTiltPercent100ths: ${tiltPosition}.`);
1331
750
  }
1332
751
  }
1333
- /**
1334
- * Creates a default thermostat cluster server with features Heating, Cooling and AutoMode.
1335
- *
1336
- * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
1337
- * @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
1338
- * @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
1339
- * @param {number} [minSetpointDeadBand] - The minimum setpoint dead band value. Defaults to 1°.
1340
- * @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
1341
- * @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
1342
- * @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
1343
- * @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
1344
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1345
- */
1346
752
  createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
1347
753
  this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
1348
754
  localTemperature: localTemperature * 100,
1349
755
  systemMode: Thermostat.SystemMode.Auto,
1350
756
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
1351
- // Thermostat.Feature.Heating
1352
757
  occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
1353
758
  minHeatSetpointLimit: minHeatSetpointLimit * 100,
1354
759
  maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
1355
760
  absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
1356
761
  absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
1357
- // Thermostat.Feature.Cooling
1358
762
  occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
1359
763
  minCoolSetpointLimit: minCoolSetpointLimit * 100,
1360
764
  maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
1361
765
  absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
1362
766
  absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
1363
- // Thermostat.Feature.AutoMode
1364
767
  minSetpointDeadBand: minSetpointDeadBand * 100,
1365
768
  thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
1366
769
  });
1367
770
  return this;
1368
771
  }
1369
- /**
1370
- * Creates a default heating thermostat cluster server with feature Heating.
1371
- *
1372
- * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
1373
- * @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
1374
- * @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
1375
- * @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
1376
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1377
- */
1378
772
  createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
1379
773
  this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating), {
1380
774
  localTemperature: localTemperature * 100,
1381
775
  systemMode: Thermostat.SystemMode.Heat,
1382
776
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
1383
- // Thermostat.Feature.Heating
1384
777
  occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
1385
778
  minHeatSetpointLimit: minHeatSetpointLimit * 100,
1386
779
  maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
@@ -1389,21 +782,11 @@ export class MatterbridgeEndpoint extends Endpoint {
1389
782
  });
1390
783
  return this;
1391
784
  }
1392
- /**
1393
- * Creates a default cooling thermostat cluster server with feature Cooling.
1394
- *
1395
- * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
1396
- * @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
1397
- * @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
1398
- * @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
1399
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1400
- */
1401
785
  createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
1402
786
  this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Cooling), {
1403
787
  localTemperature: localTemperature * 100,
1404
788
  systemMode: Thermostat.SystemMode.Cool,
1405
789
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
1406
- // Thermostat.Feature.Cooling
1407
790
  occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
1408
791
  minCoolSetpointLimit: minCoolSetpointLimit * 100,
1409
792
  maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
@@ -1412,16 +795,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1412
795
  });
1413
796
  return this;
1414
797
  }
1415
- /**
1416
- * Creates a default thermostat user interface configuration cluster server.
1417
- *
1418
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1419
- * @remarks
1420
- * The default values are:
1421
- * - temperatureDisplayMode: ThermostatUserInterfaceConfiguration.TemperatureDisplayMode.Celsius (writeble).
1422
- * - keypadLockout: ThermostatUserInterfaceConfiguration.KeypadLockout.NoLockout (writeble).
1423
- * - scheduleProgrammingVisibility: ThermostatUserInterfaceConfiguration.ScheduleProgrammingVisibility.ScheduleProgrammingPermitted (writeble).
1424
- */
1425
798
  createDefaultThermostatUserInterfaceConfigurationClusterServer() {
1426
799
  this.behaviors.require(ThermostatUserInterfaceConfigurationServer, {
1427
800
  temperatureDisplayMode: ThermostatUserInterfaceConfiguration.TemperatureDisplayMode.Celsius,
@@ -1430,273 +803,95 @@ export class MatterbridgeEndpoint extends Endpoint {
1430
803
  });
1431
804
  return this;
1432
805
  }
1433
- /**
1434
- * Creates a default fan control cluster server with features Auto, and Step and mode Off Low Med High Auto.
1435
- *
1436
- * @param {FanControl.FanMode} [fanMode] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
1437
- * @param {FanControl.FanModeSequence} [fanModeSequence] - The fan mode sequence to set. Defaults to `FanControl.FanModeSequence.OffLowMedHighAuto`.
1438
- * @param {number} [percentSetting] - The initial percent setting. Defaults to 0.
1439
- * @param {number} [percentCurrent] - The initial percent current. Defaults to 0.
1440
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1441
- *
1442
- * @remarks
1443
- * - fanmode is writable and persists across reboots.
1444
- * - fanModeSequence is fixed.
1445
- * - percentSetting is writable.
1446
- */
1447
806
  createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHighAuto, percentSetting = 0, percentCurrent = 0) {
1448
807
  this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.Auto, FanControl.Feature.Step), {
1449
- // Base fan control attributes
1450
- fanMode, // Writable and persistent attribute
1451
- fanModeSequence, // Fixed attribute
1452
- percentSetting, // Writable attribute
808
+ fanMode,
809
+ fanModeSequence,
810
+ percentSetting,
1453
811
  percentCurrent,
1454
812
  });
1455
813
  return this;
1456
814
  }
1457
- /**
1458
- * Creates an On Off fan control cluster server without features and mode Off High.
1459
- *
1460
- * @param {FanControl.FanMode} [fanMode] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
1461
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1462
- *
1463
- * @remarks
1464
- * fanmode is writable and persists across reboots.
1465
- * fanModeSequence is fixed.
1466
- * percentSetting is writable.
1467
- */
1468
815
  createOnOffFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
1469
816
  this.behaviors.require(FanControlServer, {
1470
- // Base fan control attributes
1471
- fanMode, // Writable and persistent attribute
1472
- fanModeSequence: FanControl.FanModeSequence.OffHigh, // Fixed attribute
1473
- percentSetting: 0, // Writable attribute
817
+ fanMode,
818
+ fanModeSequence: FanControl.FanModeSequence.OffHigh,
819
+ percentSetting: 0,
1474
820
  percentCurrent: 0,
1475
821
  });
1476
822
  return this;
1477
823
  }
1478
- /**
1479
- * Creates a base fan control cluster server without features and mode Off Low Med High.
1480
- *
1481
- * @param {FanControl.FanMode} [fanMode] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
1482
- * @param {FanControl.FanModeSequence} [fanModeSequence] - The fan mode sequence to set. Defaults to `FanControl.FanModeSequence.OffLowMedHigh`.
1483
- * @param {number} [percentSetting] - The initial percent setting. Defaults to 0.
1484
- * @param {number} [percentCurrent] - The initial percent current. Defaults to 0.
1485
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1486
- *
1487
- * @remarks
1488
- * fanmode is writable and persists across reboots.
1489
- * fanModeSequence is fixed.
1490
- * percentSetting is writable.
1491
- */
1492
824
  createBaseFanControlClusterServer(fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHigh, percentSetting = 0, percentCurrent = 0) {
1493
825
  this.behaviors.require(FanControlServer, {
1494
- // Base fan control attributes
1495
- fanMode, // Writable and persistent attribute
1496
- fanModeSequence, // Fixed attribute
1497
- percentSetting, // Writable attribute
826
+ fanMode,
827
+ fanModeSequence,
828
+ percentSetting,
1498
829
  percentCurrent,
1499
830
  });
1500
831
  return this;
1501
832
  }
1502
- /**
1503
- * Creates a fan control cluster server with features MultiSpeed, Auto, and Step and mode Off Low Med High Auto.
1504
- *
1505
- * @param {FanControl.FanMode} [fanMode] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
1506
- * @param {FanControl.FanModeSequence} [fanModeSequence] - The fan mode sequence to set. Defaults to `FanControl.FanModeSequence.OffLowMedHighAuto`.
1507
- * @param {number} [percentSetting] - The initial percent setting. Defaults to 0.
1508
- * @param {number} [percentCurrent] - The initial percent current. Defaults to 0.
1509
- * @param {number} [speedMax] - The maximum speed setting. Defaults to 10.
1510
- * @param {number} [speedSetting] - The initial speed setting. Defaults to 0.
1511
- * @param {number} [speedCurrent] - The initial speed current. Defaults to 0.
1512
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1513
- *
1514
- * @remarks
1515
- * - fanmode is writable and persists across reboots.
1516
- * - fanModeSequence is fixed.
1517
- * - percentSetting is writable.
1518
- * - speedMax is fixed.
1519
- * - speedSetting is writable.
1520
- */
1521
833
  createMultiSpeedFanControlClusterServer(fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHighAuto, percentSetting = 0, percentCurrent = 0, speedMax = 10, speedSetting = 0, speedCurrent = 0) {
1522
834
  this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
1523
- // Base fan control attributes
1524
- fanMode, // Writable and persistent attribute
1525
- fanModeSequence, // Fixed attribute
1526
- percentSetting, // Writable attribute
835
+ fanMode,
836
+ fanModeSequence,
837
+ percentSetting,
1527
838
  percentCurrent,
1528
- // MultiSpeed feature
1529
- speedMax, // Fixed attribute
1530
- speedSetting, // Writable attribute
839
+ speedMax,
840
+ speedSetting,
1531
841
  speedCurrent,
1532
842
  });
1533
843
  return this;
1534
844
  }
1535
- /**
1536
- * Creates a fan control cluster server with features MultiSpeed, Auto, Step, Rock, Wind and AirflowDirection and mode Off Low Med High Auto.
1537
- *
1538
- * @param {FanControl.FanMode} [fanMode] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
1539
- * @param {FanControl.FanModeSequence} [fanModeSequence] - The fan mode sequence to set. Defaults to `FanControl.FanModeSequence.OffLowMedHighAuto`.
1540
- * @param {number} [percentSetting] - The initial percent setting. Defaults to 0.
1541
- * @param {number} [percentCurrent] - The initial percent current. Defaults to 0.
1542
- * @param {number} [speedMax] - The maximum speed setting. Defaults to 10.
1543
- * @param {number} [speedSetting] - The initial speed setting. Defaults to 0.
1544
- * @param {number} [speedCurrent] - The initial speed current. Defaults to 0.
1545
- * @param {object} [rockSupport] - The rock support configuration.
1546
- * @param {boolean} rockSupport.rockLeftRight - Indicates support for rocking left to right. Defaults to true.
1547
- * @param {boolean} rockSupport.rockUpDown - Indicates support for rocking up and down. Defaults to true.
1548
- * @param {boolean} rockSupport.rockRound - Indicates support for round rocking. Defaults to true.
1549
- * @param {object} [rockSetting] - The rock setting configuration.
1550
- * @param {boolean} rockSetting.rockLeftRight - Indicates the current setting for rocking left to right. Defaults to true.
1551
- * @param {boolean} rockSetting.rockUpDown - Indicates the current setting for rocking up and down. Defaults to true.
1552
- * @param {boolean} rockSetting.rockRound - Indicates the current setting for round rocking. Defaults to true.
1553
- * @param {object} [windSupport] - The wind support configuration.
1554
- * @param {boolean} windSupport.sleepWind - Indicates support for sleep wind. Defaults to true.
1555
- * @param {boolean} windSupport.naturalWind - Indicates support for natural wind. Defaults to true.
1556
- * @param {object} [windSetting] - The wind setting configuration.
1557
- * @param {boolean} windSetting.sleepWind - Indicates the current setting for sleep wind. Defaults to false.
1558
- * @param {boolean} windSetting.naturalWind - Indicates the current setting for natural wind. Defaults to true.
1559
- * @param {FanControl.AirflowDirection} [airflowDirection] - The airflow direction. Defaults to `FanControl.AirflowDirection.Forward`.
1560
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1561
- *
1562
- * @remarks
1563
- * - fanmode is writable and persists across reboots.
1564
- * - fanModeSequence is fixed.
1565
- * - percentSetting is writable.
1566
- * - speedMax is fixed.
1567
- * - speedSetting is writable.
1568
- * - rockSupport is fixed.
1569
- * - rockSetting is writable.
1570
- * - windSupport is fixed.
1571
- * - windSetting is writable.
1572
- * - airflowDirection is writable.
1573
- */
1574
845
  createCompleteFanControlClusterServer(fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHighAuto, percentSetting = 0, percentCurrent = 0, speedMax = 10, speedSetting = 0, speedCurrent = 0, rockSupport = { rockLeftRight: true, rockUpDown: true, rockRound: true }, rockSetting = { rockLeftRight: true, rockUpDown: false, rockRound: false }, windSupport = { sleepWind: true, naturalWind: true }, windSetting = { sleepWind: false, naturalWind: true }, airflowDirection = FanControl.AirflowDirection.Forward) {
1575
846
  this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step, FanControl.Feature.Rocking, FanControl.Feature.Wind, FanControl.Feature.AirflowDirection), {
1576
- // Base fan control attributes
1577
- fanMode, // Writable and persistent attribute
1578
- fanModeSequence, // Fixed attribute
1579
- percentSetting, // Writable attribute
847
+ fanMode,
848
+ fanModeSequence,
849
+ percentSetting,
1580
850
  percentCurrent,
1581
- // MultiSpeed feature
1582
- speedMax, // Fixed attribute
1583
- speedSetting, // Writable attribute
851
+ speedMax,
852
+ speedSetting,
1584
853
  speedCurrent,
1585
- // Rocking feature
1586
- rockSupport, // Fixed attribute
1587
- rockSetting, // Writable attribute
1588
- // Wind feature
1589
- windSupport, // Fixed attribute
1590
- windSetting, // Writable attribute
1591
- // AirflowDirection feature
1592
- airflowDirection, // Writable attribute
854
+ rockSupport,
855
+ rockSetting,
856
+ windSupport,
857
+ windSetting,
858
+ airflowDirection,
1593
859
  });
1594
860
  return this;
1595
861
  }
1596
- /**
1597
- * Creates a default HEPA Filter Monitoring Cluster Server with features Condition and ReplacementProductList.
1598
- * It supports ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.Warning, and ResourceMonitoring.Feature.ReplacementProductList.
1599
- *
1600
- * @param {number} condition - The initial condition value (range 0-100). Default is 100.
1601
- * @param {ResourceMonitoring.ChangeIndication} changeIndication - The initial change indication. Default is ResourceMonitoring.ChangeIndication.Ok.
1602
- * @param {boolean | undefined} inPlaceIndicator - The in-place indicator. Default is true.
1603
- * @param {number | undefined} lastChangedTime - The last changed time (EpochS). Default is null.
1604
- * @param {ResourceMonitoring.ReplacementProduct[]} replacementProductList - The list of replacement products. Default is an empty array. It is a fixed attribute.
1605
- *
1606
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1607
- *
1608
- * @remarks
1609
- * The HEPA Filter Monitoring Cluster Server is used to monitor the status of HEPA filters.
1610
- * It provides information about the condition of the filter, whether it is in place, and the last time it was changed.
1611
- * The change indication can be used to indicate if the filter needs to be replaced or serviced.
1612
- * The replacement product list can be used to provide a list of replacement products for the filter.
1613
- * The condition attribute is fixed at 100, indicating a healthy filter.
1614
- * The degradation direction is fixed at ResourceMonitoring.DegradationDirection.Down, indicating that a lower value indicates a worse condition.
1615
- * The replacement product list is initialized as an empty array.
1616
- */
1617
862
  createDefaultHepaFilterMonitoringClusterServer(condition = 100, changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = true, lastChangedTime = null, replacementProductList = []) {
1618
863
  this.behaviors.require(MatterbridgeHepaFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.Warning, ResourceMonitoring.Feature.ReplacementProductList), {
1619
- // Feature.Condition
1620
864
  condition,
1621
- degradationDirection: ResourceMonitoring.DegradationDirection.Down, // Fixed attribute
1622
- // Feature.ReplacementProductList
1623
- replacementProductList, // Fixed attribute
1624
- // Base attributes
865
+ degradationDirection: ResourceMonitoring.DegradationDirection.Down,
866
+ replacementProductList,
1625
867
  changeIndication,
1626
868
  inPlaceIndicator,
1627
- lastChangedTime, // Writable and persistent across restarts
869
+ lastChangedTime,
1628
870
  });
1629
871
  return this;
1630
872
  }
1631
- /**
1632
- * Creates a default Activated Carbon Filter Monitoring Cluster Server with features Condition and ReplacementProductList.
1633
- * It supports ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.Warning, and ResourceMonitoring.Feature.ReplacementProductList.
1634
- *
1635
- * @param {number} condition - The initial condition value (range 0-100). Default is 100.
1636
- * @param {ResourceMonitoring.ChangeIndication} changeIndication - The initial change indication. Default is ResourceMonitoring.ChangeIndication.Ok.
1637
- * @param {boolean | undefined} inPlaceIndicator - The in-place indicator. Default is undefined.
1638
- * @param {number | undefined} lastChangedTime - The last changed time (EpochS). Default is undefined.
1639
- * @param {ResourceMonitoring.ReplacementProduct[]} replacementProductList - The list of replacement products. Default is an empty array. It is a fixed attribute.
1640
- *
1641
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1642
- *
1643
- * @remarks
1644
- * The Activated Carbon Filter Monitoring Cluster Server is used to monitor the status of activated carbon filters.
1645
- * It provides information about the condition of the filter, whether it is in place, and the last time it was changed.
1646
- * The change indication can be used to indicate if the filter needs to be replaced or serviced.
1647
- * The replacement product list can be used to provide a list of replacement products for the filter.
1648
- * The condition attribute is fixed at 100, indicating a healthy filter.
1649
- * The degradation direction is fixed at ResourceMonitoring.DegradationDirection.Down, indicating that a lower value indicates a worse condition.
1650
- * The replacement product list is initialized as an empty array.
1651
- */
1652
873
  createDefaultActivatedCarbonFilterMonitoringClusterServer(condition = 100, changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = true, lastChangedTime = null, replacementProductList = []) {
1653
874
  this.behaviors.require(MatterbridgeActivatedCarbonFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.Warning, ResourceMonitoring.Feature.ReplacementProductList), {
1654
- // Feature.Condition
1655
875
  condition,
1656
876
  degradationDirection: ResourceMonitoring.DegradationDirection.Down,
1657
- // Feature.ReplacementProductList
1658
- replacementProductList, // Fixed attribute
1659
- // Base attributes
877
+ replacementProductList,
1660
878
  changeIndication,
1661
879
  inPlaceIndicator,
1662
- lastChangedTime, // Writable and persistent across restarts
880
+ lastChangedTime,
1663
881
  });
1664
882
  return this;
1665
883
  }
1666
- /**
1667
- * Creates a default door lock cluster server.
1668
- *
1669
- * @param {DoorLock.LockState} [lockState] - The initial state of the lock (default: Locked).
1670
- * @param {DoorLock.LockType} [lockType] - The type of the lock (default: DeadBolt).
1671
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1672
- *
1673
- * @remarks
1674
- * 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.
1675
- */
1676
884
  createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
1677
885
  this.behaviors.require(MatterbridgeDoorLockServer.enable({ events: { doorLockAlarm: true, lockOperation: true, lockOperationError: true } }), {
1678
886
  lockState,
1679
887
  lockType,
1680
888
  actuatorEnabled: false,
1681
889
  operatingMode: DoorLock.OperatingMode.Normal,
1682
- // Special case of inverted bitmap: add also alwaysSet = 2047
1683
890
  supportedOperatingModes: { normal: false, vacation: true, privacy: true, noRemoteLockUnlock: true, passage: true, alwaysSet: 2047 },
1684
891
  alarmMask: { lockJammed: false, lockFactoryReset: false, lockRadioPowerCycled: false, wrongCodeEntryLimit: false, frontEscutcheonRemoved: false, doorForcedOpen: false },
1685
892
  });
1686
893
  return this;
1687
894
  }
1688
- /**
1689
- * Creates a default Mode Select cluster server.
1690
- *
1691
- * @param {string} description - The description of the mode select cluster.
1692
- * @param {ModeSelect.ModeOption[]} supportedModes - The list of supported modes.
1693
- * @param {number} [currentMode] - The current mode (default: 0).
1694
- * @param {number} [startUpMode] - The startup mode (default: 0).
1695
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1696
- *
1697
- * @remarks
1698
- * endpoint.createDefaultModeSelectClusterServer('Night mode', [{ label: 'Led ON', mode: 0, semanticTags: [] }, { label: 'Led OFF', mode: 1, semanticTags: [] }], 0, 0);
1699
- */
1700
895
  createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
1701
896
  this.behaviors.require(MatterbridgeModeSelectServer, {
1702
897
  description: description,
@@ -1707,35 +902,21 @@ export class MatterbridgeEndpoint extends Endpoint {
1707
902
  });
1708
903
  return this;
1709
904
  }
1710
- /**
1711
- * Creates the default Valve Configuration And Control cluster server with features Level.
1712
- *
1713
- * @param {ValveConfigurationAndControl.ValveState} [valveState] - The valve state to set. Defaults to `ValveConfigurationAndControl.ValveState.Closed`.
1714
- * @param {number} [valveLevel] - The valve level to set. Defaults to 0.
1715
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1716
- */
1717
905
  createDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
1718
906
  this.behaviors.require(MatterbridgeValveConfigurationAndControlServer.with(ValveConfigurationAndControl.Feature.Level), {
1719
907
  currentState: valveState,
1720
908
  targetState: valveState,
1721
909
  openDuration: null,
1722
- defaultOpenDuration: null, // Writable and persistent across restarts
910
+ defaultOpenDuration: null,
1723
911
  remainingDuration: null,
1724
912
  valveFault: { generalFault: false, blocked: false, leaking: false, notConnected: false, shortCircuit: false, currentExceeded: false },
1725
- // Feature.Level
1726
913
  currentLevel: valveLevel,
1727
914
  targetLevel: valveLevel,
1728
- defaultOpenLevel: 100, // Writable and persistent across restarts
1729
- levelStep: 1, // Fixed
915
+ defaultOpenLevel: 100,
916
+ levelStep: 1,
1730
917
  });
1731
918
  return this;
1732
919
  }
1733
- /**
1734
- * Creates the default PumpConfigurationAndControl cluster server with features ConstantSpeed.
1735
- *
1736
- * @param {PumpConfigurationAndControl.OperationMode} [pumpMode] - The pump mode to set. Defaults to `PumpConfigurationAndControl.OperationMode.Normal`.
1737
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1738
- */
1739
920
  createDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
1740
921
  this.behaviors.require(PumpConfigurationAndControlServer.with(PumpConfigurationAndControl.Feature.ConstantSpeed), {
1741
922
  minConstSpeed: null,
@@ -1750,13 +931,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1750
931
  });
1751
932
  return this;
1752
933
  }
1753
- /**
1754
- * Creates the default SmokeCOAlarm Cluster Server with features SmokeAlarm and CoAlarm.
1755
- *
1756
- * @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
1757
- * @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
1758
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1759
- */
1760
934
  createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
1761
935
  this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm).enable({
1762
936
  events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
@@ -1772,12 +946,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1772
946
  });
1773
947
  return this;
1774
948
  }
1775
- /**
1776
- * Creates a smoke only SmokeCOAlarm Cluster Server with features SmokeAlarm.
1777
- *
1778
- * @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
1779
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1780
- */
1781
949
  createSmokeOnlySmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal) {
1782
950
  this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm).enable({
1783
951
  events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: false, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
@@ -1792,12 +960,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1792
960
  });
1793
961
  return this;
1794
962
  }
1795
- /**
1796
- * Creates a co only SmokeCOAlarm Cluster Server with features CoAlarm.
1797
- *
1798
- * @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
1799
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1800
- */
1801
963
  createCoOnlySmokeCOAlarmClusterServer(coState = SmokeCoAlarm.AlarmState.Normal) {
1802
964
  this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.CoAlarm).enable({
1803
965
  events: { smokeAlarm: false, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
@@ -1812,15 +974,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1812
974
  });
1813
975
  return this;
1814
976
  }
1815
- /**
1816
- * Creates a default momentary switch cluster server with features MomentarySwitch, MomentarySwitchRelease, MomentarySwitchLongPress and MomentarySwitchMultiPress
1817
- * and events initialPress, longPress, shortRelease, longRelease, multiPressOngoing, multiPressComplete.
1818
- *
1819
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1820
- *
1821
- * @remarks
1822
- * This method adds a cluster server with default momentary switch features and configuration suitable for (AppleHome) Single Double Long automations.
1823
- */
1824
977
  createDefaultSwitchClusterServer() {
1825
978
  this.behaviors.require(MatterbridgeSwitchServer.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress).enable({
1826
979
  events: { initialPress: true, longPress: true, shortRelease: true, longRelease: true, multiPressOngoing: true, multiPressComplete: true },
@@ -1831,15 +984,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1831
984
  });
1832
985
  return this;
1833
986
  }
1834
- /**
1835
- * Creates a default momentary switch cluster server with feature MomentarySwitch and event initialPress.
1836
- *
1837
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1838
- *
1839
- * @remarks
1840
- * This method adds a cluster server with default momentary switch features and configuration suitable for a Single press automations.
1841
- * It is supported by the Home app.
1842
- */
1843
987
  createDefaultMomentarySwitchClusterServer() {
1844
988
  this.behaviors.require(MatterbridgeSwitchServer.with(Switch.Feature.MomentarySwitch).enable({
1845
989
  events: { initialPress: true },
@@ -1849,14 +993,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1849
993
  });
1850
994
  return this;
1851
995
  }
1852
- /**
1853
- * Creates a default latching switch cluster server with features LatchingSwitch.
1854
- *
1855
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1856
- *
1857
- * @remarks
1858
- * This method adds a cluster server with default latching switch features and configuration suitable for a latching switch with 2 positions.
1859
- */
1860
996
  createDefaultLatchingSwitchClusterServer() {
1861
997
  this.behaviors.require(SwitchServer.with(Switch.Feature.LatchingSwitch).enable({
1862
998
  events: { switchLatched: true },
@@ -1866,13 +1002,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1866
1002
  });
1867
1003
  return this;
1868
1004
  }
1869
- /**
1870
- * Triggers a switch event on the specified endpoint.
1871
- *
1872
- * @param {string} event - The type of event to trigger. Possible values are 'Single', 'Double', 'Long' for momentarySwitch and 'Press', 'Release' for latchingSwitch.
1873
- * @param {AnsiLogger} log - Optional logger to log the event.
1874
- * @returns {boolean} - A boolean indicating whether the event was successfully triggered.
1875
- */
1876
1005
  async triggerSwitchEvent(event, log) {
1877
1006
  if (this.maybeNumber === undefined) {
1878
1007
  this.log.error(`triggerSwitchEvent ${event} error: Endpoint number not assigned on endpoint ${this.maybeId}:${this.maybeNumber}`);
@@ -1934,37 +1063,10 @@ export class MatterbridgeEndpoint extends Endpoint {
1934
1063
  }
1935
1064
  return true;
1936
1065
  }
1937
- /**
1938
- * Creates a default OperationalState Cluster Server.
1939
- *
1940
- * @param {OperationalState.OperationalStateEnum} operationalState - The initial operational state id.
1941
- *
1942
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1943
- *
1944
- * @remarks
1945
- * This method adds a cluster server with a default operational state configuration:
1946
- * - { operationalStateId: OperationalState.OperationalStateEnum.Stopped, operationalStateLabel: 'Stopped' },
1947
- * - { operationalStateId: OperationalState.OperationalStateEnum.Running, operationalStateLabel: 'Running' },
1948
- * - { operationalStateId: OperationalState.OperationalStateEnum.Paused, operationalStateLabel: 'Paused' },
1949
- * - { operationalStateId: OperationalState.OperationalStateEnum.Error, operationalStateLabel: 'Error' },
1950
- */
1951
1066
  createDefaultOperationalStateClusterServer(operationalState = OperationalState.OperationalStateEnum.Stopped) {
1952
1067
  this.behaviors.require(MatterbridgeOperationalStateServer, getDefaultOperationalStateClusterServer(operationalState));
1953
1068
  return this;
1954
1069
  }
1955
- /**
1956
- * Creates a default boolean state cluster server.
1957
- * The stateChange event is enabled.
1958
- *
1959
- * @param {boolean} contact - The state of the cluster. Defaults to true (true = contact).
1960
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1961
- *
1962
- * @remarks
1963
- * Water Leak Detector: true = leak, false = no leak
1964
- * Water Freeze Detector: true = freeze, false = no freeze
1965
- * Rain Sensor: true = rain, false = no rain
1966
- * Contact Sensor: true = closed or contact, false = open or no contact
1967
- */
1968
1070
  createDefaultBooleanStateClusterServer(contact) {
1969
1071
  this.behaviors.require(BooleanStateServer.enable({
1970
1072
  events: { stateChange: true },
@@ -1973,22 +1075,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1973
1075
  });
1974
1076
  return this;
1975
1077
  }
1976
- /**
1977
- * Creates a default boolean state configuration cluster server to be used with the waterFreezeDetector, waterLeakDetector, and rainSensor device types.
1978
- *
1979
- * Features:
1980
- * - Visual
1981
- * - Audible
1982
- * - SensitivityLevel
1983
- *
1984
- * @remarks Supports the enableDisableAlarm command.
1985
- *
1986
- * @param {boolean} [sensorFault] - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
1987
- * @param {number} [currentSensitivityLevel] - The current sensitivity level. Defaults to `0` if not provided.
1988
- * @param {number} [supportedSensitivityLevels] - The number of supported sensitivity levels. Defaults to `2` if not provided (min 2, max 10).
1989
- * @param {number} [defaultSensitivityLevel] - The default sensitivity level. Defaults to `0` if not provided.
1990
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1991
- */
1992
1078
  createDefaultBooleanStateConfigurationClusterServer(sensorFault = false, currentSensitivityLevel = 0, supportedSensitivityLevels = 2, defaultSensitivityLevel = 0) {
1993
1079
  this.behaviors.require(MatterbridgeBooleanStateConfigurationServer.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel).enable({
1994
1080
  events: { alarmsStateChanged: true, sensorFault: true },
@@ -2003,51 +1089,18 @@ export class MatterbridgeEndpoint extends Endpoint {
2003
1089
  });
2004
1090
  return this;
2005
1091
  }
2006
- /**
2007
- * Creates a default Device Energy Management Cluster Server with feature PowerForecastReporting and with the specified ESA type, ESA canGenerate, ESA state, and power limits.
2008
- *
2009
- * @param {DeviceEnergyManagement.EsaType} [esaType] - The ESA type. Defaults to `DeviceEnergyManagement.EsaType.Other`.
2010
- * @param {boolean} [esaCanGenerate] - Indicates if the ESA can generate energy. Defaults to `false`.
2011
- * @param {DeviceEnergyManagement.EsaState} [esaState] - The ESA state. Defaults to `DeviceEnergyManagement.EsaState.Online`.
2012
- * @param {number} [absMinPower] - Indicate the minimum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
2013
- * @param {number} [absMaxPower] - Indicate the maximum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
2014
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2015
- *
2016
- * @remarks
2017
- * - The forecast attribute is set to null, indicating that there is no forecast currently available.
2018
- * - The ESA type and canGenerate attributes are fixed and cannot be changed after creation.
2019
- * - The ESA state is set to Online by default.
2020
- * - The absolute minimum and maximum power attributes are set to 0 by default.
2021
- * - For example, a battery storage inverter that can charge its battery at a maximum power of 2000W and can
2022
- * discharge the battery at a maximum power of 3000W, would have a absMinPower: -3000W, absMaxPower: 2000W.
2023
- */
2024
1092
  createDefaultDeviceEnergyManagementClusterServer(esaType = DeviceEnergyManagement.EsaType.Other, esaCanGenerate = false, esaState = DeviceEnergyManagement.EsaState.Online, absMinPower = 0, absMaxPower = 0) {
2025
1093
  this.behaviors.require(MatterbridgeDeviceEnergyManagementServer.with(DeviceEnergyManagement.Feature.PowerForecastReporting, DeviceEnergyManagement.Feature.PowerAdjustment), {
2026
- forecast: null, // A null value indicates that there is no forecast currently available
2027
- powerAdjustmentCapability: null, // A null value indicates that no power adjustment is currently possible, and nor is any adjustment currently active
2028
- esaType, // Fixed attribute
2029
- esaCanGenerate, // Fixed attribute
1094
+ forecast: null,
1095
+ powerAdjustmentCapability: null,
1096
+ esaType,
1097
+ esaCanGenerate,
2030
1098
  esaState,
2031
1099
  absMinPower,
2032
1100
  absMaxPower,
2033
1101
  });
2034
1102
  return this;
2035
1103
  }
2036
- /**
2037
- * Creates a default EnergyManagementMode Cluster Server.
2038
- *
2039
- * @param {number} [currentMode] - The current mode of the EnergyManagementMode cluster. Defaults to mode 1 (DeviceEnergyManagementMode.ModeTag.NoOptimization).
2040
- * @param {EnergyManagementMode.ModeOption[]} [supportedModes] - The supported modes for the DeviceEnergyManagementMode cluster. The attribute is fixed and defaults to a predefined set of cluster modes.
2041
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2042
- *
2043
- * @remarks
2044
- * A few examples of Device Energy Management modes and their mode tags are provided below.
2045
- * - For the "No Energy Management (Forecast reporting only)" mode, tags: 0x4000 (NoOptimization).
2046
- * - For the "Device Energy Management" mode, tags: 0x4001 (DeviceOptimization).
2047
- * - For the "Home Energy Management" mode, tags: 0x4001 (DeviceOptimization), 0x4002 (LocalOptimization).
2048
- * - For the "Grid Energy Management" mode, tags: 0x4003 (GridOptimization).
2049
- * - For the "Full Energy Management" mode, tags: 0x4001 (DeviceOptimization), 0x4002 (LocalOptimization), 0x4003 (GridOptimization).
2050
- */
2051
1104
  createDefaultDeviceEnergyManagementModeClusterServer(currentMode, supportedModes) {
2052
1105
  this.behaviors.require(MatterbridgeDeviceEnergyManagementModeServer, {
2053
1106
  supportedModes: supportedModes ?? [
@@ -2068,27 +1121,15 @@ export class MatterbridgeEndpoint extends Endpoint {
2068
1121
  mode: 5,
2069
1122
  modeTags: [{ value: DeviceEnergyManagementMode.ModeTag.DeviceOptimization }, { value: DeviceEnergyManagementMode.ModeTag.LocalOptimization }, { value: DeviceEnergyManagementMode.ModeTag.GridOptimization }],
2070
1123
  },
2071
- ], // Fixed attribute
1124
+ ],
2072
1125
  currentMode: currentMode ?? 1,
2073
1126
  });
2074
1127
  return this;
2075
1128
  }
2076
- /**
2077
- * 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.
2078
- *
2079
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2080
- */
2081
1129
  createDefaultPowerTopologyClusterServer() {
2082
1130
  this.behaviors.require(PowerTopologyServer.with(PowerTopology.Feature.TreeTopology));
2083
1131
  return this;
2084
1132
  }
2085
- /**
2086
- * Creates a default Electrical Energy Measurement Cluster Server with features ImportedEnergy, ExportedEnergy, and CumulativeEnergy.
2087
- *
2088
- * @param {number} energyImported - The total consumption value in mW/h.
2089
- * @param {number} energyExported - The total production value in mW/h.
2090
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2091
- */
2092
1133
  createDefaultElectricalEnergyMeasurementClusterServer(energyImported = null, energyExported = null) {
2093
1134
  this.behaviors.require(ElectricalEnergyMeasurementServer.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
2094
1135
  accuracy: {
@@ -2104,15 +1145,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2104
1145
  });
2105
1146
  return this;
2106
1147
  }
2107
- /**
2108
- * Creates a default Electrical Power Measurement Cluster Server with features AlternatingCurrent.
2109
- *
2110
- * @param {number} voltage - The voltage value in millivolts.
2111
- * @param {number} current - The current value in milliamperes.
2112
- * @param {number} power - The power value in milliwatts.
2113
- * @param {number} frequency - The frequency value in millihertz.
2114
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2115
- */
2116
1148
  createDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
2117
1149
  this.behaviors.require(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
2118
1150
  powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
@@ -2154,124 +1186,36 @@ export class MatterbridgeEndpoint extends Endpoint {
2154
1186
  });
2155
1187
  return this;
2156
1188
  }
2157
- /**
2158
- * Creates a default TemperatureMeasurement cluster server.
2159
- *
2160
- * @param {number | null} measuredValue - The measured value of the temperature x 100.
2161
- * @param {number | null} minMeasuredValue - The minimum measured value of the temperature x 100.
2162
- * @param {number | null} maxMeasuredValue - The maximum measured value of the temperature x 100.
2163
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2164
- */
2165
1189
  createDefaultTemperatureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
2166
1190
  this.behaviors.require(TemperatureMeasurementServer, getDefaultTemperatureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
2167
1191
  return this;
2168
1192
  }
2169
- /**
2170
- * Creates a default RelativeHumidityMeasurement cluster server.
2171
- *
2172
- * @param {number | null} measuredValue - The measured value of the relative humidity x 100.
2173
- * @param {number | null} minMeasuredValue - The minimum measured value of the relative humidity x 100.
2174
- * @param {number | null} maxMeasuredValue - The maximum measured value of the relative humidity x 100.
2175
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2176
- */
2177
1193
  createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
2178
1194
  this.behaviors.require(RelativeHumidityMeasurementServer, getDefaultRelativeHumidityMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
2179
1195
  return this;
2180
1196
  }
2181
- /**
2182
- * Creates a default PressureMeasurement cluster server.
2183
- *
2184
- * @param {number | null} measuredValue - The measured value for the pressure in kPa x 10.
2185
- * @param {number | null} minMeasuredValue - The minimum measured value for the pressure in kPa x 10.
2186
- * @param {number | null} maxMeasuredValue - The maximum measured value for the pressure in kPa x 10.
2187
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2188
- *
2189
- * @remarks
2190
- * - MeasuredValue = 10 x Pressure in kPa
2191
- * - MeasuredValue = 1 x Pressure in hPa
2192
- * - MeasuredValue = 33.8639 x Pressure in inHg
2193
- *
2194
- * Conversion:
2195
- * - 1 kPa = 10 hPa
2196
- * - 1 inHg = 33.8639 hPa
2197
- */
2198
1197
  createDefaultPressureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
2199
1198
  this.behaviors.require(PressureMeasurementServer, getDefaultPressureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
2200
1199
  return this;
2201
1200
  }
2202
- /**
2203
- * Creates a default IlluminanceMeasurement cluster server.
2204
- *
2205
- * @param {number | null} measuredValue - The measured value of illuminance.
2206
- * @param {number | null} minMeasuredValue - The minimum measured value of illuminance.
2207
- * @param {number | null} maxMeasuredValue - The maximum measured value of illuminance.
2208
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2209
- *
2210
- * @remarks The default value for the illuminance measurement is null.
2211
- * This attribute SHALL indicate the illuminance in Lux (symbol lx) as follows:
2212
- * • MeasuredValue = 10,000 x log10(illuminance) + 1,
2213
- * where 1 lx <= illuminance <= 3.576 Mlx, corresponding to a MeasuredValue in the range 1 to 0xFFFE.
2214
- * • 0 indicates a value of illuminance that is too low to be measured
2215
- * • null indicates that the illuminance measurement is invalid.
2216
- *
2217
- * - Lux to matter = Math.round(Math.max(Math.min(10000 * Math.log10(lux), 0xfffe), 0))
2218
- * - Matter to Lux = Math.round(Math.max(Math.pow(10, value / 10000), 0))
2219
- */
2220
1201
  createDefaultIlluminanceMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
2221
1202
  this.behaviors.require(IlluminanceMeasurementServer, getDefaultIlluminanceMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
2222
1203
  return this;
2223
1204
  }
2224
- /**
2225
- * Creates a default FlowMeasurement cluster server.
2226
- *
2227
- * @param {number | null} measuredValue - The measured value of the flow in 10 x m3/h.
2228
- * @param {number | null} minMeasuredValue - The minimum measured value of the flow in 10 x m3/h.
2229
- * @param {number | null} maxMeasuredValue - The maximum measured value of the flow in 10 x m3/h.
2230
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2231
- */
2232
1205
  createDefaultFlowMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
2233
1206
  this.behaviors.require(FlowMeasurementServer, getDefaultFlowMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
2234
1207
  return this;
2235
1208
  }
2236
- /**
2237
- * Creates a default OccupancySensing cluster server with feature PassiveInfrared.
2238
- *
2239
- * @param {boolean} occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
2240
- * @param {number} holdTime - The hold time in seconds. Default is 30.
2241
- * @param {number} holdTimeMin - The minimum hold time in seconds. Default is 1.
2242
- * @param {number} holdTimeMax - The maximum hold time in seconds. Default is 300.
2243
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2244
- *
2245
- * @remarks The default value for the occupancy sensor type is PIR.
2246
- */
2247
1209
  createDefaultOccupancySensingClusterServer(occupied = false, holdTime = 30, holdTimeMin = 1, holdTimeMax = 300) {
2248
1210
  this.behaviors.require(OccupancySensingServer.with(OccupancySensing.Feature.PassiveInfrared), getDefaultOccupancySensingClusterServer(occupied, holdTime, holdTimeMin, holdTimeMax));
2249
1211
  return this;
2250
1212
  }
2251
- /**
2252
- * Creates a default AirQuality cluster server.
2253
- *
2254
- * @param {AirQuality.AirQualityEnum} airQuality The air quality level. Defaults to `AirQuality.AirQualityType.Unknown`.
2255
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2256
- */
2257
1213
  createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
2258
1214
  this.behaviors.require(AirQualityServer.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
2259
1215
  airQuality,
2260
1216
  });
2261
1217
  return this;
2262
1218
  }
2263
- /**
2264
- * Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server with feature NumericMeasurement.
2265
- *
2266
- * @param {number | null} measuredValue - The measured value of the concentration.
2267
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2268
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2269
- * @param {number} [uncertainty] - The uncertainty value (optional).
2270
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2271
- *
2272
- * @remarks
2273
- * The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
2274
- */
2275
1219
  createDefaultTvocMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air, uncertainty) {
2276
1220
  this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
2277
1221
  measuredValue,
@@ -2283,16 +1227,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2283
1227
  });
2284
1228
  return this;
2285
1229
  }
2286
- /**
2287
- * Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server with feature LevelIndication, MediumLevel and CriticalLevel.
2288
- *
2289
- * @param {ConcentrationMeasurement.LevelValue} levelValue - The level value of the measurement (default to ConcentrationMeasurement.LevelValue.Unknown).
2290
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The measurement medium (default to ConcentrationMeasurement.MeasurementMedium.Air).
2291
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2292
- *
2293
- * @remarks
2294
- * The measurementMedium attribute is fixed and cannot be changed after creation.
2295
- */
2296
1230
  createLevelTvocMeasurementClusterServer(levelValue = ConcentrationMeasurement.LevelValue.Unknown, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2297
1231
  this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.LevelIndication, ConcentrationMeasurement.Feature.MediumLevel, ConcentrationMeasurement.Feature.CriticalLevel), {
2298
1232
  levelValue,
@@ -2300,17 +1234,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2300
1234
  });
2301
1235
  return this;
2302
1236
  }
2303
- /**
2304
- * Create a default CarbonMonoxideConcentrationMeasurement cluster server with feature NumericMeasurement.
2305
- *
2306
- * @param {number | null} measuredValue - The measured value of the concentration.
2307
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2308
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2309
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2310
- *
2311
- * @remarks
2312
- * The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
2313
- */
2314
1237
  createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2315
1238
  this.behaviors.require(CarbonMonoxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
2316
1239
  measuredValue,
@@ -2322,17 +1245,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2322
1245
  });
2323
1246
  return this;
2324
1247
  }
2325
- /**
2326
- * Create a default CarbonDioxideConcentrationMeasurement cluster server with feature NumericMeasurement.
2327
- *
2328
- * @param {number | null} measuredValue - The measured value of the concentration.
2329
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2330
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2331
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2332
- *
2333
- * @remarks
2334
- * The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
2335
- */
2336
1248
  createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2337
1249
  this.behaviors.require(CarbonDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
2338
1250
  measuredValue,
@@ -2344,17 +1256,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2344
1256
  });
2345
1257
  return this;
2346
1258
  }
2347
- /**
2348
- * Create a default FormaldehydeConcentrationMeasurement cluster server with feature NumericMeasurement.
2349
- *
2350
- * @param {number | null} measuredValue - The measured value of the concentration.
2351
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2352
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2353
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2354
- *
2355
- * @remarks
2356
- * The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
2357
- */
2358
1259
  createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2359
1260
  this.behaviors.require(FormaldehydeConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
2360
1261
  measuredValue,
@@ -2366,17 +1267,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2366
1267
  });
2367
1268
  return this;
2368
1269
  }
2369
- /**
2370
- * Create a default Pm1ConcentrationMeasurement cluster server with feature NumericMeasurement.
2371
- *
2372
- * @param {number | null} measuredValue - The measured value of the concentration.
2373
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2374
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2375
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2376
- *
2377
- * @remarks
2378
- * The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
2379
- */
2380
1270
  createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2381
1271
  this.behaviors.require(Pm1ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
2382
1272
  measuredValue,
@@ -2388,17 +1278,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2388
1278
  });
2389
1279
  return this;
2390
1280
  }
2391
- /**
2392
- * Create a default Pm25ConcentrationMeasurement cluster server with feature NumericMeasurement.
2393
- *
2394
- * @param {number | null} measuredValue - The measured value of the concentration.
2395
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2396
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2397
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2398
- *
2399
- * @remarks
2400
- * The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
2401
- */
2402
1281
  createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2403
1282
  this.behaviors.require(Pm25ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
2404
1283
  measuredValue,
@@ -2410,17 +1289,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2410
1289
  });
2411
1290
  return this;
2412
1291
  }
2413
- /**
2414
- * Create a default Pm10ConcentrationMeasurement cluster server with feature NumericMeasurement.
2415
- *
2416
- * @param {number | null} measuredValue - The measured value of the concentration.
2417
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2418
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2419
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2420
- *
2421
- * @remarks
2422
- * The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
2423
- */
2424
1292
  createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2425
1293
  this.behaviors.require(Pm10ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
2426
1294
  measuredValue,
@@ -2432,17 +1300,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2432
1300
  });
2433
1301
  return this;
2434
1302
  }
2435
- /**
2436
- * Create a default OzoneConcentrationMeasurement cluster server with feature NumericMeasurement.
2437
- *
2438
- * @param {number | null} measuredValue - The measured value of the concentration.
2439
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
2440
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2441
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2442
- *
2443
- * @remarks
2444
- * The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
2445
- */
2446
1303
  createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2447
1304
  this.behaviors.require(OzoneConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
2448
1305
  measuredValue,
@@ -2454,17 +1311,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2454
1311
  });
2455
1312
  return this;
2456
1313
  }
2457
- /**
2458
- * Create a default RadonConcentrationMeasurement cluster server with feature NumericMeasurement.
2459
- *
2460
- * @param {number | null} measuredValue - The measured value of the concentration.
2461
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2462
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2463
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2464
- *
2465
- * @remarks
2466
- * The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
2467
- */
2468
1314
  createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2469
1315
  this.behaviors.require(RadonConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
2470
1316
  measuredValue,
@@ -2476,17 +1322,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2476
1322
  });
2477
1323
  return this;
2478
1324
  }
2479
- /**
2480
- * Create a default NitrogenDioxideConcentrationMeasurement cluster server with feature NumericMeasurement.
2481
- *
2482
- * @param {number | null} measuredValue - The measured value of the concentration.
2483
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
2484
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2485
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2486
- *
2487
- * @remarks
2488
- * The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
2489
- */
2490
1325
  createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2491
1326
  this.behaviors.require(NitrogenDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
2492
1327
  measuredValue,
@@ -2499,4 +1334,3 @@ export class MatterbridgeEndpoint extends Endpoint {
2499
1334
  return this;
2500
1335
  }
2501
1336
  }
2502
- //# sourceMappingURL=matterbridgeEndpoint.js.map