matterbridge 3.2.8 → 3.2.9-dev-20250922-517cae7

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 (296) hide show
  1. package/CHANGELOG.md +24 -1
  2. package/README-NGINX.md +47 -23
  3. package/dist/cli.js +2 -91
  4. package/dist/cliEmitter.js +0 -30
  5. package/dist/clusters/export.js +0 -2
  6. package/dist/defaultConfigSchema.js +0 -24
  7. package/dist/deviceManager.js +1 -94
  8. package/dist/devices/airConditioner.js +0 -57
  9. package/dist/devices/batteryStorage.js +1 -48
  10. package/dist/devices/cooktop.js +0 -55
  11. package/dist/devices/dishwasher.js +0 -57
  12. package/dist/devices/evse.js +10 -74
  13. package/dist/devices/export.js +0 -5
  14. package/dist/devices/extractorHood.js +0 -42
  15. package/dist/devices/heatPump.js +2 -50
  16. package/dist/devices/laundryDryer.js +3 -62
  17. package/dist/devices/laundryWasher.js +4 -70
  18. package/dist/devices/microwaveOven.js +5 -88
  19. package/dist/devices/oven.js +0 -85
  20. package/dist/devices/refrigerator.js +0 -102
  21. package/dist/devices/roboticVacuumCleaner.js +9 -100
  22. package/dist/devices/solarPower.js +0 -38
  23. package/dist/devices/speaker.js +0 -84
  24. package/dist/devices/temperatureControl.js +3 -25
  25. package/dist/devices/waterHeater.js +2 -82
  26. package/dist/dgram/coap.js +13 -126
  27. package/dist/dgram/dgram.js +2 -114
  28. package/dist/dgram/mb_coap.js +3 -41
  29. package/dist/dgram/mb_mdns.js +15 -80
  30. package/dist/dgram/mdns.js +137 -299
  31. package/dist/dgram/multicast.js +1 -62
  32. package/dist/dgram/unicast.js +0 -54
  33. package/dist/frontend.js +45 -435
  34. package/dist/frontendTypes.js +3 -51
  35. package/dist/globalMatterbridge.js +0 -47
  36. package/dist/helpers.js +0 -53
  37. package/dist/index.js +1 -30
  38. package/dist/logger/export.js +0 -1
  39. package/dist/matter/behaviors.js +0 -2
  40. package/dist/matter/clusters.js +0 -2
  41. package/dist/matter/devices.js +0 -2
  42. package/dist/matter/endpoints.js +0 -2
  43. package/dist/matter/export.js +0 -3
  44. package/dist/matter/types.js +0 -3
  45. package/dist/matterbridge.js +57 -780
  46. package/dist/matterbridgeAccessoryPlatform.js +0 -36
  47. package/dist/matterbridgeBehaviors.js +5 -65
  48. package/dist/matterbridgeDeviceTypes.js +17 -630
  49. package/dist/matterbridgeDynamicPlatform.js +0 -36
  50. package/dist/matterbridgeEndpoint.js +55 -1373
  51. package/dist/matterbridgeEndpointHelpers.js +12 -345
  52. package/dist/matterbridgePlatform.js +0 -304
  53. package/dist/matterbridgeTypes.js +0 -25
  54. package/dist/pluginManager.js +3 -249
  55. package/dist/shelly.js +11 -172
  56. package/dist/storage/export.js +0 -1
  57. package/dist/update.js +0 -69
  58. package/dist/utils/colorUtils.js +2 -97
  59. package/dist/utils/commandLine.js +0 -54
  60. package/dist/utils/copyDirectory.js +1 -38
  61. package/dist/utils/createDirectory.js +0 -33
  62. package/dist/utils/createZip.js +2 -47
  63. package/dist/utils/deepCopy.js +0 -39
  64. package/dist/utils/deepEqual.js +1 -72
  65. package/dist/utils/error.js +0 -41
  66. package/dist/utils/export.js +0 -1
  67. package/dist/utils/hex.js +0 -124
  68. package/dist/utils/isvalid.js +0 -101
  69. package/dist/utils/jestHelpers.js +3 -153
  70. package/dist/utils/network.js +5 -91
  71. package/dist/utils/spawn.js +0 -68
  72. package/dist/utils/wait.js +8 -60
  73. package/frontend/build/assets/index.js +2 -2
  74. package/frontend/build/assets/vendor_lodash.js +1 -1
  75. package/frontend/build/assets/vendor_mdi.js +1 -1
  76. package/frontend/build/assets/vendor_mui.js +31 -23
  77. package/frontend/build/assets/vendor_node_modules.js +28 -45
  78. package/frontend/build/assets/vendor_notistack.js +2 -2
  79. package/frontend/build/assets/vendor_qrcode.js +1 -1
  80. package/frontend/build/assets/vendor_rjsf.js +12 -3
  81. package/frontend/build/index.html +0 -1
  82. package/frontend/package-lock.json +208 -283
  83. package/frontend/package.json +4 -13
  84. package/npm-shrinkwrap.json +44 -44
  85. package/package.json +2 -3
  86. package/dist/cli.d.ts +0 -26
  87. package/dist/cli.d.ts.map +0 -1
  88. package/dist/cli.js.map +0 -1
  89. package/dist/cliEmitter.d.ts +0 -34
  90. package/dist/cliEmitter.d.ts.map +0 -1
  91. package/dist/cliEmitter.js.map +0 -1
  92. package/dist/clusters/export.d.ts +0 -2
  93. package/dist/clusters/export.d.ts.map +0 -1
  94. package/dist/clusters/export.js.map +0 -1
  95. package/dist/defaultConfigSchema.d.ts +0 -28
  96. package/dist/defaultConfigSchema.d.ts.map +0 -1
  97. package/dist/defaultConfigSchema.js.map +0 -1
  98. package/dist/deviceManager.d.ts +0 -112
  99. package/dist/deviceManager.d.ts.map +0 -1
  100. package/dist/deviceManager.js.map +0 -1
  101. package/dist/devices/airConditioner.d.ts +0 -98
  102. package/dist/devices/airConditioner.d.ts.map +0 -1
  103. package/dist/devices/airConditioner.js.map +0 -1
  104. package/dist/devices/batteryStorage.d.ts +0 -48
  105. package/dist/devices/batteryStorage.d.ts.map +0 -1
  106. package/dist/devices/batteryStorage.js.map +0 -1
  107. package/dist/devices/cooktop.d.ts +0 -60
  108. package/dist/devices/cooktop.d.ts.map +0 -1
  109. package/dist/devices/cooktop.js.map +0 -1
  110. package/dist/devices/dishwasher.d.ts +0 -71
  111. package/dist/devices/dishwasher.d.ts.map +0 -1
  112. package/dist/devices/dishwasher.js.map +0 -1
  113. package/dist/devices/evse.d.ts +0 -75
  114. package/dist/devices/evse.d.ts.map +0 -1
  115. package/dist/devices/evse.js.map +0 -1
  116. package/dist/devices/export.d.ts +0 -17
  117. package/dist/devices/export.d.ts.map +0 -1
  118. package/dist/devices/export.js.map +0 -1
  119. package/dist/devices/extractorHood.d.ts +0 -46
  120. package/dist/devices/extractorHood.d.ts.map +0 -1
  121. package/dist/devices/extractorHood.js.map +0 -1
  122. package/dist/devices/heatPump.d.ts +0 -47
  123. package/dist/devices/heatPump.d.ts.map +0 -1
  124. package/dist/devices/heatPump.js.map +0 -1
  125. package/dist/devices/laundryDryer.d.ts +0 -67
  126. package/dist/devices/laundryDryer.d.ts.map +0 -1
  127. package/dist/devices/laundryDryer.js.map +0 -1
  128. package/dist/devices/laundryWasher.d.ts +0 -81
  129. package/dist/devices/laundryWasher.d.ts.map +0 -1
  130. package/dist/devices/laundryWasher.js.map +0 -1
  131. package/dist/devices/microwaveOven.d.ts +0 -168
  132. package/dist/devices/microwaveOven.d.ts.map +0 -1
  133. package/dist/devices/microwaveOven.js.map +0 -1
  134. package/dist/devices/oven.d.ts +0 -105
  135. package/dist/devices/oven.d.ts.map +0 -1
  136. package/dist/devices/oven.js.map +0 -1
  137. package/dist/devices/refrigerator.d.ts +0 -118
  138. package/dist/devices/refrigerator.d.ts.map +0 -1
  139. package/dist/devices/refrigerator.js.map +0 -1
  140. package/dist/devices/roboticVacuumCleaner.d.ts +0 -112
  141. package/dist/devices/roboticVacuumCleaner.d.ts.map +0 -1
  142. package/dist/devices/roboticVacuumCleaner.js.map +0 -1
  143. package/dist/devices/solarPower.d.ts +0 -40
  144. package/dist/devices/solarPower.d.ts.map +0 -1
  145. package/dist/devices/solarPower.js.map +0 -1
  146. package/dist/devices/speaker.d.ts +0 -87
  147. package/dist/devices/speaker.d.ts.map +0 -1
  148. package/dist/devices/speaker.js.map +0 -1
  149. package/dist/devices/temperatureControl.d.ts +0 -166
  150. package/dist/devices/temperatureControl.d.ts.map +0 -1
  151. package/dist/devices/temperatureControl.js.map +0 -1
  152. package/dist/devices/waterHeater.d.ts +0 -111
  153. package/dist/devices/waterHeater.d.ts.map +0 -1
  154. package/dist/devices/waterHeater.js.map +0 -1
  155. package/dist/dgram/coap.d.ts +0 -205
  156. package/dist/dgram/coap.d.ts.map +0 -1
  157. package/dist/dgram/coap.js.map +0 -1
  158. package/dist/dgram/dgram.d.ts +0 -141
  159. package/dist/dgram/dgram.d.ts.map +0 -1
  160. package/dist/dgram/dgram.js.map +0 -1
  161. package/dist/dgram/mb_coap.d.ts +0 -24
  162. package/dist/dgram/mb_coap.d.ts.map +0 -1
  163. package/dist/dgram/mb_coap.js.map +0 -1
  164. package/dist/dgram/mb_mdns.d.ts +0 -24
  165. package/dist/dgram/mb_mdns.d.ts.map +0 -1
  166. package/dist/dgram/mb_mdns.js.map +0 -1
  167. package/dist/dgram/mdns.d.ts +0 -290
  168. package/dist/dgram/mdns.d.ts.map +0 -1
  169. package/dist/dgram/mdns.js.map +0 -1
  170. package/dist/dgram/multicast.d.ts +0 -67
  171. package/dist/dgram/multicast.d.ts.map +0 -1
  172. package/dist/dgram/multicast.js.map +0 -1
  173. package/dist/dgram/unicast.d.ts +0 -56
  174. package/dist/dgram/unicast.d.ts.map +0 -1
  175. package/dist/dgram/unicast.js.map +0 -1
  176. package/dist/frontend.d.ts +0 -228
  177. package/dist/frontend.d.ts.map +0 -1
  178. package/dist/frontend.js.map +0 -1
  179. package/dist/frontendTypes.d.ts +0 -572
  180. package/dist/frontendTypes.d.ts.map +0 -1
  181. package/dist/frontendTypes.js.map +0 -1
  182. package/dist/globalMatterbridge.d.ts +0 -59
  183. package/dist/globalMatterbridge.d.ts.map +0 -1
  184. package/dist/globalMatterbridge.js.map +0 -1
  185. package/dist/helpers.d.ts +0 -48
  186. package/dist/helpers.d.ts.map +0 -1
  187. package/dist/helpers.js.map +0 -1
  188. package/dist/index.d.ts +0 -33
  189. package/dist/index.d.ts.map +0 -1
  190. package/dist/index.js.map +0 -1
  191. package/dist/logger/export.d.ts +0 -2
  192. package/dist/logger/export.d.ts.map +0 -1
  193. package/dist/logger/export.js.map +0 -1
  194. package/dist/matter/behaviors.d.ts +0 -2
  195. package/dist/matter/behaviors.d.ts.map +0 -1
  196. package/dist/matter/behaviors.js.map +0 -1
  197. package/dist/matter/clusters.d.ts +0 -2
  198. package/dist/matter/clusters.d.ts.map +0 -1
  199. package/dist/matter/clusters.js.map +0 -1
  200. package/dist/matter/devices.d.ts +0 -2
  201. package/dist/matter/devices.d.ts.map +0 -1
  202. package/dist/matter/devices.js.map +0 -1
  203. package/dist/matter/endpoints.d.ts +0 -2
  204. package/dist/matter/endpoints.d.ts.map +0 -1
  205. package/dist/matter/endpoints.js.map +0 -1
  206. package/dist/matter/export.d.ts +0 -5
  207. package/dist/matter/export.d.ts.map +0 -1
  208. package/dist/matter/export.js.map +0 -1
  209. package/dist/matter/types.d.ts +0 -3
  210. package/dist/matter/types.d.ts.map +0 -1
  211. package/dist/matter/types.js.map +0 -1
  212. package/dist/matterbridge.d.ts +0 -442
  213. package/dist/matterbridge.d.ts.map +0 -1
  214. package/dist/matterbridge.js.map +0 -1
  215. package/dist/matterbridgeAccessoryPlatform.d.ts +0 -42
  216. package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
  217. package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
  218. package/dist/matterbridgeBehaviors.d.ts +0 -1747
  219. package/dist/matterbridgeBehaviors.d.ts.map +0 -1
  220. package/dist/matterbridgeBehaviors.js.map +0 -1
  221. package/dist/matterbridgeDeviceTypes.d.ts +0 -761
  222. package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
  223. package/dist/matterbridgeDeviceTypes.js.map +0 -1
  224. package/dist/matterbridgeDynamicPlatform.d.ts +0 -42
  225. package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
  226. package/dist/matterbridgeDynamicPlatform.js.map +0 -1
  227. package/dist/matterbridgeEndpoint.d.ts +0 -1515
  228. package/dist/matterbridgeEndpoint.d.ts.map +0 -1
  229. package/dist/matterbridgeEndpoint.js.map +0 -1
  230. package/dist/matterbridgeEndpointHelpers.d.ts +0 -407
  231. package/dist/matterbridgeEndpointHelpers.d.ts.map +0 -1
  232. package/dist/matterbridgeEndpointHelpers.js.map +0 -1
  233. package/dist/matterbridgePlatform.d.ts +0 -380
  234. package/dist/matterbridgePlatform.d.ts.map +0 -1
  235. package/dist/matterbridgePlatform.js.map +0 -1
  236. package/dist/matterbridgeTypes.d.ts +0 -190
  237. package/dist/matterbridgeTypes.d.ts.map +0 -1
  238. package/dist/matterbridgeTypes.js.map +0 -1
  239. package/dist/pluginManager.d.ts +0 -270
  240. package/dist/pluginManager.d.ts.map +0 -1
  241. package/dist/pluginManager.js.map +0 -1
  242. package/dist/shelly.d.ts +0 -174
  243. package/dist/shelly.d.ts.map +0 -1
  244. package/dist/shelly.js.map +0 -1
  245. package/dist/storage/export.d.ts +0 -2
  246. package/dist/storage/export.d.ts.map +0 -1
  247. package/dist/storage/export.js.map +0 -1
  248. package/dist/update.d.ts +0 -75
  249. package/dist/update.d.ts.map +0 -1
  250. package/dist/update.js.map +0 -1
  251. package/dist/utils/colorUtils.d.ts +0 -99
  252. package/dist/utils/colorUtils.d.ts.map +0 -1
  253. package/dist/utils/colorUtils.js.map +0 -1
  254. package/dist/utils/commandLine.d.ts +0 -59
  255. package/dist/utils/commandLine.d.ts.map +0 -1
  256. package/dist/utils/commandLine.js.map +0 -1
  257. package/dist/utils/copyDirectory.d.ts +0 -33
  258. package/dist/utils/copyDirectory.d.ts.map +0 -1
  259. package/dist/utils/copyDirectory.js.map +0 -1
  260. package/dist/utils/createDirectory.d.ts +0 -34
  261. package/dist/utils/createDirectory.d.ts.map +0 -1
  262. package/dist/utils/createDirectory.js.map +0 -1
  263. package/dist/utils/createZip.d.ts +0 -39
  264. package/dist/utils/createZip.d.ts.map +0 -1
  265. package/dist/utils/createZip.js.map +0 -1
  266. package/dist/utils/deepCopy.d.ts +0 -32
  267. package/dist/utils/deepCopy.d.ts.map +0 -1
  268. package/dist/utils/deepCopy.js.map +0 -1
  269. package/dist/utils/deepEqual.d.ts +0 -54
  270. package/dist/utils/deepEqual.d.ts.map +0 -1
  271. package/dist/utils/deepEqual.js.map +0 -1
  272. package/dist/utils/error.d.ts +0 -44
  273. package/dist/utils/error.d.ts.map +0 -1
  274. package/dist/utils/error.js.map +0 -1
  275. package/dist/utils/export.d.ts +0 -13
  276. package/dist/utils/export.d.ts.map +0 -1
  277. package/dist/utils/export.js.map +0 -1
  278. package/dist/utils/hex.d.ts +0 -89
  279. package/dist/utils/hex.d.ts.map +0 -1
  280. package/dist/utils/hex.js.map +0 -1
  281. package/dist/utils/isvalid.d.ts +0 -103
  282. package/dist/utils/isvalid.d.ts.map +0 -1
  283. package/dist/utils/isvalid.js.map +0 -1
  284. package/dist/utils/jestHelpers.d.ts +0 -137
  285. package/dist/utils/jestHelpers.d.ts.map +0 -1
  286. package/dist/utils/jestHelpers.js.map +0 -1
  287. package/dist/utils/network.d.ts +0 -84
  288. package/dist/utils/network.d.ts.map +0 -1
  289. package/dist/utils/network.js.map +0 -1
  290. package/dist/utils/spawn.d.ts +0 -33
  291. package/dist/utils/spawn.d.ts.map +0 -1
  292. package/dist/utils/spawn.js.map +0 -1
  293. package/dist/utils/wait.d.ts +0 -54
  294. package/dist/utils/wait.d.ts.map +0 -1
  295. package/dist/utils/wait.js.map +0 -1
  296. package/frontend/build/assets/vendor_react_table.js +0 -1
