matterbridge 3.5.2 → 3.5.3-dev-20260202-e19e9b6

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