matterbridge 3.4.2 → 3.4.3-dev-20251207-3ce5a0e

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 (332) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README-SERVICE-LOCAL.md +3 -3
  3. package/README-SERVICE-OPT.md +3 -5
  4. package/README.md +8 -14
  5. package/dist/broadcastServer.js +0 -119
  6. package/dist/broadcastServerTypes.js +0 -24
  7. package/dist/cli.js +3 -97
  8. package/dist/cliEmitter.js +0 -37
  9. package/dist/cliHistory.js +0 -38
  10. package/dist/clusters/export.js +0 -2
  11. package/dist/deviceManager.js +1 -113
  12. package/dist/devices/airConditioner.js +0 -57
  13. package/dist/devices/batteryStorage.js +1 -48
  14. package/dist/devices/cooktop.js +0 -56
  15. package/dist/devices/dishwasher.js +0 -57
  16. package/dist/devices/evse.js +10 -74
  17. package/dist/devices/export.js +0 -5
  18. package/dist/devices/extractorHood.js +0 -43
  19. package/dist/devices/heatPump.js +2 -50
  20. package/dist/devices/laundryDryer.js +3 -62
  21. package/dist/devices/laundryWasher.js +4 -70
  22. package/dist/devices/microwaveOven.js +5 -88
  23. package/dist/devices/oven.js +0 -85
  24. package/dist/devices/refrigerator.js +0 -102
  25. package/dist/devices/roboticVacuumCleaner.js +9 -100
  26. package/dist/devices/solarPower.js +0 -38
  27. package/dist/devices/speaker.js +0 -84
  28. package/dist/devices/temperatureControl.js +3 -24
  29. package/dist/devices/waterHeater.js +2 -82
  30. package/dist/dgram/coap.js +13 -126
  31. package/dist/dgram/dgram.js +2 -114
  32. package/dist/dgram/mb_coap.js +3 -41
  33. package/dist/dgram/mb_mdns.js +15 -80
  34. package/dist/dgram/mdns.js +137 -299
  35. package/dist/dgram/multicast.js +1 -62
  36. package/dist/dgram/unicast.js +0 -54
  37. package/dist/frontend.js +35 -455
  38. package/dist/frontendTypes.js +0 -45
  39. package/dist/helpers.js +0 -53
  40. package/dist/index.js +0 -25
  41. package/dist/jestutils/export.js +0 -1
  42. package/dist/jestutils/jestHelpers.js +14 -371
  43. package/dist/logger/export.js +0 -1
  44. package/dist/matter/behaviors.js +0 -2
  45. package/dist/matter/clusters.js +0 -2
  46. package/dist/matter/devices.js +0 -2
  47. package/dist/matter/endpoints.js +0 -2
  48. package/dist/matter/export.js +0 -3
  49. package/dist/matter/types.js +0 -3
  50. package/dist/matterNode.js +8 -369
  51. package/dist/matterbridge.js +54 -817
  52. package/dist/matterbridgeAccessoryPlatform.js +0 -38
  53. package/dist/matterbridgeBehaviors.js +5 -68
  54. package/dist/matterbridgeDeviceTypes.js +14 -635
  55. package/dist/matterbridgeDynamicPlatform.js +0 -38
  56. package/dist/matterbridgeEndpoint.js +53 -1444
  57. package/dist/matterbridgeEndpointHelpers.js +20 -483
  58. package/dist/matterbridgeEndpointTypes.js +0 -25
  59. package/dist/matterbridgePlatform.js +1 -451
  60. package/dist/matterbridgeTypes.js +0 -26
  61. package/dist/pluginManager.js +5 -341
  62. package/dist/shelly.js +7 -178
  63. package/dist/storage/export.js +0 -1
  64. package/dist/update.js +1 -93
  65. package/dist/utils/colorUtils.js +2 -97
  66. package/dist/utils/commandLine.js +0 -60
  67. package/dist/utils/copyDirectory.js +0 -37
  68. package/dist/utils/createDirectory.js +0 -33
  69. package/dist/utils/createZip.js +2 -47
  70. package/dist/utils/deepCopy.js +0 -39
  71. package/dist/utils/deepEqual.js +1 -72
  72. package/dist/utils/error.js +0 -42
  73. package/dist/utils/export.js +0 -1
  74. package/dist/utils/format.js +0 -49
  75. package/dist/utils/hex.js +0 -124
  76. package/dist/utils/inspector.js +1 -69
  77. package/dist/utils/isvalid.js +0 -101
  78. package/dist/utils/network.js +5 -96
  79. package/dist/utils/spawn.js +1 -71
  80. package/dist/utils/tracker.js +1 -64
  81. package/dist/utils/wait.js +8 -60
  82. package/dist/workerGlobalPrefix.js +5 -37
  83. package/dist/workerTypes.js +0 -24
  84. package/dist/workers.js +4 -68
  85. package/frontend/build/assets/index.js +4 -4
  86. package/frontend/build/assets/vendor_mui.js +1 -1
  87. package/frontend/package.json +1 -1
  88. package/npm-shrinkwrap.json +8 -7
  89. package/package.json +3 -4
  90. package/scripts/marked.mjs +132 -0
  91. package/scripts/markedFooter.html +42 -0
  92. package/scripts/markedHeader.html +78 -0
  93. package/dist/broadcastServer.d.ts +0 -144
  94. package/dist/broadcastServer.d.ts.map +0 -1
  95. package/dist/broadcastServer.js.map +0 -1
  96. package/dist/broadcastServerTypes.d.ts +0 -841
  97. package/dist/broadcastServerTypes.d.ts.map +0 -1
  98. package/dist/broadcastServerTypes.js.map +0 -1
  99. package/dist/cli.d.ts +0 -30
  100. package/dist/cli.d.ts.map +0 -1
  101. package/dist/cli.js.map +0 -1
  102. package/dist/cliEmitter.d.ts +0 -50
  103. package/dist/cliEmitter.d.ts.map +0 -1
  104. package/dist/cliEmitter.js.map +0 -1
  105. package/dist/cliHistory.d.ts +0 -48
  106. package/dist/cliHistory.d.ts.map +0 -1
  107. package/dist/cliHistory.js.map +0 -1
  108. package/dist/clusters/export.d.ts +0 -2
  109. package/dist/clusters/export.d.ts.map +0 -1
  110. package/dist/clusters/export.js.map +0 -1
  111. package/dist/deviceManager.d.ts +0 -135
  112. package/dist/deviceManager.d.ts.map +0 -1
  113. package/dist/deviceManager.js.map +0 -1
  114. package/dist/devices/airConditioner.d.ts +0 -98
  115. package/dist/devices/airConditioner.d.ts.map +0 -1
  116. package/dist/devices/airConditioner.js.map +0 -1
  117. package/dist/devices/batteryStorage.d.ts +0 -48
  118. package/dist/devices/batteryStorage.d.ts.map +0 -1
  119. package/dist/devices/batteryStorage.js.map +0 -1
  120. package/dist/devices/cooktop.d.ts +0 -61
  121. package/dist/devices/cooktop.d.ts.map +0 -1
  122. package/dist/devices/cooktop.js.map +0 -1
  123. package/dist/devices/dishwasher.d.ts +0 -71
  124. package/dist/devices/dishwasher.d.ts.map +0 -1
  125. package/dist/devices/dishwasher.js.map +0 -1
  126. package/dist/devices/evse.d.ts +0 -76
  127. package/dist/devices/evse.d.ts.map +0 -1
  128. package/dist/devices/evse.js.map +0 -1
  129. package/dist/devices/export.d.ts +0 -17
  130. package/dist/devices/export.d.ts.map +0 -1
  131. package/dist/devices/export.js.map +0 -1
  132. package/dist/devices/extractorHood.d.ts +0 -46
  133. package/dist/devices/extractorHood.d.ts.map +0 -1
  134. package/dist/devices/extractorHood.js.map +0 -1
  135. package/dist/devices/heatPump.d.ts +0 -47
  136. package/dist/devices/heatPump.d.ts.map +0 -1
  137. package/dist/devices/heatPump.js.map +0 -1
  138. package/dist/devices/laundryDryer.d.ts +0 -67
  139. package/dist/devices/laundryDryer.d.ts.map +0 -1
  140. package/dist/devices/laundryDryer.js.map +0 -1
  141. package/dist/devices/laundryWasher.d.ts +0 -81
  142. package/dist/devices/laundryWasher.d.ts.map +0 -1
  143. package/dist/devices/laundryWasher.js.map +0 -1
  144. package/dist/devices/microwaveOven.d.ts +0 -168
  145. package/dist/devices/microwaveOven.d.ts.map +0 -1
  146. package/dist/devices/microwaveOven.js.map +0 -1
  147. package/dist/devices/oven.d.ts +0 -105
  148. package/dist/devices/oven.d.ts.map +0 -1
  149. package/dist/devices/oven.js.map +0 -1
  150. package/dist/devices/refrigerator.d.ts +0 -118
  151. package/dist/devices/refrigerator.d.ts.map +0 -1
  152. package/dist/devices/refrigerator.js.map +0 -1
  153. package/dist/devices/roboticVacuumCleaner.d.ts +0 -112
  154. package/dist/devices/roboticVacuumCleaner.d.ts.map +0 -1
  155. package/dist/devices/roboticVacuumCleaner.js.map +0 -1
  156. package/dist/devices/solarPower.d.ts +0 -40
  157. package/dist/devices/solarPower.d.ts.map +0 -1
  158. package/dist/devices/solarPower.js.map +0 -1
  159. package/dist/devices/speaker.d.ts +0 -87
  160. package/dist/devices/speaker.d.ts.map +0 -1
  161. package/dist/devices/speaker.js.map +0 -1
  162. package/dist/devices/temperatureControl.d.ts +0 -166
  163. package/dist/devices/temperatureControl.d.ts.map +0 -1
  164. package/dist/devices/temperatureControl.js.map +0 -1
  165. package/dist/devices/waterHeater.d.ts +0 -111
  166. package/dist/devices/waterHeater.d.ts.map +0 -1
  167. package/dist/devices/waterHeater.js.map +0 -1
  168. package/dist/dgram/coap.d.ts +0 -205
  169. package/dist/dgram/coap.d.ts.map +0 -1
  170. package/dist/dgram/coap.js.map +0 -1
  171. package/dist/dgram/dgram.d.ts +0 -141
  172. package/dist/dgram/dgram.d.ts.map +0 -1
  173. package/dist/dgram/dgram.js.map +0 -1
  174. package/dist/dgram/mb_coap.d.ts +0 -24
  175. package/dist/dgram/mb_coap.d.ts.map +0 -1
  176. package/dist/dgram/mb_coap.js.map +0 -1
  177. package/dist/dgram/mb_mdns.d.ts +0 -24
  178. package/dist/dgram/mb_mdns.d.ts.map +0 -1
  179. package/dist/dgram/mb_mdns.js.map +0 -1
  180. package/dist/dgram/mdns.d.ts +0 -290
  181. package/dist/dgram/mdns.d.ts.map +0 -1
  182. package/dist/dgram/mdns.js.map +0 -1
  183. package/dist/dgram/multicast.d.ts +0 -67
  184. package/dist/dgram/multicast.d.ts.map +0 -1
  185. package/dist/dgram/multicast.js.map +0 -1
  186. package/dist/dgram/unicast.d.ts +0 -56
  187. package/dist/dgram/unicast.d.ts.map +0 -1
  188. package/dist/dgram/unicast.js.map +0 -1
  189. package/dist/frontend.d.ts +0 -238
  190. package/dist/frontend.d.ts.map +0 -1
  191. package/dist/frontend.js.map +0 -1
  192. package/dist/frontendTypes.d.ts +0 -529
  193. package/dist/frontendTypes.d.ts.map +0 -1
  194. package/dist/frontendTypes.js.map +0 -1
  195. package/dist/helpers.d.ts +0 -48
  196. package/dist/helpers.d.ts.map +0 -1
  197. package/dist/helpers.js.map +0 -1
  198. package/dist/index.d.ts +0 -34
  199. package/dist/index.d.ts.map +0 -1
  200. package/dist/index.js.map +0 -1
  201. package/dist/jestutils/export.d.ts +0 -2
  202. package/dist/jestutils/export.d.ts.map +0 -1
  203. package/dist/jestutils/export.js.map +0 -1
  204. package/dist/jestutils/jestHelpers.d.ts +0 -345
  205. package/dist/jestutils/jestHelpers.d.ts.map +0 -1
  206. package/dist/jestutils/jestHelpers.js.map +0 -1
  207. package/dist/logger/export.d.ts +0 -2
  208. package/dist/logger/export.d.ts.map +0 -1
  209. package/dist/logger/export.js.map +0 -1
  210. package/dist/matter/behaviors.d.ts +0 -2
  211. package/dist/matter/behaviors.d.ts.map +0 -1
  212. package/dist/matter/behaviors.js.map +0 -1
  213. package/dist/matter/clusters.d.ts +0 -2
  214. package/dist/matter/clusters.d.ts.map +0 -1
  215. package/dist/matter/clusters.js.map +0 -1
  216. package/dist/matter/devices.d.ts +0 -2
  217. package/dist/matter/devices.d.ts.map +0 -1
  218. package/dist/matter/devices.js.map +0 -1
  219. package/dist/matter/endpoints.d.ts +0 -2
  220. package/dist/matter/endpoints.d.ts.map +0 -1
  221. package/dist/matter/endpoints.js.map +0 -1
  222. package/dist/matter/export.d.ts +0 -5
  223. package/dist/matter/export.d.ts.map +0 -1
  224. package/dist/matter/export.js.map +0 -1
  225. package/dist/matter/types.d.ts +0 -3
  226. package/dist/matter/types.d.ts.map +0 -1
  227. package/dist/matter/types.js.map +0 -1
  228. package/dist/matterNode.d.ts +0 -342
  229. package/dist/matterNode.d.ts.map +0 -1
  230. package/dist/matterNode.js.map +0 -1
  231. package/dist/matterbridge.d.ts +0 -492
  232. package/dist/matterbridge.d.ts.map +0 -1
  233. package/dist/matterbridge.js.map +0 -1
  234. package/dist/matterbridgeAccessoryPlatform.d.ts +0 -41
  235. package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
  236. package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
  237. package/dist/matterbridgeBehaviors.d.ts +0 -2404
  238. package/dist/matterbridgeBehaviors.d.ts.map +0 -1
  239. package/dist/matterbridgeBehaviors.js.map +0 -1
  240. package/dist/matterbridgeDeviceTypes.d.ts +0 -698
  241. package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
  242. package/dist/matterbridgeDeviceTypes.js.map +0 -1
  243. package/dist/matterbridgeDynamicPlatform.d.ts +0 -41
  244. package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
  245. package/dist/matterbridgeDynamicPlatform.js.map +0 -1
  246. package/dist/matterbridgeEndpoint.d.ts +0 -1507
  247. package/dist/matterbridgeEndpoint.d.ts.map +0 -1
  248. package/dist/matterbridgeEndpoint.js.map +0 -1
  249. package/dist/matterbridgeEndpointHelpers.d.ts +0 -787
  250. package/dist/matterbridgeEndpointHelpers.d.ts.map +0 -1
  251. package/dist/matterbridgeEndpointHelpers.js.map +0 -1
  252. package/dist/matterbridgeEndpointTypes.d.ts +0 -166
  253. package/dist/matterbridgeEndpointTypes.d.ts.map +0 -1
  254. package/dist/matterbridgeEndpointTypes.js.map +0 -1
  255. package/dist/matterbridgePlatform.d.ts +0 -539
  256. package/dist/matterbridgePlatform.d.ts.map +0 -1
  257. package/dist/matterbridgePlatform.js.map +0 -1
  258. package/dist/matterbridgeTypes.d.ts +0 -251
  259. package/dist/matterbridgeTypes.d.ts.map +0 -1
  260. package/dist/matterbridgeTypes.js.map +0 -1
  261. package/dist/pluginManager.d.ts +0 -372
  262. package/dist/pluginManager.d.ts.map +0 -1
  263. package/dist/pluginManager.js.map +0 -1
  264. package/dist/shelly.d.ts +0 -181
  265. package/dist/shelly.d.ts.map +0 -1
  266. package/dist/shelly.js.map +0 -1
  267. package/dist/storage/export.d.ts +0 -2
  268. package/dist/storage/export.d.ts.map +0 -1
  269. package/dist/storage/export.js.map +0 -1
  270. package/dist/update.d.ts +0 -84
  271. package/dist/update.d.ts.map +0 -1
  272. package/dist/update.js.map +0 -1
  273. package/dist/utils/colorUtils.d.ts +0 -101
  274. package/dist/utils/colorUtils.d.ts.map +0 -1
  275. package/dist/utils/colorUtils.js.map +0 -1
  276. package/dist/utils/commandLine.d.ts +0 -66
  277. package/dist/utils/commandLine.d.ts.map +0 -1
  278. package/dist/utils/commandLine.js.map +0 -1
  279. package/dist/utils/copyDirectory.d.ts +0 -35
  280. package/dist/utils/copyDirectory.d.ts.map +0 -1
  281. package/dist/utils/copyDirectory.js.map +0 -1
  282. package/dist/utils/createDirectory.d.ts +0 -34
  283. package/dist/utils/createDirectory.d.ts.map +0 -1
  284. package/dist/utils/createDirectory.js.map +0 -1
  285. package/dist/utils/createZip.d.ts +0 -39
  286. package/dist/utils/createZip.d.ts.map +0 -1
  287. package/dist/utils/createZip.js.map +0 -1
  288. package/dist/utils/deepCopy.d.ts +0 -32
  289. package/dist/utils/deepCopy.d.ts.map +0 -1
  290. package/dist/utils/deepCopy.js.map +0 -1
  291. package/dist/utils/deepEqual.d.ts +0 -54
  292. package/dist/utils/deepEqual.d.ts.map +0 -1
  293. package/dist/utils/deepEqual.js.map +0 -1
  294. package/dist/utils/error.d.ts +0 -45
  295. package/dist/utils/error.d.ts.map +0 -1
  296. package/dist/utils/error.js.map +0 -1
  297. package/dist/utils/export.d.ts +0 -13
  298. package/dist/utils/export.d.ts.map +0 -1
  299. package/dist/utils/export.js.map +0 -1
  300. package/dist/utils/format.d.ts +0 -53
  301. package/dist/utils/format.d.ts.map +0 -1
  302. package/dist/utils/format.js.map +0 -1
  303. package/dist/utils/hex.d.ts +0 -89
  304. package/dist/utils/hex.d.ts.map +0 -1
  305. package/dist/utils/hex.js.map +0 -1
  306. package/dist/utils/inspector.d.ts +0 -87
  307. package/dist/utils/inspector.d.ts.map +0 -1
  308. package/dist/utils/inspector.js.map +0 -1
  309. package/dist/utils/isvalid.d.ts +0 -103
  310. package/dist/utils/isvalid.d.ts.map +0 -1
  311. package/dist/utils/isvalid.js.map +0 -1
  312. package/dist/utils/network.d.ts +0 -111
  313. package/dist/utils/network.d.ts.map +0 -1
  314. package/dist/utils/network.js.map +0 -1
  315. package/dist/utils/spawn.d.ts +0 -33
  316. package/dist/utils/spawn.d.ts.map +0 -1
  317. package/dist/utils/spawn.js.map +0 -1
  318. package/dist/utils/tracker.d.ts +0 -108
  319. package/dist/utils/tracker.d.ts.map +0 -1
  320. package/dist/utils/tracker.js.map +0 -1
  321. package/dist/utils/wait.d.ts +0 -54
  322. package/dist/utils/wait.d.ts.map +0 -1
  323. package/dist/utils/wait.js.map +0 -1
  324. package/dist/workerGlobalPrefix.d.ts +0 -25
  325. package/dist/workerGlobalPrefix.d.ts.map +0 -1
  326. package/dist/workerGlobalPrefix.js.map +0 -1
  327. package/dist/workerTypes.d.ts +0 -52
  328. package/dist/workerTypes.d.ts.map +0 -1
  329. package/dist/workerTypes.js.map +0 -1
  330. package/dist/workers.d.ts +0 -69
  331. package/dist/workers.d.ts.map +0 -1
  332. package/dist/workers.js.map +0 -1
