matterbridge 3.3.1-dev-20251011-c8b30f8 → 3.3.1

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 (291) hide show
  1. package/CHANGELOG.md +3 -3
  2. package/dist/broadcastServer.d.ts +105 -0
  3. package/dist/broadcastServer.d.ts.map +1 -0
  4. package/dist/broadcastServer.js +86 -1
  5. package/dist/broadcastServer.js.map +1 -0
  6. package/dist/broadcastServerTypes.d.ts +717 -0
  7. package/dist/broadcastServerTypes.d.ts.map +1 -0
  8. package/dist/broadcastServerTypes.js +24 -0
  9. package/dist/broadcastServerTypes.js.map +1 -0
  10. package/dist/cli.d.ts +26 -0
  11. package/dist/cli.d.ts.map +1 -0
  12. package/dist/cli.js +147 -6
  13. package/dist/cli.js.map +1 -0
  14. package/dist/cliEmitter.d.ts +50 -0
  15. package/dist/cliEmitter.d.ts.map +1 -0
  16. package/dist/cliEmitter.js +37 -0
  17. package/dist/cliEmitter.js.map +1 -0
  18. package/dist/cliHistory.d.ts +70 -0
  19. package/dist/cliHistory.d.ts.map +1 -0
  20. package/dist/cliHistory.js +89 -14
  21. package/dist/cliHistory.js.map +1 -0
  22. package/dist/clusters/export.d.ts +2 -0
  23. package/dist/clusters/export.d.ts.map +1 -0
  24. package/dist/clusters/export.js +2 -0
  25. package/dist/clusters/export.js.map +1 -0
  26. package/dist/defaultConfigSchema.d.ts +28 -0
  27. package/dist/defaultConfigSchema.d.ts.map +1 -0
  28. package/dist/defaultConfigSchema.js +24 -0
  29. package/dist/defaultConfigSchema.js.map +1 -0
  30. package/dist/deviceManager.d.ts +117 -0
  31. package/dist/deviceManager.d.ts.map +1 -0
  32. package/dist/deviceManager.js +124 -1
  33. package/dist/deviceManager.js.map +1 -0
  34. package/dist/devices/airConditioner.d.ts +98 -0
  35. package/dist/devices/airConditioner.d.ts.map +1 -0
  36. package/dist/devices/airConditioner.js +57 -0
  37. package/dist/devices/airConditioner.js.map +1 -0
  38. package/dist/devices/batteryStorage.d.ts +48 -0
  39. package/dist/devices/batteryStorage.d.ts.map +1 -0
  40. package/dist/devices/batteryStorage.js +48 -1
  41. package/dist/devices/batteryStorage.js.map +1 -0
  42. package/dist/devices/cooktop.d.ts +60 -0
  43. package/dist/devices/cooktop.d.ts.map +1 -0
  44. package/dist/devices/cooktop.js +55 -0
  45. package/dist/devices/cooktop.js.map +1 -0
  46. package/dist/devices/dishwasher.d.ts +71 -0
  47. package/dist/devices/dishwasher.d.ts.map +1 -0
  48. package/dist/devices/dishwasher.js +57 -0
  49. package/dist/devices/dishwasher.js.map +1 -0
  50. package/dist/devices/evse.d.ts +75 -0
  51. package/dist/devices/evse.d.ts.map +1 -0
  52. package/dist/devices/evse.js +74 -10
  53. package/dist/devices/evse.js.map +1 -0
  54. package/dist/devices/export.d.ts +17 -0
  55. package/dist/devices/export.d.ts.map +1 -0
  56. package/dist/devices/export.js +5 -0
  57. package/dist/devices/export.js.map +1 -0
  58. package/dist/devices/extractorHood.d.ts +46 -0
  59. package/dist/devices/extractorHood.d.ts.map +1 -0
  60. package/dist/devices/extractorHood.js +42 -0
  61. package/dist/devices/extractorHood.js.map +1 -0
  62. package/dist/devices/heatPump.d.ts +47 -0
  63. package/dist/devices/heatPump.d.ts.map +1 -0
  64. package/dist/devices/heatPump.js +50 -2
  65. package/dist/devices/heatPump.js.map +1 -0
  66. package/dist/devices/laundryDryer.d.ts +67 -0
  67. package/dist/devices/laundryDryer.d.ts.map +1 -0
  68. package/dist/devices/laundryDryer.js +62 -3
  69. package/dist/devices/laundryDryer.js.map +1 -0
  70. package/dist/devices/laundryWasher.d.ts +81 -0
  71. package/dist/devices/laundryWasher.d.ts.map +1 -0
  72. package/dist/devices/laundryWasher.js +70 -4
  73. package/dist/devices/laundryWasher.js.map +1 -0
  74. package/dist/devices/microwaveOven.d.ts +168 -0
  75. package/dist/devices/microwaveOven.d.ts.map +1 -0
  76. package/dist/devices/microwaveOven.js +88 -5
  77. package/dist/devices/microwaveOven.js.map +1 -0
  78. package/dist/devices/oven.d.ts +105 -0
  79. package/dist/devices/oven.d.ts.map +1 -0
  80. package/dist/devices/oven.js +85 -0
  81. package/dist/devices/oven.js.map +1 -0
  82. package/dist/devices/refrigerator.d.ts +118 -0
  83. package/dist/devices/refrigerator.d.ts.map +1 -0
  84. package/dist/devices/refrigerator.js +102 -0
  85. package/dist/devices/refrigerator.js.map +1 -0
  86. package/dist/devices/roboticVacuumCleaner.d.ts +112 -0
  87. package/dist/devices/roboticVacuumCleaner.d.ts.map +1 -0
  88. package/dist/devices/roboticVacuumCleaner.js +100 -9
  89. package/dist/devices/roboticVacuumCleaner.js.map +1 -0
  90. package/dist/devices/solarPower.d.ts +40 -0
  91. package/dist/devices/solarPower.d.ts.map +1 -0
  92. package/dist/devices/solarPower.js +38 -0
  93. package/dist/devices/solarPower.js.map +1 -0
  94. package/dist/devices/speaker.d.ts +87 -0
  95. package/dist/devices/speaker.d.ts.map +1 -0
  96. package/dist/devices/speaker.js +84 -0
  97. package/dist/devices/speaker.js.map +1 -0
  98. package/dist/devices/temperatureControl.d.ts +166 -0
  99. package/dist/devices/temperatureControl.d.ts.map +1 -0
  100. package/dist/devices/temperatureControl.js +25 -3
  101. package/dist/devices/temperatureControl.js.map +1 -0
  102. package/dist/devices/waterHeater.d.ts +111 -0
  103. package/dist/devices/waterHeater.d.ts.map +1 -0
  104. package/dist/devices/waterHeater.js +82 -2
  105. package/dist/devices/waterHeater.js.map +1 -0
  106. package/dist/dgram/coap.d.ts +205 -0
  107. package/dist/dgram/coap.d.ts.map +1 -0
  108. package/dist/dgram/coap.js +126 -13
  109. package/dist/dgram/coap.js.map +1 -0
  110. package/dist/dgram/dgram.d.ts +141 -0
  111. package/dist/dgram/dgram.d.ts.map +1 -0
  112. package/dist/dgram/dgram.js +114 -2
  113. package/dist/dgram/dgram.js.map +1 -0
  114. package/dist/dgram/mb_coap.d.ts +24 -0
  115. package/dist/dgram/mb_coap.d.ts.map +1 -0
  116. package/dist/dgram/mb_coap.js +41 -3
  117. package/dist/dgram/mb_coap.js.map +1 -0
  118. package/dist/dgram/mb_mdns.d.ts +24 -0
  119. package/dist/dgram/mb_mdns.d.ts.map +1 -0
  120. package/dist/dgram/mb_mdns.js +80 -15
  121. package/dist/dgram/mb_mdns.js.map +1 -0
  122. package/dist/dgram/mdns.d.ts +290 -0
  123. package/dist/dgram/mdns.d.ts.map +1 -0
  124. package/dist/dgram/mdns.js +299 -137
  125. package/dist/dgram/mdns.js.map +1 -0
  126. package/dist/dgram/multicast.d.ts +67 -0
  127. package/dist/dgram/multicast.d.ts.map +1 -0
  128. package/dist/dgram/multicast.js +62 -1
  129. package/dist/dgram/multicast.js.map +1 -0
  130. package/dist/dgram/unicast.d.ts +56 -0
  131. package/dist/dgram/unicast.d.ts.map +1 -0
  132. package/dist/dgram/unicast.js +54 -0
  133. package/dist/dgram/unicast.js.map +1 -0
  134. package/dist/frontend.d.ts +234 -0
  135. package/dist/frontend.d.ts.map +1 -0
  136. package/dist/frontend.js +402 -29
  137. package/dist/frontend.js.map +1 -0
  138. package/dist/frontendTypes.d.ts +522 -0
  139. package/dist/frontendTypes.d.ts.map +1 -0
  140. package/dist/frontendTypes.js +45 -0
  141. package/dist/frontendTypes.js.map +1 -0
  142. package/dist/helpers.d.ts +48 -0
  143. package/dist/helpers.d.ts.map +1 -0
  144. package/dist/helpers.js +53 -0
  145. package/dist/helpers.js.map +1 -0
  146. package/dist/index.d.ts +33 -0
  147. package/dist/index.d.ts.map +1 -0
  148. package/dist/index.js +25 -0
  149. package/dist/index.js.map +1 -0
  150. package/dist/logger/export.d.ts +2 -0
  151. package/dist/logger/export.d.ts.map +1 -0
  152. package/dist/logger/export.js +1 -0
  153. package/dist/logger/export.js.map +1 -0
  154. package/dist/matter/behaviors.d.ts +2 -0
  155. package/dist/matter/behaviors.d.ts.map +1 -0
  156. package/dist/matter/behaviors.js +2 -0
  157. package/dist/matter/behaviors.js.map +1 -0
  158. package/dist/matter/clusters.d.ts +2 -0
  159. package/dist/matter/clusters.d.ts.map +1 -0
  160. package/dist/matter/clusters.js +2 -0
  161. package/dist/matter/clusters.js.map +1 -0
  162. package/dist/matter/devices.d.ts +2 -0
  163. package/dist/matter/devices.d.ts.map +1 -0
  164. package/dist/matter/devices.js +2 -0
  165. package/dist/matter/devices.js.map +1 -0
  166. package/dist/matter/endpoints.d.ts +2 -0
  167. package/dist/matter/endpoints.d.ts.map +1 -0
  168. package/dist/matter/endpoints.js +2 -0
  169. package/dist/matter/endpoints.js.map +1 -0
  170. package/dist/matter/export.d.ts +5 -0
  171. package/dist/matter/export.d.ts.map +1 -0
  172. package/dist/matter/export.js +3 -0
  173. package/dist/matter/export.js.map +1 -0
  174. package/dist/matter/types.d.ts +3 -0
  175. package/dist/matter/types.d.ts.map +1 -0
  176. package/dist/matter/types.js +3 -0
  177. package/dist/matter/types.js.map +1 -0
  178. package/dist/matterbridge.d.ts +469 -0
  179. package/dist/matterbridge.d.ts.map +1 -0
  180. package/dist/matterbridge.js +795 -45
  181. package/dist/matterbridge.js.map +1 -0
  182. package/dist/matterbridgeAccessoryPlatform.d.ts +42 -0
  183. package/dist/matterbridgeAccessoryPlatform.d.ts.map +1 -0
  184. package/dist/matterbridgeAccessoryPlatform.js +36 -0
  185. package/dist/matterbridgeAccessoryPlatform.js.map +1 -0
  186. package/dist/matterbridgeBehaviors.d.ts +1747 -0
  187. package/dist/matterbridgeBehaviors.d.ts.map +1 -0
  188. package/dist/matterbridgeBehaviors.js +65 -5
  189. package/dist/matterbridgeBehaviors.js.map +1 -0
  190. package/dist/matterbridgeDeviceTypes.d.ts +761 -0
  191. package/dist/matterbridgeDeviceTypes.d.ts.map +1 -0
  192. package/dist/matterbridgeDeviceTypes.js +630 -17
  193. package/dist/matterbridgeDeviceTypes.js.map +1 -0
  194. package/dist/matterbridgeDynamicPlatform.d.ts +42 -0
  195. package/dist/matterbridgeDynamicPlatform.d.ts.map +1 -0
  196. package/dist/matterbridgeDynamicPlatform.js +36 -0
  197. package/dist/matterbridgeDynamicPlatform.js.map +1 -0
  198. package/dist/matterbridgeEndpoint.d.ts +1534 -0
  199. package/dist/matterbridgeEndpoint.d.ts.map +1 -0
  200. package/dist/matterbridgeEndpoint.js +1398 -58
  201. package/dist/matterbridgeEndpoint.js.map +1 -0
  202. package/dist/matterbridgeEndpointHelpers.d.ts +407 -0
  203. package/dist/matterbridgeEndpointHelpers.d.ts.map +1 -0
  204. package/dist/matterbridgeEndpointHelpers.js +345 -12
  205. package/dist/matterbridgeEndpointHelpers.js.map +1 -0
  206. package/dist/matterbridgePlatform.d.ts +402 -0
  207. package/dist/matterbridgePlatform.d.ts.map +1 -0
  208. package/dist/matterbridgePlatform.js +341 -1
  209. package/dist/matterbridgePlatform.js.map +1 -0
  210. package/dist/matterbridgeTypes.d.ts +209 -0
  211. package/dist/matterbridgeTypes.d.ts.map +1 -0
  212. package/dist/matterbridgeTypes.js +26 -0
  213. package/dist/matterbridgeTypes.js.map +1 -0
  214. package/dist/pluginManager.d.ts +353 -0
  215. package/dist/pluginManager.d.ts.map +1 -0
  216. package/dist/pluginManager.js +325 -3
  217. package/dist/pluginManager.js.map +1 -0
  218. package/dist/shelly.d.ts +174 -0
  219. package/dist/shelly.d.ts.map +1 -0
  220. package/dist/shelly.js +168 -7
  221. package/dist/shelly.js.map +1 -0
  222. package/dist/storage/export.d.ts +2 -0
  223. package/dist/storage/export.d.ts.map +1 -0
  224. package/dist/storage/export.js +1 -0
  225. package/dist/storage/export.js.map +1 -0
  226. package/dist/update.d.ts +75 -0
  227. package/dist/update.d.ts.map +1 -0
  228. package/dist/update.js +69 -0
  229. package/dist/update.js.map +1 -0
  230. package/dist/utils/colorUtils.d.ts +99 -0
  231. package/dist/utils/colorUtils.d.ts.map +1 -0
  232. package/dist/utils/colorUtils.js +97 -2
  233. package/dist/utils/colorUtils.js.map +1 -0
  234. package/dist/utils/commandLine.d.ts +59 -0
  235. package/dist/utils/commandLine.d.ts.map +1 -0
  236. package/dist/utils/commandLine.js +54 -0
  237. package/dist/utils/commandLine.js.map +1 -0
  238. package/dist/utils/copyDirectory.d.ts +33 -0
  239. package/dist/utils/copyDirectory.d.ts.map +1 -0
  240. package/dist/utils/copyDirectory.js +38 -1
  241. package/dist/utils/copyDirectory.js.map +1 -0
  242. package/dist/utils/createDirectory.d.ts +34 -0
  243. package/dist/utils/createDirectory.d.ts.map +1 -0
  244. package/dist/utils/createDirectory.js +33 -0
  245. package/dist/utils/createDirectory.js.map +1 -0
  246. package/dist/utils/createZip.d.ts +39 -0
  247. package/dist/utils/createZip.d.ts.map +1 -0
  248. package/dist/utils/createZip.js +47 -2
  249. package/dist/utils/createZip.js.map +1 -0
  250. package/dist/utils/deepCopy.d.ts +32 -0
  251. package/dist/utils/deepCopy.d.ts.map +1 -0
  252. package/dist/utils/deepCopy.js +39 -0
  253. package/dist/utils/deepCopy.js.map +1 -0
  254. package/dist/utils/deepEqual.d.ts +54 -0
  255. package/dist/utils/deepEqual.d.ts.map +1 -0
  256. package/dist/utils/deepEqual.js +72 -1
  257. package/dist/utils/deepEqual.js.map +1 -0
  258. package/dist/utils/error.d.ts +44 -0
  259. package/dist/utils/error.d.ts.map +1 -0
  260. package/dist/utils/error.js +41 -0
  261. package/dist/utils/error.js.map +1 -0
  262. package/dist/utils/export.d.ts +13 -0
  263. package/dist/utils/export.d.ts.map +1 -0
  264. package/dist/utils/export.js +1 -0
  265. package/dist/utils/export.js.map +1 -0
  266. package/dist/utils/hex.d.ts +89 -0
  267. package/dist/utils/hex.d.ts.map +1 -0
  268. package/dist/utils/hex.js +124 -0
  269. package/dist/utils/hex.js.map +1 -0
  270. package/dist/utils/isvalid.d.ts +103 -0
  271. package/dist/utils/isvalid.d.ts.map +1 -0
  272. package/dist/utils/isvalid.js +101 -0
  273. package/dist/utils/isvalid.js.map +1 -0
  274. package/dist/utils/jestHelpers.d.ts +137 -0
  275. package/dist/utils/jestHelpers.d.ts.map +1 -0
  276. package/dist/utils/jestHelpers.js +153 -3
  277. package/dist/utils/jestHelpers.js.map +1 -0
  278. package/dist/utils/network.d.ts +115 -0
  279. package/dist/utils/network.d.ts.map +1 -0
  280. package/dist/utils/network.js +108 -5
  281. package/dist/utils/network.js.map +1 -0
  282. package/dist/utils/spawn.d.ts +35 -0
  283. package/dist/utils/spawn.d.ts.map +1 -0
  284. package/dist/utils/spawn.js +71 -0
  285. package/dist/utils/spawn.js.map +1 -0
  286. package/dist/utils/wait.d.ts +54 -0
  287. package/dist/utils/wait.d.ts.map +1 -0
  288. package/dist/utils/wait.js +60 -8
  289. package/dist/utils/wait.js.map +1 -0
  290. package/npm-shrinkwrap.json +2 -2
  291. package/package.json +2 -1