@@ -1,29 +1,3 @@
1
- /**
2
- * This file contains the types for WebSocket messages.
3
- *
4
- * @file frontendTypes.ts
5
- * @author Luca Liguori
6
- * @created 2025-09-17
7
- * @version 1.0.0
8
- * @license Apache-2.0
9
- *
10
- * Copyright 2025, 2026, 2027 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
- /**
25
- * Enumeration of WebSocket broadcast message IDs.
26
- */
27
1
  export var WsBroadcastMessageId;
28
2
  (function (WsBroadcastMessageId) {
29
3
  WsBroadcastMessageId[WsBroadcastMessageId["Log"] = 0] = "Log";
@@ -40,34 +14,12 @@ export var WsBroadcastMessageId;
40
14
  WsBroadcastMessageId[WsBroadcastMessageId["ShellySysUpdate"] = 100] = "ShellySysUpdate";
41
15
  WsBroadcastMessageId[WsBroadcastMessageId["ShellyMainUpdate"] = 101] = "ShellyMainUpdate";
42
16
  })(WsBroadcastMessageId || (WsBroadcastMessageId = {}));
43
- /**
44
- * Type guard to check if a message is a WsMessageBroadcast.
45
- *
46
- * @param {WsMessage} msg - The message to check.
47
- *
48
- * @returns {msg is WsMessageBroadcast} True if the message is a WsMessageBroadcast, false otherwise.
49
- */
50
17
  export function isBroadcast(msg) {
51
- return msg.id >= 0 /* WsBroadcastMessageId.Log */ && msg.id <= 101 /* WsBroadcastMessageId.ShellyMainUpdate */;
18
+ return msg.id >= 0 && msg.id <= 101;
52
19
  }
