matterbridge 3.3.0-dev-20251002-bbaa166 → 3.3.0

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