matterbridge 3.3.7-dev-20251109-a306ab9 → 3.3.7

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 (302) hide show
  1. package/dist/broadcastServer.d.ts +115 -0
  2. package/dist/broadcastServer.d.ts.map +1 -0
  3. package/dist/broadcastServer.js +93 -1
  4. package/dist/broadcastServer.js.map +1 -0
  5. package/dist/broadcastServerTypes.d.ts +806 -0
  6. package/dist/broadcastServerTypes.d.ts.map +1 -0
  7. package/dist/broadcastServerTypes.js +24 -0
  8. package/dist/broadcastServerTypes.js.map +1 -0
  9. package/dist/cli.d.ts +30 -0
  10. package/dist/cli.d.ts.map +1 -0
  11. package/dist/cli.js +97 -1
  12. package/dist/cli.js.map +1 -0
  13. package/dist/cliEmitter.d.ts +50 -0
  14. package/dist/cliEmitter.d.ts.map +1 -0
  15. package/dist/cliEmitter.js +37 -0
  16. package/dist/cliEmitter.js.map +1 -0
  17. package/dist/cliHistory.d.ts +48 -0
  18. package/dist/cliHistory.d.ts.map +1 -0
  19. package/dist/cliHistory.js +38 -0
  20. package/dist/cliHistory.js.map +1 -0
  21. package/dist/clusters/export.d.ts +2 -0
  22. package/dist/clusters/export.d.ts.map +1 -0
  23. package/dist/clusters/export.js +2 -0
  24. package/dist/clusters/export.js.map +1 -0
  25. package/dist/defaultConfigSchema.d.ts +28 -0
  26. package/dist/defaultConfigSchema.d.ts.map +1 -0
  27. package/dist/defaultConfigSchema.js +24 -0
  28. package/dist/defaultConfigSchema.js.map +1 -0
  29. package/dist/deviceManager.d.ts +128 -0
  30. package/dist/deviceManager.d.ts.map +1 -0
  31. package/dist/deviceManager.js +105 -1
  32. package/dist/deviceManager.js.map +1 -0
  33. package/dist/devices/airConditioner.d.ts +98 -0
  34. package/dist/devices/airConditioner.d.ts.map +1 -0
  35. package/dist/devices/airConditioner.js +57 -0
  36. package/dist/devices/airConditioner.js.map +1 -0
  37. package/dist/devices/batteryStorage.d.ts +48 -0
  38. package/dist/devices/batteryStorage.d.ts.map +1 -0
  39. package/dist/devices/batteryStorage.js +48 -1
  40. package/dist/devices/batteryStorage.js.map +1 -0
  41. package/dist/devices/cooktop.d.ts +60 -0
  42. package/dist/devices/cooktop.d.ts.map +1 -0
  43. package/dist/devices/cooktop.js +55 -0
  44. package/dist/devices/cooktop.js.map +1 -0
  45. package/dist/devices/dishwasher.d.ts +71 -0
  46. package/dist/devices/dishwasher.d.ts.map +1 -0
  47. package/dist/devices/dishwasher.js +57 -0
  48. package/dist/devices/dishwasher.js.map +1 -0
  49. package/dist/devices/evse.d.ts +76 -0
  50. package/dist/devices/evse.d.ts.map +1 -0
  51. package/dist/devices/evse.js +74 -10
  52. package/dist/devices/evse.js.map +1 -0
  53. package/dist/devices/export.d.ts +17 -0
  54. package/dist/devices/export.d.ts.map +1 -0
  55. package/dist/devices/export.js +5 -0
  56. package/dist/devices/export.js.map +1 -0
  57. package/dist/devices/extractorHood.d.ts +46 -0
  58. package/dist/devices/extractorHood.d.ts.map +1 -0
  59. package/dist/devices/extractorHood.js +42 -0
  60. package/dist/devices/extractorHood.js.map +1 -0
  61. package/dist/devices/heatPump.d.ts +47 -0
  62. package/dist/devices/heatPump.d.ts.map +1 -0
  63. package/dist/devices/heatPump.js +50 -2
  64. package/dist/devices/heatPump.js.map +1 -0
  65. package/dist/devices/laundryDryer.d.ts +67 -0
  66. package/dist/devices/laundryDryer.d.ts.map +1 -0
  67. package/dist/devices/laundryDryer.js +62 -3
  68. package/dist/devices/laundryDryer.js.map +1 -0
  69. package/dist/devices/laundryWasher.d.ts +81 -0
  70. package/dist/devices/laundryWasher.d.ts.map +1 -0
  71. package/dist/devices/laundryWasher.js +70 -4
  72. package/dist/devices/laundryWasher.js.map +1 -0
  73. package/dist/devices/microwaveOven.d.ts +168 -0
  74. package/dist/devices/microwaveOven.d.ts.map +1 -0
  75. package/dist/devices/microwaveOven.js +88 -5
  76. package/dist/devices/microwaveOven.js.map +1 -0
  77. package/dist/devices/oven.d.ts +105 -0
  78. package/dist/devices/oven.d.ts.map +1 -0
  79. package/dist/devices/oven.js +85 -0
  80. package/dist/devices/oven.js.map +1 -0
  81. package/dist/devices/refrigerator.d.ts +118 -0
  82. package/dist/devices/refrigerator.d.ts.map +1 -0
  83. package/dist/devices/refrigerator.js +102 -0
  84. package/dist/devices/refrigerator.js.map +1 -0
  85. package/dist/devices/roboticVacuumCleaner.d.ts +112 -0
  86. package/dist/devices/roboticVacuumCleaner.d.ts.map +1 -0
  87. package/dist/devices/roboticVacuumCleaner.js +100 -9
  88. package/dist/devices/roboticVacuumCleaner.js.map +1 -0
  89. package/dist/devices/solarPower.d.ts +40 -0
  90. package/dist/devices/solarPower.d.ts.map +1 -0
  91. package/dist/devices/solarPower.js +38 -0
  92. package/dist/devices/solarPower.js.map +1 -0
  93. package/dist/devices/speaker.d.ts +87 -0
  94. package/dist/devices/speaker.d.ts.map +1 -0
  95. package/dist/devices/speaker.js +84 -0
  96. package/dist/devices/speaker.js.map +1 -0
  97. package/dist/devices/temperatureControl.d.ts +166 -0
  98. package/dist/devices/temperatureControl.d.ts.map +1 -0
  99. package/dist/devices/temperatureControl.js +24 -3
  100. package/dist/devices/temperatureControl.js.map +1 -0
  101. package/dist/devices/waterHeater.d.ts +111 -0
  102. package/dist/devices/waterHeater.d.ts.map +1 -0
  103. package/dist/devices/waterHeater.js +82 -2
  104. package/dist/devices/waterHeater.js.map +1 -0
  105. package/dist/dgram/coap.d.ts +205 -0
  106. package/dist/dgram/coap.d.ts.map +1 -0
  107. package/dist/dgram/coap.js +126 -13
  108. package/dist/dgram/coap.js.map +1 -0
  109. package/dist/dgram/dgram.d.ts +141 -0
  110. package/dist/dgram/dgram.d.ts.map +1 -0
  111. package/dist/dgram/dgram.js +114 -2
  112. package/dist/dgram/dgram.js.map +1 -0
  113. package/dist/dgram/mb_coap.d.ts +24 -0
  114. package/dist/dgram/mb_coap.d.ts.map +1 -0
  115. package/dist/dgram/mb_coap.js +41 -3
  116. package/dist/dgram/mb_coap.js.map +1 -0
  117. package/dist/dgram/mb_mdns.d.ts +24 -0
  118. package/dist/dgram/mb_mdns.d.ts.map +1 -0
  119. package/dist/dgram/mb_mdns.js +80 -15
  120. package/dist/dgram/mb_mdns.js.map +1 -0
  121. package/dist/dgram/mdns.d.ts +290 -0
  122. package/dist/dgram/mdns.d.ts.map +1 -0
  123. package/dist/dgram/mdns.js +299 -137
  124. package/dist/dgram/mdns.js.map +1 -0
  125. package/dist/dgram/multicast.d.ts +67 -0
  126. package/dist/dgram/multicast.d.ts.map +1 -0
  127. package/dist/dgram/multicast.js +62 -1
  128. package/dist/dgram/multicast.js.map +1 -0
  129. package/dist/dgram/unicast.d.ts +56 -0
  130. package/dist/dgram/unicast.d.ts.map +1 -0
  131. package/dist/dgram/unicast.js +54 -0
  132. package/dist/dgram/unicast.js.map +1 -0
  133. package/dist/frontend.d.ts +238 -0
  134. package/dist/frontend.d.ts.map +1 -0
  135. package/dist/frontend.js +451 -35
  136. package/dist/frontend.js.map +1 -0
  137. package/dist/frontendTypes.d.ts +529 -0
  138. package/dist/frontendTypes.d.ts.map +1 -0
  139. package/dist/frontendTypes.js +45 -0
  140. package/dist/frontendTypes.js.map +1 -0
  141. package/dist/helpers.d.ts +48 -0
  142. package/dist/helpers.d.ts.map +1 -0
  143. package/dist/helpers.js +53 -0
  144. package/dist/helpers.js.map +1 -0
  145. package/dist/index.d.ts +33 -0
  146. package/dist/index.d.ts.map +1 -0
  147. package/dist/index.js +25 -0
  148. package/dist/index.js.map +1 -0
  149. package/dist/logger/export.d.ts +2 -0
  150. package/dist/logger/export.d.ts.map +1 -0
  151. package/dist/logger/export.js +1 -0
  152. package/dist/logger/export.js.map +1 -0
  153. package/dist/matter/behaviors.d.ts +2 -0
  154. package/dist/matter/behaviors.d.ts.map +1 -0
  155. package/dist/matter/behaviors.js +2 -0
  156. package/dist/matter/behaviors.js.map +1 -0
  157. package/dist/matter/clusters.d.ts +2 -0
  158. package/dist/matter/clusters.d.ts.map +1 -0
  159. package/dist/matter/clusters.js +2 -0
  160. package/dist/matter/clusters.js.map +1 -0
  161. package/dist/matter/devices.d.ts +2 -0
  162. package/dist/matter/devices.d.ts.map +1 -0
  163. package/dist/matter/devices.js +2 -0
  164. package/dist/matter/devices.js.map +1 -0
  165. package/dist/matter/endpoints.d.ts +2 -0
  166. package/dist/matter/endpoints.d.ts.map +1 -0
  167. package/dist/matter/endpoints.js +2 -0
  168. package/dist/matter/endpoints.js.map +1 -0
  169. package/dist/matter/export.d.ts +5 -0
  170. package/dist/matter/export.d.ts.map +1 -0
  171. package/dist/matter/export.js +3 -0
  172. package/dist/matter/export.js.map +1 -0
  173. package/dist/matter/types.d.ts +3 -0
  174. package/dist/matter/types.d.ts.map +1 -0
  175. package/dist/matter/types.js +3 -0
  176. package/dist/matter/types.js.map +1 -0
  177. package/dist/matterbridge.d.ts +478 -0
  178. package/dist/matterbridge.d.ts.map +1 -0
  179. package/dist/matterbridge.js +828 -46
  180. package/dist/matterbridge.js.map +1 -0
  181. package/dist/matterbridgeAccessoryPlatform.d.ts +42 -0
  182. package/dist/matterbridgeAccessoryPlatform.d.ts.map +1 -0
  183. package/dist/matterbridgeAccessoryPlatform.js +37 -0
  184. package/dist/matterbridgeAccessoryPlatform.js.map +1 -0
  185. package/dist/matterbridgeBehaviors.d.ts +2404 -0
  186. package/dist/matterbridgeBehaviors.d.ts.map +1 -0
  187. package/dist/matterbridgeBehaviors.js +68 -5
  188. package/dist/matterbridgeBehaviors.js.map +1 -0
  189. package/dist/matterbridgeDeviceTypes.d.ts +770 -0
  190. package/dist/matterbridgeDeviceTypes.d.ts.map +1 -0
  191. package/dist/matterbridgeDeviceTypes.js +638 -17
  192. package/dist/matterbridgeDeviceTypes.js.map +1 -0
  193. package/dist/matterbridgeDynamicPlatform.d.ts +42 -0
  194. package/dist/matterbridgeDynamicPlatform.d.ts.map +1 -0
  195. package/dist/matterbridgeDynamicPlatform.js +37 -0
  196. package/dist/matterbridgeDynamicPlatform.js.map +1 -0
  197. package/dist/matterbridgeEndpoint.d.ts +1556 -0
  198. package/dist/matterbridgeEndpoint.d.ts.map +1 -0
  199. package/dist/matterbridgeEndpoint.js +1408 -52
  200. package/dist/matterbridgeEndpoint.js.map +1 -0
  201. package/dist/matterbridgeEndpointHelpers.d.ts +758 -0
  202. package/dist/matterbridgeEndpointHelpers.d.ts.map +1 -0
  203. package/dist/matterbridgeEndpointHelpers.js +464 -19
  204. package/dist/matterbridgeEndpointHelpers.js.map +1 -0
  205. package/dist/matterbridgePlatform.d.ts +402 -0
  206. package/dist/matterbridgePlatform.d.ts.map +1 -0
  207. package/dist/matterbridgePlatform.js +341 -1
  208. package/dist/matterbridgePlatform.js.map +1 -0
  209. package/dist/matterbridgeTypes.d.ts +239 -0
  210. package/dist/matterbridgeTypes.d.ts.map +1 -0
  211. package/dist/matterbridgeTypes.js +26 -0
  212. package/dist/matterbridgeTypes.js.map +1 -0
  213. package/dist/pluginManager.d.ts +371 -0
  214. package/dist/pluginManager.d.ts.map +1 -0
  215. package/dist/pluginManager.js +339 -4
  216. package/dist/pluginManager.js.map +1 -0
  217. package/dist/shelly.d.ts +174 -0
  218. package/dist/shelly.d.ts.map +1 -0
  219. package/dist/shelly.js +168 -7
  220. package/dist/shelly.js.map +1 -0
  221. package/dist/storage/export.d.ts +2 -0
  222. package/dist/storage/export.d.ts.map +1 -0
  223. package/dist/storage/export.js +1 -0
  224. package/dist/storage/export.js.map +1 -0
  225. package/dist/update.d.ts +75 -0
  226. package/dist/update.d.ts.map +1 -0
  227. package/dist/update.js +69 -0
  228. package/dist/update.js.map +1 -0
  229. package/dist/utils/colorUtils.d.ts +101 -0
  230. package/dist/utils/colorUtils.d.ts.map +1 -0
  231. package/dist/utils/colorUtils.js +97 -2
  232. package/dist/utils/colorUtils.js.map +1 -0
  233. package/dist/utils/commandLine.d.ts +66 -0
  234. package/dist/utils/commandLine.d.ts.map +1 -0
  235. package/dist/utils/commandLine.js +60 -0
  236. package/dist/utils/commandLine.js.map +1 -0
  237. package/dist/utils/copyDirectory.d.ts +33 -0
  238. package/dist/utils/copyDirectory.d.ts.map +1 -0
  239. package/dist/utils/copyDirectory.js +38 -1
  240. package/dist/utils/copyDirectory.js.map +1 -0
  241. package/dist/utils/createDirectory.d.ts +34 -0
  242. package/dist/utils/createDirectory.d.ts.map +1 -0
  243. package/dist/utils/createDirectory.js +33 -0
  244. package/dist/utils/createDirectory.js.map +1 -0
  245. package/dist/utils/createZip.d.ts +39 -0
  246. package/dist/utils/createZip.d.ts.map +1 -0
  247. package/dist/utils/createZip.js +47 -2
  248. package/dist/utils/createZip.js.map +1 -0
  249. package/dist/utils/deepCopy.d.ts +32 -0
  250. package/dist/utils/deepCopy.d.ts.map +1 -0
  251. package/dist/utils/deepCopy.js +39 -0
  252. package/dist/utils/deepCopy.js.map +1 -0
  253. package/dist/utils/deepEqual.d.ts +54 -0
  254. package/dist/utils/deepEqual.d.ts.map +1 -0
  255. package/dist/utils/deepEqual.js +72 -1
  256. package/dist/utils/deepEqual.js.map +1 -0
  257. package/dist/utils/error.d.ts +44 -0
  258. package/dist/utils/error.d.ts.map +1 -0
  259. package/dist/utils/error.js +41 -0
  260. package/dist/utils/error.js.map +1 -0
  261. package/dist/utils/export.d.ts +13 -0
  262. package/dist/utils/export.d.ts.map +1 -0
  263. package/dist/utils/export.js +1 -0
  264. package/dist/utils/export.js.map +1 -0
  265. package/dist/utils/format.d.ts +53 -0
  266. package/dist/utils/format.d.ts.map +1 -0
  267. package/dist/utils/format.js +49 -0
  268. package/dist/utils/format.js.map +1 -0
  269. package/dist/utils/hex.d.ts +89 -0
  270. package/dist/utils/hex.d.ts.map +1 -0
  271. package/dist/utils/hex.js +124 -0
  272. package/dist/utils/hex.js.map +1 -0
  273. package/dist/utils/inspector.d.ts +87 -0
  274. package/dist/utils/inspector.d.ts.map +1 -0
  275. package/dist/utils/inspector.js +69 -1
  276. package/dist/utils/inspector.js.map +1 -0
  277. package/dist/utils/isvalid.d.ts +103 -0
  278. package/dist/utils/isvalid.d.ts.map +1 -0
  279. package/dist/utils/isvalid.js +101 -0
  280. package/dist/utils/isvalid.js.map +1 -0
  281. package/dist/utils/jestHelpers.d.ts +139 -0
  282. package/dist/utils/jestHelpers.d.ts.map +1 -0
  283. package/dist/utils/jestHelpers.js +153 -3
  284. package/dist/utils/jestHelpers.js.map +1 -0
  285. package/dist/utils/network.d.ts +101 -0
  286. package/dist/utils/network.d.ts.map +1 -0
  287. package/dist/utils/network.js +96 -5
  288. package/dist/utils/network.js.map +1 -0
  289. package/dist/utils/spawn.d.ts +35 -0
  290. package/dist/utils/spawn.d.ts.map +1 -0
  291. package/dist/utils/spawn.js +71 -0
  292. package/dist/utils/spawn.js.map +1 -0
  293. package/dist/utils/tracker.d.ts +108 -0
  294. package/dist/utils/tracker.d.ts.map +1 -0
  295. package/dist/utils/tracker.js +64 -1
  296. package/dist/utils/tracker.js.map +1 -0
  297. package/dist/utils/wait.d.ts +54 -0
  298. package/dist/utils/wait.d.ts.map +1 -0
  299. package/dist/utils/wait.js +60 -8
  300. package/dist/utils/wait.js.map +1 -0
  301. package/npm-shrinkwrap.json +2 -2
  302. package/package.json +2 -1