@@ -1,38 +1,10 @@
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
- // eslint-disable-next-line no-console
25
1
  if (process.argv.includes('--loader') || process.argv.includes('-loader'))
26
2
  console.log('\u001B[32mMatterbridgeEndpointHelpers loaded.\u001B[40;0m');
27
- // Other modules
28
3
  import { createHash } from 'node:crypto';
29
- // AnsiLogger module
30
4
  import { BLUE, CYAN, db, debugStringify, er, hk, or, YELLOW, zb } from 'node-ansi-logger';
31
- // @matter
32
5
  import { Lifecycle } from '@matter/general';
33
6
  import { MeasurementType } from '@matter/types/globals';
34
7
  import { getClusterNameById } from '@matter/types/cluster';
35
- // @matter clusters
36
8
  import { PowerSource } from '@matter/types/clusters/power-source';
37
9
  import { UserLabel } from '@matter/types/clusters/user-label';
38
10
  import { FixedLabel } from '@matter/types/clusters/fixed-label';
@@ -77,7 +49,6 @@ import { TotalVolatileOrganicCompoundsConcentrationMeasurement } from '@matter/t
77
49
  import { OperationalState } from '@matter/types/clusters/operational-state';
78
50
  import { DeviceEnergyManagement } from '@matter/types/clusters/device-energy-management';
