matterbridge 3.3.3 → 3.3.4-dev-20251020-df40d12

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