matterbridge 3.2.6-dev-20250906-4b022a0 → 3.2.6

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 (279) hide show
  1. package/CHANGELOG.md +3 -2
  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 +83 -0
  83. package/dist/devices/speaker.d.ts.map +1 -0
  84. package/dist/devices/speaker.js +80 -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 +313 -0
  123. package/dist/frontend.d.ts.map +1 -0
  124. package/dist/frontend.js +450 -24
  125. package/dist/frontend.js.map +1 -0
  126. package/dist/globalMatterbridge.d.ts +59 -0
  127. package/dist/globalMatterbridge.d.ts.map +1 -0
  128. package/dist/globalMatterbridge.js +47 -0
  129. package/dist/globalMatterbridge.js.map +1 -0
  130. package/dist/helpers.d.ts +48 -0
  131. package/dist/helpers.d.ts.map +1 -0
  132. package/dist/helpers.js +53 -0
  133. package/dist/helpers.js.map +1 -0
  134. package/dist/index.d.ts +33 -0
  135. package/dist/index.d.ts.map +1 -0
  136. package/dist/index.js +30 -1
  137. package/dist/index.js.map +1 -0
  138. package/dist/jest-utils/jestHelpers.d.ts +103 -0
  139. package/dist/jest-utils/jestHelpers.d.ts.map +1 -0
  140. package/dist/jest-utils/jestHelpers.js +124 -2
  141. package/dist/jest-utils/jestHelpers.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 +457 -0
  171. package/dist/matterbridge.d.ts.map +1 -0
  172. package/dist/matterbridge.js +821 -90
  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 +1351 -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 +1438 -0
  191. package/dist/matterbridgeEndpoint.d.ts.map +1 -0
  192. package/dist/matterbridgeEndpoint.js +1301 -54
  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 +379 -0
  199. package/dist/matterbridgePlatform.d.ts.map +1 -0
  200. package/dist/matterbridgePlatform.js +304 -0
  201. package/dist/matterbridgePlatform.js.map +1 -0
  202. package/dist/matterbridgeTypes.d.ts +198 -0
  203. package/dist/matterbridgeTypes.d.ts.map +1 -0
  204. package/dist/matterbridgeTypes.js +25 -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/network.d.ts +84 -0
  267. package/dist/utils/network.d.ts.map +1 -0
  268. package/dist/utils/network.js +91 -5
  269. package/dist/utils/network.js.map +1 -0
  270. package/dist/utils/spawn.d.ts +33 -0
  271. package/dist/utils/spawn.d.ts.map +1 -0
  272. package/dist/utils/spawn.js +40 -0
  273. package/dist/utils/spawn.js.map +1 -0
  274. package/dist/utils/wait.d.ts +54 -0
  275. package/dist/utils/wait.d.ts.map +1 -0
  276. package/dist/utils/wait.js +60 -8
  277. package/dist/utils/wait.js.map +1 -0
  278. package/npm-shrinkwrap.json +2 -2
  279. package/package.json +2 -1