53
- /**
54
- * Type guard to check if a message is a WsMessageApiRequest.
55
- *
56
- * @param {WsMessage} msg - The message to check.
57
- *
58
- * @returns {msg is WsMessageBaseApiRequest} True if the message is a WsMessageApiRequest, false otherwise.
59
- */
60
20
  export function isApiRequest(msg) {
61
- return msg.id > 101 /* WsBroadcastMessageId.ShellyMainUpdate */ && msg.src === 'Frontend' && msg.dst === 'Matterbridge' && !('success' in msg) && !('error' in msg);
21
+ return msg.id > 101 && msg.src === 'Frontend' && msg.dst === 'Matterbridge' && !('success' in msg) && !('error' in msg);
62
22
  }
63
- /**
64
- * Type guard to check if a message is a WsMessageApiResponse.
65
- *
66
- * @param {WsMessage} msg - The message to check.
67
- *
68
- * @returns {msg is WsMessageApiResponse} True if the message is a WsMessageApiResponse, false otherwise.
69
- */
70
23
  export function isApiResponse(msg) {
71
- return msg.id > 101 /* WsBroadcastMessageId.ShellyMainUpdate */ && msg.src === 'Matterbridge' && msg.dst === 'Frontend' && ('success' in msg || 'error' in msg);
24
+ return msg.id > 101 && msg.src === 'Matterbridge' && msg.dst === 'Frontend' && ('success' in msg || 'error' in msg);
72
25
  }