79
51
  import { DeviceEnergyManagementMode } from '@matter/types/clusters/device-energy-management-mode';
80
- // @matter behaviors
81
52
  import { PowerSourceServer } from '@matter/node/behaviors/power-source';
82
53
  import { UserLabelServer } from '@matter/node/behaviors/user-label';
83
54
  import { FixedLabelServer } from '@matter/node/behaviors/fixed-label';
@@ -107,133 +78,63 @@ import { Pm25ConcentrationMeasurementServer } from '@matter/node/behaviors/pm25-
107
78
  import { Pm10ConcentrationMeasurementServer } from '@matter/node/behaviors/pm10-concentration-measurement';
108
79
  import { RadonConcentrationMeasurementServer } from '@matter/node/behaviors/radon-concentration-measurement';
109
80
  import { TotalVolatileOrganicCompoundsConcentrationMeasurementServer } from '@matter/node/behaviors/total-volatile-organic-compounds-concentration-measurement';
110
- // Matterbridge
111
81
  import { deepCopy } from './utils/deepCopy.js';
112
82
  import { deepEqual } from './utils/deepEqual.js';
113
83
  import { isValidArray } from './utils/isvalid.js';
114
84
  import { MatterbridgeIdentifyServer, MatterbridgeOnOffServer, MatterbridgeLevelControlServer, MatterbridgeColorControlServer, MatterbridgeLiftWindowCoveringServer, MatterbridgeThermostatServer, MatterbridgeFanControlServer, MatterbridgeDoorLockServer, MatterbridgeModeSelectServer, MatterbridgeValveConfigurationAndControlServer, MatterbridgeSmokeCoAlarmServer, MatterbridgeBooleanStateConfigurationServer, MatterbridgeOperationalStateServer, MatterbridgePowerSourceServer, MatterbridgeDeviceEnergyManagementServer, MatterbridgeDeviceEnergyManagementModeServer, } from './matterbridgeBehaviors.js';
115
- /**
116
- * Capitalizes the first letter of a string.
117
- *
118
- * @param {string} name - The string to capitalize.
119
- * @returns {string} The string with the first letter capitalized.
120
- */
121
85
  export function capitalizeFirstLetter(name) {
122
86
  if (!name)
123
87
  return name;
124
88
  return name.charAt(0).toUpperCase() + name.slice(1);
125
89
  }
126
- /**
127
- * Lowercases the first letter of a string.
128
- *
129
- * @param {string} name - The string to lowercase the first letter of.
130
- * @returns {string} The string with the first letter lowercased.
131
- */
132
90
  export function lowercaseFirstLetter(name) {
133
91
  if (!name)
134
92
  return name;
135
93
  return name.charAt(0).toLowerCase() + name.slice(1);
136
94
  }
137
- /**
138
- * Checks if the device name contains non-Latin characters.
139
- *
140
- * @param {string} deviceName - The name of the device to check.
141
- * @returns {boolean} Returns true if the device name contains non-Latin characters, false otherwise.
142
- */
143
95
  export function checkNotLatinCharacters(deviceName) {
144
96
  const nonLatinRegexList = [
145
- /[\u0400-\u04FF\u0500-\u052F]/, // Cyrillic
146
- /[\u2E80-\u9FFF]/, // CJK (Chinese, Japanese, Korean)
147
- /[\uAC00-\uD7AF]/, // Korean Hangul
148
- /[\u0600-\u06FF\u0750-\u077F]/, // Arabic, Persian
149
- /[\u0590-\u05FF]/, // Hebrew
150
- /[\u0900-\u097F]/, // Devanagari (Hindi, Sanskrit)
151
- /[\u0E00-\u0E7F]/, // Thai
152
- /[\u1200-\u137F]/, // Ethiopic (Amharic, Tigrinya)
97
+ /[\u0400-\u04FF\u0500-\u052F]/,
98
+ /[\u2E80-\u9FFF]/,
99
+ /[\uAC00-\uD7AF]/,
100
+ /[\u0600-\u06FF\u0750-\u077F]/,
101
+ /[\u0590-\u05FF]/,
102
+ /[\u0900-\u097F]/,
103
+ /[\u0E00-\u0E7F]/,
104
+ /[\u1200-\u137F]/,
153
105
  ];
154
106
  return nonLatinRegexList.some((regex) => regex.test(deviceName));
155
107
  }