@@ -1,32 +1,85 @@
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.2.1
8
+ * @license Apache-2.0
9
+ *
10
+ * Copyright 2024, 2025, 2026 Luca Liguori.
11
+ *
12
+ * Licensed under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License.
14
+ * You may obtain a copy of the License at
15
+ *
16
+ * http://www.apache.org/licenses/LICENSE-2.0
17
+ *
18
+ * Unless required by applicable law or agreed to in writing, software
19
+ * distributed under the License is distributed on an "AS IS" BASIS,
20
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ * See the License for the specific language governing permissions and
22
+ * limitations under the License.
23
+ */
24
+ // 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/export.js';
35
+ /**
36
+ * Represents the base Matterbridge platform. It is extended by the MatterbridgeAccessoryPlatform and MatterbridgeServicePlatform classes.
37
+ *
38
+ */
9
39
  export class MatterbridgePlatform {
40
+ /** The Matterbridge instance of this Platform. */
10
41
  matterbridge;
42
+ /** The logger instance for this platform. */
11
43
  log;
44
+ /** The configuration for this platform. */
12
45
  config = {};
46
+ /** The name of the platform. Will be set by the loadPlugin() method using the package.json value. */
13
47
  name = '';
48
+ /** The type of the platform. Will be set by the extending classes. */
14
49
  type = '';
50
+ /** The version of the platform. Will be set by the loadPlugin() method using the package.json value */
15
51
  version = '1.0.0';
52
+ /** Platform node storage manager. */
16
53
  storage;
54
+ /** Platform context storage. */
17
55
  context;
56
+ // Device and entity select in the plugin config UI
18
57
  selectDevice = new Map();
19
58
  selectEntity = new Map();
59
+ // Promises for storage
20
60
  _contextReady;
21
61
  _selectDeviceContextReady;
22
62
  _selectEntityContextReady;
63
+ /** The ready promise for the platform, which resolves when the platform is fully initialized. */
23
64
  ready;
65
+ /** Registered MatterbridgeEndpoint Map by uniqueId */
24
66
  _registeredEndpoints = new Map();
67
+ /** Registered MatterbridgeEndpoint Map by deviceName */
25
68
  _registeredEndpointsByName = new Map();
69
+ /**
70
+ * Creates an instance of the base MatterbridgePlatform.
71
+ * It is extended by the MatterbridgeAccessoryPlatform and MatterbridgeServicePlatform classes.
72
+ * Each plugin must extend the MatterbridgeAccessoryPlatform and MatterbridgeServicePlatform classes.
73
+ *
74
+ * @param {Matterbridge} matterbridge - The Matterbridge instance.
75
+ * @param {AnsiLogger} log - The logger instance.
76
+ * @param {PlatformConfig} config - The platform configuration.
77
+ */
26
78
  constructor(matterbridge, log, config) {
27
79
  this.matterbridge = matterbridge;
28
80
  this.log = log;
29
81
  this.config = config;
82
+ // create the NodeStorageManager for the plugin platform
30
83
  if (!isValidString(this.config.name, 1))
31
84
  throw new Error('Platform: the plugin name is missing or invalid.');
32
85
  this.log.debug(`Creating storage for plugin ${this.config.name} in ${path.join(this.matterbridge.matterbridgeDirectory, this.config.name)}`);
@@ -37,12 +90,14 @@ export class MatterbridgePlatform {
37
90
  logging: false,
38
91
  forgiveParseErrors: true,
39
92
  });
93
+ // create the context storage for the plugin platform
40
94
  this.log.debug(`Creating context for plugin ${this.config.name}`);
41
95
  this._contextReady = this.storage.createStorage('context').then((context) => {
42
96
  this.context = context;
43
97
  this.log.debug(`Created context for plugin ${this.config.name}`);
44
98
  return;
45
99
  });
100
+ // create the selectDevice storage for the plugin platform
46
101
  this.log.debug(`Loading selectDevice for plugin ${this.config.name}`);
47
102
  this._selectDeviceContextReady = this.storage.createStorage('selectDevice').then(async (context) => {
48
103
  const selectDevice = await context.get('selectDevice', []);
@@ -51,6 +106,7 @@ export class MatterbridgePlatform {
51
106
  this.log.debug(`Loaded ${this.selectDevice.size} selectDevice for plugin ${this.config.name}`);
52
107
  return;
53
108
  });
109
+ // create the selectEntity storage for the plugin platform
54
110
  this.log.debug(`Loading selectEntity for plugin ${this.config.name}`);
55
111
  this._selectEntityContextReady = this.storage.createStorage('selectEntity').then(async (context) => {
56
112
  const selectEntity = await context.get('selectEntity', []);
@@ -59,47 +115,140 @@ export class MatterbridgePlatform {
59
115
  this.log.debug(`Loaded ${this.selectEntity.size} selectEntity for plugin ${this.config.name}`);
60
116
  return;
61
117
  });
118
+ // Create the `ready` promise for the platform
62
119
  this.ready = Promise.all([this._contextReady, this._selectDeviceContextReady, this._selectEntityContextReady]).then(() => {
63
120
  this.log.debug(`MatterbridgePlatform for plugin ${this.config.name} is fully initialized`);
64
121
  return;
65
122
  });
66
123
  }
124
+ /**
125
+ * This method must be overridden in the extended class.
126
+ * It is called when the platform is started.
127
+ * Use this method to create the MatterbridgeEndpoints and call this.registerDevice().
128
+ *
129
+ * @param {string} [reason] - The reason for starting.
130
+ * @throws {Error} - Throws an error if the method is not overridden.
131
+ */
67
132
  async onStart(reason) {
68
133
  this.log.error('Plugins must override onStart.', reason);
69
134
  throw new Error('Plugins must override onStart.');
70
135
  }
136
+ /**
137
+ * This method can be overridden in the extended class. In this case always call super.onConfigure() to save the select and run checkEndpointNumbers().
138
+ * It is called after the platform has started.
139
+ * 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
140
+ * matter storage (i.e. the onOff attribute of the OnOff cluster).
141
+ */
71
142
  async onConfigure() {
72
143
  this.log.debug(`Configuring platform ${this.name}`);
144
+ // Save the selectDevice and selectEntity
73
145
  await this.saveSelects();
146
+ // Check and update the endpoint numbers
74
147
  await this.checkEndpointNumbers();
75
148
  }
149
+ /**
150
+ * 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.
151
+ * It is called when the platform is shutting down.
152
+ * Use this method to clean up any resources you used in the constructor or onStart.
153
+ *
154
+ * @param {string} [reason] - The reason for shutting down.
155
+ */
76
156
  async onShutdown(reason) {
77
157
  this.log.debug(`Shutting down platform ${this.name}`, reason);
158
+ // Save the selectDevice and selectEntity
78
159
  await this.saveSelects();
160
+ // Check and update the endpoint numbers
79
161
  await this.checkEndpointNumbers();
162
+ // Cleanup memory
80
163
  this.selectDevice.clear();
81
164
  this.selectEntity.clear();
82
165
  this._registeredEndpoints.clear();
83
166
  this._registeredEndpointsByName.clear();
167
+ // Close the storage
84
168
  await this.context?.close();
85
169
  this.context = undefined;
86
170
  await this.storage?.close();
87
171
  }
172
+ /**
173
+ * Called when the logger level is changed.
174
+ *
175
+ * @param {LogLevel} logLevel The new logger level.
176
+ */
88
177
  async onChangeLoggerLevel(logLevel) {
89
178
  this.log.debug(`The plugin doesn't override onChangeLoggerLevel. Logger level set to: ${logLevel}`);
90
179
  }
180
+ /**
181
+ * Called when a plugin config includes an action button or an action button with text field.
182
+ *
183
+ * @param {string} action The action triggered by the button in plugin config.
184
+ * @param {string} value The value of the field of the action button.
185
+ * @param {string} id The id of the schema associated with the action.
186
+ * @param {PlatformConfig} formData The changed form data of the plugin.
187
+ *
188
+ * @remarks
189
+ * This method can be overridden in the extended class.
190
+ *
191
+ * Use this method to handle the action defined in the plugin schema:
192
+ * ```json
193
+ * "addDevice": {
194
+ * "description": "Manually add a device that has not been discovered with mdns:",
195
+ * "type": "boolean",
196
+ * "buttonText": "ADD", // The text on the button. This is used when the action doesn't include a text field.
197
+ * "buttonField": "ADD", // The text on the button. This is used when the action includes a text field.
198
+ * "buttonClose": false, // optional, default is false. When true, the dialog will close after the action is sent.
199
+ * "buttonSave": false, // optional, default is false. When true, the dialog will close and trigger the restart required after the action is sent.
200
+ * "textPlaceholder": "Enter the device IP address", // optional: the placeholder text for the text field.
201
+ * "default": false
202
+ * },
203
+ * ```
204
+ */
91
205
  async onAction(action, value, id, formData) {
92
206
  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);
93
207
  }
208
+ /**
209
+ * Called when the plugin config has been updated.
210
+ *
211
+ * @param {PlatformConfig} config The new plugin config.
212
+ */
94
213
  async onConfigChanged(config) {
95
214
  this.log.debug(`The plugin ${CYAN}${config.name}${db} doesn't override onConfigChanged. Received new config.`);
96
215
  }
216
+ /**
217
+ * Retrieves the devices registered with the platform.
218
+ *
219
+ * @returns {MatterbridgeEndpoint[]} The registered devices.
220
+ */
97
221
  getDevices() {
98
222
  return Array.from(this._registeredEndpoints.values());
99
223
  }
224
+ /**
225
+ * Checks if a device with this name is already registered in the platform.
226
+ *
227
+ * @param {string} deviceName - The device name to check.
228
+ * @returns {boolean} True if the device is already registered, false otherwise.
229
+ */
100
230
  hasDeviceName(deviceName) {
101
231
  return this._registeredEndpointsByName.has(deviceName);
102
232
  }
233
+ /**
234
+ * Registers a device with the Matterbridge platform and performs validation checks.
235
+ *
236
+ * This method also checks if the implementation called createDefaultBasicInformationClusterServer() instead of createDefaultBridgedDeviceBasicInformationClusterServer().
237
+ *
238
+ * This is correct with Accessory platforms so we check if we are running in bridge mode and add the bridgedNode and the BridgedDeviceBasicInformation cluster.
239
+ *
240
+ * If we are in bridge mode, we add the bridgedNode and the BridgedDeviceBasicInformation cluster.
241
+ *
242
+ * If we are in childbridge mode and the plugin is a 'DynamicPlatform', we add the bridgedNode and the BridgedDeviceBasicInformation cluster.
243
+ *
244
+ * if we are in childbridge mode and the plugin is a 'AccessoryPlatform', the device is not bridged.
245
+ *
246
+ * If the device.mode = 'server', the device is not bridged.
247
+ *
248
+ * If the device.mode = 'matter', the device is not bridged.
249
+ *
250
+ * @param {MatterbridgeEndpoint} device - The device to register.
251
+ */
103
252
  async registerDevice(device) {
104
253
  device.plugin = this.name;
105
254
  if (!device.uniqueId) {
@@ -121,7 +270,9 @@ export class MatterbridgePlatform {
121
270
  if (checkNotLatinCharacters(device.deviceName)) {
122
271
  this.log.debug(`Device with name ${CYAN}${device.deviceName}${db} has non latin characters.`);
123
272
  }
273
+ // Validate bridgedNode and BridgedDeviceBasicInformation cluster
124
274
  if (device.mode === undefined && (this.matterbridge.bridgeMode === 'bridge' || (this.matterbridge.bridgeMode === 'childbridge' && this.type === 'DynamicPlatform'))) {
275
+ // If the device is a bridged device, we add the bridgedNode to the deviceTypes map and to the Descriptor Cluster options
125
276
  if (!device.deviceTypes.has(bridgedNode.code)) {
126
277
  this.log.debug(`Device with name ${CYAN}${device.deviceName}${db} has no bridgedNode device type. Adding it...`);
127
278
  device.deviceTypes.set(bridgedNode.code, bridgedNode);
@@ -133,6 +284,7 @@ export class MatterbridgePlatform {
133
284
  }
134
285
  }
135
286
  }
287
+ // If the device is a bridged device, we add the BridgedDeviceBasicInformation cluster
136
288
  if (!device.hasClusterServer(BridgedDeviceBasicInformation.Cluster.id)) {
137
289
  this.log.debug(`Device with name ${CYAN}${device.deviceName}${db} has no BridgedDeviceBasicInformation cluster. Adding it...`);
138
290
  device.createDefaultBridgedDeviceBasicInformationClusterServer(device.deviceName, device.serialNumber, device.vendorId, device.vendorName, device.productName, device.softwareVersion, device.softwareVersionString, device.hardwareVersion, device.hardwareVersionString);
@@ -142,6 +294,11 @@ export class MatterbridgePlatform {
142
294
  this._registeredEndpoints.set(device.uniqueId, device);
143
295
  this._registeredEndpointsByName.set(device.deviceName, device);
144
296
  }
297
+ /**
298
+ * Unregisters a device registered with the Matterbridge platform.
299
+ *
300
+ * @param {MatterbridgeEndpoint} device - The device to unregister.
301
+ */
145
302
  async unregisterDevice(device) {
146
303
  await this.matterbridge.removeBridgedEndpoint(this.name, device);
147
304
  if (device.uniqueId)
@@ -149,11 +306,24 @@ export class MatterbridgePlatform {
149
306
  if (device.deviceName)
150
307
  this._registeredEndpointsByName.delete(device.deviceName);
151
308
  }
309
+ /**
310
+ * Unregisters all devices registered with the Matterbridge platform.
311
+ *
312
+ * @param {number} [delay] - The delay in milliseconds between removing each bridged endpoint (default: 0).
313
+ */
152
314
  async unregisterAllDevices(delay = 0) {
153
315
  await this.matterbridge.removeAllBridgedEndpoints(this.name, delay);
154
316
  this._registeredEndpoints.clear();
155
317
  this._registeredEndpointsByName.clear();
156
318
  }
319
+ /**
320
+ * Saves the select devices and entities to storage.
321
+ *
322
+ * This method saves the current state of `selectDevice` and `selectEntity` maps to their respective storage.
323
+ * It logs the number of items being saved and ensures that the storage is properly closed after saving.
324
+ *
325
+ * @returns {Promise<void>} A promise that resolves when the save operation is complete.
326
+ */
157
327
  async saveSelects() {
158
328
  if (this.storage) {
159
329
  this.log.debug(`Saving ${this.selectDevice.size} selectDevice...`);
@@ -166,19 +336,60 @@ export class MatterbridgePlatform {
166
336
  await selectEntity.close();
167
337
  }
168
338
  }
339
+ /**
340
+ * Clears all the select device and entity maps.
341
+ *
342
+ * @returns {void}
343
+ */
169
344
  async clearSelect() {
170
345
  this.selectDevice.clear();
171
346
  this.selectEntity.clear();
172
347
  await this.saveSelects();
173
348
  }
349
+ /**
350
+ * Clears the select for a single device.
351
+ *
352
+ * @param {string} serial - The serial of the device to clear.
353
+ * @returns {void}
354
+ */
174
355
  async clearDeviceSelect(serial) {
175
356
  this.selectDevice.delete(serial);
176
357
  await this.saveSelects();
177
358
  }
359
+ /**
360
+ * Clears the select for a single entity.
361
+ *
362
+ * @param {string} name - The name of the entity to clear.
363
+ * @returns {void}
364
+ */
178
365
  async clearEntitySelect(name) {
179
366
  this.selectEntity.delete(name);
180
367
  await this.saveSelects();
181
368
  }
369
+ /**
370
+ * Set the select device in the platform map.
371
+ *
372
+ * @param {string} serial - The serial number of the device.
373
+ * @param {string} name - The name of the device.
374
+ * @param {string} [configUrl] - The configuration URL of the device.
375
+ * @param {string} [icon] - The icon of the device: 'wifi', 'ble', 'hub'
376
+ * @param {Array<{ name: string; description: string; icon?: string }>} [entities] - The entities associated with the device.
377
+ * @returns {void}
378
+ *
379
+ * @remarks
380
+ * In the schema use selectFrom: 'serial' or 'name'
381
+ * ```json
382
+ * "whiteList": {
383
+ * "description": "Only the devices in the list will be exposed.",
384
+ * "type": "array",
385
+ * "items": {
386
+ * "type": "string"
387
+ * },
388
+ * "uniqueItems": true,
389
+ * "selectFrom": "name"
390
+ * },
391
+ * ```
392
+ */
182
393
  setSelectDevice(serial, name, configUrl, icon, entities) {
183
394
  const device = this.selectDevice.get(serial);
184
395
  if (device) {
@@ -195,6 +406,35 @@ export class MatterbridgePlatform {
195
406
  this.selectDevice.set(serial, { serial, name, configUrl, icon, entities });
196
407
  }
197
408
  }
409
+ /**
410
+ * Set the select device entity in the platform map.
411
+ *
412
+ * @param {string} serial - The serial number of the device.
413
+ * @param {string} entityName - The name of the entity.
414
+ * @param {string} entityDescription - The description of the entity.
415
+ * @param {string} [entityIcon] - The icon of the entity: 'wifi', 'ble', 'hub', 'component', 'matter'
416
+ * @returns {void}
417
+ *
418
+ * @remarks
419
+ * In the schema use selectDeviceEntityFrom: 'name' or 'description'
420
+ * ```json
421
+ * "deviceEntityBlackList": {
422
+ * "description": "List of entities not to be exposed for a single device.",
423
+ * "type": "object",
424
+ * "uniqueItems": true,
425
+ * "selectFrom": "name",
426
+ * "additionalProperties": {
427
+ * "description": "List of entities not to be exposed for this device.",
428
+ * "type": "array",
429
+ * "items": {
430
+ * "type": "string"
431
+ * },
432
+ * "uniqueItems": true,
433
+ * "selectDeviceEntityFrom": "name"
434
+ * }
435
+ * },
436
+ * ```
437
+ */
198
438
  setSelectDeviceEntity(serial, entityName, entityDescription, entityIcon) {
199
439
  const device = this.selectDevice.get(serial);
200
440
  if (device) {
@@ -204,6 +444,11 @@ export class MatterbridgePlatform {
204
444
  device.entities.push({ name: entityName, description: entityDescription, icon: entityIcon });
205
445
  }
206
446
  }
447
+ /**
448
+ * Retrieves the select devices from the platform map.
449
+ *
450
+ * @returns {{ pluginName: string; serial: string; name: string; configUrl?: string; icon?: string; entities?: { name: string; description: string; icon?: string }[] }[]} The selected devices array.
451
+ */
207
452
  getSelectDevices() {
208
453
  const selectDevices = [];
209
454
  for (const device of this.selectDevice.values()) {
@@ -211,9 +456,36 @@ export class MatterbridgePlatform {
211
456
  }
212
457
  return selectDevices;
213
458
  }
459
+ /**
460
+ * Set the select entity in the platform map.
461
+ *
462
+ * @param {string} name - The entity name.
463
+ * @param {string} description - The entity description.
464
+ * @param {string} [icon] - The entity icon: 'wifi', 'ble', 'hub', 'component', 'matter'
465
+ * @returns {void}
466
+ *
467
+ * @remarks
468
+ * In the schema use selectEntityFrom: 'name' or 'description'
469
+ * ```json
470
+ * "entityBlackList": {
471
+ * "description": "The entities in the list that belongs to a device will not be exposed.",
472
+ * "type": "array",
473
+ * "items": {
474
+ * "type": "string"
475
+ * },
476
+ * "uniqueItems": true,
477
+ * "selectEntityFrom": "name"
478
+ * },
479
+ * ```
480
+ */
214
481
  setSelectEntity(name, description, icon) {
215
482
  this.selectEntity.set(name, { name, description, icon });
216
483
  }
484
+ /**
485
+ * Retrieve the select entities.
486
+ *
487
+ * @returns {{ pluginName: string; name: string; description: string; icon?: string }[]} The select entities array.
488
+ */
217
489
  getSelectEntities() {
218
490
  const selectEntities = [];
219
491
  for (const entity of this.selectEntity.values()) {
@@ -221,6 +493,12 @@ export class MatterbridgePlatform {
221
493
  }
222
494
  return selectEntities;
223
495
  }
496
+ /**
497
+ * Verifies if the Matterbridge version meets the required version.
498
+ *
499
+ * @param {string} requiredVersion - The required version to compare against.
500
+ * @returns {boolean} True if the Matterbridge version meets or exceeds the required version, false otherwise.
501
+ */
224
502
  verifyMatterbridgeVersion(requiredVersion) {
225
503
  const compareVersions = (matterbridgeVersion, requiredVersion) => {
226
504
  const stripTag = (v) => {
@@ -245,6 +523,14 @@ export class MatterbridgePlatform {
245
523
  return false;
246
524
  return true;
247
525
  }
526
+ /**
527
+ * Validates if a device is allowed based on the whitelist and blacklist configurations.
528
+ * The blacklist has priority over the whitelist.
529
+ *
530
+ * @param {string | string[]} device - The device name(s) to validate.
531
+ * @param {boolean} [log] - Whether to log the validation result.
532
+ * @returns {boolean} - Returns true if the device is allowed, false otherwise.
533
+ */
248
534
  validateDevice(device, log = true) {
249
535
  if (!Array.isArray(device))
250
536
  device = [device];
@@ -274,6 +560,14 @@ export class MatterbridgePlatform {
274
560
  this.log.info(`Skipping device ${CYAN}${device.join(', ')}${nf} because not in whitelist`);
275
561
  return false;
276
562
  }
563
+ /**
564
+ * Validates if an entity is allowed based on the entity blacklist and device-entity blacklist configurations.
565
+ *
566
+ * @param {string} device - The device to which the entity belongs.
567
+ * @param {string} entity - The entity to validate.
568
+ * @param {boolean} [log] - Whether to log the validation result.
569
+ * @returns {boolean} - Returns true if the entity is allowed, false otherwise.
570
+ */
277
571
  validateEntity(device, entity, log = true) {
278
572
  if (isValidArray(this.config.entityBlackList, 1) && this.config.entityBlackList.find((e) => e === entity)) {
279
573
  if (log)
@@ -292,6 +586,15 @@ export class MatterbridgePlatform {
292
586
  }
293
587
  return true;
294
588
  }
589
+ /**
590
+ * Checks and updates the endpoint numbers for Matterbridge devices.
591
+ *
592
+ * This method retrieves the list of Matterbridge devices and their child endpoints,
593
+ * compares their current endpoint numbers with the stored ones, and updates the storage
594
+ * if there are any changes. It logs the changes and updates the endpoint numbers accordingly.
595
+ *
596
+ * @returns {Promise<number>} The size of the updated endpoint map, or -1 if storage is not available.
597
+ */
295
598
  async checkEndpointNumbers() {
296
599
  if (!this.storage)
297
600
  return -1;
@@ -332,3 +635,4 @@ export class MatterbridgePlatform {
332
635
  return endpointMap.size;
333
636
  }
334
637
  }
638
+ //# sourceMappingURL=matterbridgePlatform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matterbridgePlatform.js","sourceRoot":"","sources":["../src/matterbridgePlatform.ts"],"names":[],"mappings":"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