73
- //# sourceMappingURL=frontendTypes.js.map
@@ -1,70 +1,23 @@
1
- /**
2
- * This file contains functions to set and get global instances of Matterbridge, Frontend, and Logger.
3
- *
4
- * @file globalMatterbridge.ts
5
- * @author Luca Liguori
6
- * @created 2025-06-01
7
- * @version 1.0.0
8
- * @license Apache-2.0
9
- *
10
- * Copyright 2025, 2026, 2027 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
- /**
25
- * Store the Matterbridge instance globally for later retrieval.
26
- *
27
- * @param {Matterbridge} matterbridge An initialized Matterbridge instance
28
- */
29
1
  export function setGlobalMatterbridge(matterbridge) {
30
2
  globalThis.__matterbridge__ = matterbridge;
31
3
  globalThis.__frontend__ = matterbridge.frontend;
32
4
  globalThis.__log__ = matterbridge.log;
33
5
  }
34
- /**
35
- * Retrieve the globally stored Matterbridge instance.
36
- *
37
- * @returns {Matterbridge} The Matterbridge instance.
38
- * @throws {Error} If the Matterbridge instance is not set.
39
- */
40
6
  export function getGlobalMatterbridge() {
41
7
  if (!globalThis.__matterbridge__) {
42
8
  throw new Error('Global Matterbridge instance is not set.');
43
9
  }
44
10
  return globalThis.__matterbridge__;
45
11
  }