@@ -1,7 +1,34 @@
1
+ /**
2
+ * This file contains the class MatterbridgePlatform.
3
+ *
4
+ * @file matterbridgePlatform.ts
5
+ * @author Luca Liguori
6
+ * @created 2024-03-21
7
+ * @version 1.3.0
8
+ * @license Apache-2.0
9
+ *
10
+ * Copyright 2024, 2025, 2026 Luca Liguori.
11
+ *
12
+ * Licensed under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License.
14
+ * You may obtain a copy of the License at
15
+ *
16
+ * http://www.apache.org/licenses/LICENSE-2.0
17
+ *
18
+ * Unless required by applicable law or agreed to in writing, software
19
+ * distributed under the License is distributed on an "AS IS" BASIS,
20
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ * See the License for the specific language governing permissions and
22
+ * limitations under the License.
23
+ */
24
+ // eslint-disable-next-line no-console
1
25
  if (process.argv.includes('--loader') || process.argv.includes('-loader'))
2
26
  console.log('\u001B[32mMatterbridgePlatform loaded.\u001B[40;0m');
27
+ // Node.js modules
3
28
  import path from 'node:path';
29
+ // Node AnsiLogger module
4
30
  import { CYAN, db, er, nf, wr } from 'node-ansi-logger';
31
+ // Node Storage module
5
32
  import { NodeStorageManager } from 'node-persist-manager';