156
- /**
157
- * Generates a unique ID based on the device name.
158
- *
159
- * @param {string} deviceName - The name of the device to generate a unique ID for.
160
- * @returns {string} A unique ID generated from the device name using MD5 hashing.
161
- */
162
108
  export function generateUniqueId(deviceName) {
163
- return createHash('md5').update(deviceName).digest('hex'); // MD5 hash of the device name
109
+ return createHash('md5').update(deviceName).digest('hex');
164
110
  }
165
- /**
166
- * Generates a unique ID based on four parameters.
167
- *
168
- * @param {string} param1 - The first parameter.
169
- * @param {string} param2 - The second parameter.
170
- * @param {string} param3 - The third parameter.
171
- * @param {string} param4 - The fourth parameter.
172
- * @returns {string} A unique ID generated from the concatenation of the parameters using MD5 hashing.
173
- */
174
111
  export function createUniqueId(param1, param2, param3, param4) {
175
112
  const hash = createHash('md5');
176
113
  hash.update(param1 + param2 + param3 + param4);
177
114
  return hash.digest('hex');
178
115
  }
179
- /**
180
- * Retrieves the features for a specific behavior.
181
- *
182
- * @param {Endpoint} endpoint - The endpoint to retrieve the features from.
183
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to retrieve the features for.
184
- *
185
- * @returns {Record<string, boolean | undefined>} The features for the specified behavior.
186
- *
187
- * @remarks Use with:
188
- * ```typescript
189
- * expect(featuresFor(device, 'powerSource').wired).toBe(true);
190
- * ```
191
- */
192
116
  export function featuresFor(endpoint, cluster) {
193
117
  const behaviorId = getBehavior(endpoint, cluster)?.id;
194
118
  if (!behaviorId) {
195
119
  endpoint.log?.error(`featuresFor error: cluster not found on endpoint ${or}${endpoint.maybeId}${er}:${or}${endpoint.maybeNumber}${er}`);
196
120
  return {};
197
121
  }
198
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
199
122
  return endpoint.behaviors.supported[lowercaseFirstLetter(behaviorId)]['cluster']['supportedFeatures'];
200
123
  }
201
- /**
202
- * Maps a list of ClusterId to Behavior.Type for server clusters.
203
- *
204
- * @param {ClusterId[]} clusterServerList - The list of ClusterId to map.
205
- * @returns {Behavior.Type[]} An array of Behavior.Type corresponding to the ClusterId in the server list.
206
- */
207
124
  export function getBehaviourTypesFromClusterServerIds(clusterServerList) {
208
- // Map Server ClusterId to Behavior.Type
209
125
  const behaviorTypes = [];
210
126
  clusterServerList.forEach((clusterId) => {
211
127
  behaviorTypes.push(getBehaviourTypeFromClusterServerId(clusterId));
212
128
  });
213
129
  return behaviorTypes;
214
130
  }
215
- /**
216
- * Maps a list of ClusterId to Behavior.Type for client clusters.
217
- *
218
- * @param {ClusterId[]} clusterClientList - The list of ClusterId to map.
219
- * @returns {Behavior.Type[]} An array of Behavior.Type corresponding to the ClusterId in the client list.
220
- */
221
131
  export function getBehaviourTypesFromClusterClientIds(clusterClientList) {
222
- // Map Client ClusterId to Behavior.Type
223
132
  const behaviorTypes = [];
224
133
  clusterClientList.forEach((_clusterId) => {
225
- // behaviorTypes.push(getBehaviourTypeFromClusterClientId(clusterId));
226
134
  });
227
135
  return behaviorTypes;
228
136
  }