46
- /**
47
- * Retrieve the globally stored Frontend instance.
48
- *
49
- * @returns {Frontend} The Frontend instance.
50
- * @throws {Error} If the Frontend instance is not set.
51
- */
52
12
  export function getGlobalFrontend() {
53
13
  if (!globalThis.__frontend__) {
54
14
  throw new Error('Global Frontend instance is not set.');
55
15
  }
56
16
  return globalThis.__frontend__;
57
17
  }
58
- /**
59
- * Retrieve the globally stored Logger instance.
60
- *
61
- * @returns {AnsiLogger} The AnsiLogger instance.
62
- * @throws {Error} If the Logger instance is not set.
63
- */
64
18
  export function getGlobalLog() {
65
19
  if (!globalThis.__log__) {
66
20
  throw new Error('Global Logger instance is not set.');
67
21
  }
68
22
  return globalThis.__log__;
69
23
  }
70
- //# sourceMappingURL=globalMatterbridge.js.map
package/dist/helpers.js CHANGED
@@ -1,27 +1,3 @@
1
- /**
2
- * This file contains the helpers functions of Matterbridge.
3
- *
4
- * @file helpers.ts
5
- * @author Luca Liguori
6
- * @created 2025-05-12
7
- * @version 1.0.0
8
- * @license Apache-2.0
9
- *
10
- * Copyright 2025, 2026, 2027 Luca Liguori.
11
- *
12
- * Licensed under the Apache License, Version 2.0 (the "License");
13
- * you may not use this file except in compliance with the License.
14
- * You may obtain a copy of the License at
15
- *
16
- * http://www.apache.org/licenses/LICENSE-2.0
17
- *
18
- * Unless required by applicable law or agreed to in writing, software
19
- * distributed under the License is distributed on an "AS IS" BASIS,
20
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
- * See the License for the specific language governing permissions and
22
- * limitations under the License.
23
- */
24
- // @matter module
25
1
  import { OnOff } from '@matter/main/clusters/on-off';