6
33
  import { Descriptor } from '@matter/types/clusters/descriptor';
7
34
  import { BridgedDeviceBasicInformation } from '@matter/types/clusters/bridged-device-basic-information';
@@ -9,27 +36,54 @@ import { checkNotLatinCharacters } from './matterbridgeEndpointHelpers.js';
9
36
  import { bridgedNode } from './matterbridgeDeviceTypes.js';
10
37
  import { isValidArray, isValidObject, isValidString } from './utils/isvalid.js';
11
38
  import { addVirtualDevice } from './helpers.js';
39
+ /**
40
+ * Represents the base Matterbridge platform. It is extended by the MatterbridgeAccessoryPlatform and MatterbridgeServicePlatform classes.
41
+ *
42
+ */
12
43
  export class MatterbridgePlatform {
44
+ /** The Matterbridge instance of this Platform. */
13
45
  matterbridge;
46
+ /** The logger instance for this platform. */
14
47
  log;
48
+ /** The configuration for this platform. */
15
49
  config;
50
+ /** The name of the platform. Will be set by the loadPlugin() method using the package.json value. */
16
51
  name = '';
52
+ /** The type of the platform. Will be set by the extending classes. */
17
53
  type = 'AnyPlatform';
54
+ /** The version of the platform. Will be set by the loadPlugin() method using the package.json value */
18
55
  version = '1.0.0';
56
+ /** Platform node storage manager in the matterbridgeDirectory. */
19
57
  storage;
58
+ /** Platform context in the storage of matterbridgeDirectory. Use await platform.ready to access it early. */
20
59
  context;
60
+ // Device and entity select in the plugin config UI
21
61
  selectDevice = new Map();
22
62
  selectEntity = new Map();
63
+ // Promises for platform initialization. They are grouped in platform.ready with Promise.all.
23
64
  contextReady;
24
65
  selectDeviceContextReady;
25
66
  selectEntityContextReady;
67
+ /** The ready promise for the platform, which resolves when the platform is fully initialized (including context and selects). */
26
68
  ready;
69
+ /** Registered MatterbridgeEndpoint Map keyed by uniqueId */
27
70
  registeredEndpointsByUniqueId = new Map();
71
+ /** Registered MatterbridgeEndpoint Map keyed by deviceName */
28
72
  registeredEndpointsByName = new Map();
73
+ /**
74
+ * Creates an instance of the base MatterbridgePlatform.
75
+ * It is extended by the MatterbridgeAccessoryPlatform and MatterbridgeServicePlatform classes.
76
+ * Each plugin must extend the MatterbridgeAccessoryPlatform and MatterbridgeServicePlatform classes.
77
+ *
78
+ * @param {PlatformMatterbridge} matterbridge - The Matterbridge instance.
79
+ * @param {AnsiLogger} log - The logger instance.
80
+ * @param {PlatformConfig} config - The platform configuration.
81
+ */
29
82
  constructor(matterbridge, log, config) {
30
83
  this.matterbridge = matterbridge;
31
84
  this.log = log;
32
85
  this.config = config;
86
+ // create the NodeStorageManager for the plugin platform
33
87
  if (!isValidString(this.config.name, 1))
34
88
  throw new Error('Platform: the plugin name is missing or invalid.');
35
89
  this.log.debug(`Creating storage for plugin ${this.config.name} in ${path.join(this.matterbridge.matterbridgeDirectory, this.config.name)}`);
@@ -40,12 +94,14 @@ export class MatterbridgePlatform {
40
94
  logging: false,
41
95
  forgiveParseErrors: true,
42
96
  });
97
+ // create the context storage for the plugin platform
43
98
  this.log.debug(`Creating context for plugin ${this.config.name}`);
44
99
  this.contextReady = this.storage.createStorage('context').then((context) => {
45
100
  this.context = context;
46
101
  this.log.debug(`Created context for plugin ${this.config.name}`);
47
102
  return;
48
103
  });
104
+ // create the selectDevice storage for the plugin platform
49
105
  this.log.debug(`Loading selectDevice for plugin ${this.config.name}`);
50
106
  this.selectDeviceContextReady = this.storage.createStorage('selectDevice').then(async (context) => {
51
107
  const selectDevice = await context.get('selectDevice', []);
@@ -54,6 +110,7 @@ export class MatterbridgePlatform {
54
110
  this.log.debug(`Loaded ${this.selectDevice.size} selectDevice for plugin ${this.config.name}`);
55
111
  return;
56
112
  });
113
+ // create the selectEntity storage for the plugin platform
57
114
  this.log.debug(`Loading selectEntity for plugin ${this.config.name}`);
58
115
  this.selectEntityContextReady = this.storage.createStorage('selectEntity').then(async (context) => {
59
116
  const selectEntity = await context.get('selectEntity', []);
@@ -62,59 +119,165 @@ export class MatterbridgePlatform {
62
119
  this.log.debug(`Loaded ${this.selectEntity.size} selectEntity for plugin ${this.config.name}`);
63
120
  return;
64
121
  });
122
+ // Create the `ready` promise for the platform
65
123
  this.ready = Promise.all([this.contextReady, this.selectDeviceContextReady, this.selectEntityContextReady]).then(() => {
66
124
  this.log.debug(`MatterbridgePlatform for plugin ${this.config.name} is fully initialized`);
67
125
  return;
68
126
  });
69
127
  }
128
+ /**
129
+ * This method shall be overridden in the extended class.
130
+ * It is called when the platform is started.
131
+ * Use this method to create the MatterbridgeEndpoints and call this.registerDevice().
132
+ *
133
+ * @param {string} [reason] - The reason for starting.
134
+ * @throws {Error} - Throws an error if the method is not overridden.
135
+ */
70
136
  async onStart(reason) {
71
137
  this.log.error('Plugins must override onStart.', reason);
72
138
  throw new Error('Plugins must override onStart.');
73
139
  }
140
+ /**
141
+ * This method can be overridden in the extended class. In this case always call super.onConfigure() to save the select and run checkEndpointNumbers().
142
+ * It is called after the platform has started.
143
+ * Use this method to perform any configuration of your devices and to override the value of the attributes that are persistent and stored in the
144
+ * matter storage (i.e. the onOff attribute of the OnOff cluster).
145
+ */
74
146
  async onConfigure() {
75
147
  this.log.debug(`Configuring platform ${this.name}`);
148
+ // Save the selectDevice and selectEntity
76
149
  await this.saveSelects();
150
+ // Check and update the endpoint numbers
77
151
  await this.checkEndpointNumbers();
78
152
  }
153
+ /**
154
+ * This method can be overridden in the extended class. In this case always call super.onShutdown() to save the selects, run checkEndpointNumbers() and cleanup memory.
155
+ * It is called when the platform is shutting down.
156
+ * Use this method to clean up any resources you used in the constructor or onStart.
157
+ *
158
+ * @param {string} [reason] - The reason for shutting down.
159
+ */
79
160
  async onShutdown(reason) {
80
161
  this.log.debug(`Shutting down platform ${this.name}`, reason);
162
+ // Save the selectDevice and selectEntity
81
163
  await this.saveSelects();
164
+ // Check and update the endpoint numbers
82
165
  await this.checkEndpointNumbers();
166
+ // Cleanup memory
83
167
  this.selectDevice.clear();
84
168
  this.selectEntity.clear();
85
169
  this.registeredEndpointsByUniqueId.clear();
86
170
  this.registeredEndpointsByName.clear();
171
+ // Close the storage
87
172
  await this.context?.close();
88
173
  this.context = undefined;
89
174
  await this.storage?.close();
90
175
  }
176
+ /**
177
+ * Called when the logger level is changed.
178
+ *
179
+ * @param {LogLevel} logLevel The new logger level.
180
+ */
91
181
  async onChangeLoggerLevel(logLevel) {
92
182
  this.log.debug(`The plugin doesn't override onChangeLoggerLevel. Logger level set to: ${logLevel}`);
93
183
  }
184
+ /**
185
+ * Called when a plugin config includes an action button or an action button with text field.
186
+ *
187
+ * @param {string} action The action triggered by the button in plugin config.
188
+ * @param {string} value The value of the field of the action button.
189
+ * @param {string} id The id of the schema associated with the action.
190
+ * @param {PlatformConfig} formData The changed form data of the plugin.
191
+ *
192
+ * @remarks
193
+ * This method can be overridden in the extended class.
194
+ *
195
+ * Use this method to handle the action defined in the plugin schema:
196
+ * ```json
197
+ * "addDevice": {
198
+ * "description": "Manually add a device that has not been discovered with mdns:",
199
+ * "type": "boolean",
200
+ * "buttonText": "ADD", // The text on the button. This is used when the action doesn't include a text field.
201
+ * "buttonField": "ADD", // The text on the button. This is used when the action includes a text field.
202
+ * "buttonClose": false, // optional, default is false. When true, the dialog will close after the action is sent.
203
+ * "buttonSave": false, // optional, default is false. When true, the dialog will close and trigger the restart required after the action is sent.
204
+ * "textPlaceholder": "Enter the device IP address", // optional: the placeholder text for the text field.
205
+ * "default": false
206
+ * },
207
+ * ```
208
+ */
94
209
  async onAction(action, value, id, formData) {
95
210
  this.log.debug(`The plugin ${CYAN}${this.name}${db} doesn't override onAction. Received action ${CYAN}${action}${db}${value ? ' with ' + CYAN + value + db : ''} ${id ? ' for schema ' + CYAN + id + db : ''}`, formData);
96
211
  }
212
+ /**
213
+ * Called when the plugin config has been updated.
214
+ *
215
+ * @param {PlatformConfig} config The new plugin config.
216
+ */
97
217
  async onConfigChanged(config) {
98
218
  this.log.debug(`The plugin ${CYAN}${config.name}${db} doesn't override onConfigChanged. Received new config.`);
99
219
  }
220
+ /**
221
+ * Save the platform configuration to the platform config JSON.
222
+ *
223
+ * @param {PlatformConfig} [config] - The platform configuration to save.
224
+ * @returns {void}
225
+ */
100
226
  saveConfig(config) {
227
+ // TODO: replace with a message to the matterbridge thread
101
228
  const plugin = this.matterbridge.plugins.get(this.name);
102
229
  if (!plugin) {
103
230
  throw new Error(`Plugin ${this.name} not found`);
104
231
  }
105
- this.matterbridge.plugins.saveConfigFromJson(plugin, config);
232
+ this.matterbridge.plugins.saveConfigFromJson(plugin, config); // No await as it's not necessary to wait
106
233
  }
234
+ /**
235
+ * Sends a restart required message to the frontend.
236
+ *
237
+ * @param {boolean} [snackbar] - If true, shows a snackbar notification. Default is true.
238
+ * @param {boolean} [fixed] - If true, shows a fixed notification. Default is false.
239
+ * @returns {void}
240
+ */
107
241
  wssSendRestartRequired(snackbar = true, fixed = false) {
242
+ // TODO: replace with a message to the frontend thread
108
243
  this.matterbridge.frontend.wssSendRestartRequired(snackbar, fixed);
109
244
  }
245
+ /**
246
+ * Retrieves the devices registered with the platform.
247
+ *
248
+ * @returns {MatterbridgeEndpoint[]} The registered devices.
249
+ */
110
250
  getDevices() {
111
251
  return Array.from(this.registeredEndpointsByUniqueId.values());
112
252
  }
253
+ /**
254
+ * Checks if a device with this name is already registered in the platform.
255
+ *
256
+ * @param {string} deviceName - The device name to check.
257
+ * @returns {boolean} True if the device is already registered, false otherwise.
258
+ */
113
259
  hasDeviceName(deviceName) {
114
260
  return this.registeredEndpointsByName.has(deviceName);
115
261
  }
262
+ /**
263
+ * Registers a virtual device with the platform aggregator endpoint.
264
+ *
265
+ * The virtual device is created as an instance of `Endpoint` with the provided device type.
266
+ * When the virtual device is turned on, the provided callback function is executed.
267
+ * The onOff state of the virtual device always reverts to false when the device is turned on.
268
+ *
269
+ * @param { string } name - The name of the virtual device.
270
+ * @param { 'light' | 'outlet' | 'switch' | 'mounted_switch' } type - The type of the virtual device.
271
+ * @param { () => Promise<void> } callback - The callback to call when the virtual device is turned on.
272
+ *
273
+ * @returns {Promise<void>} A promise that resolves when the virtual device is registered.
274
+ *
275
+ * @remarks
276
+ * The virtual devices don't show up in the device list of the frontend.
277
+ */
116
278
  async registerVirtualDevice(name, type, callback) {
117
279
  let aggregator;
280
+ // TODO: replace with a message to the matterbridge thread
118
281
  if (this.matterbridge.bridgeMode === 'bridge') {
119
282
  aggregator = this.matterbridge.aggregatorNode;
120
283
  }
@@ -131,6 +294,25 @@ export class MatterbridgePlatform {
131
294
  }
132
295
  }
133
296
  }
297
+ /**
298
+ * Registers a device with the Matterbridge platform and performs validation checks.
299
+ *
300
+ * This method also checks if the implementation called createDefaultBasicInformationClusterServer() instead of createDefaultBridgedDeviceBasicInformationClusterServer().
301
+ *
302
+ * This is correct with Accessory platforms so we check if we are running in bridge mode and add the bridgedNode and the BridgedDeviceBasicInformation cluster.
303
+ *
304
+ * If we are in bridge mode, we add the bridgedNode device type and the BridgedDeviceBasicInformation cluster.
305
+ *
306
+ * If we are in childbridge mode and the plugin is a 'DynamicPlatform', we add the bridgedNode device type and the BridgedDeviceBasicInformation cluster.
307
+ *
308
+ * if we are in childbridge mode and the plugin is a 'AccessoryPlatform', the device is not bridged so no action is taken.
309
+ *
310
+ * If the device.mode = 'server', the device is not bridged so no action is taken.
311
+ *
312
+ * If the device.mode = 'matter', the device is not bridged so no action is taken.
313
+ *
314
+ * @param {MatterbridgeEndpoint} device - The device to register.
315
+ */
134
316
  async registerDevice(device) {
135
317
  device.plugin = this.name;
136
318
  if (!device.uniqueId) {
@@ -152,7 +334,9 @@ export class MatterbridgePlatform {
152
334
  if (checkNotLatinCharacters(device.deviceName)) {
153
335
  this.log.debug(`Device with name ${CYAN}${device.deviceName}${db} has non latin characters.`);
154
336
  }
337
+ // Validate bridgedNode and BridgedDeviceBasicInformation cluster
155
338
  if (device.mode === undefined && (this.matterbridge.bridgeMode === 'bridge' || (this.matterbridge.bridgeMode === 'childbridge' && this.type === 'DynamicPlatform'))) {
339
+ // If the device is a bridged device, we add the bridgedNode to the deviceTypes map and to the Descriptor Cluster options
156
340
  if (!device.deviceTypes.has(bridgedNode.code)) {
157
341
  this.log.debug(`Device with name ${CYAN}${device.deviceName}${db} has no bridgedNode device type. Adding it...`);
158
342
  device.deviceTypes.set(bridgedNode.code, bridgedNode);
@@ -164,27 +348,49 @@ export class MatterbridgePlatform {
164
348
  }
165
349
  }
166
350
  }
351
+ // If the device is a bridged device, we add the BridgedDeviceBasicInformation cluster
167
352
  if (!device.hasClusterServer(BridgedDeviceBasicInformation.Cluster.id)) {
168
353
  this.log.debug(`Device with name ${CYAN}${device.deviceName}${db} has no BridgedDeviceBasicInformation cluster. Adding it...`);
169
354
  device.createDefaultBridgedDeviceBasicInformationClusterServer(device.deviceName, device.serialNumber, device.vendorId, device.vendorName, device.productName, device.softwareVersion, device.softwareVersionString, device.hardwareVersion, device.hardwareVersionString);
170
355
  }
171
356
  }
357
+ // TODO: replace with a message to the matterbridge thread
172
358
  await this.matterbridge.addBridgedEndpoint(this.name, device);
173
359
  this.registeredEndpointsByUniqueId.set(device.uniqueId, device);
174
360
  this.registeredEndpointsByName.set(device.deviceName, device);
175
361
  }
362
+ /**
363
+ * Unregisters a device registered with the Matterbridge platform.
364
+ *
365
+ * @param {MatterbridgeEndpoint} device - The device to unregister.
366
+ */
176
367
  async unregisterDevice(device) {
368
+ // TODO: replace with a message to the matterbridge thread
177
369
  await this.matterbridge.removeBridgedEndpoint(this.name, device);
178
370
  if (device.uniqueId)
179
371
  this.registeredEndpointsByUniqueId.delete(device.uniqueId);
180
372
  if (device.deviceName)
181
373
  this.registeredEndpointsByName.delete(device.deviceName);
182
374
  }
375
+ /**
376
+ * Unregisters all devices registered with the Matterbridge platform.
377
+ *
378
+ * @param {number} [delay] - The delay in milliseconds between removing each bridged endpoint (default: 0).
379
+ */
183
380
  async unregisterAllDevices(delay = 0) {
381
+ // TODO: replace with a message to the matterbridge thread
184
382
  await this.matterbridge.removeAllBridgedEndpoints(this.name, delay);
185
383
  this.registeredEndpointsByUniqueId.clear();
186
384
  this.registeredEndpointsByName.clear();
187
385
  }
386
+ /**
387
+ * Saves the select devices and entities to storage.
388
+ *
389
+ * This method saves the current state of `selectDevice` and `selectEntity` maps to their respective storage.
390
+ * It logs the number of items being saved and ensures that the storage is properly closed after saving.
391
+ *
392
+ * @returns {Promise<void>} A promise that resolves when the save operation is complete.
393
+ */
188
394
  async saveSelects() {
189
395
  if (this.storage) {
190
396
  this.log.debug(`Saving ${this.selectDevice.size} selectDevice...`);
@@ -197,19 +403,60 @@ export class MatterbridgePlatform {
197
403
  await selectEntity.close();
198
404
  }
199
405
  }
406
+ /**
407
+ * Clears all the select device and entity maps.
408
+ *
409
+ * @returns {void}
410
+ */
200
411
  async clearSelect() {
201
412
  this.selectDevice.clear();
202
413
  this.selectEntity.clear();
203
414
  await this.saveSelects();
204
415
  }
416
+ /**
417
+ * Clears the select for a single device.
418
+ *
419
+ * @param {string} serial - The serial of the device to clear.
420
+ * @returns {void}
421
+ */
205
422
  async clearDeviceSelect(serial) {
206
423
  this.selectDevice.delete(serial);
207
424
  await this.saveSelects();
208
425
  }
426
+ /**
427
+ * Clears the select for a single entity.
428
+ *
429
+ * @param {string} name - The name of the entity to clear.
430
+ * @returns {void}
431
+ */
209
432
  async clearEntitySelect(name) {
210
433
  this.selectEntity.delete(name);
211
434
  await this.saveSelects();
212
435
  }
436
+ /**
437
+ * Set the select device in the platform map.
438
+ *
439
+ * @param {string} serial - The serial number of the device.
440
+ * @param {string} name - The name of the device.
441
+ * @param {string} [configUrl] - The configuration URL of the device.
442
+ * @param {string} [icon] - The icon of the device: 'wifi', 'ble', 'hub'
443
+ * @param {Array<{ name: string; description: string; icon?: string }>} [entities] - The entities associated with the device.
444
+ * @returns {void}
445
+ *
446
+ * @remarks
447
+ * In the schema use selectFrom: 'serial' or 'name'
448
+ * ```json
449
+ * "whiteList": {
450
+ * "description": "Only the devices in the list will be exposed.",
451
+ * "type": "array",
452
+ * "items": {
453
+ * "type": "string"
454
+ * },
455
+ * "uniqueItems": true,
456
+ * "selectFrom": "name"
457
+ * },
458
+ * ```
459
+ */
213
460
  setSelectDevice(serial, name, configUrl, icon, entities) {
214
461
  const device = this.selectDevice.get(serial);
215
462
  if (device) {
@@ -226,6 +473,35 @@ export class MatterbridgePlatform {
226
473
  this.selectDevice.set(serial, { serial, name, configUrl, icon, entities });
227
474
  }
228
475
  }
476
+ /**
477
+ * Set the select device entity in the platform map.
478
+ *
479
+ * @param {string} serial - The serial number of the device.
480
+ * @param {string} entityName - The name of the entity.
481
+ * @param {string} entityDescription - The description of the entity.
482
+ * @param {string} [entityIcon] - The icon of the entity: 'wifi', 'ble', 'hub', 'component', 'matter'
483
+ * @returns {void}
484
+ *
485
+ * @remarks
486
+ * In the schema use selectDeviceEntityFrom: 'name' or 'description'
487
+ * ```json
488
+ * "deviceEntityBlackList": {
489
+ * "description": "List of entities not to be exposed for a single device.",
490
+ * "type": "object",
491
+ * "uniqueItems": true,
492
+ * "selectFrom": "name",
493
+ * "additionalProperties": {
494
+ * "description": "List of entities not to be exposed for this device.",
495
+ * "type": "array",
496
+ * "items": {
497
+ * "type": "string"
498
+ * },
499
+ * "uniqueItems": true,
500
+ * "selectDeviceEntityFrom": "name"
501
+ * }
502
+ * },
503
+ * ```
504
+ */
229
505
  setSelectDeviceEntity(serial, entityName, entityDescription, entityIcon) {
230
506
  const device = this.selectDevice.get(serial);
231
507
  if (device) {
@@ -235,6 +511,11 @@ export class MatterbridgePlatform {
235
511
  device.entities.push({ name: entityName, description: entityDescription, icon: entityIcon });
236
512
  }
237
513
  }
514
+ /**
515
+ * Retrieves the select devices from the platform map.
516
+ *
517
+ * @returns {ApiSelectDevice[]} The selected devices array.
518
+ */
238
519
  getSelectDevices() {
239
520
  const selectDevices = [];
240
521
  for (const device of this.selectDevice.values()) {
@@ -242,9 +523,36 @@ export class MatterbridgePlatform {
242
523
  }
243
524
  return selectDevices;
244
525
  }
526
+ /**
527
+ * Set the select entity in the platform map.
528
+ *
529
+ * @param {string} name - The entity name.
530
+ * @param {string} description - The entity description.
531
+ * @param {string} [icon] - The entity icon: 'wifi', 'ble', 'hub', 'component', 'matter'
532
+ * @returns {void}
533
+ *
534
+ * @remarks
535
+ * In the schema use selectEntityFrom: 'name' or 'description'
536
+ * ```json
537
+ * "entityBlackList": {
538
+ * "description": "The entities in the list will not be exposed.",
539
+ * "type": "array",
540
+ * "items": {
541
+ * "type": "string"
542
+ * },
543
+ * "uniqueItems": true,
544
+ * "selectEntityFrom": "name"
545
+ * },
546
+ * ```
547
+ */
245
548
  setSelectEntity(name, description, icon) {
246
549
  this.selectEntity.set(name, { name, description, icon });
247
550
  }
551
+ /**
552
+ * Retrieve the select entities.
553
+ *
554
+ * @returns {ApiSelectEntity[]} The select entities array.
555
+ */
248
556
  getSelectEntities() {
249
557
  const selectEntities = [];
250
558
  for (const entity of this.selectEntity.values()) {
@@ -252,6 +560,12 @@ export class MatterbridgePlatform {
252
560
  }
253
561
  return selectEntities;
254
562
  }
563
+ /**
564
+ * Verifies if the Matterbridge version meets the required version.
565
+ *
566
+ * @param {string} requiredVersion - The required version to compare against.
567
+ * @returns {boolean} True if the Matterbridge version meets or exceeds the required version, false otherwise.
568
+ */
255
569
  verifyMatterbridgeVersion(requiredVersion) {
256
570
  const compareVersions = (matterbridgeVersion, requiredVersion) => {
257
571
  const stripTag = (v) => {
@@ -276,6 +590,14 @@ export class MatterbridgePlatform {
276
590
  return false;
277
591
  return true;
278
592
  }
593
+ /**
594
+ * Validates if a device is allowed based on the whitelist and blacklist configurations.
595
+ * The blacklist has priority over the whitelist.
596
+ *
597
+ * @param {string | string[]} device - The device name(s) to validate.
598
+ * @param {boolean} [log] - Whether to log the validation result.
599
+ * @returns {boolean} - Returns true if the device is allowed, false otherwise.
600
+ */
279
601
  validateDevice(device, log = true) {
280
602
  if (!Array.isArray(device))
281
603
  device = [device];
@@ -305,6 +627,14 @@ export class MatterbridgePlatform {
305
627
  this.log.info(`Skipping device ${CYAN}${device.join(', ')}${nf} because not in whitelist`);
306
628
  return false;
307
629
  }
630
+ /**
631
+ * Validates if an entity is allowed based on the entity blacklist and device-entity blacklist configurations.
632
+ *
633
+ * @param {string} device - The device to which the entity belongs.
634
+ * @param {string} entity - The entity to validate.
635
+ * @param {boolean} [log] - Whether to log the validation result.
636
+ * @returns {boolean} - Returns true if the entity is allowed, false otherwise.
637
+ */
308
638
  validateEntity(device, entity, log = true) {
309
639
  if (isValidArray(this.config.entityBlackList, 1) && this.config.entityBlackList.find((e) => e === entity)) {
310
640
  if (log)
@@ -323,6 +653,15 @@ export class MatterbridgePlatform {
323
653
  }
324
654
  return true;
325
655
  }
656
+ /**
657
+ * Checks and updates the endpoint numbers for Matterbridge devices.
658
+ *
659
+ * This method retrieves the list of Matterbridge devices and their child endpoints,
660
+ * compares their current endpoint numbers with the stored ones, and updates the storage
661
+ * if there are any changes. It logs the changes and updates the endpoint numbers accordingly.
662
+ *
663
+ * @returns {Promise<number>} The size of the updated endpoint map, or -1 if storage is not available.
664
+ */
326
665
  async checkEndpointNumbers() {
327
666
  if (!this.storage)
328
667
  return -1;
@@ -363,3 +702,4 @@ export class MatterbridgePlatform {
363
702
  return endpointMap.size;
364
703
  }
365
704
  }
705
+ //# sourceMappingURL=matterbridgePlatform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matterbridgePlatform.js","sourceRoot":"","sources":["../src/matterbridgePlatform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,sCAAsC;AACtC,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;IAAE,OAAO,CAAC,GAAG,CAAC,oDAAoD,CAAC,CAAC;AAE7I,kBAAkB;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