229
- /**
230
- * Maps a ClusterId to a Behavior.Type for server clusters.
231
- *
232
- * @param {ClusterId} clusterId - The ClusterId to map.
233
- * @returns {Behavior.Type} The corresponding Behavior.Type for the given ClusterId.
234
- */
235
137
  export function getBehaviourTypeFromClusterServerId(clusterId) {
236
- // Map ClusterId to Server Behavior.Type
237
138
  if (clusterId === PowerSource.Cluster.id)
238
139
  return PowerSourceServer.with(PowerSource.Feature.Wired);
239
140
  if (clusterId === UserLabel.Cluster.id)
@@ -324,22 +225,8 @@ export function getBehaviourTypeFromClusterServerId(clusterId) {
324
225
  return MatterbridgeDeviceEnergyManagementModeServer;
325
226
  return MatterbridgeIdentifyServer;
326
227
  }
327
- /**
328
- * Maps a ClusterId to a Behavior.Type for client clusters.
329
- *
330
- * @param {ClusterId} _clusterId - The ClusterId to map.
331
- */
332
228
  export function getBehaviourTypeFromClusterClientId(_clusterId) {
333
- // Map ClusterId to Client Behavior.Type
334
- // return IdentifyClient;
335
229
  }
336
- /**
337
- * Retrieves the Behavior.Type for a given cluster from the endpoint's supported behaviors.
338
- *
339
- * @param {MatterbridgeEndpoint} endpoint - The endpoint to retrieve the behavior from.
340
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to retrieve the behavior for.
341
- * @returns {Behavior.Type | undefined} The Behavior.Type for the given cluster, or undefined if not found.
342
- */
343
230
  export function getBehavior(endpoint, cluster) {
344
231
  let behavior;
345
232
  if (typeof cluster === 'string') {
@@ -356,18 +243,6 @@ export function getBehavior(endpoint, cluster) {
356
243
  }
357
244
  return behavior;
358
245
  }
359
- /**
360
- * Invokes a command on the specified behavior of the endpoint. Used ONLY in Jest tests.
361
- *
362
- * @param {MatterbridgeEndpoint} endpoint - The endpoint to invoke the command on.
363
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to invoke the command on.
364
- * @param {keyof MatterbridgeEndpointCommands} command - The command to invoke.
365
- * @param {Record<string, boolean | number | bigint | string | object | null>} [params] - The parameters to pass to the command.
366
- *
367
- * @returns {Promise<boolean>} A promise that resolves to true if the command was invoked successfully, false otherwise.
368
- *
369
- * @deprecated Used ONLY in Jest tests.
370
- */
371
246
  export async function invokeBehaviorCommand(endpoint, cluster, command, params) {
372
247
  const behaviorId = getBehavior(endpoint, cluster)?.id;
373
248
  if (!behaviorId) {
@@ -375,7 +250,6 @@ export async function invokeBehaviorCommand(endpoint, cluster, command, params)
375
250
  return false;
376
251
  }
377
252
  await endpoint.act((agent) => {
378
- // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
379
253
  const behavior = agent[behaviorId];
380
254
  if (!(command in behavior) || typeof behavior[command] !== 'function') {
381
255
  endpoint.log?.error(`invokeBehaviorCommand error: command ${hk}${command}${er} not found on agent for endpoint ${or}${endpoint.maybeId}${er}:${or}${endpoint.maybeNumber}${er}`);
@@ -385,19 +259,6 @@ export async function invokeBehaviorCommand(endpoint, cluster, command, params)
385
259
  });
386
260
  return true;
387
261
  }
388
- /**
389
- * Invokes the subscription handler on the specified cluster and attribute of the endpoint. Used ONLY in Jest tests.
390
- *
391
- * @param {MatterbridgeEndpoint} endpoint - The endpoint to invoke the subscription handler on.
392
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to invoke the subscription handler on.
393
- * @param {string} attribute - The attribute to invoke the subscription handler on.
394
- * @param {unknown} newValue - The new value of the attribute.
395
- * @param {unknown} oldValue - The old value of the attribute.
396
- *
397
- * @returns {Promise<boolean>} A promise that resolves to true if the subscription handler was invoked successfully, false otherwise.
398
- *
399
- * @deprecated Used ONLY in Jest tests.
400
- */
401
262
  export async function invokeSubscribeHandler(endpoint, cluster, attribute, newValue, oldValue) {
402
263
  const event = attribute + '$Changed';
403
264
  const behaviorId = getBehavior(endpoint, cluster)?.id;
@@ -414,17 +275,9 @@ export async function invokeSubscribeHandler(endpoint, cluster, attribute, newVa
414
275
  endpoint.log.error(`invokeSubscribeHandler ${hk}${event}${er} error: cluster ${behaviorId} not found on endpoint ${or}${endpoint.id}${er}:${or}${endpoint.number}${er}`);
415
276
  return false;
416
277
  }
417
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
418
- // @ts-ignore
419
278
  await endpoint.act((agent) => agent[behaviorId].events[event].emit(newValue, oldValue, { ...agent.context, offline: false }));
420
279
  return true;
421
280
  }
422
- /**
423
- * Adds required cluster servers to the specified endpoint based on the device types.
424
- *
425
- * @param {MatterbridgeEndpoint} endpoint - The endpoint to add the required cluster servers to.
426
- * @returns {void}
427
- */
428
281
  export function addRequiredClusterServers(endpoint) {
429
282
  const requiredServerList = [];
430
283
  endpoint.log.debug(`addRequiredClusterServers for ${CYAN}${endpoint.maybeId}${db}`);
@@ -439,12 +292,6 @@ export function addRequiredClusterServers(endpoint) {
439
292
  });
440
293
  addClusterServers(endpoint, requiredServerList);
441
294
  }
442
- /**
443
- * Adds optional cluster servers to the specified endpoint based on the device types.
444
- *
445
- * @param {MatterbridgeEndpoint} endpoint - The endpoint to add the optional cluster servers to.
446
- * @returns {void}
447
- */
448
295
  export function addOptionalClusterServers(endpoint) {
449
296
  const optionalServerList = [];
450
297
  endpoint.log.debug(`addOptionalClusterServers for ${CYAN}${endpoint.maybeId}${db}`);
@@ -459,12 +306,6 @@ export function addOptionalClusterServers(endpoint) {
459
306
  });
460
307
  addClusterServers(endpoint, optionalServerList);
461
308
  }
462
- /**
463
- * Adds cluster servers to the specified endpoint based on the provided server list.
464
- *
465
- * @param {MatterbridgeEndpoint} endpoint - The endpoint to add the cluster servers to.
466
- * @param {ClusterId[]} serverList - The list of cluster IDs to add.
467
- */
468
309
  export function addClusterServers(endpoint, serverList) {
469
310
  if (serverList.includes(PowerSource.Cluster.id))
470
311
  endpoint.createDefaultPowerSourceWiredClusterServer();
@@ -545,13 +386,6 @@ export function addClusterServers(endpoint, serverList) {
545
386
  if (serverList.includes(DeviceEnergyManagementMode.Cluster.id))
546
387
  endpoint.createDefaultDeviceEnergyManagementModeClusterServer();
547
388
  }
548
- /**
549
- * Adds a fixed label to the FixedLabel cluster. The FixedLabel cluster is created if it does not exist.
550
- *
551
- * @param {MatterbridgeEndpoint} endpoint - The endpoint to add the cluster servers to.
552
- * @param {string} label - The label to add. Max 16 characters.
553
- * @param {string} value - The value of the label. Max 16 characters.
554
- */
555
389
  export async function addFixedLabel(endpoint, label, value) {
556
390
  if (!endpoint.hasClusterServer(FixedLabel.Cluster.id)) {
557
391
  endpoint.log.debug(`addFixedLabel: add cluster ${hk}FixedLabel${db}:${hk}fixedLabel${db} with label ${CYAN}${label}${db} value ${CYAN}${value}${db}`);
@@ -568,13 +402,6 @@ export async function addFixedLabel(endpoint, label, value) {
568
402
  await endpoint.setAttribute(FixedLabel.Cluster.id, 'labelList', labelList, endpoint.log);
569
403
  }
570
404
  }
571
- /**
572
- * Adds a user label to the UserLabel cluster. The UserLabel cluster is created if it does not exist.
573
- *
574
- * @param {MatterbridgeEndpoint} endpoint - The endpoint to add the cluster servers to.
575
- * @param {string} label - The label to add. Max 16 characters.
576
- * @param {string} value - The value of the label. Max 16 characters.
577
- */
578
405
  export async function addUserLabel(endpoint, label, value) {
579
406
  if (!endpoint.hasClusterServer(UserLabel.Cluster.id)) {
580
407
  endpoint.log.debug(`addUserLabel: add cluster ${hk}UserLabel${db}:${hk}userLabel${db} with label ${CYAN}${label}${db} value ${CYAN}${value}${db}`);
@@ -591,48 +418,16 @@ export async function addUserLabel(endpoint, label, value) {
591
418
  await endpoint.setAttribute(UserLabel.Cluster.id, 'labelList', labelList, endpoint.log);
592
419
  }
593
420
  }
594
- /**
595
- * Returns the options for a given behavior type.
596
- *
597
- * @param {T} type - The behavior type.
598
- * @param {Behavior.Options<T>} options - The options for the behavior type.
599
- * @returns {Behavior.Options<T>} The options for the behavior type.
600
- */
601
421
  export function optionsFor(type, options) {
602
422
  return options;
603
423
  }
604
- /**
605
- * Retrieves the cluster ID.
606
- *
607
- * @param {Endpoint} endpoint - The endpoint to retrieve the cluster ID from.
608
- * @param {ClusterId} cluster - The ID of the cluster.
609
- * @returns {number | undefined} The ID of the cluster.
610
- */
611
424
  export function getClusterId(endpoint, cluster) {
612
425
  return endpoint.behaviors.supported[lowercaseFirstLetter(cluster)]?.schema?.id;
613
426
  }
614
- /**
615
- * Retrieves the ID of an attribute from a cluster behavior.
616
- *
617
- * @param {Endpoint} endpoint - The endpoint to retrieve the attribute ID from.
618
- * @param {string} cluster - The name of the cluster.
619
- * @param {string} attribute - The name of the attribute.
620
- * @returns {number | undefined} The ID of the attribute, or undefined if not found.
621
- */
622
427
  export function getAttributeId(endpoint, cluster, attribute) {
623
428
  const clusterBehavior = endpoint.behaviors.supported[lowercaseFirstLetter(cluster)];
624
429
  return clusterBehavior?.cluster?.attributes[lowercaseFirstLetter(attribute)]?.id;
625
430
  }
626
- /**
627
- * Retrieves the value of the provided attribute from the given cluster.
628
- *
629
- * @param {MatterbridgeEndpoint} endpoint - The endpoint to retrieve the attribute from.
630
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to retrieve the attribute from.
631
- * @param {string} attribute - The name of the attribute to retrieve.
632
- * @param {AnsiLogger} [log] - (Optional) The logger to use for logging the retrieve. Errors are logged to the endpoint logger.
633
- * @returns {any} The value of the attribute, or undefined if the attribute is not found.
634
- */
635
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
636
431
  export function getAttribute(endpoint, cluster, attribute, log) {
637
432
  const clusterName = getBehavior(endpoint, cluster)?.id;
638
433
  if (!clusterName) {
@@ -655,16 +450,6 @@ export function getAttribute(endpoint, cluster, attribute, log) {
655
450
  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}`);
656
451
  return value;
657
452
  }
658
- /**
659
- * Sets the value of an attribute on a cluster server.
660
- *
661
- * @param {MatterbridgeEndpoint} endpoint - The endpoint to set the attribute on.
662
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to set the attribute on.
663
- * @param {string} attribute - The name of the attribute.
664
- * @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
665
- * @param {AnsiLogger} [log] - (Optional) The logger to use for logging the set. Errors are logged to the endpoint logger.
666
- * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
667
- */
668
453
  export async function setAttribute(endpoint, cluster, attribute, value, log) {
669
454
  const clusterName = getBehavior(endpoint, cluster)?.id;
670
455
  if (!clusterName) {
@@ -690,16 +475,6 @@ export async function setAttribute(endpoint, cluster, attribute, value, log) {
690
475
  `to ${YELLOW}${value !== null && typeof value === 'object' ? debugStringify(value) : value}${db}`);
691
476
  return true;
692
477
  }
693
- /**
694
- * Sets the value of an attribute on a cluster server.
695
- *
696
- * @param {MatterbridgeEndpoint} endpoint - The endpoint to update the attribute on.
697
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to update the attribute on.
698
- * @param {string} attribute - The name of the attribute.
699
- * @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
700
- * @param {AnsiLogger} [log] - (Optional) The logger to use for logging the update. Errors are logged to the endpoint logger.
701
- * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
702
- */
703
478
  export async function updateAttribute(endpoint, cluster, attribute, value, log) {
704
479
  const clusterName = getBehavior(endpoint, cluster)?.id;
705
480
  if (!clusterName) {
@@ -730,24 +505,7 @@ export async function updateAttribute(endpoint, cluster, attribute, value, log)
730
505
  `to ${YELLOW}${value !== null && typeof value === 'object' ? debugStringify(value) : value}${db}`);
731
506
  return true;
732
507
  }
733
- /**
734
- * Subscribes to the provided attribute on a cluster.
735
- *
736
- * @param {MatterbridgeEndpoint} endpoint - The endpoint to subscribe the attribute to.
737
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to subscribe the attribute to.
738
- * @param {string} attribute - The name of the attribute to subscribe to.
739
- * @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.
740
- * @param {AnsiLogger} [log] - Optional logger for logging errors and information.
741
- * @returns {boolean} - A boolean indicating whether the subscription was successful.
742
- *
743
- * @remarks The listener function (cannot be async) will receive three parameters:
744
- * - `newValue`: The new value of the attribute.
745
- * - `oldValue`: The old value of the attribute.
746
- * - `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.
747
- */
748
- export async function subscribeAttribute(endpoint, cluster, attribute,
749
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
750
- listener, log) {
508
+ export async function subscribeAttribute(endpoint, cluster, attribute, listener, log) {
751
509
  const clusterName = getBehavior(endpoint, cluster)?.id;
752
510
  if (!clusterName) {
753
511
  endpoint.log.error(`subscribeAttribute ${hk}${attribute}${er} error: cluster not found on endpoint ${or}${endpoint.maybeId}${er}:${or}${endpoint.maybeNumber}${er}`);
@@ -757,7 +515,6 @@ listener, log) {
757
515
  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`);
758
516
  await endpoint.construction.ready;
759
517
  }
760
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
761
518
  const events = endpoint.events;
762
519
  attribute = lowercaseFirstLetter(attribute) + '$Changed';
763
520
  if (!(clusterName in events) || !(attribute in events[clusterName])) {
@@ -768,17 +525,6 @@ listener, log) {
768
525
  log?.info(`${db}Subscribed endpoint ${or}${endpoint.id}${db}:${or}${endpoint.number}${db} attribute ${hk}${capitalizeFirstLetter(clusterName)}${db}.${hk}${attribute}${db}`);
769
526
  return true;
770
527
  }
771
- /**
772
- * Triggers an event on the specified cluster.
773
- *
774
- * @param {MatterbridgeEndpoint} endpoint - The endpoint to trigger the event on.
775
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The ID of the cluster.
776
- * @param {string} event - The name of the event to trigger.
777
- * @param {Record<string, boolean | number | bigint | string | object | undefined | null>} payload - The payload to pass to the event.
778
- * @param {AnsiLogger} [log] - Optional logger for logging information.
779
- *
780
- * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the event was successfully triggered.
781
- */
782
528
  export async function triggerEvent(endpoint, cluster, event, payload, log) {
783
529
  const clusterName = getBehavior(endpoint, cluster)?.id;
784
530
  if (!clusterName) {
@@ -789,63 +535,30 @@ export async function triggerEvent(endpoint, cluster, event, payload, log) {
789
535
  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`);
790
536
  return false;
791
537
  }
792
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
793
538
  const events = endpoint.events;
794
539
  if (!(clusterName in events) || !(event in events[clusterName])) {
795
540
  endpoint.log.error(`triggerEvent ${hk}${event}${er} error: cluster ${clusterName} not found on endpoint ${or}${endpoint.id}${er}:${or}${endpoint.number}${er}`);
796
541
  return false;
797
542
  }
798
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
799
- // @ts-ignore
800
543
  await endpoint.act((agent) => agent[clusterName].events[event].emit(payload, agent.context));
801
544
  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} `);
802
545
  return true;
803
546
  }
804
- /** Utility Cluster Helpers */
805
- /**
806
- * Get the default power source wired cluster server options.
807
- *
808
- * @param {PowerSource.WiredCurrentType} wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
809
- * @returns {Behavior.Options<PowerSourceClusterServer>} The options for the power source wired cluster server.
810
- *
811
- * @remarks
812
- * - order: The order of the power source is a persisted attribute that indicates the order in which the power sources are used.
813
- * - description: The description of the power source is a fixed attribute that describes the power source type.
814
- * - 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).
815
- */
816
547
  export function getDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
817
548
  return optionsFor(MatterbridgePowerSourceServer.with(PowerSource.Feature.Wired), {
818
- // Base attributes
819
549
  status: PowerSource.PowerSourceStatus.Active,
820
550
  order: 0,
821
551
  description: wiredCurrentType === PowerSource.WiredCurrentType.Ac ? 'AC Power' : 'DC Power',
822
- endpointList: [], // Will be filled by the MatterbridgePowerSourceServer
823
- // Wired feature attributes
552
+ endpointList: [],
824
553
  wiredCurrentType,
825
554
  });
826
555
  }
827
- /**
828
- * Get the default power source battery cluster server options.
829
- *
830
- * @param {null | number} batPercentRemaining - The remaining battery percentage (default: null). The attribute is in the range 0-200.
831
- * @param {PowerSource.BatChargeLevel} batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
832
- * @param {null | number} batVoltage - The battery voltage (default: null).
833
- * @param {PowerSource.BatReplaceability} batReplaceability - The replaceability of the battery (default: PowerSource.BatReplaceability.Unspecified).
834
- * @returns {Behavior.Options<PowerSourceClusterServer>} The options for the power source replaceable battery cluster server.
835
- *
836
- * @remarks
837
- * - order: The order of the power source is a persisted attribute that indicates the order in which the power sources are used.
838
- * - description: The description of the power source is a fixed attribute that describes the power source type.
839
- * - batReplaceability: The replaceability of the battery is a fixed attribute that indicates whether the battery is user-replaceable or not.
840
- */
841
556
  export function getDefaultPowerSourceBatteryClusterServer(batPercentRemaining = null, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = null, batReplaceability = PowerSource.BatReplaceability.Unspecified) {
842
557
  return optionsFor(MatterbridgePowerSourceServer.with(PowerSource.Feature.Battery), {
843
- // Base attributes
844
558
  status: PowerSource.PowerSourceStatus.Active,
845
559
  order: 0,
846
560
  description: 'Primary battery',
847
- endpointList: [], // Will be filled by the MatterbridgePowerSourceServer
848
- // Battery feature attributes
561
+ endpointList: [],
849
562
  batVoltage,
850
563
  batPercentRemaining: batPercentRemaining !== null ? Math.min(Math.max(batPercentRemaining * 2, 0), 200) : null,
851
564
  batChargeLevel,
@@ -853,85 +566,40 @@ export function getDefaultPowerSourceBatteryClusterServer(batPercentRemaining =
853
566
  batReplaceability,
854
567
  });
855
568
  }
856
- /**
857
- * Get the default power source replaceable battery cluster server options.
858
- *
859
- * @param {number} batPercentRemaining - The remaining battery percentage (default: 100). The attribute is in the range 0-200.
860
- * @param {PowerSource.BatChargeLevel} batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
861
- * @param {number} batVoltage - The battery voltage (default: 1500).
862
- * @param {string} batReplacementDescription - The description of the battery replacement (default: 'Battery type').
863
- * @param {number} batQuantity - The quantity of the battery (default: 1).
864
- * @param {PowerSource.BatReplaceability} batReplaceability - The replaceability of the battery (default: PowerSource.BatReplaceability.UserReplaceable).
865
- * @returns {Behavior.Options<PowerSourceClusterServer>} The options for the power source replaceable battery cluster server.
866
- *
867
- * @remarks
868
- * - order: The order of the power source is a persisted attribute that indicates the order in which the power sources are used.
869
- * - description: The description of the power source is a fixed attribute that describes the power source type.
870
- * - batReplaceability: The replaceability of the battery is a fixed attribute that indicates whether the battery is user-replaceable or not.
871
- * - batReplacementDescription: The description of the battery replacement is a fixed attribute that describes the battery type.
872
- * - batQuantity: The quantity of the battery is a fixed attribute that indicates how many batteries are present in the device.
873
- */
874
569
  export function getDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1, batReplaceability = PowerSource.BatReplaceability.UserReplaceable) {
875
570
  return optionsFor(MatterbridgePowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
876
- // Base attributes
877
571
  status: PowerSource.PowerSourceStatus.Active,
878
572
  order: 0,
879
573
  description: 'Primary battery',
880
- endpointList: [], // Will be filled by the MatterbridgePowerSourceServer
881
- // Battery feature attributes
574
+ endpointList: [],
882
575
  batVoltage,
883
576
  batPercentRemaining: Math.min(Math.max(batPercentRemaining * 2, 0), 200),
884
577
  batChargeLevel,
885
578
  batReplacementNeeded: false,
886
579
  batReplaceability,
887
580
  activeBatFaults: undefined,
888
- // Replaceable feature attributes
889
581
  batReplacementDescription,
890
582
  batQuantity,
891
583
  });
892
584
  }
893
- /**
894
- * Creates a default power source rechargeable battery cluster server.
895
- *
896
- * @param {number} [batPercentRemaining] - The remaining battery percentage (default: 100). The attribute is in the range 0-200.
897
- * @param {PowerSource.BatChargeLevel} [batChargeLevel] - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
898
- * @param {number} [batVoltage] - The battery voltage in mV (default: 1500).
899
- * @param {PowerSource.BatReplaceability} [batReplaceability] - The replaceability of the battery (default: PowerSource.BatReplaceability.Unspecified).
900
- * @returns {Behavior.Options<PowerSourceClusterServer>} The options for the power source rechargeable battery cluster server.
901
- *
902
- * @remarks
903
- * - order: The order of the power source is a persisted attribute that indicates the order in which the power sources are used.
904
- * - description: The description of the power source is a fixed attribute that describes the power source type.
905
- * - batReplaceability: The replaceability of the battery is a fixed attribute that indicates whether the battery is user-replaceable or not.
906
- */
907
585
  export function getDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplaceability = PowerSource.BatReplaceability.Unspecified) {
908
586
  return optionsFor(MatterbridgePowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
909
- // Base attributes
910
587
  status: PowerSource.PowerSourceStatus.Active,
911
588
  order: 0,
912
589
  description: 'Primary battery',
913
- endpointList: [], // Will be filled by the MatterbridgePowerSourceServer
914
- // Battery feature attributes
590
+ endpointList: [],
915
591
  batVoltage,
916
592
  batPercentRemaining: Math.min(Math.max(batPercentRemaining * 2, 0), 200),
917
- batTimeRemaining: null, // Indicates the estimated time in seconds before the battery will no longer be able to provide power to the Node
593
+ batTimeRemaining: null,
918
594
  batChargeLevel,
919
595
  batReplacementNeeded: false,
920
596
  batReplaceability,
921
597
  batPresent: true,
922
598
  activeBatFaults: [],
923
- // Rechargeable feature attributes
924
599
  batChargeState: PowerSource.BatChargeState.IsNotCharging,
925
600
  batFunctionalWhileCharging: true,
926
601
  });
927
602
  }
928
- /**
929
- * Get the default Electrical Energy Measurement Cluster Server options with features ImportedEnergy, ExportedEnergy, and CumulativeEnergy.
930
- *
931
- * @param {number} energyImported - The total consumption value in mW/h.
932
- * @param {number} energyExported - The total production value in mW/h.
933
- * @returns {Behavior.Options<ElectricalEnergyMeasurementServer>} - The default options for the Electrical Energy Measurement Cluster Server.
934
- */
935
603
  export function getDefaultElectricalEnergyMeasurementClusterServer(energyImported = null, energyExported = null) {
936
604
  return optionsFor(ElectricalEnergyMeasurementServer.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
937
605
  accuracy: {
@@ -946,15 +614,6 @@ export function getDefaultElectricalEnergyMeasurementClusterServer(energyImporte
946
614
  cumulativeEnergyExported: energyExported !== null && energyExported >= 0 ? { energy: energyExported } : null,
947
615
  });
948
616
  }
949
- /**
950
- * Get the default Electrical Power Measurement Cluster Server options with features AlternatingCurrent.
951
- *
952
- * @param {number} voltage - The voltage value in millivolts.
953
- * @param {number} current - The current value in milliamperes.
954
- * @param {number} power - The power value in milliwatts.
955
- * @param {number} frequency - The frequency value in millihertz.
956
- * @returns {Behavior.Options<ElectricalPowerMeasurementServer>} - The default options for the Electrical Power Measurement Cluster Server.
957
- */
958
617
  export function getDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
959
618
  return optionsFor(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
960
619
  powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
@@ -995,15 +654,6 @@ export function getDefaultElectricalPowerMeasurementClusterServer(voltage = null
995
654
  frequency: frequency,
996
655
  });
997
656
  }
998
- /**
999
- * Get the default Electrical Apparent Power Measurement Cluster Server with features AlternatingCurrent.
1000
- *
1001
- * @param {number} voltage - The voltage value in millivolts.
1002
- * @param {number} apparentCurrent - The current value in milliamperes.
1003
- * @param {number} apparentPower - The apparent power value in millivoltamperes.
1004
- * @param {number} frequency - The frequency value in millihertz.
1005
- * @returns {Behavior.Options<ElectricalPowerMeasurementServer>} - The default options for the Electrical Apparent Power Measurement Cluster Server.
1006
- */
1007
657
  export function getApparentElectricalPowerMeasurementClusterServer(voltage = null, apparentCurrent = null, apparentPower = null, frequency = null) {
1008
658
  return optionsFor(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
1009
659
  powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
@@ -1044,55 +694,19 @@ export function getApparentElectricalPowerMeasurementClusterServer(voltage = nul
1044
694
  frequency: frequency,
1045
695
  });
1046
696
  }
1047
- /**
1048
- * Get the default Device Energy Management Cluster Server with feature PowerForecastReporting and with the specified ESA type, ESA canGenerate, ESA state, and power limits.
1049
- *
1050
- * @param {DeviceEnergyManagement.EsaType} [esaType] - The ESA type. Defaults to `DeviceEnergyManagement.EsaType.Other`.
1051
- * @param {boolean} [esaCanGenerate] - Indicates if the ESA can generate energy. Defaults to `false`.
1052
- * @param {DeviceEnergyManagement.EsaState} [esaState] - The ESA state. Defaults to `DeviceEnergyManagement.EsaState.Online`.
1053
- * @param {number} [absMinPower] - Indicate the minimum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
1054
- * @param {number} [absMaxPower] - Indicate the maximum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
1055
- * @returns {Behavior.Options<DeviceEnergyManagementClusterServer>} - The default options for the Device Energy Management Cluster Server.
1056
- *
1057
- * @remarks
1058
- * - The forecast attribute is set to null, indicating that there is no forecast currently available.
1059
- * - The ESA type and canGenerate attributes are fixed and cannot be changed after creation.
1060
- * - The ESA state is set to Online by default.
1061
- * - The absolute minimum and maximum power attributes are set to 0 by default.
1062
- * - For example, a battery storage inverter that can charge its battery at a maximum power of 2000W and can
1063
- * discharge the battery at a maximum power of 3000W, would have a absMinPower: -3000W, absMaxPower: 2000W.
1064
- */
1065
697
  export function getDefaultDeviceEnergyManagementClusterServer(esaType = DeviceEnergyManagement.EsaType.Other, esaCanGenerate = false, esaState = DeviceEnergyManagement.EsaState.Online, absMinPower = 0, absMaxPower = 0) {
1066
698
  return optionsFor(MatterbridgeDeviceEnergyManagementServer.with(DeviceEnergyManagement.Feature.PowerForecastReporting, DeviceEnergyManagement.Feature.PowerAdjustment), {
1067
- esaType, // Fixed attribute
1068
- esaCanGenerate, // Fixed attribute
699
+ esaType,
700
+ esaCanGenerate,
1069
701
  esaState,
1070
702
  absMinPower,
1071
703
  absMaxPower,
1072
- // PowerAdjustment feature (commands: powerAdjustRequest and cancelPowerAdjustRequest events: powerAdjustStart and powerAdjustEnd)
1073
- powerAdjustmentCapability: null, // A null value indicates that no power adjustment is currently possible, and nor is any adjustment currently active
704
+ powerAdjustmentCapability: null,
1074
705
  optOutState: DeviceEnergyManagement.OptOutState.NoOptOut,
1075
- // PowerForecastReporting
1076
- forecast: null, // A null value indicates that there is no forecast currently available
706
+ forecast: null,
1077
707
  });
1078
708
  }
1079
- /**
1080
- * Get the default EnergyManagementMode Cluster Server.
1081
- *
1082
- * @param {number} [currentMode] - The current mode of the EnergyManagementMode cluster. Defaults to mode 1 (DeviceEnergyManagementMode.ModeTag.NoOptimization).
1083
- * @param {EnergyManagementMode.ModeOption[]} [supportedModes] - The supported modes for the DeviceEnergyManagementMode cluster. The attribute is fixed and defaults to a predefined set of cluster modes.
1084
- * @returns {Behavior.Options<DeviceEnergyManagementModeClusterServer>} - The default options for the Device Energy Management Mode cluster server.
1085
- *
1086
- * @remarks
1087
- * A few examples of Device Energy Management modes and their mode tags are provided below.
1088
- * - For the "No Energy Management (Forecast reporting only)" mode, tags: 0x4000 (NoOptimization).
1089
- * - For the "Device Energy Management" mode, tags: 0x4001 (DeviceOptimization).
1090
- * - For the "Home Energy Management" mode, tags: 0x4001 (DeviceOptimization), 0x4002 (LocalOptimization).
1091
- * - For the "Grid Energy Management" mode, tags: 0x4003 (GridOptimization).
1092
- * - For the "Full Energy Management" mode, tags: 0x4001 (DeviceOptimization), 0x4002 (LocalOptimization), 0x4003 (GridOptimization).
1093
- */
1094
709
  export function getDefaultDeviceEnergyManagementModeClusterServer(currentMode, supportedModes) {
1095
- // TODO: matter.js 0.16.0 needs a with() method
1096
710
  return optionsFor(MatterbridgeDeviceEnergyManagementModeServer.with(), {
1097
711
  supportedModes: supportedModes ?? [
1098
712
  { label: 'No Energy Management (Forecast reporting only)', mode: 1, modeTags: [{ value: DeviceEnergyManagementMode.ModeTag.NoOptimization }] },
@@ -1112,26 +726,11 @@ export function getDefaultDeviceEnergyManagementModeClusterServer(currentMode, s
1112
726
  mode: 5,
1113
727
  modeTags: [{ value: DeviceEnergyManagementMode.ModeTag.DeviceOptimization }, { value: DeviceEnergyManagementMode.ModeTag.LocalOptimization }, { value: DeviceEnergyManagementMode.ModeTag.GridOptimization }],
1114
728
  },
1115
- ], // Fixed attribute
729
+ ],
1116
730
  currentMode: currentMode ?? 1,
1117
731
  });
1118
732
  }
1119
- /** Application Cluster Helpers */
1120
- /**
1121
- * Get the default OperationalState Cluster Server.
1122
- *
1123
- * @param {OperationalState.OperationalStateEnum} operationalState - The initial operational state id.
1124
- * @returns {Behavior.Options<MatterbridgeOperationalStateServer>} - The default options for the OperationalState cluster server.
1125
- *
1126
- * @remarks
1127
- * This method adds a cluster server with a default operational state configuration:
1128
- * - { operationalStateId: OperationalState.OperationalStateEnum.Stopped, operationalStateLabel: 'Stopped' },
1129
- * - { operationalStateId: OperationalState.OperationalStateEnum.Running, operationalStateLabel: 'Running' },
1130
- * - { operationalStateId: OperationalState.OperationalStateEnum.Paused, operationalStateLabel: 'Paused' },
1131
- * - { operationalStateId: OperationalState.OperationalStateEnum.Error, operationalStateLabel: 'Error' },
1132
- */
1133
733
  export function getDefaultOperationalStateClusterServer(operationalState = OperationalState.OperationalStateEnum.Stopped) {
1134
- // TODO: matter.js 0.16.0 needs a with() method
1135
734
  return optionsFor(MatterbridgeOperationalStateServer.with(), {
1136
735
  phaseList: [],
1137
736
  currentPhase: null,
@@ -1146,14 +745,6 @@ export function getDefaultOperationalStateClusterServer(operationalState = Opera
1146
745
  operationalError: { errorStateId: OperationalState.ErrorState.NoError, errorStateDetails: 'Fully operational' },
1147
746
  });
1148
747
  }
1149
- /**
1150
- * Get the default TemperatureMeasurement cluster server options.
1151
- *
1152
- * @param {number | null} measuredValue - The measured value of the temperature x 100.
1153
- * @param {number | null} minMeasuredValue - The minimum measured value of the temperature x 100.
1154
- * @param {number | null} maxMeasuredValue - The maximum measured value of the temperature x 100.
1155
- * @returns {Behavior.Options<MatterbridgeTemperatureMeasurementServer>} - The default options for the TemperatureMeasurement cluster server.
1156
- */
1157
748
  export function getDefaultTemperatureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
1158
749
  return optionsFor(TemperatureMeasurementServer, {
1159
750
  measuredValue,
@@ -1162,14 +753,6 @@ export function getDefaultTemperatureMeasurementClusterServer(measuredValue = nu
1162
753
  tolerance: 0,
1163
754
  });
1164
755
  }
1165
- /**
1166
- * Get the default RelativeHumidityMeasurement cluster server options.
1167
- *
1168
- * @param {number | null} measuredValue - The measured value of the relative humidity x 100.
1169
- * @param {number | null} minMeasuredValue - The minimum measured value of the relative humidity x 100.
1170
- * @param {number | null} maxMeasuredValue - The maximum measured value of the relative humidity x 100.
1171
- * @returns {Behavior.Options<MatterbridgeRelativeHumidityMeasurementServer>} - The default options for the RelativeHumidityMeasurement cluster server.
1172
- */
1173
756
  export function getDefaultRelativeHumidityMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
1174
757
  return optionsFor(RelativeHumidityMeasurementServer, {
1175
758
  measuredValue,
@@ -1178,14 +761,6 @@ export function getDefaultRelativeHumidityMeasurementClusterServer(measuredValue
1178
761
  tolerance: 0,
1179
762
  });
1180
763
  }
1181
- /**
1182
- * Get the default PressureMeasurement cluster server options.
1183
- *
1184
- * @param {number | null} measuredValue - The measured value for the pressure in kPa x 10.
1185
- * @param {number | null} minMeasuredValue - The minimum measured value for the pressure in kPa x 10.
1186
- * @param {number | null} maxMeasuredValue - The maximum measured value for the pressure in kPa x 10.
1187
- * @returns {Behavior.Options<MatterbridgePressureMeasurementServer>} - The default options for the PressureMeasurement cluster server.
1188
- */
1189
764
  export function getDefaultPressureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
1190
765
  return optionsFor(PressureMeasurementServer, {
1191
766
  measuredValue,
@@ -1194,21 +769,6 @@ export function getDefaultPressureMeasurementClusterServer(measuredValue = null,
1194
769
  tolerance: 0,
1195
770
  });
1196
771
  }
1197
- /**
1198
- * Get the default IlluminanceMeasurement cluster server options.
1199
- *
1200
- * @param {number | null} measuredValue - The measured value of illuminance.
1201
- * @param {number | null} minMeasuredValue - The minimum measured value of illuminance.
1202
- * @param {number | null} maxMeasuredValue - The maximum measured value of illuminance.
1203
- * @returns {Behavior.Options<MatterbridgeIlluminanceMeasurementServer>} - The default options for the IlluminanceMeasurement cluster server.
1204
- *
1205
- * @remarks The default value for the illuminance measurement is null.
1206
- * This attribute SHALL indicate the illuminance in Lux (symbol lx) as follows:
1207
- * • MeasuredValue = 10,000 x log10(illuminance) + 1,
1208
- * where 1 lx <= illuminance <= 3.576 Mlx, corresponding to a MeasuredValue in the range 1 to 0xFFFE.
1209
- * • 0 indicates a value of illuminance that is too low to be measured
1210
- * • null indicates that the illuminance measurement is invalid.
1211
- */
1212
772
  export function getDefaultIlluminanceMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
1213
773
  return optionsFor(IlluminanceMeasurementServer, {
1214
774
  measuredValue,
@@ -1217,14 +777,6 @@ export function getDefaultIlluminanceMeasurementClusterServer(measuredValue = nu
1217
777
  tolerance: 0,
1218
778
  });
1219
779
  }
1220
- /**
1221
- * Get the default FlowMeasurement cluster server options.
1222
- *
1223
- * @param {number | null} measuredValue - The measured value of the flow in 10 x m3/h.
1224
- * @param {number | null} minMeasuredValue - The minimum measured value of the flow in 10 x m3/h.
1225
- * @param {number | null} maxMeasuredValue - The maximum measured value of the flow in 10 x m3/h.
1226
- * @returns {Behavior.Options<MatterbridgeFlowMeasurementServer>} - The default options for the FlowMeasurement cluster server.
1227
- */
1228
780
  export function getDefaultFlowMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
1229
781
  return optionsFor(FlowMeasurementServer, {
1230
782
  measuredValue,
@@ -1233,20 +785,6 @@ export function getDefaultFlowMeasurementClusterServer(measuredValue = null, min
1233
785
  tolerance: 0,
1234
786
  });
1235
787
  }
1236
- /**
1237
- * Get the default OccupancySensing cluster server options.
1238
- *
1239
- * @param {boolean} occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
1240
- * @param {number} holdTime - The hold time in seconds. Default is 30.
1241
- * @param {number} holdTimeMin - The minimum hold time in seconds. Default is 1.
1242
- * @param {number} holdTimeMax - The maximum hold time in seconds. Default is 300.
1243
- * @returns {Behavior.Options<MatterbridgeOccupancySensingServer>} - The default options for the OccupancySensing cluster server.
1244
- *
1245
- * @remarks The default value for the occupancy sensor type is PIR.
1246
- * Servers SHALL set these attributes for backward compatibility with clients implementing a cluster revision <= 4 as
1247
- * described in OccupancySensorType and OccupancySensorTypeBitmap Attributes.
1248
- * This replaces the 9 legacy attributes PIROccupiedToUnoccupiedDelay through PhysicalContactUnoccupiedToOccupiedThreshold.
1249
- */
1250
788
  export function getDefaultOccupancySensingClusterServer(occupied = false, holdTime = 30, holdTimeMin = 1, holdTimeMax = 300) {
1251
789
  return optionsFor(OccupancySensingServer.with(OccupancySensing.Feature.PassiveInfrared), {
1252
790
  occupancy: { occupied },
@@ -1259,4 +797,3 @@ export function getDefaultOccupancySensingClusterServer(occupied = false, holdTi
1259
797
  holdTimeLimits: { holdTimeMin, holdTimeMax, holdTimeDefault: holdTime },
1260
798
  });
1261
799
  }
1262
- //# sourceMappingURL=matterbridgeEndpointHelpers.js.map