26
2
  import { Endpoint } from '@matter/node';
27
3
  import { BridgedDeviceBasicInformationServer } from '@matter/node/behaviors/bridged-device-basic-information';
@@ -30,24 +6,8 @@ import { OnOffPlugInUnitDevice } from '@matter/node/devices/on-off-plug-in-unit'
30
6
  import { MountedOnOffControlDevice } from '@matter/node/devices/mounted-on-off-control';
31
7
  import { OnOffLightDevice } from '@matter/node/devices/on-off-light';
32
8
  import { OnOffLightSwitchDevice } from '@matter/node/devices/on-off-light-switch';
33
- // Matterbridge
34
9
  import { hasParameter } from './utils/commandLine.js';
35
- /**
36
- * Adds a virtual device to the provided endpoint, sets up an event listener for device state changes,
37
- * and ensures the device is initialized in the off state.
38
- *
39
- * @param {Endpoint<AggregatorEndpoint>} aggregatorEndpoint - The aggragator endpoint to which the virtual device will be added.
40
- * @param {string} name - The name of the virtual device. Spaces in the name are removed to form the device ID.
41
- * @param {'light' | 'outlet' | 'switch' | 'mounted_switch'} type - The type of the virtual device. Can be 'light', 'outlet', 'switch', or 'mounted_switch'.
42
- * @param {() => Promise<void>} callback - A callback function that gets executed when the device's on/off state changes to true.
43
- * @returns {Promise<Endpoint>} A promise that resolves with the created virtual device.
44
- * @remarks The virtual device is created as an instance of `Endpoint` with the `OnOffPlugInUnitDevice` device type.
45
- * The onOff state always reverts to false when the device is turned on.
46
- */
47
10
  export async function addVirtualDevice(aggregatorEndpoint, name, type, callback) {
48
- // Create a new virtual device by instantiating `Endpoint` with device information.
49
- // The device ID is created by replacing all spaces in the name with an empty string.
50
- // The node label of the bridged device basic information is set to the given name.
51
11
  let deviceType;
52
12
  switch (type) {
53
13
  case 'light':
@@ -68,9 +28,7 @@ export async function addVirtualDevice(aggregatorEndpoint, name, type, callback)
68
28
  bridgedDeviceBasicInformation: { nodeLabel: name.slice(0, 32) },
69
29
  onOff: { onOff: false, startUpOnOff: OnOff.StartUpOnOff.Off },
70
30
  });
