matterbridge 3.5.2 → 3.5.3-dev-20260202-e19e9b6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (280) hide show
  1. package/CHANGELOG.md +30 -1
  2. package/README-DOCKER.md +2 -2
  3. package/README.md +14 -9
  4. package/dist/broadcastServer.d.ts +0 -115
  5. package/dist/broadcastServer.js +0 -117
  6. package/dist/broadcastServerTypes.d.ts +0 -43
  7. package/dist/broadcastServerTypes.js +0 -24
  8. package/dist/checkUpdates.d.ts +0 -75
  9. package/dist/checkUpdates.js +1 -91
  10. package/dist/cli.d.ts +0 -24
  11. package/dist/cli.js +1 -97
  12. package/dist/cliEmitter.d.ts +0 -36
  13. package/dist/cliEmitter.js +0 -37
  14. package/dist/cliHistory.d.ts +0 -42
  15. package/dist/cliHistory.js +0 -38
  16. package/dist/clusters/export.d.ts +0 -1
  17. package/dist/clusters/export.js +0 -2
  18. package/dist/deviceManager.d.ts +0 -108
  19. package/dist/deviceManager.js +1 -114
  20. package/dist/devices/airConditioner.d.ts +0 -75
  21. package/dist/devices/airConditioner.js +0 -57
  22. package/dist/devices/basicVideoPlayer.d.ts +0 -58
  23. package/dist/devices/basicVideoPlayer.js +1 -56
  24. package/dist/devices/batteryStorage.d.ts +0 -43
  25. package/dist/devices/batteryStorage.js +1 -48
  26. package/dist/devices/castingVideoPlayer.d.ts +0 -63
  27. package/dist/devices/castingVideoPlayer.js +2 -65
  28. package/dist/devices/cooktop.d.ts +0 -55
  29. package/dist/devices/cooktop.js +0 -56
  30. package/dist/devices/dishwasher.d.ts +0 -55
  31. package/dist/devices/dishwasher.js +0 -57
  32. package/dist/devices/evse.d.ts +0 -57
  33. package/dist/devices/evse.js +10 -74
  34. package/dist/devices/export.d.ts +0 -1
  35. package/dist/devices/export.js +0 -5
  36. package/dist/devices/extractorHood.d.ts +0 -41
  37. package/dist/devices/extractorHood.js +0 -43
  38. package/dist/devices/heatPump.d.ts +0 -43
  39. package/dist/devices/heatPump.js +2 -50
  40. package/dist/devices/laundryDryer.d.ts +0 -58
  41. package/dist/devices/laundryDryer.js +3 -62
  42. package/dist/devices/laundryWasher.d.ts +0 -64
  43. package/dist/devices/laundryWasher.js +4 -70
  44. package/dist/devices/microwaveOven.d.ts +1 -77
  45. package/dist/devices/microwaveOven.js +5 -88
  46. package/dist/devices/oven.d.ts +0 -82
  47. package/dist/devices/oven.js +0 -85
  48. package/dist/devices/refrigerator.d.ts +0 -100
  49. package/dist/devices/refrigerator.js +0 -102
  50. package/dist/devices/roboticVacuumCleaner.d.ts +0 -83
  51. package/dist/devices/roboticVacuumCleaner.js +9 -100
  52. package/dist/devices/solarPower.d.ts +0 -36
  53. package/dist/devices/solarPower.js +0 -38
  54. package/dist/devices/speaker.d.ts +0 -79
  55. package/dist/devices/speaker.js +0 -84
  56. package/dist/devices/temperatureControl.d.ts +0 -21
  57. package/dist/devices/temperatureControl.js +3 -24
  58. package/dist/devices/waterHeater.d.ts +0 -74
  59. package/dist/devices/waterHeater.js +2 -82
  60. package/dist/dgram/export.d.ts +0 -1
  61. package/dist/dgram/export.js +0 -1
  62. package/dist/frontend.d.ts +0 -187
  63. package/dist/frontend.js +37 -498
  64. package/dist/frontendTypes.d.ts +0 -57
  65. package/dist/frontendTypes.js +0 -45
  66. package/dist/helpers.d.ts +0 -43
  67. package/dist/helpers.js +0 -54
  68. package/dist/index.d.ts +0 -23
  69. package/dist/index.js +0 -25
  70. package/dist/jestutils/export.d.ts +0 -1
  71. package/dist/jestutils/export.js +0 -1
  72. package/dist/jestutils/jestHelpers.d.ts +0 -255
  73. package/dist/jestutils/jestHelpers.js +15 -371
  74. package/dist/logger/export.d.ts +0 -1
  75. package/dist/logger/export.js +0 -1
  76. package/dist/matter/behaviors.d.ts +0 -1
  77. package/dist/matter/behaviors.js +0 -2
  78. package/dist/matter/clusters.d.ts +0 -1
  79. package/dist/matter/clusters.js +0 -2
  80. package/dist/matter/devices.d.ts +0 -1
  81. package/dist/matter/devices.js +0 -2
  82. package/dist/matter/endpoints.d.ts +0 -1
  83. package/dist/matter/endpoints.js +0 -2
  84. package/dist/matter/export.d.ts +0 -1
  85. package/dist/matter/export.js +0 -2
  86. package/dist/matter/types.d.ts +0 -1
  87. package/dist/matter/types.js +0 -2
  88. package/dist/matterNode.d.ts +0 -258
  89. package/dist/matterNode.js +8 -359
  90. package/dist/matterbridge.d.ts +0 -373
  91. package/dist/matterbridge.js +46 -854
  92. package/dist/matterbridgeAccessoryPlatform.d.ts +0 -42
  93. package/dist/matterbridgeAccessoryPlatform.js +0 -50
  94. package/dist/matterbridgeBehaviors.d.ts +0 -24
  95. package/dist/matterbridgeBehaviors.js +5 -65
  96. package/dist/matterbridgeDeviceTypes.d.ts +0 -649
  97. package/dist/matterbridgeDeviceTypes.js +6 -673
  98. package/dist/matterbridgeDynamicPlatform.d.ts +0 -42
  99. package/dist/matterbridgeDynamicPlatform.js +0 -50
  100. package/dist/matterbridgeEndpoint.d.ts +0 -1369
  101. package/dist/matterbridgeEndpoint.js +54 -1507
  102. package/dist/matterbridgeEndpointHelpers.d.ts +0 -425
  103. package/dist/matterbridgeEndpointHelpers.js +20 -482
  104. package/dist/matterbridgeEndpointTypes.d.ts +0 -70
  105. package/dist/matterbridgeEndpointTypes.js +0 -25
  106. package/dist/matterbridgePlatform.d.ts +0 -434
  107. package/dist/matterbridgePlatform.js +1 -472
  108. package/dist/matterbridgePlatformTypes.d.ts +0 -29
  109. package/dist/matterbridgePlatformTypes.js +0 -24
  110. package/dist/matterbridgeTypes.d.ts +0 -46
  111. package/dist/matterbridgeTypes.js +0 -26
  112. package/dist/mb_coap.d.ts +0 -23
  113. package/dist/mb_coap.js +3 -41
  114. package/dist/mb_health.d.ts +0 -67
  115. package/dist/mb_health.js +0 -70
  116. package/dist/mb_mdns.d.ts +0 -23
  117. package/dist/mb_mdns.js +36 -94
  118. package/dist/pluginManager.d.ts +0 -305
  119. package/dist/pluginManager.js +5 -342
  120. package/dist/shelly.d.ts +0 -157
  121. package/dist/shelly.js +7 -178
  122. package/dist/spawn.d.ts +0 -32
  123. package/dist/spawn.js +1 -71
  124. package/dist/storage/export.d.ts +0 -1
  125. package/dist/storage/export.js +0 -1
  126. package/dist/utils/export.d.ts +0 -1
  127. package/dist/utils/export.js +0 -1
  128. package/dist/worker.d.ts +0 -61
  129. package/dist/worker.js +4 -65
  130. package/dist/workerCheckUpdates.d.ts +0 -24
  131. package/dist/workerCheckUpdates.js +5 -36
  132. package/dist/workerGlobalPrefix.d.ts +0 -24
  133. package/dist/workerGlobalPrefix.js +5 -36
  134. package/dist/workerTypes.d.ts +0 -25
  135. package/dist/workerTypes.js +0 -24
  136. package/frontend/build/assets/index.js +4 -4
  137. package/frontend/build/assets/vendor_emotion.js +1 -1
  138. package/frontend/build/assets/vendor_lodash.js +1 -1
  139. package/frontend/build/assets/vendor_mdi.js +1 -1
  140. package/frontend/build/assets/vendor_mui.js +22 -22
  141. package/frontend/build/assets/vendor_node_modules.js +20 -20
  142. package/frontend/build/assets/vendor_notistack.js +2 -2
  143. package/frontend/build/assets/vendor_qrcode.js +1 -1
  144. package/frontend/build/assets/vendor_rjsf.js +8 -8
  145. package/frontend/build/index.html +1 -1
  146. package/frontend/package.json +48 -47
  147. package/npm-shrinkwrap.json +77 -47
  148. package/package.json +7 -7
  149. package/dist/broadcastServer.d.ts.map +0 -1
  150. package/dist/broadcastServer.js.map +0 -1
  151. package/dist/broadcastServerTypes.d.ts.map +0 -1
  152. package/dist/broadcastServerTypes.js.map +0 -1
  153. package/dist/checkUpdates.d.ts.map +0 -1
  154. package/dist/checkUpdates.js.map +0 -1
  155. package/dist/cli.d.ts.map +0 -1
  156. package/dist/cli.js.map +0 -1
  157. package/dist/cliEmitter.d.ts.map +0 -1
  158. package/dist/cliEmitter.js.map +0 -1
  159. package/dist/cliHistory.d.ts.map +0 -1
  160. package/dist/cliHistory.js.map +0 -1
  161. package/dist/clusters/export.d.ts.map +0 -1
  162. package/dist/clusters/export.js.map +0 -1
  163. package/dist/deviceManager.d.ts.map +0 -1
  164. package/dist/deviceManager.js.map +0 -1
  165. package/dist/devices/airConditioner.d.ts.map +0 -1
  166. package/dist/devices/airConditioner.js.map +0 -1
  167. package/dist/devices/basicVideoPlayer.d.ts.map +0 -1
  168. package/dist/devices/basicVideoPlayer.js.map +0 -1
  169. package/dist/devices/batteryStorage.d.ts.map +0 -1
  170. package/dist/devices/batteryStorage.js.map +0 -1
  171. package/dist/devices/castingVideoPlayer.d.ts.map +0 -1
  172. package/dist/devices/castingVideoPlayer.js.map +0 -1
  173. package/dist/devices/cooktop.d.ts.map +0 -1
  174. package/dist/devices/cooktop.js.map +0 -1
  175. package/dist/devices/dishwasher.d.ts.map +0 -1
  176. package/dist/devices/dishwasher.js.map +0 -1
  177. package/dist/devices/evse.d.ts.map +0 -1
  178. package/dist/devices/evse.js.map +0 -1
  179. package/dist/devices/export.d.ts.map +0 -1
  180. package/dist/devices/export.js.map +0 -1
  181. package/dist/devices/extractorHood.d.ts.map +0 -1
  182. package/dist/devices/extractorHood.js.map +0 -1
  183. package/dist/devices/heatPump.d.ts.map +0 -1
  184. package/dist/devices/heatPump.js.map +0 -1
  185. package/dist/devices/laundryDryer.d.ts.map +0 -1
  186. package/dist/devices/laundryDryer.js.map +0 -1
  187. package/dist/devices/laundryWasher.d.ts.map +0 -1
  188. package/dist/devices/laundryWasher.js.map +0 -1
  189. package/dist/devices/microwaveOven.d.ts.map +0 -1
  190. package/dist/devices/microwaveOven.js.map +0 -1
  191. package/dist/devices/oven.d.ts.map +0 -1
  192. package/dist/devices/oven.js.map +0 -1
  193. package/dist/devices/refrigerator.d.ts.map +0 -1
  194. package/dist/devices/refrigerator.js.map +0 -1
  195. package/dist/devices/roboticVacuumCleaner.d.ts.map +0 -1
  196. package/dist/devices/roboticVacuumCleaner.js.map +0 -1
  197. package/dist/devices/solarPower.d.ts.map +0 -1
  198. package/dist/devices/solarPower.js.map +0 -1
  199. package/dist/devices/speaker.d.ts.map +0 -1
  200. package/dist/devices/speaker.js.map +0 -1
  201. package/dist/devices/temperatureControl.d.ts.map +0 -1
  202. package/dist/devices/temperatureControl.js.map +0 -1
  203. package/dist/devices/waterHeater.d.ts.map +0 -1
  204. package/dist/devices/waterHeater.js.map +0 -1
  205. package/dist/dgram/export.d.ts.map +0 -1
  206. package/dist/dgram/export.js.map +0 -1
  207. package/dist/frontend.d.ts.map +0 -1
  208. package/dist/frontend.js.map +0 -1
  209. package/dist/frontendTypes.d.ts.map +0 -1
  210. package/dist/frontendTypes.js.map +0 -1
  211. package/dist/helpers.d.ts.map +0 -1
  212. package/dist/helpers.js.map +0 -1
  213. package/dist/index.d.ts.map +0 -1
  214. package/dist/index.js.map +0 -1
  215. package/dist/jestutils/export.d.ts.map +0 -1
  216. package/dist/jestutils/export.js.map +0 -1
  217. package/dist/jestutils/jestHelpers.d.ts.map +0 -1
  218. package/dist/jestutils/jestHelpers.js.map +0 -1
  219. package/dist/logger/export.d.ts.map +0 -1
  220. package/dist/logger/export.js.map +0 -1
  221. package/dist/matter/behaviors.d.ts.map +0 -1
  222. package/dist/matter/behaviors.js.map +0 -1
  223. package/dist/matter/clusters.d.ts.map +0 -1
  224. package/dist/matter/clusters.js.map +0 -1
  225. package/dist/matter/devices.d.ts.map +0 -1
  226. package/dist/matter/devices.js.map +0 -1
  227. package/dist/matter/endpoints.d.ts.map +0 -1
  228. package/dist/matter/endpoints.js.map +0 -1
  229. package/dist/matter/export.d.ts.map +0 -1
  230. package/dist/matter/export.js.map +0 -1
  231. package/dist/matter/types.d.ts.map +0 -1
  232. package/dist/matter/types.js.map +0 -1
  233. package/dist/matterNode.d.ts.map +0 -1
  234. package/dist/matterNode.js.map +0 -1
  235. package/dist/matterbridge.d.ts.map +0 -1
  236. package/dist/matterbridge.js.map +0 -1
  237. package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
  238. package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
  239. package/dist/matterbridgeBehaviors.d.ts.map +0 -1
  240. package/dist/matterbridgeBehaviors.js.map +0 -1
  241. package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
  242. package/dist/matterbridgeDeviceTypes.js.map +0 -1
  243. package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
  244. package/dist/matterbridgeDynamicPlatform.js.map +0 -1
  245. package/dist/matterbridgeEndpoint.d.ts.map +0 -1
  246. package/dist/matterbridgeEndpoint.js.map +0 -1
  247. package/dist/matterbridgeEndpointHelpers.d.ts.map +0 -1
  248. package/dist/matterbridgeEndpointHelpers.js.map +0 -1
  249. package/dist/matterbridgeEndpointTypes.d.ts.map +0 -1
  250. package/dist/matterbridgeEndpointTypes.js.map +0 -1
  251. package/dist/matterbridgePlatform.d.ts.map +0 -1
  252. package/dist/matterbridgePlatform.js.map +0 -1
  253. package/dist/matterbridgePlatformTypes.d.ts.map +0 -1
  254. package/dist/matterbridgePlatformTypes.js.map +0 -1
  255. package/dist/matterbridgeTypes.d.ts.map +0 -1
  256. package/dist/matterbridgeTypes.js.map +0 -1
  257. package/dist/mb_coap.d.ts.map +0 -1
  258. package/dist/mb_coap.js.map +0 -1
  259. package/dist/mb_health.d.ts.map +0 -1
  260. package/dist/mb_health.js.map +0 -1
  261. package/dist/mb_mdns.d.ts.map +0 -1
  262. package/dist/mb_mdns.js.map +0 -1
  263. package/dist/pluginManager.d.ts.map +0 -1
  264. package/dist/pluginManager.js.map +0 -1
  265. package/dist/shelly.d.ts.map +0 -1
  266. package/dist/shelly.js.map +0 -1
  267. package/dist/spawn.d.ts.map +0 -1
  268. package/dist/spawn.js.map +0 -1
  269. package/dist/storage/export.d.ts.map +0 -1
  270. package/dist/storage/export.js.map +0 -1
  271. package/dist/utils/export.d.ts.map +0 -1
  272. package/dist/utils/export.js.map +0 -1
  273. package/dist/worker.d.ts.map +0 -1
  274. package/dist/worker.js.map +0 -1
  275. package/dist/workerCheckUpdates.d.ts.map +0 -1
  276. package/dist/workerCheckUpdates.js.map +0 -1
  277. package/dist/workerGlobalPrefix.d.ts.map +0 -1
  278. package/dist/workerGlobalPrefix.js.map +0 -1
  279. package/dist/workerTypes.d.ts.map +0 -1
  280. package/dist/workerTypes.js.map +0 -1
