matterbridge 3.4.1 → 3.4.2-dev-20251202-c41a119

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