71
- // Set up an event listener for when the `onOff` state changes.
72
31
  device.events.onOff.onOff$Changed.on((value) => {
73
- // If the `onOff` state becomes true, turn off the virtual device and execute the callback.
74
32
  if (value) {
75
33
  callback();
76
34
  process.nextTick(async () => {
@@ -78,24 +36,14 @@ export async function addVirtualDevice(aggregatorEndpoint, name, type, callback)
78
36
  await device.setStateOf(OnOffBaseServer, { onOff: false });
79
37
  }
80
38
  catch (_error) {
81
- // Not necessary to handle the error
82
39
  }
83
40
  });
84
41
  }
85
42
  });
86
- // Add the created device to the given endpoint.
87
43
  await aggregatorEndpoint.add(device);
88
- // Initially set the state of the virtual device's `OnOffBaseServer` to false (off).
89
44
  await device.setStateOf(OnOffBaseServer, { onOff: false });
90
45
  return device;
91
46
  }
92
- /**
93
- * Creates and add the virtual devices to the aggregator.
94
- *
95
- * @param {Matterbridge} matterbridge - The Matterbridge instance.
96
- * @param {Endpoint<AggregatorEndpoint>} aggregatorEndpoint - The aggregator node to add the virtual devices to.
97
- * @returns {Promise<void>} A promise that resolves when the virtual devices are added.
98
- */
99
47
  export async function addVirtualDevices(matterbridge, aggregatorEndpoint) {
100
48
  if (matterbridge.matterbridgeInformation.virtualMode !== 'disabled' && matterbridge.bridgeMode === 'bridge' && aggregatorEndpoint) {
101
49
  matterbridge.log.notice(`Creating virtual devices for Matterbridge server node...`);
@@ -144,4 +92,3 @@ export async function addVirtualDevices(matterbridge, aggregatorEndpoint) {
144
92
  }
145
93
  }
146
94
  }
