matterbridge 3.1.1-dev-20250703-80c685d → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. package/CHANGELOG.md +7 -5
  2. package/README.md +5 -25
  3. package/dist/cli.d.ts +26 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +93 -6
  6. package/dist/cli.js.map +1 -0
  7. package/dist/cliEmitter.d.ts +34 -0
  8. package/dist/cliEmitter.d.ts.map +1 -0
  9. package/dist/cliEmitter.js +36 -0
  10. package/dist/cliEmitter.js.map +1 -0
  11. package/dist/clusters/export.d.ts +2 -0
  12. package/dist/clusters/export.d.ts.map +1 -0
  13. package/dist/clusters/export.js +2 -0
  14. package/dist/clusters/export.js.map +1 -0
  15. package/dist/defaultConfigSchema.d.ts +28 -0
  16. package/dist/defaultConfigSchema.d.ts.map +1 -0
  17. package/dist/defaultConfigSchema.js +24 -0
  18. package/dist/defaultConfigSchema.js.map +1 -0
  19. package/dist/deviceManager.d.ts +112 -0
  20. package/dist/deviceManager.d.ts.map +1 -0
  21. package/dist/deviceManager.js +94 -1
  22. package/dist/deviceManager.js.map +1 -0
  23. package/dist/devices/batteryStorage.d.ts +48 -0
  24. package/dist/devices/batteryStorage.d.ts.map +1 -0
  25. package/dist/devices/batteryStorage.js +48 -1
  26. package/dist/devices/batteryStorage.js.map +1 -0
  27. package/dist/devices/evse.d.ts +75 -0
  28. package/dist/devices/evse.d.ts.map +1 -0
  29. package/dist/devices/evse.js +74 -10
  30. package/dist/devices/evse.js.map +1 -0
  31. package/dist/devices/export.d.ts +9 -0
  32. package/dist/devices/export.d.ts.map +1 -0
  33. package/dist/devices/export.js +2 -0
  34. package/dist/devices/export.js.map +1 -0
  35. package/dist/devices/heatPump.d.ts +47 -0
  36. package/dist/devices/heatPump.d.ts.map +1 -0
  37. package/dist/devices/heatPump.js +50 -2
  38. package/dist/devices/heatPump.js.map +1 -0
  39. package/dist/devices/laundryDryer.d.ts +87 -0
  40. package/dist/devices/laundryDryer.d.ts.map +1 -0
  41. package/dist/devices/laundryDryer.js +83 -6
  42. package/dist/devices/laundryDryer.js.map +1 -0
  43. package/dist/devices/laundryWasher.d.ts +242 -0
  44. package/dist/devices/laundryWasher.d.ts.map +1 -0
  45. package/dist/devices/laundryWasher.js +91 -7
  46. package/dist/devices/laundryWasher.js.map +1 -0
  47. package/dist/devices/roboticVacuumCleaner.d.ts +103 -0
  48. package/dist/devices/roboticVacuumCleaner.d.ts.map +1 -0
  49. package/dist/devices/roboticVacuumCleaner.js +82 -6
  50. package/dist/devices/roboticVacuumCleaner.js.map +1 -0
  51. package/dist/devices/solarPower.d.ts +40 -0
  52. package/dist/devices/solarPower.d.ts.map +1 -0
  53. package/dist/devices/solarPower.js +38 -0
  54. package/dist/devices/solarPower.js.map +1 -0
  55. package/dist/devices/waterHeater.d.ts +111 -0
  56. package/dist/devices/waterHeater.d.ts.map +1 -0
  57. package/dist/devices/waterHeater.js +82 -2
  58. package/dist/devices/waterHeater.js.map +1 -0
  59. package/dist/frontend.d.ts +302 -0
  60. package/dist/frontend.d.ts.map +1 -0
  61. package/dist/frontend.js +455 -27
  62. package/dist/frontend.js.map +1 -0
  63. package/dist/globalMatterbridge.d.ts +59 -0
  64. package/dist/globalMatterbridge.d.ts.map +1 -0
  65. package/dist/globalMatterbridge.js +47 -0
  66. package/dist/globalMatterbridge.js.map +1 -0
  67. package/dist/helpers.d.ts +48 -0
  68. package/dist/helpers.d.ts.map +1 -0
  69. package/dist/helpers.js +53 -0
  70. package/dist/helpers.js.map +1 -0
  71. package/dist/index.d.ts +41 -0
  72. package/dist/index.d.ts.map +1 -0
  73. package/dist/index.js +31 -1
  74. package/dist/index.js.map +1 -0
  75. package/dist/logger/export.d.ts +2 -0
  76. package/dist/logger/export.d.ts.map +1 -0
  77. package/dist/logger/export.js +1 -0
  78. package/dist/logger/export.js.map +1 -0
  79. package/dist/matter/behaviors.d.ts +2 -0
  80. package/dist/matter/behaviors.d.ts.map +1 -0
  81. package/dist/matter/behaviors.js +2 -0
  82. package/dist/matter/behaviors.js.map +1 -0
  83. package/dist/matter/clusters.d.ts +2 -0
  84. package/dist/matter/clusters.d.ts.map +1 -0
  85. package/dist/matter/clusters.js +2 -0
  86. package/dist/matter/clusters.js.map +1 -0
  87. package/dist/matter/devices.d.ts +2 -0
  88. package/dist/matter/devices.d.ts.map +1 -0
  89. package/dist/matter/devices.js +2 -0
  90. package/dist/matter/devices.js.map +1 -0
  91. package/dist/matter/endpoints.d.ts +2 -0
  92. package/dist/matter/endpoints.d.ts.map +1 -0
  93. package/dist/matter/endpoints.js +2 -0
  94. package/dist/matter/endpoints.js.map +1 -0
  95. package/dist/matter/export.d.ts +5 -0
  96. package/dist/matter/export.d.ts.map +1 -0
  97. package/dist/matter/export.js +3 -0
  98. package/dist/matter/export.js.map +1 -0
  99. package/dist/matter/types.d.ts +3 -0
  100. package/dist/matter/types.d.ts.map +1 -0
  101. package/dist/matter/types.js +3 -0
  102. package/dist/matter/types.js.map +1 -0
  103. package/dist/matterbridge.d.ts +450 -0
  104. package/dist/matterbridge.d.ts.map +1 -0
  105. package/dist/matterbridge.js +819 -68
  106. package/dist/matterbridge.js.map +1 -0
  107. package/dist/matterbridgeAccessoryPlatform.d.ts +42 -0
  108. package/dist/matterbridgeAccessoryPlatform.d.ts.map +1 -0
  109. package/dist/matterbridgeAccessoryPlatform.js +36 -0
  110. package/dist/matterbridgeAccessoryPlatform.js.map +1 -0
  111. package/dist/matterbridgeBehaviors.d.ts +1340 -0
  112. package/dist/matterbridgeBehaviors.d.ts.map +1 -0
  113. package/dist/matterbridgeBehaviors.js +61 -1
  114. package/dist/matterbridgeBehaviors.js.map +1 -0
  115. package/dist/matterbridgeDeviceTypes.d.ts +709 -0
  116. package/dist/matterbridgeDeviceTypes.d.ts.map +1 -0
  117. package/dist/matterbridgeDeviceTypes.js +579 -15
  118. package/dist/matterbridgeDeviceTypes.js.map +1 -0
  119. package/dist/matterbridgeDynamicPlatform.d.ts +42 -0
  120. package/dist/matterbridgeDynamicPlatform.d.ts.map +1 -0
  121. package/dist/matterbridgeDynamicPlatform.js +36 -0
  122. package/dist/matterbridgeDynamicPlatform.js.map +1 -0
  123. package/dist/matterbridgeEndpoint.d.ts +1179 -0
  124. package/dist/matterbridgeEndpoint.d.ts.map +1 -0
  125. package/dist/matterbridgeEndpoint.js +1027 -42
  126. package/dist/matterbridgeEndpoint.js.map +1 -0
  127. package/dist/matterbridgeEndpointHelpers.d.ts +3198 -0
  128. package/dist/matterbridgeEndpointHelpers.d.ts.map +1 -0
  129. package/dist/matterbridgeEndpointHelpers.js +322 -12
  130. package/dist/matterbridgeEndpointHelpers.js.map +1 -0
  131. package/dist/matterbridgePlatform.d.ts +310 -0
  132. package/dist/matterbridgePlatform.d.ts.map +1 -0
  133. package/dist/matterbridgePlatform.js +233 -0
  134. package/dist/matterbridgePlatform.js.map +1 -0
  135. package/dist/matterbridgeTypes.d.ts +192 -0
  136. package/dist/matterbridgeTypes.d.ts.map +1 -0
  137. package/dist/matterbridgeTypes.js +25 -0
  138. package/dist/matterbridgeTypes.js.map +1 -0
  139. package/dist/pluginManager.d.ts +291 -0
  140. package/dist/pluginManager.d.ts.map +1 -0
  141. package/dist/pluginManager.js +269 -5
  142. package/dist/pluginManager.js.map +1 -0
  143. package/dist/shelly.d.ts +174 -0
  144. package/dist/shelly.d.ts.map +1 -0
  145. package/dist/shelly.js +168 -7
  146. package/dist/shelly.js.map +1 -0
  147. package/dist/storage/export.d.ts +2 -0
  148. package/dist/storage/export.d.ts.map +1 -0
  149. package/dist/storage/export.js +1 -0
  150. package/dist/storage/export.js.map +1 -0
  151. package/dist/update.d.ts +59 -0
  152. package/dist/update.d.ts.map +1 -0
  153. package/dist/update.js +54 -0
  154. package/dist/update.js.map +1 -0
  155. package/dist/utils/colorUtils.d.ts +117 -0
  156. package/dist/utils/colorUtils.d.ts.map +1 -0
  157. package/dist/utils/colorUtils.js +263 -2
  158. package/dist/utils/colorUtils.js.map +1 -0
  159. package/dist/utils/commandLine.d.ts +59 -0
  160. package/dist/utils/commandLine.d.ts.map +1 -0
  161. package/dist/utils/commandLine.js +54 -0
  162. package/dist/utils/commandLine.js.map +1 -0
  163. package/dist/utils/copyDirectory.d.ts +33 -0
  164. package/dist/utils/copyDirectory.d.ts.map +1 -0
  165. package/dist/utils/copyDirectory.js +38 -1
  166. package/dist/utils/copyDirectory.js.map +1 -0
  167. package/dist/utils/createDirectory.d.ts +34 -0
  168. package/dist/utils/createDirectory.d.ts.map +1 -0
  169. package/dist/utils/createDirectory.js +33 -0
  170. package/dist/utils/createDirectory.js.map +1 -0
  171. package/dist/utils/createZip.d.ts +39 -0
  172. package/dist/utils/createZip.d.ts.map +1 -0
  173. package/dist/utils/createZip.js +47 -2
  174. package/dist/utils/createZip.js.map +1 -0
  175. package/dist/utils/deepCopy.d.ts +32 -0
  176. package/dist/utils/deepCopy.d.ts.map +1 -0
  177. package/dist/utils/deepCopy.js +39 -0
  178. package/dist/utils/deepCopy.js.map +1 -0
  179. package/dist/utils/deepEqual.d.ts +54 -0
  180. package/dist/utils/deepEqual.d.ts.map +1 -0
  181. package/dist/utils/deepEqual.js +72 -1
  182. package/dist/utils/deepEqual.js.map +1 -0
  183. package/dist/utils/export.d.ts +12 -0
  184. package/dist/utils/export.d.ts.map +1 -0
  185. package/dist/utils/export.js +1 -0
  186. package/dist/utils/export.js.map +1 -0
  187. package/dist/utils/hex.d.ts +49 -0
  188. package/dist/utils/hex.d.ts.map +1 -0
  189. package/dist/utils/hex.js +58 -0
  190. package/dist/utils/hex.js.map +1 -0
  191. package/dist/utils/isvalid.d.ts +103 -0
  192. package/dist/utils/isvalid.d.ts.map +1 -0
  193. package/dist/utils/isvalid.js +101 -0
  194. package/dist/utils/isvalid.js.map +1 -0
  195. package/dist/utils/network.d.ts +76 -0
  196. package/dist/utils/network.d.ts.map +1 -0
  197. package/dist/utils/network.js +83 -5
  198. package/dist/utils/network.js.map +1 -0
  199. package/dist/utils/spawn.d.ts +11 -0
  200. package/dist/utils/spawn.d.ts.map +1 -0
  201. package/dist/utils/spawn.js +79 -63
  202. package/dist/utils/spawn.js.map +1 -0
  203. package/dist/utils/wait.d.ts +56 -0
  204. package/dist/utils/wait.d.ts.map +1 -0
  205. package/dist/utils/wait.js +62 -9
  206. package/dist/utils/wait.js.map +1 -0
  207. package/npm-shrinkwrap.json +6 -6
  208. package/package.json +3 -2