@@ -1,7 +1,34 @@
1
+ /**
2
+ * This file contains the helpers for the class MatterbridgeEndpoint.
3
+ *
4
+ * @file matterbridgeEndpointHelpers.ts
5
+ * @author Luca Liguori
6
+ * @created 2024-10-01
7
+ * @version 2.1.0
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
+ // Other modules
1
25
  import { createHash } from 'node:crypto';
26
+ // AnsiLogger module
2
27
  import { BLUE, CYAN, db, debugStringify, er, hk, or, YELLOW, zb } from 'node-ansi-logger';
28
+ // @matter
3
29
  import { Lifecycle } from '@matter/main';
4
30
  import { getClusterNameById } from '@matter/main/types';
31
+ // @matter clusters
5
32
  import { PowerSource } from '@matter/main/clusters/power-source';
6
33
  import { UserLabel } from '@matter/main/clusters/user-label';
7
34
  import { FixedLabel } from '@matter/main/clusters/fixed-label';
@@ -46,6 +73,7 @@ import { TotalVolatileOrganicCompoundsConcentrationMeasurement } from '@matter/m
46
73
  import { OperationalState } from '@matter/main/clusters/operational-state';
47
74
  import { DeviceEnergyManagement } from '@matter/main/clusters/device-energy-management';
48
75
  import { DeviceEnergyManagementMode } from '@matter/main/clusters/device-energy-management-mode';
76
+ // @matter behaviors
49
77
  import { PowerSourceServer } from '@matter/main/behaviors/power-source';
50
78
  import { UserLabelServer } from '@matter/main/behaviors/user-label';
51
79
  import { FixedLabelServer } from '@matter/main/behaviors/fixed-label';
@@ -76,56 +104,126 @@ import { Pm10ConcentrationMeasurementServer } from '@matter/main/behaviors/pm10-
76
104
  import { RadonConcentrationMeasurementServer } from '@matter/main/behaviors/radon-concentration-measurement';
77
105
  import { TotalVolatileOrganicCompoundsConcentrationMeasurementServer } from '@matter/main/behaviors/total-volatile-organic-compounds-concentration-measurement';
78
106
  import { DeviceEnergyManagementServer } from '@matter/node/behaviors/device-energy-management';
107
+ // Matterbridge
79
108
  import { deepCopy, deepEqual, isValidArray } from './utils/export.js';
80
109
  import { MatterbridgeIdentifyServer, MatterbridgeOnOffServer, MatterbridgeLevelControlServer, MatterbridgeColorControlServer, MatterbridgeLiftWindowCoveringServer, MatterbridgeThermostatServer, MatterbridgeFanControlServer, MatterbridgeDoorLockServer, MatterbridgeModeSelectServer, MatterbridgeValveConfigurationAndControlServer, MatterbridgeSmokeCoAlarmServer, MatterbridgeBooleanStateConfigurationServer, MatterbridgeOperationalStateServer, MatterbridgeDeviceEnergyManagementModeServer, } from './matterbridgeBehaviors.js';
110
+ /**
111
+ * Capitalizes the first letter of a string.
112
+ *
113
+ * @param {string} name - The string to capitalize.
114
+ * @returns {string} The string with the first letter capitalized.
115
+ */
81
116
  export function capitalizeFirstLetter(name) {
82
117
  if (!name)
83
118
  return name;
84
119
  return name.charAt(0).toUpperCase() + name.slice(1);
85
120
  }
