matterbridge 3.3.7 → 3.3.8-dev-20251115-920acfc

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