package/CHANGELOG.md CHANGED
@@ -8,12 +8,12 @@ If you like this project and find it useful, please consider giving it a star on
8
8
  <img src="bmc-button.svg" alt="Buy me a coffee" width="120">
9
9
  </a>
10
10
 
11
- ## [3.1.1] - 2025-07-01
11
+ ## [3.1.1] - 2025-07-04
12
12
 
13
13
  ### Development Breaking Changes
14
14
 
15
- - [devices]: The single devices (i.e. Rvc, Evse etc...) are only exported from `matterbridge/devices`. Please update your imports to use the new export path. Refer to the [documentation](README-DEV.md) for details on imports.
16
- - [MatterbridgeEndpoint]: Added the mode property: `server` will make the device indipendent from its plugin. It has its own server node: QRCode, Fabrics and Sessions are visible in the Devices section of the Home page. This a workaround for the Rvc Apple issue. So the Rvc (like any other device) can be paired directly to the controller and is a native Matter device and is not bridged.
15
+ - [exports]: The single devices (i.e. Rvc, Evse etc...) are only exported from `matterbridge/devices`. Please update your imports to use the new export path. Refer to the [documentation](README-DEV.md) for details on imports.
16
+ - [MatterbridgeEndpoint]: Added the mode property: `server` will make the device indipendent from its plugin. It has its own server node: QRCode, Fabrics and Sessions are visible in the Devices section of the Home page. This is a workaround for the Rvc Apple issue. With mode=server the Rvc (like any other device) can be paired directly to the controller like a native not bridged Matter device.
17
17
 