121
+ /**
122
+ * Lowercases the first letter of a string.
123
+ *
124
+ * @param {string} name - The string to lowercase the first letter of.
125
+ * @returns {string} The string with the first letter lowercased.
126
+ */
86
127
  export function lowercaseFirstLetter(name) {
87
128
  if (!name)
88
129
  return name;
89
130
  return name.charAt(0).toLowerCase() + name.slice(1);
90
131
  }
132
+ /**
133
+ * Checks if the device name contains non-Latin characters.
134
+ *
135
+ * @param {string} deviceName - The name of the device to check.
136
+ * @returns {boolean} Returns true if the device name contains non-Latin characters, false otherwise.
137
+ */
91
138
  export function checkNotLatinCharacters(deviceName) {
92
139
  const nonLatinRegexList = [
93
- /[\u0400-\u04FF\u0500-\u052F]/,
94
- /[\u2E80-\u9FFF]/,
95
- /[\uAC00-\uD7AF]/,
96
- /[\u0600-\u06FF\u0750-\u077F]/,
97
- /[\u0590-\u05FF]/,
98
- /[\u0900-\u097F]/,
99
- /[\u0E00-\u0E7F]/,
100
- /[\u1200-\u137F]/,
140
+ /[\u0400-\u04FF\u0500-\u052F]/, // Cyrillic
141
+ /[\u2E80-\u9FFF]/, // CJK (Chinese, Japanese, Korean)
142
+ /[\uAC00-\uD7AF]/, // Korean Hangul
143
+ /[\u0600-\u06FF\u0750-\u077F]/, // Arabic, Persian
144
+ /[\u0590-\u05FF]/, // Hebrew
145
+ /[\u0900-\u097F]/, // Devanagari (Hindi, Sanskrit)
146
+ /[\u0E00-\u0E7F]/, // Thai
147
+ /[\u1200-\u137F]/, // Ethiopic (Amharic, Tigrinya)
101
148
  ];
102
149
  return nonLatinRegexList.some((regex) => regex.test(deviceName));
103
150
  }