package/dist/mb_mdns.js CHANGED
@@ -1,36 +1,9 @@
1
- /**
2
- * @description This file contains the bin mb_mdns for the class Mdns.
3
- * @file src/dgram/mb_mdns.ts
4
- * @author Luca Liguori
5
- * @created 2025-07-22
6
- * @version 1.0.0
7
- * @license Apache-2.0
8
- *
9
- * Copyright 2025, 2026, 2027 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
1
  import os from 'node:os';
24
- // Net imports
25
2
  import { MDNS_MULTICAST_IPV4_ADDRESS, MDNS_MULTICAST_IPV6_ADDRESS, MDNS_MULTICAST_PORT, Mdns } from '@matterbridge/dgram';
26
- // Utils imports
27
3
  import { getIntParameter, getParameter, getStringArrayParameter, hasParameter } from '@matterbridge/utils';
28
- // istanbul ignore next
29
4
  {
30
5
  if (hasParameter('h') || hasParameter('help')) {
31
- // eslint-disable-next-line no-console
32
6
  console.log(`Copyright (c) Matterbridge. All rights reserved. Version 1.0.0.\n`);
33
- // eslint-disable-next-line no-console
34
7
  console.log(`Usage: mb_mdns [options...]
35
8
 
36
9
  If no command line is provided, mb_mdns shows all incoming mDNS records on all interfaces (0.0.0.0 and ::).
@@ -75,10 +48,8 @@ Examples:
75
48
  # Query each 5s and listen for _matterbridge._tcp.local service records
76
49
  mb_mdns --query 5000 --filter _matterbridge._tcp.local
77
50
  `);
78
- // eslint-disable-next-line n/no-process-exit
79
51
  process.exit(0);
80
52
  }
81
- // Dynamic JSON import (Node >= 20) with import attributes
82
53
  const { default: pkg } = await import('../package.json', { with: { type: 'json' } });
83
54
  let mdnsIpv4QueryInterval;
84
55
  let mdnsIpv6QueryInterval;
@@ -86,9 +57,6 @@ Examples:
86
57
  let mdnsIpv6AdvertiseInterval;
87
58
  let mdnsIpv4 = undefined;
88
59
  let mdnsIpv6 = undefined;
89
- /**
90
- * Cleanup and log device information before exiting.
91
- */
92
60
  async function cleanupAndLogAndExit() {
93
61
  clearInterval(mdnsIpv4QueryInterval);
94
62
  clearInterval(mdnsIpv6QueryInterval);
@@ -96,54 +64,48 @@ Examples:
96
64
  clearInterval(mdnsIpv6AdvertiseInterval);
97
65
  if (hasParameter('advertise')) {
98
66
  if (mdnsIpv4)
99
- advertise(mdnsIpv4, 0); // Send goodbye with TTL 0
67
+ advertise(mdnsIpv4, 0);
100
68
  if (mdnsIpv6)
101
- advertise(mdnsIpv6, 0); // Send goodbye with TTL 0
69
+ advertise(mdnsIpv6, 0);
102
70
  }
103
- await new Promise((resolve) => setTimeout(resolve, 250)); // Wait for 250ms to allow goodbye messages to be sent
71
+ await new Promise((resolve) => setTimeout(resolve, 250));
104
72
  mdnsIpv4?.stop();
105
73
  mdnsIpv6?.stop();
106
74
  mdnsIpv4?.logDevices();
107
75
  mdnsIpv6?.logDevices();
108
- await new Promise((resolve) => setTimeout(resolve, 250)); // Wait for 250ms to allow sockets to close
76
+ await new Promise((resolve) => setTimeout(resolve, 250));
109
77
  }