147
- //# sourceMappingURL=helpers.js.map
package/dist/index.js CHANGED
@@ -1,31 +1,6 @@
1
- /**
2
- * @description This file contains the entry point of Matterbridge.
3
- * @file index.ts
4
- * @author Luca Liguori
5
- * @created 2023-12-29
6
- * @version 1.0.7
7
- * @license Apache-2.0
8
- *
9
- * Copyright 2023, 2024, 2025 Luca Liguori.
10
- *
11
- * Licensed under the Apache License, Version 2.0 (the "License");
12
- * you may not use this file except in compliance with the License.
13
- * You may obtain a copy of the License at
14
- *
15
- * http://www.apache.org/licenses/LICENSE-2.0
16
- *
17
- * Unless required by applicable law or agreed to in writing, software
18
- * distributed under the License is distributed on an "AS IS" BASIS,
19
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
- * See the License for the specific language governing permissions and
21
- * limitations under the License.
22
- */
23
- // AnsiLogger module
24
1
  import { AnsiLogger } from 'node-ansi-logger';
25
- // Matterbridge
26
2
  import { Matterbridge } from './matterbridge.js';
27
3
  import { hasParameter } from './utils/export.js';
28
- // Matterbridge
29
4
  export * from './matterbridge.js';
30
5
  export * from './matterbridgeTypes.js';
31
6
  export * from './matterbridgeEndpoint.js';
@@ -36,10 +11,7 @@ export * from './matterbridgePlatform.js';
36
11
  export * from './matterbridgeAccessoryPlatform.js';
37
12
  export * from './matterbridgeDynamicPlatform.js';
38
13
  export { addVirtualDevice } from './helpers.js';
39
- const log = new AnsiLogger({ logName: 'Main', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: hasParameter('debug') ? "debug" /* LogLevel.DEBUG */ : "info" /* LogLevel.INFO */ });
40
- /**
41
- * Main function to load the Matterbridge instance.
42
- */
14
+ const log = new AnsiLogger({ logName: 'Main', logTimestampFormat: 4, logLevel: hasParameter('debug') ? "debug" : "info" });
43
15
  async function main() {
44
16
  log.debug('***Matterbridge.loadInstance() called');
45
17
  await Matterbridge.loadInstance();
@@ -48,4 +20,3 @@ async function main() {
48
20
  main().catch((error) => {
49
21
  log.error(`Matterbridge.loadInstance() failed with error: ${error instanceof Error ? error.message : error}`);
50
22
  });
51
- //# sourceMappingURL=index.js.map
@@ -1,2 +1 @@
1
1
  export * from 'node-ansi-logger';
2
- //# sourceMappingURL=export.js.map
@@ -1,3 +1 @@
1
- // @matter
2
1
  export * from '@matter/node/behaviors';
3
- //# sourceMappingURL=behaviors.js.map
@@ -1,3 +1 @@
1
- // @matter
2
1
  export * from '@matter/types/clusters';
3
- //# sourceMappingURL=clusters.js.map
@@ -1,3 +1 @@
1
- // @matter
2
1
  export * from '@matter/node/devices';
3
- //# sourceMappingURL=devices.js.map
@@ -1,3 +1 @@
1
- // @matter
2
1
  export { AggregatorEndpoint, ElectricalSensorEndpoint, PowerSourceEndpoint, BridgedNodeEndpoint, RootEndpoint, DeviceEnergyManagementEndpoint, OtaProviderEndpoint, OtaRequestorEndpoint } from '@matter/node/endpoints';
3
- //# sourceMappingURL=endpoints.js.map
@@ -1,7 +1,4 @@
1
- /* eslint-disable import/export */
2
- // @matter
3
1
  export * from '@matter/main';
4
2
  export { SemanticNamespace, ClosureTag, CompassDirectionTag, CompassLocationTag, DirectionTag, ElectricalMeasurementTag, LaundryTag, LevelTag, LocationTag, NumberTag, PositionTag, PowerSourceTag, RefrigeratorTag, RoomAirConditionerTag, SwitchesTag, } from '@matter/main';
5
3
  export { AttributeElement, ClusterElement, ClusterModel, CommandElement, EventElement, FieldElement } from '@matter/main/model';
6
4
  export { MdnsService, Val } from '@matter/main/protocol';
7
- //# sourceMappingURL=export.js.map
@@ -1,5 +1,2 @@
1
- /* eslint-disable import/export */
2
- // @matter
3
1
  export * from '@matter/types';
4
2
  export { ClusterRegistry } from '@matter/types';
5
- //# sourceMappingURL=types.js.map