151
+ /**
152
+ * Generates a unique ID based on the device name.
153
+ *
154
+ * @param {string} deviceName - The name of the device to generate a unique ID for.
155
+ * @returns {string} A unique ID generated from the device name using MD5 hashing.
156
+ */
104
157
  export function generateUniqueId(deviceName) {
105
- return createHash('md5').update(deviceName).digest('hex');
106
- }
158
+ return createHash('md5').update(deviceName).digest('hex'); // MD5 hash of the device name
159
+ }
160
+ /**
161
+ * Generates a unique ID based on four parameters.
162
+ *
163
+ * @param {string} param1 - The first parameter.
164
+ * @param {string} param2 - The second parameter.
165
+ * @param {string} param3 - The third parameter.
166
+ * @param {string} param4 - The fourth parameter.
167
+ * @returns {string} A unique ID generated from the concatenation of the parameters using MD5 hashing.
168
+ */
107
169
  export function createUniqueId(param1, param2, param3, param4) {
108
170
  const hash = createHash('md5');
109
171
  hash.update(param1 + param2 + param3 + param4);
110
172
  return hash.digest('hex');
111
173
  }
174
+ /**
175
+ * Retrieves the features for a specific behavior.
176
+ *
177
+ * @param {Endpoint} endpoint - The endpoint to retrieve the features from.
178
+ * @param {string} behavior - The behavior to retrieve the features for.
179
+ *
180
+ * @returns {Record<string, boolean | undefined>} The features for the specified behavior.
181
+ *
182
+ * @remarks Use with:
183
+ * ```typescript
184
+ * expect(featuresFor(device, 'powerSource').wired).toBe(true);
185
+ * ```
186
+ */
112
187
  export function featuresFor(endpoint, behavior) {
188
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
113
189
  return endpoint.behaviors.supported[lowercaseFirstLetter(behavior)]['cluster']['supportedFeatures'];
114
190
  }
191
+ /**
192
+ * Maps a list of ClusterId to Behavior.Type for server clusters.
193
+ *
194
+ * @param {ClusterId[]} clusterServerList - The list of ClusterId to map.
195
+ * @returns {Behavior.Type[]} An array of Behavior.Type corresponding to the ClusterId in the server list.
196
+ */
115
197
  export function getBehaviourTypesFromClusterServerIds(clusterServerList) {
198
+ // Map Server ClusterId to Behavior.Type
116
199
  const behaviorTypes = [];
117
200
  clusterServerList.forEach((clusterId) => {
118
201
  behaviorTypes.push(getBehaviourTypeFromClusterServerId(clusterId));
119
202
  });
120
203
  return behaviorTypes;
121
204
  }