110
78
  const query = (mdns) => {
111
79
  mdns.log.info('Sending mDNS query for common services...');
112
80
  try {
113
81
  mdns.sendQuery([
114
- { name: '_matterc._udp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
115
- { name: '_matter._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
116
- { name: '_matterbridge._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
117
- { name: '_home-assistant._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
118
- { name: '_shelly._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
119
- { name: '_mqtt._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
120
- { name: '_http._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
121
- { name: '_googlecast._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
122
- { name: '_airplay._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
123
- { name: '_amzn-alexa._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
124
- { name: '_companion-link._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
125
- { name: '_hap._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
126
- { name: '_hap._udp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
127
- { name: '_ipp._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
128
- { name: '_ipps._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
129
- { name: '_meshcop._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
130
- { name: '_printer._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
131
- { name: '_raop._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
132
- { name: '_sleep-proxy._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
133
- { name: '_ssh._tcp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
134
- { name: '_services._dns-sd._udp.local', type: 12 /* DnsRecordType.PTR */, class: 1 /* DnsClass.IN */, unicastResponse: true },
82
+ { name: '_matterc._udp.local', type: 12, class: 1, unicastResponse: true },
83
+ { name: '_matter._tcp.local', type: 12, class: 1, unicastResponse: true },
84
+ { name: '_matterbridge._tcp.local', type: 12, class: 1, unicastResponse: true },
85
+ { name: '_home-assistant._tcp.local', type: 12, class: 1, unicastResponse: true },
86
+ { name: '_shelly._tcp.local', type: 12, class: 1, unicastResponse: true },
87
+ { name: '_mqtt._tcp.local', type: 12, class: 1, unicastResponse: true },
88
+ { name: '_http._tcp.local', type: 12, class: 1, unicastResponse: true },
89
+ { name: '_googlecast._tcp.local', type: 12, class: 1, unicastResponse: true },
90
+ { name: '_airplay._tcp.local', type: 12, class: 1, unicastResponse: true },
91
+ { name: '_amzn-alexa._tcp.local', type: 12, class: 1, unicastResponse: true },
92
+ { name: '_companion-link._tcp.local', type: 12, class: 1, unicastResponse: true },
93
+ { name: '_hap._tcp.local', type: 12, class: 1, unicastResponse: true },
94
+ { name: '_hap._udp.local', type: 12, class: 1, unicastResponse: true },
95
+ { name: '_ipp._tcp.local', type: 12, class: 1, unicastResponse: true },
96
+ { name: '_ipps._tcp.local', type: 12, class: 1, unicastResponse: true },
97
+ { name: '_meshcop._tcp.local', type: 12, class: 1, unicastResponse: true },
98
+ { name: '_printer._tcp.local', type: 12, class: 1, unicastResponse: true },
99
+ { name: '_raop._tcp.local', type: 12, class: 1, unicastResponse: true },
100
+ { name: '_sleep-proxy._tcp.local', type: 12, class: 1, unicastResponse: true },
101
+ { name: '_ssh._tcp.local', type: 12, class: 1, unicastResponse: true },
102
+ { name: '_services._dns-sd._udp.local', type: 12, class: 1, unicastResponse: true },
135
103
  ]);
136
104
  }
137
105
  catch (error) {
138
106
  mdns.log.error(`Error sending mDNS query: ${error.message}`);
139
107
  }
140
108
  };
141
- /**
142
- * Sends an mDNS advertisement for the HTTP service over UDP IPv4.
143
- *
144
- * @param {Mdns} mdns - The Mdns instance to use for sending the advertisement.
145
- * @param {number} [ttl] - The time-to-live for the advertisement records. Defaults to 120 seconds. Send 0 for goodbye.
146
- */
147
109
  const advertise = (mdns, ttl = 120) => {
148
110
  mdns.log.info(`Sending mDNS advertisement for matterbridge service with TTL ${ttl ? ttl.toString() : 'goodbye'}...`);
149
111
  const httpServiceType = '_http._tcp.local';
@@ -159,25 +121,17 @@ Examples:
159
121
  const srvRdata = mdns.encodeSrvRdata(0, 0, port, hostName);
160
122
  const txtRdata = mdns.encodeTxtRdata([`version=${pkg.version}`, 'path=/']);
161
123
  const answers = [
162
- // PTR records for service types and instances
163
- { name: '_services._dns-sd._udp.local', rtype: 12 /* DnsRecordType.PTR */, rclass: 1 /* DnsClass.IN */, ttl, rdata: ptrHttpServiceTypeRdata },
164
- { name: httpServiceType, rtype: 12 /* DnsRecordType.PTR */, rclass: 1 /* DnsClass.IN */, ttl, rdata: ptrHttpInstanceRdata },
165
- { name: '_services._dns-sd._udp.local', rtype: 12 /* DnsRecordType.PTR */, rclass: 1 /* DnsClass.IN */, ttl, rdata: ptrMatterbridgeServiceTypeRdata },
166
- { name: matterbridgeServiceType, rtype: 12 /* DnsRecordType.PTR */, rclass: 1 /* DnsClass.IN */, ttl, rdata: ptrMatterbridgeInstanceRdata },
167
- // SRV record for the HTTP instance
168
- { name: httpInstanceName, rtype: 33 /* DnsRecordType.SRV */, rclass: 1 /* DnsClass.IN */ | 32768 /* DnsClassFlag.FLUSH */, ttl, rdata: srvRdata },
169
- // SRV record for the matterbridge instance
170
- { name: matterbridgeInstanceName, rtype: 33 /* DnsRecordType.SRV */, rclass: 1 /* DnsClass.IN */ | 32768 /* DnsClassFlag.FLUSH */, ttl, rdata: srvRdata },
171
- // TXT record for the HTTP instance
172
- { name: httpInstanceName, rtype: 16 /* DnsRecordType.TXT */, rclass: 1 /* DnsClass.IN */ | 32768 /* DnsClassFlag.FLUSH */, ttl, rdata: txtRdata },
173
- // TXT record for the matterbridge instance
174
- { name: matterbridgeInstanceName, rtype: 16 /* DnsRecordType.TXT */, rclass: 1 /* DnsClass.IN */ | 32768 /* DnsClassFlag.FLUSH */, ttl, rdata: txtRdata },
124
+ { name: '_services._dns-sd._udp.local', rtype: 12, rclass: 1, ttl, rdata: ptrHttpServiceTypeRdata },
125
+ { name: httpServiceType, rtype: 12, rclass: 1, ttl, rdata: ptrHttpInstanceRdata },
126
+ { name: '_services._dns-sd._udp.local', rtype: 12, rclass: 1, ttl, rdata: ptrMatterbridgeServiceTypeRdata },
127
+ { name: matterbridgeServiceType, rtype: 12, rclass: 1, ttl, rdata: ptrMatterbridgeInstanceRdata },
128
+ { name: httpInstanceName, rtype: 33, rclass: 1 | 32768, ttl, rdata: srvRdata },
129
+ { name: matterbridgeInstanceName, rtype: 33, rclass: 1 | 32768, ttl, rdata: srvRdata },
130
+ { name: httpInstanceName, rtype: 16, rclass: 1 | 32768, ttl, rdata: txtRdata },
131
+ { name: matterbridgeInstanceName, rtype: 16, rclass: 1 | 32768, ttl, rdata: txtRdata },
175
132
  ];
176
- // Always attempt to add both A and all AAAA records (best effort), regardless of the socket family.
177
133
  const interfaces = os.networkInterfaces();
178
- // Use specified interface name if provided
179
134
  let interfaceInfos = mdns.interfaceName ? interfaces[mdns.interfaceName] : undefined;
180
- // Find the first non-internal IPv4 and IPv6 addresses if interface name is not provided or not found
181
135
  if (!interfaceInfos) {
182
136
  interfaceInfos = [];
183
137
  for (const name of Object.keys(interfaces)) {
@@ -188,15 +142,14 @@ Examples:
188
142
  }
189
143
  }
190
144
  }
191
- // Encode A and AAAA records for all non-internal addresses of the selected interface
192
145
  for (const info of interfaceInfos) {
193
146
  if (info.family === 'IPv4' && !info.internal) {
194
147
  const ipv4 = info.address;
195
- answers.push({ name: hostName, rtype: 1 /* DnsRecordType.A */, rclass: 1 /* DnsClass.IN */ | 32768 /* DnsClassFlag.FLUSH */, ttl, rdata: mdns.encodeA(ipv4) });
148
+ answers.push({ name: hostName, rtype: 1, rclass: 1 | 32768, ttl, rdata: mdns.encodeA(ipv4) });
196
149
  }
197
150
  else if (info.family === 'IPv6' && !info.internal) {
198
151
  const ipv6 = info.address;
199
- answers.push({ name: hostName, rtype: 28 /* DnsRecordType.AAAA */, rclass: 1 /* DnsClass.IN */ | 32768 /* DnsClassFlag.FLUSH */, ttl, rdata: mdns.encodeAAAA(ipv6) });
152
+ answers.push({ name: hostName, rtype: 28, rclass: 1 | 32768, ttl, rdata: mdns.encodeAAAA(ipv6) });
200
153
  }
201
154
  }
202
155
  try {
@@ -210,19 +163,15 @@ Examples:
210
163
  mdnsIpv4 = new Mdns('mDNS Server udp4', MDNS_MULTICAST_IPV4_ADDRESS, MDNS_MULTICAST_PORT, 'udp4', true, getParameter('interfaceName'), getParameter('ipv4InterfaceAddress') || '0.0.0.0', getParameter('outgoingIpv4InterfaceAddress'));
211
164
  if (hasParameter('v') || hasParameter('verbose'))
212
165
  mdnsIpv4.listNetworkInterfaces();
213
- // Apply filters if any
214
166
  const filters = getStringArrayParameter('filter');
215
167
  if (filters)
216
168
  mdnsIpv4.filters.push(...filters);
217
- // Apply ip filters if any
218
169
  const ipFilters = getStringArrayParameter('ip-filter');
219
170
  if (ipFilters)
220
171
  mdnsIpv4.ipFilters.push(...ipFilters);
221
- // Handle errors
222
172
  mdnsIpv4.on('error', (err) => {
223
173
  mdnsIpv4?.log.error(`mDNS udp4 Server error: ${err.message}\n${err.stack}`);
224
174
  });
225
- // Start the IPv4 mDNS server
226
175
  mdnsIpv4.start();
227
176
  mdnsIpv4.on('ready', (address) => {
228
177
  mdnsIpv4?.socket.setMulticastLoopback(false);
@@ -241,19 +190,15 @@ Examples:
241
190
  mdnsIpv6 = new Mdns('mDNS Server udp6', MDNS_MULTICAST_IPV6_ADDRESS, MDNS_MULTICAST_PORT, 'udp6', true, getParameter('interfaceName'), getParameter('ipv6InterfaceAddress') || '::', getParameter('outgoingIpv6InterfaceAddress'));
242
191
  if (hasParameter('v') || hasParameter('verbose'))
243
192
  mdnsIpv6.listNetworkInterfaces();
244
- // Apply filters if any
245
193
  const filters = getStringArrayParameter('filter');
246
194
  if (filters)
247
195
  mdnsIpv6.filters.push(...filters);
248
- // Apply ip filters if any
249
196
  const ipFilters = getStringArrayParameter('ip-filter');
250
197
  if (ipFilters)
251
198
  mdnsIpv6.ipFilters.push(...ipFilters);
252
- // Handle errors
253
199
  mdnsIpv6.on('error', (err) => {
254
200
  mdnsIpv6?.log.error(`mDNS udp6 Server error: ${err.message}\n${err.stack}`);
255
201
  });
256
- // Start the IPv6 mDNS server
257
202
  mdnsIpv6.start();
258
203
  mdnsIpv6.on('ready', (address) => {
259
204
  mdnsIpv6?.socket.setMulticastLoopback(false);
@@ -268,18 +213,15 @@ Examples:
268
213
  }
269
214
  });
270
215
  }
271
- // Handle Ctrl+C (SIGINT) and SIGTERM to stop and log devices
272
216
  process.on('SIGINT', async () => {
273
217
  await cleanupAndLogAndExit();
274
218
  });
275
219
  process.on('SIGTERM', async () => {
276
220
  await cleanupAndLogAndExit();
277
221
  });
278
- // Exit after a timeout to avoid running indefinitely in test environments
279
222
  if (!hasParameter('no-timeout')) {
280
223
  setTimeout(async () => {
281
224
  await cleanupAndLogAndExit();
282
- }, 600000).unref(); // 10 minutes timeout to exit if no activity
225
+ }, 600000).unref();
283
226
  }
284
227
  }
285
- //# sourceMappingURL=mb_mdns.js.map
@@ -1,26 +1,3 @@
1
- /**
2
- * This file contains the Plugins class.
3
- *
4
- * @file plugins.ts
5
- * @author Luca Liguori
6
- * @created 2024-07-14
7
- * @version 1.3.5
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
1
  import EventEmitter from 'node:events';
25
2
  import { LogLevel } from 'node-ansi-logger';
26
3
  import type { Matterbridge } from './matterbridge.js';
@@ -39,9 +16,6 @@ interface PluginManagerEvents {
39
16
  configured: [name: string];
40
17
  shutdown: [name: string];
41
18
  }
42
- /**
43
- * Manages Matterbridge plugins.
44
- */
45
19
  export declare class PluginManager extends EventEmitter<PluginManagerEvents> {
46
20
  private readonly matterbridge;
47
21
  private readonly _plugins;
@@ -49,325 +23,46 @@ export declare class PluginManager extends EventEmitter<PluginManagerEvents> {
49
23
  private readonly server;
50
24
  private readonly debug;
51
25
  private readonly verbose;
52
- /**
53
- * Creates an instance of PluginManager.
54
- *
55
- * @param {Matterbridge} matterbridge - The Matterbridge instance.
56
- */
57
26
  constructor(matterbridge: Matterbridge);
58
27
  destroy(): void;
59
28
  private msgHandler;
60
- /**
61
- * Gets the number of plugins.
62
- *
63
- * @returns {number} The number of plugins.
64
- */
65
29
  get length(): number;
66
- /**
67
- * Gets the number of plugins.
68
- *
69
- * @returns {number} The number of plugins.
70
- */
71
30
  get size(): number;
72
- /**
73
- * Checks if a plugin with the specified name exists.
74
- *
75
- * @param {string} name - The name of the plugin.
76
- * @returns {boolean} True if the plugin exists, false otherwise.
77
- */
78
31
  has(name: string): boolean;
79
- /**
80
- * Gets a plugin by its name.
81
- *
82
- * @param {string} name - The name of the plugin.
83
- * @returns {Plugin | undefined} The plugin, or undefined if not found.
84
- */
85
32
  get(name: string): Plugin | undefined;
86
- /**
87
- * Adds a plugin to the manager.
88
- *
89
- * @param {Plugin} plugin - The plugin to add.
90
- * @returns {Plugin} The added plugin.
91
- */
92
33
  set(plugin: Plugin): Plugin;
93
- /**
94
- * Clears all plugins from the manager.
95
- */
96
34
  clear(): void;
97
- /**
98
- * Converts a plugin or API plugin to a storage plugin.
99
- *
100
- * @param {Plugin | ApiPlugin} plugin - The plugin or API plugin to convert.
101
- * @returns {StoragePlugin} The converted storage plugin.
102
- */
103
35
  private toStoragePlugin;
104
- /**
105
- * Converts a plugin to an API plugin.
106
- *
107
- * @param {Plugin} plugin - The plugin to convert.
108
- * @returns {ApiPlugin} The converted API plugin.
109
- */
110
36
  private toApiPlugin;
111
- /**
112
- * Gets an array of all plugins.
113
- *
114
- * @returns {Plugin[]} An array of all plugins.
115
- */
116
37
  array(): Plugin[];
117
- /**
118
- * Gets a StoragePlugin array of all plugins suitable for serialization.
119
- *
120
- * @returns {StoragePlugin[]} An array of all plugins.
121
- */
122
38
  storagePluginArray(): StoragePlugin[];
123
- /**
124
- * Gets an ApiPlugin array of all plugins suitable for serialization.
125
- *
126
- * @returns {ApiPlugin[]} An array of all plugins.
127
- */
128
39
  apiPluginArray(): ApiPlugin[];
129
- /**
130
- * Gets an iterator for the plugins.
131
- *
132
- * @returns {IterableIterator<Plugin>} An iterator for the plugins.
133
- */
134
40
  [Symbol.iterator](): MapIterator<Plugin>;
135
- /**
136
- * Executes a provided function once for each plugin.
137
- *
138
- * @param {Function} callback - The function to execute for each plugin.
139
- * @returns {Promise<void>}
140
- */
141
41
  forEach(callback: (plugin: Plugin) => Promise<void>): Promise<void>;
142
- /**
143
- * Sets the log level for the plugin manager.
144
- *
145
- * @param {LogLevel} logLevel - The log level to set.
146
- */
147
42
  set logLevel(logLevel: LogLevel);
148
- /**
149
- * Loads registered plugins from storage.
150
- *
151
- * @returns {Promise<StoragePlugin[]>} A promise that resolves to an array of registered plugins.
152
- */
153
43
  loadFromStorage(): Promise<StoragePlugin[]>;
154
- /**
155
- * Saves registered plugins to storage.
156
- *
157
- * @returns {Promise<number>} A promise that resolves to the number of registered plugins.
158
- */
159
44
  saveToStorage(): Promise<number>;
160
- /**
161
- * Resolves the name of a plugin by loading and parsing its package.json file.
162
- * It will first try to resolve the path as is, then in the global modules directory, and finally in the matterbridge plugin directory.
163
- *
164
- * @param {string} nameOrPath - The name of the plugin or the path to the plugin's package.json file.
165
- * @returns {Promise<string | null>} A promise that resolves to the path of the plugin's package.json file or null if it could not be resolved.
166
- */
167
45
  resolve(nameOrPath: string): Promise<string | null>;
168
- /**
169
- * Installs a package globally using npm.
170
- *
171
- * @param {string} packageName - The name of the package to install.
172
- * @returns {Promise<boolean>} A promise that resolves to true if the installation was successful, false otherwise.
173
- */
174
46
  install(packageName: string): Promise<boolean>;
175
- /**
176
- * Uninstalls a package globally using npm.
177
- *
178
- * @param {string} packageName - The name of the package to uninstall.
179
- * @returns {Promise<boolean>} A promise that resolves to true if the uninstallation was successful, false otherwise.
180
- */
181
47
  uninstall(packageName: string): Promise<boolean>;
182
- /**
183
- * Get the author of a plugin from its package.json.
184
- *
185
- * @param {Record<string, string | number | Record<string, string | number | object>>} packageJson - The package.json object of the plugin.
186
- * @returns {string} The author of the plugin, or 'Unknown author' if not found.
187
- */
188
48
  getAuthor(packageJson: Record<string, string | number | Record<string, string | number | object>>): string;
189
- /**
190
- * Get the homepage of a plugin from its package.json.
191
- *
192
- * @param {Record<string, string | number | Record<string, string | number | object>>} packageJson - The package.json object of the plugin.
193
- * @returns {string | undefined} The homepage of the plugin, or undefined if not found.
194
- */
195
49
  getHomepage(packageJson: Record<string, string | number | Record<string, string | number | object>>): string | undefined;
196
- /**
197
- * Get the help URL of a plugin from its package.json.
198
- *
199
- * @param {Record<string, string | number | Record<string, string | number | object>>} packageJson - The package.json object of the plugin.
200
- * @returns {string | undefined} The URL to the help page or to the README file, or undefined if not found.
201
- */
202
50
  getHelp(packageJson: Record<string, string | number | Record<string, string | number | object>>): string | undefined;
203
- /**
204
- * Get the changelog URL of a plugin from its package.json.
205
- *
206
- * @param {Record<string, string | number | Record<string, string | number | object>>} packageJson - The package.json object of the plugin.
207
- * @returns {string | undefined} The URL to the CHANGELOG file, or undefined if not found.
208
- */
209
51
  getChangelog(packageJson: Record<string, string | number | Record<string, string | number | object>>): string | undefined;
210
- /**
211
- * Get the first funding URL(s) of a plugin from its package.json.
212
- *
213
- * @param {Record<string, any>} packageJson - The package.json object of the plugin.
214
- * @returns {string | undefined} The first funding URLs, or undefined if not found.
215
- */
216
52
  getFunding(packageJson: Record<string, any>): string | undefined;
217
- /**
218
- * Parses the plugin package.json and returns it.
219
- * It will also log warnings and errors for missing or invalid fields.
220
- * It will return null if critical errors are found.
221
- *
222
- * @param {Plugin | PluginName} plugin - The plugin to load the package from.
223
- * @returns {Promise<Record<string, string | number | object> | null>} A promise that resolves to the parsed package.json object or null if it could not be parsed.
224
- */
225
53
  parse(plugin: Plugin | PluginName): Promise<Record<string, string | number | object> | null>;
226
- /**
227
- * Enables a plugin by its name or path.
228
- *
229
- * This method enables a plugin by setting its `enabled` property to `true` and saving the updated
230
- * plugin information to storage. It first checks if the plugin is already registered in the `_plugins` map.
231
- * If not, it attempts to resolve the plugin's `package.json` file to retrieve its name and enable it.
232
- *
233
- * @param {string} nameOrPath - The name or path of the plugin to enable.
234
- * @returns {Promise<Plugin | null>} A promise that resolves to the enabled plugin object, or null if the plugin could not be enabled.
235
- */
236
54
  enable(nameOrPath: string): Promise<Plugin | null>;
237
- /**
238
- * Disables a plugin by its name or path.
239
- *
240
- * This method disables a plugin by setting its `enabled` property to `false` and saving the updated
241
- * plugin information to storage. It first checks if the plugin is already registered in the `_plugins` map.
242
- * If not, it attempts to resolve the plugin's `package.json` file to retrieve its name and disable it.
243
- *
244
- * @param {string} nameOrPath - The name or path of the plugin to enable.
245
- * @returns {Promise<Plugin | null>} A promise that resolves to the disabled plugin object, or null if the plugin could not be disabled.
246
- */
247
55
  disable(nameOrPath: string): Promise<Plugin | null>;
248
- /**
249
- * Removes a plugin by its name or path.
250
- *
251
- * This method removes a plugin from the `_plugins` map and saves the updated plugin information to storage.
252
- * It first checks if the plugin is already registered in the `_plugins` map. If not, it attempts to resolve
253
- * the plugin's `package.json` file to retrieve its name and remove it.
254
- *
255
- * @param {string} nameOrPath - The name or path of the plugin to remove.
256
- * @returns {Promise<Plugin | null>} A promise that resolves to the removed plugin object, or null if the plugin could not be removed.
257
- */
258
56
  remove(nameOrPath: string): Promise<Plugin | null>;
259
- /**
260
- * Adds a plugin by its name or path.
261
- *
262
- * This method adds a plugin to the plugins map and saves the updated plugin information to storage.
263
- * It first resolves the plugin's `package.json` file to retrieve its details. If the plugin is already
264
- * registered, it logs an info message and returns null. Otherwise, it registers the plugin, enables it,
265
- * and saves the updated plugin information to storage.
266
- *
267
- * @param {string} nameOrPath - The name or path of the plugin to add.
268
- * @returns {Promise<Plugin | null>} A promise that resolves to the added plugin object, or null if the plugin could not be added.
269
- */
270
57
  add(nameOrPath: string): Promise<Plugin | null>;
271
- /**
272
- * Loads a plugin and returns the corresponding MatterbridgePlatform instance.
273
- *
274
- * @param {Plugin | PluginName} plugin - The plugin to load.
275
- * @param {boolean} start - Optional flag indicating whether to start the plugin after loading. Default is false.
276
- * @param {string} message - Optional message to pass to the plugin when starting.
277
- * @param {boolean} configure - Optional flag indicating whether to configure the plugin after loading. Default is false.
278
- * @returns {Promise<MatterbridgePlatform | undefined>} A Promise that resolves to the loaded MatterbridgePlatform instance or undefined.
279
- */
280
58
  load(plugin: Plugin | PluginName, start?: boolean, message?: string, configure?: boolean): Promise<MatterbridgePlatform | undefined>;
281
- /**
282
- * Starts a plugin.
283
- *
284
- * @param {Plugin | PluginName} plugin - The plugin to start.
285
- * @param {string} [message] - Optional message to pass to the plugin's onStart method.
286
- * @param {boolean} [configure] - Indicates whether to configure the plugin after starting (default false).
287
- * @returns {Promise<Plugin | undefined>} A promise that resolves when the plugin is started successfully, or rejects with an error if starting the plugin fails.
288
- */
289
59
  start(plugin: Plugin | PluginName, message?: string, configure?: boolean): Promise<Plugin | undefined>;
290
- /**
291
- * Configures a plugin.
292
- *
293
- * @param {Plugin | PluginName} plugin - The plugin to configure.
294
- * @returns {Promise<Plugin | undefined>} A promise that resolves when the plugin is configured successfully, or rejects with an error if configuration fails.
295
- */
296
60
  configure(plugin: Plugin | PluginName): Promise<Plugin | undefined>;
297
- /**
298
- * Shuts down a plugin.
299
- *
300
- * This method shuts down a plugin by calling its `onShutdown` method and resetting its state.
301
- * It logs the shutdown process and optionally removes all devices associated with the plugin.
302
- *
303
- * @param {Plugin | PluginName} plugin - The plugin to shut down.
304
- * @param {string} [reason] - The reason for shutting down the plugin.
305
- * @param {boolean} [removeAllDevices] - Whether to remove all devices associated with the plugin.
306
- * @param {boolean} [force] - Whether to force the shutdown even if the plugin is not loaded or started.
307
- * @returns {Promise<Plugin | undefined>} A promise that resolves to the shut down plugin object, or undefined if the shutdown failed.
308
- */
309
61
  shutdown(plugin: Plugin | PluginName, reason?: string, removeAllDevices?: boolean, force?: boolean): Promise<Plugin | undefined>;
310
- /**
311
- * Loads the configuration for a plugin.
312
- * If the configuration file exists, it reads the file and returns the parsed JSON data.
313
- * If the configuration file does not exist, it creates a new file with default configuration and returns it.
314
- * If any error occurs during file access or creation, it logs an error and return un empty config.
315
- *
316
- * @param {Plugin} plugin - The plugin for which to load the configuration.
317
- * @returns {Promise<PlatformConfig>} A promise that resolves to the loaded or created configuration.
318
- */
319
62
  loadConfig(plugin: Plugin): Promise<PlatformConfig>;
320
- /**
321
- * Saves the configuration of a plugin to a file.
322
- *
323
- * This method saves the configuration of the specified plugin to a JSON file in the matterbridge directory.
324
- * If the plugin's configuration is not found, it logs an error and rejects the promise. If the configuration
325
- * is successfully saved, it logs a debug message. If an error occurs during the file write operation, it logs
326
- * the error and rejects the promise.
327
- *
328
- * @param {Plugin} plugin - The plugin whose configuration is to be saved.
329
- * @param {boolean} [restartRequired] - Indicates whether a restart is required after saving the configuration.
330
- * @returns {Promise<void>} A promise that resolves when the configuration is successfully saved, or rejects if an error occurs.
331
- * @throws {Error} If the plugin's configuration is not found.
332
- */
333
63
  saveConfigFromPlugin(plugin: Plugin, restartRequired?: boolean): Promise<void>;
334
- /**
335
- * Saves the configuration of a plugin from a JSON object to a file.
336
- *
337
- * This method saves the provided configuration of the specified plugin to a JSON file in the matterbridge directory.
338
- * It first checks if the configuration data is valid by ensuring it contains the correct name and type, and matches
339
- * the plugin's name. If the configuration data is invalid, it logs an error and returns. If the configuration is
340
- * successfully saved, it updates the plugin's `configJson` property and logs a debug message. If an error occurs
341
- * during the file write operation, it logs the error and returns.
342
- *
343
- * @param {Plugin} plugin - The plugin whose configuration is to be saved.
344
- * @param {PlatformConfig} config - The configuration data to be saved.
345
- * @param {boolean} [restartRequired] - Indicates whether a restart is required after saving the configuration.
346
- * @returns {Promise<void>} A promise that resolves when the configuration is successfully saved, or returns if an error occurs.
347
- */
348
64
  saveConfigFromJson(plugin: Plugin, config: PlatformConfig, restartRequired?: boolean): Promise<void>;
349
- /**
350
- * Loads the schema for a plugin.
351
- *
352
- * This method attempts to load the schema file for the specified plugin. If the schema file is found,
353
- * it reads and parses the file, updates the schema's title and description, and logs the process.
354
- * If the schema file is not found, it logs the event and loads a default schema for the plugin.
355
- *
356
- * @param {Plugin} plugin - The plugin whose schema is to be loaded.
357
- * @returns {Promise<PlatformSchema>} A promise that resolves to the loaded schema object, or the default schema if the schema file is not found.
358
- */
359
65
  loadSchema(plugin: Plugin): Promise<PlatformSchema>;
360
- /**
361
- * Returns the default schema for a plugin.
362
- *
363
- * This method generates a default schema object for the specified plugin. The schema includes
364
- * metadata such as the plugin's title, description, version, and author. It also defines the
365
- * properties of the schema, including the plugin's name, type, debug flag, and unregisterOnShutdown flag.
366
- *
367
- * @param {Plugin} plugin - The plugin for which the default schema is to be generated.
368
- * @returns {PlatformSchema} The default schema object for the plugin.
369
- */
370
66
  getDefaultSchema(plugin: Plugin): PlatformSchema;
371
67
  }
372
68
  export {};
373
- //# sourceMappingURL=pluginManager.d.ts.map