18
18
  ### Added
19
19
 
@@ -22,13 +22,15 @@ If you like this project and find it useful, please consider giving it a star on
22
22
  - [SolarPower]: Added SolarPower class and Jest test (working on Home Assistant and SmartThings). Thanks Ludovic BOUÉ.
23
23
  - [BatteryStorage]: Added BatteryStorage class and Jest test (working on Home Assistant and SmartThings). Thanks Ludovic BOUÉ.
24
24
  - [HeatPump]: Added HeatPump class and Jest test (working on Home Assistant and SmartThings).
25
+ - [test]: Improved test units on Frontend class and all Matterbridge classes (coverage 93%).
25
26
 
26
27
  ### Changed
27
28
 
28
29
  - [package]: Updated dependencies.
29
- - [frontend]: Added all esa devices.
30
- - [frontend]: New default values: select on the home page and icon view on devices page.
31
30
  - [matter.js]: Bumped `matter.js` to 0.15.1 (https://github.com/project-chip/matter.js/discussions/2220). Great job matter.js!
31
+ - [frontend]: Added all esa devices.
32
+ - [frontend]: New default values: devices on the home page and icon view on the devices page.
33
+ - [imports]: Added dynamic imports to Matterbridge and Frontend classes.
32
34
 
33
35
  <a href="https://www.buymeacoffee.com/luligugithub">
34
36
  <img src="bmc-button.svg" alt="Buy me a coffee" width="80">
package/README.md CHANGED
@@ -520,27 +520,13 @@ As of version 18.4.x, the Robot is supported by the Home app only as a single, n
520
520
 
521
521
  If a Robot is present alongside other devices in the bridge, the entire bridge becomes unstable in the Home app.
522
522
 
523
- ## Home Assistant
524
-
525
- So far is the only controller supporting some Matter 1.2, 1.3 and 1.4 device type:
526
-
527
- - airQualitySensor code 0x002c (Matter 1.2)
528
- - smokesmokeCoAlarm code 0x0076 (Matter 1.2)
529
- - waterFreezeDetector code 0x0041 (Matter 1.3 with only BooleanState cluster)
530
- - waterLeakDetector code 0x0043 (Matter 1.3 with only BooleanState cluster)
531
- - rainSensor code 0x0044 (Matter 1.3 with only BooleanState cluster)
532
- - deviceEnergyManagement code 0x050d (Matter 1.3 with only DeviceEnergyManagementMode cluster)
533
-
534
- Electrical measurements:
523
+ A workaround has been released in Matterbridge 3.1.1. Ask the plugin authors to update the code.
535
524
 
536
- - electrical measurements from EveHistoryCluster (used in old Matterbridge plugins)
537
- - electricalSensor code 0x0510 with clusters: ElectricalPowerMeasurement and ElectricalEnergyMeasurement
538
-
539
- Other supported cluster:
525
+ ## Home Assistant
540
526
 
541
- - modeSelect code 0x27 with ModeSelect cluster
527
+ So far is the only controller supporting all Matter 1.2, 1.3 and 1.4 device type.
542
528
 
543
- ## Home Assistant issues (Matter Server for HA is still in Beta)
529
+ ## Home Assistant issues
544
530
 
545
531
  - If HA doesn't show all devices, reload the Matter Server Integration or reboot HA
546
532
  - Home Assistant doesn't seem to always react when a device is removed from the bridge: they remain in HA unavailable forever...
@@ -565,8 +551,7 @@ There is no support for these Matter device types:
565
551
  - pressure sensor
566
552
  - flow sensor
567
553
 
568
- In the zigbee2mqtt and shelly plugins select the option to expose
569
- the switch devices like light or outlet cause they don't show up like switch
554
+ In the zigbee2mqtt and shelly plugins select the option to expose the switch devices like light or outlet cause they don't show up like switch
570
555
  (Matterbridge uses a switch device type without client cluster).
571
556
 
572
557
  ## SmartThings
@@ -575,11 +560,6 @@ Tested by Tamer Salah
575
560
 
576
561
  No issues reported so far.
577
562
 
578
- Supports also:
579
-
580
- - air Quality Sensor (Matter 1.2)
581
- - smoke Co Alarm
582
-
583
563
  ## eWeLink
584
564
 
585
565
  Tested by Tamer Salah
package/dist/cli.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ /**
2
+ * This file contains the CLI entry point of Matterbridge.
3
+ *
4
+ * @file cli.ts
5
+ * @author Luca Liguori
6
+ * @created 2023-12-29
7
+ * @version 2.0.1
8
+ * @license Apache-2.0
9
+ *
10
+ * Copyright 2023, 2024, 2025 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
+ import { Matterbridge } from './matterbridge.js';
25
+ export declare let instance: Matterbridge | undefined;
26
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAYH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,eAAO,IAAI,QAAQ,EAAE,YAAY,GAAG,SAAS,CAAC"}
package/dist/cli.js CHANGED
@@ -1,19 +1,44 @@
1
+ /**
2
+ * This file contains the CLI entry point of Matterbridge.
3
+ *
4
+ * @file cli.ts
5
+ * @author Luca Liguori
6
+ * @created 2023-12-29
7
+ * @version 2.0.1
8
+ * @license Apache-2.0
9
+ *
10
+ * Copyright 2023, 2024, 2025 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
+ */
1
24
  import os from 'node:os';
2
- import { EventEmitter } from 'node:events';
3
25
  import { inspect } from 'node:util';
26
+ // AnsiLogger module
4
27
  import { AnsiLogger, BRIGHT, CYAN, db, YELLOW } from 'node-ansi-logger';
28
+ // Matterbridge
5
29
  import { getIntParameter, hasParameter } from './utils/export.js';
6
30
  import { Matterbridge } from './matterbridge.js';
7
- export const cliEmitter = new EventEmitter();
31
+ import { cliEmitter, lastCpuUsage, setLastCpuUsage } from './cliEmitter.js';
8
32
  export let instance;
33
+ // Inspectop
9
34
  let session;
10
35
  let snapshotInterval;
36
+ // Cpu and memory check
11
37
  let memoryCheckInterval;
12
38
  let prevCpus;
13
- export let lastCpuUsage = 0;
14
39
  let peakCpu = 0;
15
40
  let peakRss = 0;
16
- const log = new AnsiLogger({ logName: 'Cli', logTimestampFormat: 4, logLevel: hasParameter('debug') ? "debug" : "info" });
41
+ const log = new AnsiLogger({ logName: 'Cli', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: hasParameter('debug') ? "debug" /* LogLevel.DEBUG */ : "info" /* LogLevel.INFO */ });
17
42
  const formatMemoryUsage = (bytes) => {
18
43
  if (bytes >= 1024 ** 3) {
19
44
  return `${(bytes / 1024 ** 3).toFixed(2)} GB`;
@@ -40,14 +65,20 @@ const formatOsUpTime = (seconds) => {
40
65
  }
41
66
  return `${seconds} second${seconds !== 1 ? 's' : ''}`;
42
67
  };
68
+ /**
69
+ * Starts the CPU and memory check interval.
70
+ */
43
71
  async function startCpuMemoryCheck() {
72
+ // const os = await import('node:os');
44
73
  log.debug(`Cpu memory check started`);
45
74
  prevCpus = os.cpus();
46
75
  clearInterval(memoryCheckInterval);
47
76
  const interval = () => {
77
+ // Get the os uptime
48
78
  const systemUptime = formatOsUpTime(Math.floor(os.uptime()));
49
79
  const processUptime = formatOsUpTime(Math.floor(process.uptime()));
50
80
  cliEmitter.emit('uptime', systemUptime, processUptime);
81
+ // Get the memory usage
51
82
  const totalMememory = formatMemoryUsage(os.totalmem());
52
83
  const freeMemory = formatMemoryUsage(os.freemem());
53
84
  const memoryUsageRaw = process.memoryUsage();
@@ -59,10 +90,12 @@ async function startCpuMemoryCheck() {
59
90
  if (memoryUsageRaw.rss > peakRss)
60
91
  peakRss = memoryUsageRaw.rss;
61
92
  cliEmitter.emit('memory', totalMememory, freeMemory, rss, heapTotal, heapUsed, external, arrayBuffers);
93
+ // Get the cpu usage
62
94
  const currCpus = os.cpus();
95
+ // log.debug(`Cpus: ${JSON.stringify(currCpus)}`);
63
96
  let cpuUsageLog;
64
97
  if (currCpus.length !== prevCpus.length) {
65
- prevCpus = currCpus;
98
+ prevCpus = currCpus; // Reset the previous cpus
66
99
  log.debug(`Cpu check length failed, resetting previous cpus`);
67
100
  return;
68
101
  }
@@ -82,26 +115,35 @@ async function startCpuMemoryCheck() {
82
115
  }
83
116
  else {
84
117
  cpuUsageLog = cpuUsage.toFixed(2);
85
- lastCpuUsage = cpuUsage;
118
+ setLastCpuUsage(cpuUsage);
86
119
  if (lastCpuUsage > peakCpu)
87
120
  peakCpu = lastCpuUsage;
88
121
  cliEmitter.emit('cpu', lastCpuUsage);
89
122
  }
90
123
  prevCpus = currCpus;
124
+ // Show the cpu and memory usage
91
125
  log.debug(`***${YELLOW}${BRIGHT}Cpu usage:${db} ${CYAN}${cpuUsageLog.padStart(6, ' ')} %${db} ${YELLOW}${BRIGHT}Memory usage:${db} rss ${CYAN}${rss}${db} heapTotal ${CYAN}${heapTotal}${db} heapUsed ${CYAN}${heapUsed}${db} external ${external} arrayBuffers ${arrayBuffers}`);
92
126
  };
93
127
  interval();
94
128
  clearInterval(memoryCheckInterval);
95
129
  memoryCheckInterval = setInterval(interval, getIntParameter('memoryinterval') ?? 10 * 1000).unref();
96
130
  }
131
+ /**
132
+ * Stops the CPU and memory check interval.
133
+ */
97
134
  async function stopCpuMemoryCheck() {
98
135
  log.debug(`***Cpu memory check stopped. Peak cpu: ${CYAN}${peakCpu.toFixed(2)} %${db}. Peak rss: ${CYAN}${formatMemoryUsage(peakRss)}${db}.`);
99
136
  clearInterval(memoryCheckInterval);
100
137
  }
138
+ /**
139
+ * Starts the inspector for heap sampling.
140
+ * This function is called when the -inspect parameter is passed.
141
+ */
101
142
  async function startInspector() {
102
143
  const { Session } = await import('node:inspector');
103
144
  const { mkdirSync } = await import('node:fs');
104
145
  log.debug(`***Starting heap sampling...`);
146
+ // Create the heap snapshots directory if it doesn't exist
105
147
  mkdirSync('heap_profile', { recursive: true });
106
148
  try {
107
149
  session = new Session();
@@ -110,6 +152,7 @@ async function startInspector() {
110
152
  session?.post('HeapProfiler.startSampling', (err) => (err ? reject(err) : resolve()));
111
153
  });
112
154
  log.debug(`***Started heap sampling`);
155
+ // Set an interval to take heap snapshots
113
156
  const interval = getIntParameter('snapshotinterval');
114
157
  if (interval && interval >= 30000) {
115
158
  log.debug(`***Started heap snapshot interval of ${CYAN}${interval}${db} ms`);
@@ -127,13 +170,19 @@ async function startInspector() {
127
170
  return;
128
171
  }
129
172
  }
173
+ /**
174
+ * Stops the heap sampling and saves the profile to a file.
175
+ * This function is called when the inspector is stopped.
176
+ */
130
177
  async function stopInspector() {
131
178
  const { writeFileSync } = await import('node:fs');
132
179
  const path = await import('node:path');
133
180
  log.debug(`***Stopping heap sampling...`);
134
181
  if (snapshotInterval) {
135
182
  log.debug(`***Clearing heap snapshot interval...`);
183
+ // Clear the snapshot interval if it exists
136
184
  clearInterval(snapshotInterval);
185
+ // Take a final heap snapshot before stopping
137
186
  await takeHeapSnapshot();
138
187
  }
139
188
  if (!session) {
@@ -141,6 +190,7 @@ async function stopInspector() {
141
190
  return;
142
191
  }
143
192
  try {
193
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
144
194
  const result = await new Promise((resolve, reject) => {
145
195
  session?.post('HeapProfiler.stopSampling', (err, result) => (err ? reject(err) : resolve(result)));
146
196
  });
@@ -158,6 +208,13 @@ async function stopInspector() {
158
208
  log.debug(`***Stopped heap sampling`);
159
209
  }
160
210
  }
211
+ /**
212
+ * Takes a heap snapshot and saves it to the file name Heap-snapshot-<timestamp>.heapsnapshot.
213
+ * This function is called periodically based on the -snapshotinterval parameter.
214
+ * The -snapshotinterval parameter must at least 30000 ms.
215
+ * The snapshot is saved in the heap_profile directory that is created in the current working directory.
216
+ * The snapshot can be analyzed using vscode or Chrome DevTools or other tools that support heap snapshots.
217
+ */
161
218
  async function takeHeapSnapshot() {
162
219
  const { writeFileSync } = await import('node:fs');
163
220
  const path = await import('node:path');
@@ -189,6 +246,10 @@ async function takeHeapSnapshot() {
189
246
  });
190
247
  });
191
248
  }
249
+ /**
250
+ * Triggers a manual garbage collection.
251
+ * This function is working only if the process is started with --expose-gc.
252
+ */
192
253
  function triggerGarbageCollection() {
193
254
  if (typeof global.gc === 'function') {
194
255
  global.gc();
@@ -198,6 +259,9 @@ function triggerGarbageCollection() {
198
259
  log.debug('Garbage collection is not exposed. Start Node.js with --expose-gc to enable manual GC.');
199
260
  }
200
261
  }
262
+ /**
263
+ * Registers event handlers for the Matterbridge instance.
264
+ */
201
265
  function registerHandlers() {
202
266
  log.debug('Registering event handlers...');
203
267
  if (instance)
@@ -220,32 +284,52 @@ function registerHandlers() {
220
284
  instance.on('triggergarbagecollection', async () => triggerGarbageCollection());
221
285
  log.debug('Registered event handlers');
222
286
  }
287
+ /**
288
+ * Shuts down the Matterbridge instance and exits the process.
289
+ */
223
290
  async function shutdown() {
224
291
  log.debug('Received shutdown event, exiting...');
225
292
  if (hasParameter('inspect'))
226
293
  await stopInspector();
227
294
  await stopCpuMemoryCheck();
228
295
  cliEmitter.emit('shutdown');
296
+ // eslint-disable-next-line n/no-process-exit
229
297
  process.exit(0);
230
298
  }
299
+ /**
300
+ *
301
+ */
231
302
  async function restart() {
232
303
  log.debug('Received restart event, loading...');
233
304
  instance = await Matterbridge.loadInstance(true);
234
305
  registerHandlers();
235
306
  }
307
+ /**
308
+ *
309
+ */
236
310
  async function update() {
237
311
  log.debug('Received update event, updating...');
312
+ // TODO: Implement update logic outside of matterbridge
238
313
  instance = await Matterbridge.loadInstance(true);
239
314
  registerHandlers();
240
315
  }
316
+ /**
317
+ * Starts the CPU and memory check when the -startmemorycheck parameter is passed.
318
+ */
241
319
  async function start() {
242
320
  log.debug('Received start memory check event');
243
321
  await startCpuMemoryCheck();
244
322
  }
323
+ /**
324
+ * Stops the CPU and memory check when the -stopmemorycheck parameter is passed.
325
+ */
245
326
  async function stop() {
246
327
  log.debug('Received stop memory check event');
247
328
  await stopCpuMemoryCheck();
248
329
  }
330
+ /**
331
+ * Main function that initializes the Matterbridge instance and starts the CLI.
332
+ */
249
333
  async function main() {
250
334
  log.debug(`Cli main() started`);
251
335
  await startCpuMemoryCheck();
@@ -254,6 +338,7 @@ async function main() {
254
338
  log.debug(`***Matterbridge.loadInstance(true) called`);
255
339
  instance = await Matterbridge.loadInstance(true);
256
340
  log.debug(`***Matterbridge.loadInstance(true) exited`);
341
+ // Check if the instance needs to shut down from parseCommandLine()
257
342
  if (!instance || instance.shutdown) {
258
343
  shutdown();
259
344
  }
@@ -262,9 +347,11 @@ async function main() {
262
347
  cliEmitter.emit('ready');
263
348
  }
264
349
  }
350
+ // Run the main function
265
351
  process.title = 'matterbridge';
266
352
  main().catch((error) => {
267
353
  const errorMessage = error instanceof Error ? error.message : error;
268
354
  const errorInspect = inspect(error, { depth: 10 });
269
355
  log.error(`Matterbridge.loadInstance() failed with error: ${errorMessage}\nstack: ${errorInspect}`);
270
356
  });
357
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,oBAAoB;AACpB,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAA6B,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAEnG,eAAe;AACf,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE5E,MAAM,CAAC,IAAI,QAAkC,CAAC;AAE9C,YAAY;AACZ,IAAI,OAA4B,CAAC;AACjC,IAAI,gBAAgC,CAAC;AAErC,uBAAuB;AACvB,IAAI,mBAAmC,CAAC;AACxC,IAAI,QAAsB,CAAC;AAC3B,IAAI,OAAO,GAAG,CAAC,CAAC;AAChB,IAAI,OAAO,GAAG,CAAC,CAAC;AAEhB,MAAM,GAAG,GAAG,IAAI,UAAU,CA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B,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,IAAI;IACjB,GAAG,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;IAEhC,MAAM,mBAAmB,EAAE,CAAC;IAE5B,IAAI,YAAY,CAAC,SAAS,CAAC;QAAE,MAAM,cAAc,EAAE,CAAC;IAEpD,GAAG,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAEvD,QAAQ,GAAG,MAAM,YAAY,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAEjD,GAAG,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAEvD,mEAAmE;IACnE,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,QAAQ,EAAE,CAAC;QACnC,QAAQ,EAAE,CAAC;IACb,CAAC;SAAM,CAAC;QACN,gBAAgB,EAAE,CAAC;QACnB,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC;AAED,wBAAwB;AACxB,OAAO,CAAC,KAAK,GAAG,cAAc,CAAC;AAC/B,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;IACpE,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IACnD,GAAG,CAAC,KAAK,CAAC,kDAAkD,YAAY,YAAY,YAAY,EAAE,CAAC,CAAC;AACtG,CAAC,CAAC,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * This file contains the CLI emitter.
3
+ *
4
+ * @file cliEmitter.ts
5
+ * @author Luca Liguori
6
+ * @created 2025-07-04
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
+ import { EventEmitter } from 'node:events';
25
+ export declare const cliEmitter: EventEmitter<[never]>;
26
+ export declare let lastCpuUsage: number;
27
+ /**
28
+ * Sets the last CPU usage.
29
+ *
30
+ * @param {number} val - The CPU usage percentage to set.
31
+ * @returns {void}
32
+ */
33
+ export declare function setLastCpuUsage(val: number): void;
34
+ //# sourceMappingURL=cliEmitter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cliEmitter.d.ts","sourceRoot":"","sources":["../src/cliEmitter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,eAAO,MAAM,UAAU,uBAAqB,CAAC;AAE7C,eAAO,IAAI,YAAY,QAAI,CAAC;AAE5B;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEjD"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * This file contains the CLI emitter.
3
+ *
4
+ * @file cliEmitter.ts
5
+ * @author Luca Liguori
6
+ * @created 2025-07-04
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
+ import { EventEmitter } from 'node:events';
25
+ export const cliEmitter = new EventEmitter();
26
+ export let lastCpuUsage = 0;
27
+ /**
28
+ * Sets the last CPU usage.
29
+ *
30
+ * @param {number} val - The CPU usage percentage to set.
31
+ * @returns {void}
32
+ */
33
+ export function setLastCpuUsage(val) {
34
+ lastCpuUsage = val;
35
+ }
36
+ //# sourceMappingURL=cliEmitter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cliEmitter.js","sourceRoot":"","sources":["../src/cliEmitter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,YAAY,EAAE,CAAC;AAE7C,MAAM,CAAC,IAAI,YAAY,GAAG,CAAC,CAAC;AAE5B;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,GAAW;IACzC,YAAY,GAAG,GAAG,CAAC;AACrB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=export.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../src/clusters/export.ts"],"names":[],"mappings":""}
@@ -1 +1,3 @@
1
1
  export {};
2
+ // Nothing to export right now, but this file is here to make it easier to add exports in the future
3
+ //# sourceMappingURL=export.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export.js","sourceRoot":"","sources":["../../src/clusters/export.ts"],"names":[],"mappings":";AAAA,oGAAoG"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * This file contains the default config for the plugins.
3
+ *
4
+ * @file defaultConfigSchema.ts
5
+ * @author Luca Liguori
6
+ * @created 2024-05-07
7
+ * @version 1.0.1
8
+ * @license Apache-2.0
9
+ *
10
+ * Copyright 2024, 2025, 2026 Luca Liguori.
11
+ *
12
+ * Licensed under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License.
14
+ * You may obtain a copy of the License at
15
+ *
16
+ * http://www.apache.org/licenses/LICENSE-2.0
17
+ *
18
+ * Unless required by applicable law or agreed to in writing, software
19
+ * distributed under the License is distributed on an "AS IS" BASIS,
20
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ * See the License for the specific language governing permissions and
22
+ * limitations under the License.
23
+ */
24
+ import { PlatformConfig } from './matterbridgePlatform.js';
25
+ export declare const zigbee2mqtt_config: PlatformConfig;
26
+ export declare const somfytahoma_config: PlatformConfig;
27
+ export declare const shelly_config: PlatformConfig;
28
+ //# sourceMappingURL=defaultConfigSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultConfigSchema.d.ts","sourceRoot":"","sources":["../src/defaultConfigSchema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,eAAO,MAAM,kBAAkB,EAAE,cAiBhC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,cAWhC,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,cA2B3B,CAAC"}
@@ -1,3 +1,26 @@
1
+ /**
2
+ * This file contains the default config for the plugins.
3
+ *
4
+ * @file defaultConfigSchema.ts
5
+ * @author Luca Liguori
6
+ * @created 2024-05-07
7
+ * @version 1.0.1
8
+ * @license Apache-2.0
9
+ *
10
+ * Copyright 2024, 2025, 2026 Luca Liguori.
11
+ *
12
+ * Licensed under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License.
14
+ * You may obtain a copy of the License at
15
+ *
16
+ * http://www.apache.org/licenses/LICENSE-2.0
17
+ *
18
+ * Unless required by applicable law or agreed to in writing, software
19
+ * distributed under the License is distributed on an "AS IS" BASIS,
20
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ * See the License for the specific language governing permissions and
22
+ * limitations under the License.
23
+ */
1
24
  export const zigbee2mqtt_config = {
2
25
  name: 'matterbridge-zigbee2mqtt',
3
26
  type: 'DynamicPlatform',
@@ -56,3 +79,4 @@ export const shelly_config = {
56
79
  debugWs: false,
57
80
  unregisterOnShutdown: false,
58
81
  };
82
+ //# sourceMappingURL=defaultConfigSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultConfigSchema.js","sourceRoot":"","sources":["../src/defaultConfigSchema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,MAAM,CAAC,MAAM,kBAAkB,GAAmB;IAChD,IAAI,EAAE,0BAA0B;IAChC,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE,WAAW;IACjB,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,aAAa;IACpB,SAAS,EAAE,EAAE;IACb,SAAS,EAAE,EAAE;IACb,UAAU,EAAE,EAAE;IACd,SAAS,EAAE,EAAE;IACb,UAAU,EAAE,EAAE;IACd,gBAAgB,EAAE,EAAE;IACpB,sBAAsB,EAAE,EAAE;IAC1B,KAAK,EAAE,KAAK;IACZ,oBAAoB,EAAE,KAAK;CAC5B,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAmB;IAChD,IAAI,EAAE,2BAA2B;IACjC,IAAI,EAAE,iBAAiB;IACvB,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,OAAO,EAAE,cAAc;IACvB,SAAS,EAAE,EAAE;IACb,SAAS,EAAE,EAAE;IACb,gBAAgB,EAAE,EAAE;IACpB,KAAK,EAAE,KAAK;IACZ,oBAAoB,EAAE,KAAK;CAC5B,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAmB;IAC3C,IAAI,E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