205
+ /**
206
+ * Maps a list of ClusterId to Behavior.Type for client clusters.
207
+ *
208
+ * @param {ClusterId[]} clusterClientList - The list of ClusterId to map.
209
+ * @returns {Behavior.Type[]} An array of Behavior.Type corresponding to the ClusterId in the client list.
210
+ */
122
211
  export function getBehaviourTypesFromClusterClientIds(clusterClientList) {
212
+ // Map Client ClusterId to Behavior.Type
123
213
  const behaviorTypes = [];
124
214
  clusterClientList.forEach((_clusterId) => {
215
+ // behaviorTypes.push(getBehaviourTypeFromClusterClientId(clusterId));
125
216
  });
126
217
  return behaviorTypes;
127
218
  }
219
+ /**
220
+ * Maps a ClusterId to a Behavior.Type for server clusters.
221
+ *
222
+ * @param {ClusterId} clusterId - The ClusterId to map.
223
+ * @returns {Behavior.Type} The corresponding Behavior.Type for the given ClusterId.
224
+ */
128
225
  export function getBehaviourTypeFromClusterServerId(clusterId) {
226
+ // Map ClusterId to Server Behavior.Type
129
227
  if (clusterId === PowerSource.Cluster.id)
130
228
  return PowerSourceServer.with(PowerSource.Feature.Wired);
131
229
  if (clusterId === UserLabel.Cluster.id)
@@ -216,8 +314,22 @@ export function getBehaviourTypeFromClusterServerId(clusterId) {
216
314
  return MatterbridgeDeviceEnergyManagementModeServer;
217
315
  return MatterbridgeIdentifyServer;
218
316
  }
317
+ /**
318
+ * Maps a ClusterId to a Behavior.Type for client clusters.
319
+ *
320
+ * @param {ClusterId} _clusterId - The ClusterId to map.
321
+ */
219
322
  export function getBehaviourTypeFromClusterClientId(_clusterId) {
220
- }
323
+ // Map ClusterId to Client Behavior.Type
324
+ // return IdentifyClient;
325
+ }
326
+ /**
327
+ * Retrieves the Behavior.Type for a given cluster from the endpoint's supported behaviors.
328
+ *
329
+ * @param {MatterbridgeEndpoint} endpoint - The endpoint to retrieve the behavior from.
330
+ * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to retrieve the behavior for.
331
+ * @returns {Behavior.Type | undefined} The Behavior.Type for the given cluster, or undefined if not found.
332
+ */
221
333
  export function getBehavior(endpoint, cluster) {
222
334
  let behavior;
223
335
  if (typeof cluster === 'string') {
@@ -234,6 +346,18 @@ export function getBehavior(endpoint, cluster) {
234
346
  }
235
347
  return behavior;
236
348
  }
349
+ /**
350
+ * Invokes a command on the specified behavior of the endpoint. Used ONLY in Jest tests.
351
+ *
352
+ * @param {MatterbridgeEndpoint} endpoint - The endpoint to invoke the command on.
353
+ * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to invoke the command on.
354
+ * @param {keyof MatterbridgeEndpointCommands} command - The command to invoke.
355
+ * @param {Record<string, boolean | number | bigint | string | object | null>} [params] - The parameters to pass to the command.
356
+ *
357
+ * @returns {Promise<boolean>} A promise that resolves to true if the command was invoked successfully, false otherwise.
358
+ *
359
+ * @deprecated Used ONLY in Jest tests.
360
+ */
237
361
  export async function invokeBehaviorCommand(endpoint, cluster, command, params) {
238
362
  const behaviorId = getBehavior(endpoint, cluster)?.id;
239
363
  if (!behaviorId) {
@@ -241,6 +365,7 @@ export async function invokeBehaviorCommand(endpoint, cluster, command, params)
241
365
  return false;
242
366
  }
243
367
  await endpoint.act((agent) => {
368
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
244
369
  const behavior = agent[behaviorId];
245
370
  if (!(command in behavior) || typeof behavior[command] !== 'function') {
246
371
  endpoint.log?.error(`invokeBehaviorCommand error: command ${hk}${command}${er} not found on agent for endpoint ${or}${endpoint.maybeId}${er}:${or}${endpoint.maybeNumber}${er}`);
@@ -250,6 +375,19 @@ export async function invokeBehaviorCommand(endpoint, cluster, command, params)
250
375
  });
251
376
  return true;
252
377
  }
378
+ /**
379
+ * Invokes the subscription handler on the specified cluster and attribute of the endpoint. Used ONLY in Jest tests.
380
+ *
381
+ * @param {MatterbridgeEndpoint} endpoint - The endpoint to invoke the subscription handler on.
382
+ * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to invoke the subscription handler on.
383
+ * @param {string} attribute - The attribute to invoke the subscription handler on.
384
+ * @param {unknown} newValue - The new value of the attribute.
385
+ * @param {unknown} oldValue - The old value of the attribute.
386
+ *
387
+ * @returns {Promise<boolean>} A promise that resolves to true if the subscription handler was invoked successfully, false otherwise.
388
+ *
389
+ * @deprecated Used ONLY in Jest tests.
390
+ */
253
391
  export async function invokeSubscribeHandler(endpoint, cluster, attribute, newValue, oldValue) {
254
392
  const event = attribute + '$Changed';
255
393
  const clusterName = getBehavior(endpoint, cluster)?.id;
@@ -266,9 +404,17 @@ export async function invokeSubscribeHandler(endpoint, cluster, attribute, newVa
266
404
  endpoint.log.error(`invokeSubscribeHandler ${hk}${event}${er} error: cluster ${clusterName} not found on endpoint ${or}${endpoint.id}${er}:${or}${endpoint.number}${er}`);
267
405
  return false;
268
406
  }
407
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
408
+ // @ts-ignore
269
409
  await endpoint.act((agent) => agent[clusterName].events[event].emit(newValue, oldValue, { ...agent.context, offline: false }));
270
410
  return true;
271
411
  }
412
+ /**
413
+ * Adds required cluster servers to the specified endpoint based on the device types.
414
+ *
415
+ * @param {MatterbridgeEndpoint} endpoint - The endpoint to add the required cluster servers to.
416
+ * @returns {void}
417
+ */
272
418
  export function addRequiredClusterServers(endpoint) {
273
419
  const requiredServerList = [];
274
420
  endpoint.log.debug(`addRequiredClusterServers for ${CYAN}${endpoint.maybeId}${db}`);
@@ -283,6 +429,12 @@ export function addRequiredClusterServers(endpoint) {
283
429
  });
284
430
  addClusterServers(endpoint, requiredServerList);
285
431
  }
432
+ /**
433
+ * Adds optional cluster servers to the specified endpoint based on the device types.
434
+ *
435
+ * @param {MatterbridgeEndpoint} endpoint - The endpoint to add the optional cluster servers to.
436
+ * @returns {void}
437
+ */
286
438
  export function addOptionalClusterServers(endpoint) {
287
439
  const optionalServerList = [];
288
440
  endpoint.log.debug(`addOptionalClusterServers for ${CYAN}${endpoint.maybeId}${db}`);
@@ -297,6 +449,12 @@ export function addOptionalClusterServers(endpoint) {
297
449
  });
298
450
  addClusterServers(endpoint, optionalServerList);
299
451
  }
452
+ /**
453
+ * Adds cluster servers to the specified endpoint based on the provided server list.
454
+ *
455
+ * @param {MatterbridgeEndpoint} endpoint - The endpoint to add the cluster servers to.
456
+ * @param {ClusterId[]} serverList - The list of cluster IDs to add.
457
+ */
300
458
  export function addClusterServers(endpoint, serverList) {
301
459
  if (serverList.includes(PowerSource.Cluster.id))
302
460
  endpoint.createDefaultPowerSourceWiredClusterServer();
@@ -377,6 +535,13 @@ export function addClusterServers(endpoint, serverList) {
377
535
  if (serverList.includes(DeviceEnergyManagementMode.Cluster.id))
378
536
  endpoint.createDefaultDeviceEnergyManagementModeClusterServer();
379
537
  }
538
+ /**
539
+ * Adds a fixed label to the FixedLabel cluster. The FixedLabel cluster is created if it does not exist.
540
+ *
541
+ * @param {MatterbridgeEndpoint} endpoint - The endpoint to add the cluster servers to.
542
+ * @param {string} label - The label to add. Max 16 characters.
543
+ * @param {string} value - The value of the label. Max 16 characters.
544
+ */
380
545
  export async function addFixedLabel(endpoint, label, value) {
381
546
  if (!endpoint.hasClusterServer(FixedLabel.Cluster.id)) {
382
547
  endpoint.log.debug(`addFixedLabel: add cluster ${hk}FixedLabel${db}:${hk}fixedLabel${db} with label ${CYAN}${label}${db} value ${CYAN}${value}${db}`);
@@ -393,6 +558,13 @@ export async function addFixedLabel(endpoint, label, value) {
393
558
  await endpoint.setAttribute(FixedLabel.Cluster.id, 'labelList', labelList, endpoint.log);
394
559
  }
395
560
  }
561
+ /**
562
+ * Adds a user label to the UserLabel cluster. The UserLabel cluster is created if it does not exist.
563
+ *
564
+ * @param {MatterbridgeEndpoint} endpoint - The endpoint to add the cluster servers to.
565
+ * @param {string} label - The label to add. Max 16 characters.
566
+ * @param {string} value - The value of the label. Max 16 characters.
567
+ */
396
568
  export async function addUserLabel(endpoint, label, value) {
397
569
  if (!endpoint.hasClusterServer(UserLabel.Cluster.id)) {
398
570
  endpoint.log.debug(`addUserLabel: add cluster ${hk}UserLabel${db}:${hk}userLabel${db} with label ${CYAN}${label}${db} value ${CYAN}${value}${db}`);
@@ -409,16 +581,48 @@ export async function addUserLabel(endpoint, label, value) {
409
581
  await endpoint.setAttribute(UserLabel.Cluster.id, 'labelList', labelList, endpoint.log);
410
582
  }
411
583
  }
584
+ /**
585
+ * Returns the options for a given behavior type.
586
+ *
587
+ * @param {T} type - The behavior type.
588
+ * @param {Behavior.Options<T>} options - The options for the behavior type.
589
+ * @returns {Behavior.Options<T>} The options for the behavior type.
590
+ */
412
591
  export function optionsFor(type, options) {
413
592
  return options;
414
593
  }
594
+ /**
595
+ * Retrieves the cluster ID.
596
+ *
597
+ * @param {Endpoint} endpoint - The endpoint to retrieve the cluster ID from.
598
+ * @param {ClusterId} cluster - The ID of the cluster.
599
+ * @returns {number | undefined} The ID of the cluster.
600
+ */
415
601
  export function getClusterId(endpoint, cluster) {
416
602
  return endpoint.behaviors.supported[lowercaseFirstLetter(cluster)]?.schema?.id;
417
603
  }
604
+ /**
605
+ * Retrieves the ID of an attribute from a cluster behavior.
606
+ *
607
+ * @param {Endpoint} endpoint - The endpoint to retrieve the attribute ID from.
608
+ * @param {string} cluster - The name of the cluster.
609
+ * @param {string} attribute - The name of the attribute.
610
+ * @returns {number | undefined} The ID of the attribute, or undefined if not found.
611
+ */
418
612
  export function getAttributeId(endpoint, cluster, attribute) {
419
613
  const clusterBehavior = endpoint.behaviors.supported[lowercaseFirstLetter(cluster)];
420
614
  return clusterBehavior?.cluster?.attributes[lowercaseFirstLetter(attribute)]?.id;
421
615
  }
616
+ /**
617
+ * Retrieves the value of the provided attribute from the given cluster.
618
+ *
619
+ * @param {MatterbridgeEndpoint} endpoint - The endpoint to retrieve the attribute from.
620
+ * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to retrieve the attribute from.
621
+ * @param {string} attribute - The name of the attribute to retrieve.
622
+ * @param {AnsiLogger} [log] - (Optional) The logger to use for logging the retrieve. Errors are logged to the endpoint logger.
623
+ * @returns {any} The value of the attribute, or undefined if the attribute is not found.
624
+ */
625
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
422
626
  export function getAttribute(endpoint, cluster, attribute, log) {
423
627
  const clusterName = getBehavior(endpoint, cluster)?.id;
424
628
  if (!clusterName) {
@@ -441,6 +645,16 @@ export function getAttribute(endpoint, cluster, attribute, log) {
441
645
  log?.info(`${db}Get endpoint ${or}${endpoint.id}${db}:${or}${endpoint.number}${db} attribute ${hk}${capitalizeFirstLetter(clusterName)}${db}.${hk}${attribute}${db} value ${YELLOW}${value !== null && typeof value === 'object' ? debugStringify(value) : value}${db}`);
442
646
  return value;
443
647
  }
648
+ /**
649
+ * Sets the value of an attribute on a cluster server.
650
+ *
651
+ * @param {MatterbridgeEndpoint} endpoint - The endpoint to set the attribute on.
652
+ * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to set the attribute on.
653
+ * @param {string} attribute - The name of the attribute.
654
+ * @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
655
+ * @param {AnsiLogger} [log] - (Optional) The logger to use for logging the set. Errors are logged to the endpoint logger.
656
+ * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
657
+ */
444
658
  export async function setAttribute(endpoint, cluster, attribute, value, log) {
445
659
  const clusterName = getBehavior(endpoint, cluster)?.id;
446
660
  if (!clusterName) {
@@ -466,6 +680,16 @@ export async function setAttribute(endpoint, cluster, attribute, value, log) {
466
680
  `to ${YELLOW}${value !== null && typeof value === 'object' ? debugStringify(value) : value}${db}`);
467
681
  return true;
468
682
  }
683
+ /**
684
+ * Sets the value of an attribute on a cluster server.
685
+ *
686
+ * @param {MatterbridgeEndpoint} endpoint - The endpoint to update the attribute on.
687
+ * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to update the attribute on.
688
+ * @param {string} attribute - The name of the attribute.
689
+ * @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
690
+ * @param {AnsiLogger} [log] - (Optional) The logger to use for logging the update. Errors are logged to the endpoint logger.
691
+ * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
692
+ */
469
693
  export async function updateAttribute(endpoint, cluster, attribute, value, log) {
470
694
  const clusterName = getBehavior(endpoint, cluster)?.id;
471
695
  if (!clusterName) {
@@ -496,7 +720,24 @@ export async function updateAttribute(endpoint, cluster, attribute, value, log)
496
720
  `to ${YELLOW}${value !== null && typeof value === 'object' ? debugStringify(value) : value}${db}`);
497
721
  return true;
498
722
  }
499
- export async function subscribeAttribute(endpoint, cluster, attribute, listener, log) {
723
+ /**
724
+ * Subscribes to the provided attribute on a cluster.
725
+ *
726
+ * @param {MatterbridgeEndpoint} endpoint - The endpoint to subscribe the attribute to.
727
+ * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to subscribe the attribute to.
728
+ * @param {string} attribute - The name of the attribute to subscribe to.
729
+ * @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.
730
+ * @param {AnsiLogger} [log] - Optional logger for logging errors and information.
731
+ * @returns {boolean} - A boolean indicating whether the subscription was successful.
732
+ *
733
+ * @remarks The listener function (cannot be async) will receive three parameters:
734
+ * - `newValue`: The new value of the attribute.
735
+ * - `oldValue`: The old value of the attribute.
736
+ * - `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.
737
+ */
738
+ export async function subscribeAttribute(endpoint, cluster, attribute,
739
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
740
+ listener, log) {
500
741
  const clusterName = getBehavior(endpoint, cluster)?.id;
501
742
  if (!clusterName) {
502
743
  endpoint.log.error(`subscribeAttribute ${hk}${attribute}${er} error: cluster not found on endpoint ${or}${endpoint.maybeId}${er}:${or}${endpoint.maybeNumber}${er}`);
@@ -506,6 +747,7 @@ export async function subscribeAttribute(endpoint, cluster, attribute, listener,
506
747
  endpoint.log.debug(`subscribeAttribute ${hk}${clusterName}.${attribute}${db}: Endpoint ${or}${endpoint.maybeId}${db}:${or}${endpoint.maybeNumber}${db} is in the ${BLUE}${endpoint.construction.status}${db} state`);
507
748
  await endpoint.construction.ready;
508
749
  }
750
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
509
751
  const events = endpoint.events;
510
752
  attribute = lowercaseFirstLetter(attribute) + '$Changed';
511
753
  if (!(clusterName in events) || !(attribute in events[clusterName])) {
@@ -516,6 +758,17 @@ export async function subscribeAttribute(endpoint, cluster, attribute, listener,
516
758
  log?.info(`${db}Subscribed endpoint ${or}${endpoint.id}${db}:${or}${endpoint.number}${db} attribute ${hk}${capitalizeFirstLetter(clusterName)}${db}.${hk}${attribute}${db}`);
517
759
  return true;
518
760
  }
761
+ /**
762
+ * Triggers an event on the specified cluster.
763
+ *
764
+ * @param {MatterbridgeEndpoint} endpoint - The endpoint to trigger the event on.
765
+ * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The ID of the cluster.
766
+ * @param {string} event - The name of the event to trigger.
767
+ * @param {Record<string, boolean | number | bigint | string | object | undefined | null>} payload - The payload to pass to the event.
768
+ * @param {AnsiLogger} [log] - Optional logger for logging information.
769
+ *
770
+ * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the event was successfully triggered.
771
+ */
519
772
  export async function triggerEvent(endpoint, cluster, event, payload, log) {
520
773
  const clusterName = getBehavior(endpoint, cluster)?.id;
521
774
  if (!clusterName) {
@@ -526,15 +779,32 @@ export async function triggerEvent(endpoint, cluster, event, payload, log) {
526
779
  endpoint.log.error(`triggerEvent ${hk}${clusterName}.${event}${er} error: Endpoint ${or}${endpoint.maybeId}${er}:${or}${endpoint.maybeNumber}${er} is in the ${BLUE}${endpoint.construction.status}${er} state`);
527
780
  return false;
528
781
  }
782
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
529
783
  const events = endpoint.events;
530
784
  if (!(clusterName in events) || !(event in events[clusterName])) {
531
785
  endpoint.log.error(`triggerEvent ${hk}${event}${er} error: cluster ${clusterName} not found on endpoint ${or}${endpoint.id}${er}:${or}${endpoint.number}${er}`);
532
786
  return false;
533
787
  }
788
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
789
+ // @ts-ignore
534
790
  await endpoint.act((agent) => agent[clusterName].events[event].emit(payload, agent.context));
535
791
  log?.info(`${db}Trigger event ${hk}${capitalizeFirstLetter(clusterName)}${db}.${hk}${event}${db} with ${debugStringify(payload)}${db} on endpoint ${or}${endpoint.id}${db}:${or}${endpoint.number}${db} `);
536
792
  return true;
537
793
  }
794
+ /**
795
+ * Get the default OperationalState Cluster Server.
796
+ *
797
+ * @param {OperationalState.OperationalStateEnum} operationalState - The initial operational state id.
798
+ *
799
+ * @returns {Behavior.Options<MatterbridgeOperationalStateServer>} - The default options for the OperationalState cluster server.
800
+ *
801
+ * @remarks
802
+ * This method adds a cluster server with a default operational state configuration:
803
+ * - { operationalStateId: OperationalState.OperationalStateEnum.Stopped, operationalStateLabel: 'Stopped' },
804
+ * - { operationalStateId: OperationalState.OperationalStateEnum.Running, operationalStateLabel: 'Running' },
805
+ * - { operationalStateId: OperationalState.OperationalStateEnum.Paused, operationalStateLabel: 'Paused' },
806
+ * - { operationalStateId: OperationalState.OperationalStateEnum.Error, operationalStateLabel: 'Error' },
807
+ */
538
808
  export function getDefaultOperationalStateClusterServer(operationalState = OperationalState.OperationalStateEnum.Stopped) {
539
809
  return optionsFor(MatterbridgeOperationalStateServer, {
540
810
  phaseList: [],
@@ -550,6 +820,14 @@ export function getDefaultOperationalStateClusterServer(operationalState = Opera
550
820
  operationalError: { errorStateId: OperationalState.ErrorState.NoError, errorStateLabel: 'No error', errorStateDetails: 'Fully operational' },
551
821
  });
552
822
  }
823
+ /**
824
+ * Get the default TemperatureMeasurement cluster server options.
825
+ *
826
+ * @param {number | null} measuredValue - The measured value of the temperature x 100.
827
+ * @param {number | null} minMeasuredValue - The minimum measured value of the temperature x 100.
828
+ * @param {number | null} maxMeasuredValue - The maximum measured value of the temperature x 100.
829
+ * @returns {Behavior.Options<MatterbridgeTemperatureMeasurementServer>} - The default options for the TemperatureMeasurement cluster server.
830
+ */
553
831
  export function getDefaultTemperatureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
554
832
  return optionsFor(TemperatureMeasurementServer, {
555
833
  measuredValue,
@@ -558,6 +836,14 @@ export function getDefaultTemperatureMeasurementClusterServer(measuredValue = nu
558
836
  tolerance: 0,
559
837
  });
560
838
  }
839
+ /**
840
+ * Get the default RelativeHumidityMeasurement cluster server options.
841
+ *
842
+ * @param {number | null} measuredValue - The measured value of the relative humidity x 100.
843
+ * @param {number | null} minMeasuredValue - The minimum measured value of the relative humidity x 100.
844
+ * @param {number | null} maxMeasuredValue - The maximum measured value of the relative humidity x 100.
845
+ * @returns {Behavior.Options<MatterbridgeRelativeHumidityMeasurementServer>} - The default options for the RelativeHumidityMeasurement cluster server.
846
+ */
561
847
  export function getDefaultRelativeHumidityMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
562
848
  return optionsFor(RelativeHumidityMeasurementServer, {
563
849
  measuredValue,
@@ -566,6 +852,14 @@ export function getDefaultRelativeHumidityMeasurementClusterServer(measuredValue
566
852
  tolerance: 0,
567
853
  });
568
854
  }
855
+ /**
856
+ * Get the default PressureMeasurement cluster server options.
857
+ *
858
+ * @param {number | null} measuredValue - The measured value for the pressure in kPa x 10.
859
+ * @param {number | null} minMeasuredValue - The minimum measured value for the pressure in kPa x 10.
860
+ * @param {number | null} maxMeasuredValue - The maximum measured value for the pressure in kPa x 10.
861
+ * @returns {Behavior.Options<MatterbridgePressureMeasurementServer>} - The default options for the PressureMeasurement cluster server.
862
+ */
569
863
  export function getDefaultPressureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
570
864
  return optionsFor(PressureMeasurementServer, {
571
865
  measuredValue,
@@ -574,6 +868,22 @@ export function getDefaultPressureMeasurementClusterServer(measuredValue = null,
574
868
  tolerance: 0,
575
869
  });
576
870
  }
871
+ /**
872
+ * Get the default IlluminanceMeasurement cluster server options.
873
+ *
874
+ * @param {number | null} measuredValue - The measured value of illuminance.
875
+ * @param {number | null} minMeasuredValue - The minimum measured value of illuminance.
876
+ * @param {number | null} maxMeasuredValue - The maximum measured value of illuminance.
877
+ *
878
+ * @returns {Behavior.Options<MatterbridgeIlluminanceMeasurementServer>} - The default options for the IlluminanceMeasurement cluster server.
879
+ *
880
+ * @remarks The default value for the illuminance measurement is null.
881
+ * This attribute SHALL indicate the illuminance in Lux (symbol lx) as follows:
882
+ * • MeasuredValue = 10,000 x log10(illuminance) + 1,
883
+ * where 1 lx <= illuminance <= 3.576 Mlx, corresponding to a MeasuredValue in the range 1 to 0xFFFE.
884
+ * • 0 indicates a value of illuminance that is too low to be measured
885
+ * • null indicates that the illuminance measurement is invalid.
886
+ */
577
887
  export function getDefaultIlluminanceMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
578
888
  return optionsFor(IlluminanceMeasurementServer, {
579
889
  measuredValue,
@@ -582,6 +892,14 @@ export function getDefaultIlluminanceMeasurementClusterServer(measuredValue = nu
582
892
  tolerance: 0,
583
893
  });
584
894
  }
895
+ /**
896
+ * Get the default FlowMeasurement cluster server options.
897
+ *
898
+ * @param {number | null} measuredValue - The measured value of the flow in 10 x m3/h.
899
+ * @param {number | null} minMeasuredValue - The minimum measured value of the flow in 10 x m3/h.
900
+ * @param {number | null} maxMeasuredValue - The maximum measured value of the flow in 10 x m3/h.
901
+ * @returns {Behavior.Options<MatterbridgeFlowMeasurementServer>} - The default options for the FlowMeasurement cluster server.
902
+ */
585
903
  export function getDefaultFlowMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
586
904
  return optionsFor(FlowMeasurementServer, {
587
905
  measuredValue,
@@ -590,6 +908,20 @@ export function getDefaultFlowMeasurementClusterServer(measuredValue = null, min
590
908
  tolerance: 0,
591
909
  });
592
910
  }
911
+ /**
912
+ * Get the default OccupancySensing cluster server options.
913
+ *
914
+ * @param {boolean} occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
915
+ * @param {number} holdTime - The hold time in seconds. Default is 30.
916
+ * @param {number} holdTimeMin - The minimum hold time in seconds. Default is 1.
917
+ * @param {number} holdTimeMax - The maximum hold time in seconds. Default is 300.
918
+ * @returns {Behavior.Options<MatterbridgeOccupancySensingServer>} - The default options for the OccupancySensing cluster server.
919
+ *
920
+ * @remarks The default value for the occupancy sensor type is PIR.
921
+ * Servers SHALL set these attributes for backward compatibility with clients implementing a cluster revision <= 4 as
922
+ * described in OccupancySensorType and OccupancySensorTypeBitmap Attributes.
923
+ * This replaces the 9 legacy attributes PIROccupiedToUnoccupiedDelay through PhysicalContactUnoccupiedToOccupiedThreshold.
924
+ */
593
925
  export function getDefaultOccupancySensingClusterServer(occupied = false, holdTime = 30, holdTimeMin = 1, holdTimeMax = 300) {
594
926
  return optionsFor(OccupancySensingServer.with(OccupancySensing.Feature.PassiveInfrared), {
595
927
  occupancy: { occupied },
@@ -601,3 +933,4 @@ export function getDefaultOccupancySensingClusterServer(occupied = false, holdTi
601
933
  holdTimeLimits: { holdTimeMin, holdTimeMax, holdTimeDefault: holdTime },
602
934
  });
603
935
  }
936
+ //# sourceMappingURL=matterbridgeEndpointHelpers.js.map