matterbridge 3.3.8-dev-20251115-ca5ff21 → 3.3.8

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 (310) 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 +43 -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 +92 -11
  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 +111 -20
  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 +454 -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 +34 -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/jestutils/export.d.ts +2 -0
  150. package/dist/jestutils/export.d.ts.map +1 -0
  151. package/dist/jestutils/export.js +1 -0
  152. package/dist/jestutils/export.js.map +1 -0
  153. package/dist/jestutils/jestHelpers.d.ts +250 -0
  154. package/dist/jestutils/jestHelpers.d.ts.map +1 -0
  155. package/dist/jestutils/jestHelpers.js +275 -4
  156. package/dist/jestutils/jestHelpers.js.map +1 -0
  157. package/dist/logger/export.d.ts +2 -0
  158. package/dist/logger/export.d.ts.map +1 -0
  159. package/dist/logger/export.js +1 -0
  160. package/dist/logger/export.js.map +1 -0
  161. package/dist/matter/behaviors.d.ts +2 -0
  162. package/dist/matter/behaviors.d.ts.map +1 -0
  163. package/dist/matter/behaviors.js +2 -0
  164. package/dist/matter/behaviors.js.map +1 -0
  165. package/dist/matter/clusters.d.ts +2 -0
  166. package/dist/matter/clusters.d.ts.map +1 -0
  167. package/dist/matter/clusters.js +2 -0
  168. package/dist/matter/clusters.js.map +1 -0
  169. package/dist/matter/devices.d.ts +2 -0
  170. package/dist/matter/devices.d.ts.map +1 -0
  171. package/dist/matter/devices.js +2 -0
  172. package/dist/matter/devices.js.map +1 -0
  173. package/dist/matter/endpoints.d.ts +2 -0
  174. package/dist/matter/endpoints.d.ts.map +1 -0
  175. package/dist/matter/endpoints.js +2 -0
  176. package/dist/matter/endpoints.js.map +1 -0
  177. package/dist/matter/export.d.ts +5 -0
  178. package/dist/matter/export.d.ts.map +1 -0
  179. package/dist/matter/export.js +3 -0
  180. package/dist/matter/export.js.map +1 -0
  181. package/dist/matter/types.d.ts +3 -0
  182. package/dist/matter/types.d.ts.map +1 -0
  183. package/dist/matter/types.js +3 -0
  184. package/dist/matter/types.js.map +1 -0
  185. package/dist/matterbridge.d.ts +469 -0
  186. package/dist/matterbridge.d.ts.map +1 -0
  187. package/dist/matterbridge.js +788 -46
  188. package/dist/matterbridge.js.map +1 -0
  189. package/dist/matterbridgeAccessoryPlatform.d.ts +41 -0
  190. package/dist/matterbridgeAccessoryPlatform.d.ts.map +1 -0
  191. package/dist/matterbridgeAccessoryPlatform.js +38 -0
  192. package/dist/matterbridgeAccessoryPlatform.js.map +1 -0
  193. package/dist/matterbridgeBehaviors.d.ts +2404 -0
  194. package/dist/matterbridgeBehaviors.d.ts.map +1 -0
  195. package/dist/matterbridgeBehaviors.js +77 -14
  196. package/dist/matterbridgeBehaviors.js.map +1 -0
  197. package/dist/matterbridgeDeviceTypes.d.ts +698 -0
  198. package/dist/matterbridgeDeviceTypes.d.ts.map +1 -0
  199. package/dist/matterbridgeDeviceTypes.js +635 -14
  200. package/dist/matterbridgeDeviceTypes.js.map +1 -0
  201. package/dist/matterbridgeDynamicPlatform.d.ts +41 -0
  202. package/dist/matterbridgeDynamicPlatform.d.ts.map +1 -0
  203. package/dist/matterbridgeDynamicPlatform.js +38 -0
  204. package/dist/matterbridgeDynamicPlatform.js.map +1 -0
  205. package/dist/matterbridgeEndpoint.d.ts +1490 -0
  206. package/dist/matterbridgeEndpoint.d.ts.map +1 -0
  207. package/dist/matterbridgeEndpoint.js +1432 -53
  208. package/dist/matterbridgeEndpoint.js.map +1 -0
  209. package/dist/matterbridgeEndpointHelpers.d.ts +787 -0
  210. package/dist/matterbridgeEndpointHelpers.d.ts.map +1 -0
  211. package/dist/matterbridgeEndpointHelpers.js +488 -25
  212. package/dist/matterbridgeEndpointHelpers.js.map +1 -0
  213. package/dist/matterbridgeEndpointTypes.d.ts +197 -0
  214. package/dist/matterbridgeEndpointTypes.d.ts.map +1 -0
  215. package/dist/matterbridgeEndpointTypes.js +25 -0
  216. package/dist/matterbridgeEndpointTypes.js.map +1 -0
  217. package/dist/matterbridgePlatform.d.ts +415 -0
  218. package/dist/matterbridgePlatform.d.ts.map +1 -0
  219. package/dist/matterbridgePlatform.js +354 -1
  220. package/dist/matterbridgePlatform.js.map +1 -0
  221. package/dist/matterbridgeTypes.d.ts +239 -0
  222. package/dist/matterbridgeTypes.d.ts.map +1 -0
  223. package/dist/matterbridgeTypes.js +26 -0
  224. package/dist/matterbridgeTypes.js.map +1 -0
  225. package/dist/pluginManager.d.ts +371 -0
  226. package/dist/pluginManager.d.ts.map +1 -0
  227. package/dist/pluginManager.js +339 -4
  228. package/dist/pluginManager.js.map +1 -0
  229. package/dist/shelly.d.ts +174 -0
  230. package/dist/shelly.d.ts.map +1 -0
  231. package/dist/shelly.js +168 -7
  232. package/dist/shelly.js.map +1 -0
  233. package/dist/storage/export.d.ts +2 -0
  234. package/dist/storage/export.d.ts.map +1 -0
  235. package/dist/storage/export.js +1 -0
  236. package/dist/storage/export.js.map +1 -0
  237. package/dist/update.d.ts +75 -0
  238. package/dist/update.d.ts.map +1 -0
  239. package/dist/update.js +69 -0
  240. package/dist/update.js.map +1 -0
  241. package/dist/utils/colorUtils.d.ts +101 -0
  242. package/dist/utils/colorUtils.d.ts.map +1 -0
  243. package/dist/utils/colorUtils.js +97 -2
  244. package/dist/utils/colorUtils.js.map +1 -0
  245. package/dist/utils/commandLine.d.ts +66 -0
  246. package/dist/utils/commandLine.d.ts.map +1 -0
  247. package/dist/utils/commandLine.js +60 -0
  248. package/dist/utils/commandLine.js.map +1 -0
  249. package/dist/utils/copyDirectory.d.ts +33 -0
  250. package/dist/utils/copyDirectory.d.ts.map +1 -0
  251. package/dist/utils/copyDirectory.js +38 -1
  252. package/dist/utils/copyDirectory.js.map +1 -0
  253. package/dist/utils/createDirectory.d.ts +34 -0
  254. package/dist/utils/createDirectory.d.ts.map +1 -0
  255. package/dist/utils/createDirectory.js +33 -0
  256. package/dist/utils/createDirectory.js.map +1 -0
  257. package/dist/utils/createZip.d.ts +39 -0
  258. package/dist/utils/createZip.d.ts.map +1 -0
  259. package/dist/utils/createZip.js +47 -2
  260. package/dist/utils/createZip.js.map +1 -0
  261. package/dist/utils/deepCopy.d.ts +32 -0
  262. package/dist/utils/deepCopy.d.ts.map +1 -0
  263. package/dist/utils/deepCopy.js +39 -0
  264. package/dist/utils/deepCopy.js.map +1 -0
  265. package/dist/utils/deepEqual.d.ts +54 -0
  266. package/dist/utils/deepEqual.d.ts.map +1 -0
  267. package/dist/utils/deepEqual.js +72 -1
  268. package/dist/utils/deepEqual.js.map +1 -0
  269. package/dist/utils/error.d.ts +44 -0
  270. package/dist/utils/error.d.ts.map +1 -0
  271. package/dist/utils/error.js +41 -0
  272. package/dist/utils/error.js.map +1 -0
  273. package/dist/utils/export.d.ts +13 -0
  274. package/dist/utils/export.d.ts.map +1 -0
  275. package/dist/utils/export.js +1 -0
  276. package/dist/utils/export.js.map +1 -0
  277. package/dist/utils/format.d.ts +53 -0
  278. package/dist/utils/format.d.ts.map +1 -0
  279. package/dist/utils/format.js +49 -0
  280. package/dist/utils/format.js.map +1 -0
  281. package/dist/utils/hex.d.ts +89 -0
  282. package/dist/utils/hex.d.ts.map +1 -0
  283. package/dist/utils/hex.js +124 -0
  284. package/dist/utils/hex.js.map +1 -0
  285. package/dist/utils/inspector.d.ts +87 -0
  286. package/dist/utils/inspector.d.ts.map +1 -0
  287. package/dist/utils/inspector.js +69 -1
  288. package/dist/utils/inspector.js.map +1 -0
  289. package/dist/utils/isvalid.d.ts +103 -0
  290. package/dist/utils/isvalid.d.ts.map +1 -0
  291. package/dist/utils/isvalid.js +101 -0
  292. package/dist/utils/isvalid.js.map +1 -0
  293. package/dist/utils/network.d.ts +101 -0
  294. package/dist/utils/network.d.ts.map +1 -0
  295. package/dist/utils/network.js +96 -5
  296. package/dist/utils/network.js.map +1 -0
  297. package/dist/utils/spawn.d.ts +35 -0
  298. package/dist/utils/spawn.d.ts.map +1 -0
  299. package/dist/utils/spawn.js +71 -0
  300. package/dist/utils/spawn.js.map +1 -0
  301. package/dist/utils/tracker.d.ts +108 -0
  302. package/dist/utils/tracker.d.ts.map +1 -0
  303. package/dist/utils/tracker.js +64 -1
  304. package/dist/utils/tracker.js.map +1 -0
  305. package/dist/utils/wait.d.ts +54 -0
  306. package/dist/utils/wait.d.ts.map +1 -0
  307. package/dist/utils/wait.js +60 -8
  308. package/dist/utils/wait.js.map +1 -0
  309. package/npm-shrinkwrap.json +2 -2
  310. package/package.json +2 -1
@@ -0,0 +1,128 @@
1
+ /**
2
+ * This file contains the DeviceManager class.
3
+ *
4
+ * @file devices.ts
5
+ * @author Luca Liguori
6
+ * @created 2024-07-26
7
+ * @version 1.1.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
+ import { LogLevel } from 'node-ansi-logger';
25
+ import type { MatterbridgeEndpoint } from './matterbridgeEndpoint.js';
26
+ import { type BaseDevice } from './matterbridgeTypes.js';
27
+ /**
28
+ * Manages Matterbridge devices.
29
+ */
30
+ export declare class DeviceManager {
31
+ private readonly _devices;
32
+ private readonly log;
33
+ private readonly server;
34
+ private readonly debug;
35
+ private readonly verbose;
36
+ /**
37
+ * Creates an instance of DeviceManager.
38
+ */
39
+ constructor();
40
+ destroy(): void;
41
+ private msgHandler;
42
+ /**
43
+ * Gets the number of devices.
44
+ *
45
+ * @returns {number} The number of devices.
46
+ */
47
+ get length(): number;
48
+ /**
49
+ * Gets the number of devices.
50
+ *
51
+ * @returns {number} The number of devices.
52
+ */
53
+ get size(): number;
54
+ /**
55
+ * Checks if a device with the specified unique ID exists.
56
+ *
57
+ * @param {string} uniqueId - The unique ID of the device.
58
+ * @returns {boolean} True if the device exists, false otherwise.
59
+ */
60
+ has(uniqueId: string): boolean;
61
+ /**
62
+ * Gets a device by its unique ID.
63
+ *
64
+ * @param {string} uniqueId - The unique ID of the device.
65
+ * @returns {MatterbridgeEndpoint | undefined} The device, or undefined if not found.
66
+ */
67
+ get(uniqueId: string): MatterbridgeEndpoint | undefined;
68
+ /**
69
+ * Adds a device to the manager.
70
+ *
71
+ * @param {MatterbridgeEndpoint} device - The device to add.
72
+ * @returns {MatterbridgeEndpoint} The added device.
73
+ * @throws {Error} If the device does not have a unique ID.
74
+ */
75
+ set(device: MatterbridgeEndpoint): MatterbridgeEndpoint;
76
+ /**
77
+ * Removes a device from the manager.
78
+ *
79
+ * @param {MatterbridgeEndpoint} device - The device to remove.
80
+ * @returns {boolean} True if the device was removed, false otherwise.
81
+ * @throws {Error} If the device does not have a unique ID.
82
+ */
83
+ remove(device: MatterbridgeEndpoint): boolean;
84
+ /**
85
+ * Clears all devices from the manager.
86
+ */
87
+ clear(): void;
88
+ /**
89
+ * Converts a MatterbridgeEndpoint to a BaseDevice.
90
+ *
91
+ * @param {MatterbridgeEndpoint} device The MatterbridgeEndpoint to convert.
92
+ * @returns {BaseDevice} The converted BaseDevice.
93
+ */
94
+ private toBaseDevice;
95
+ /**
96
+ * Gets an array of all devices.
97
+ *
98
+ * @returns {MatterbridgeEndpoint[]} An array of all devices.
99
+ */
100
+ array(): MatterbridgeEndpoint[];
101
+ /**
102
+ * Gets a base array of all devices suitable for serialization.
103
+ *
104
+ * @param {string} [pluginName] - Optional plugin name to filter devices.
105
+ * @returns {ApiDevices[]} A base array of all devices.
106
+ */
107
+ baseArray(pluginName?: string): BaseDevice[];
108
+ /**
109
+ * Iterates over all devices.
110
+ *
111
+ * @returns {IterableIterator<MatterbridgeEndpoint>} An iterator for the devices.
112
+ */
113
+ [Symbol.iterator](): MapIterator<MatterbridgeEndpoint>;
114
+ /**
115
+ * Asynchronously iterates over each device and calls the provided callback function.
116
+ *
117
+ * @param {(device: MatterbridgeEndpoint) => Promise<void>} callback - The callback function to call with each device.
118
+ * @returns {Promise<void>} A promise that resolves when all callbacks have been called.
119
+ */
120
+ forEach(callback: (device: MatterbridgeEndpoint) => Promise<void>): Promise<void>;
121
+ /**
122
+ * Sets the log level.
123
+ *
124
+ * @param {LogLevel} logLevel - The log level to set.
125
+ */
126
+ set logLevel(logLevel: LogLevel);
127
+ }
128
+ //# sourceMappingURL=deviceManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deviceManager.d.ts","sourceRoot":"","sources":["../src/deviceManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAG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,CAAC,IAAI,CAAC;IAavF;;;;OAIG;IACH,IAAI,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAE9B;CACF"}
@@ -1,15 +1,45 @@
1
+ /**
2
+ * This file contains the DeviceManager class.
3
+ *
4
+ * @file devices.ts
5
+ * @author Luca Liguori
6
+ * @created 2024-07-26
7
+ * @version 1.1.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
+ // AnsiLogger module
1
25
  import { AnsiLogger, BLUE, CYAN, db, debugStringify, er } from 'node-ansi-logger';
2
26
  import { dev } from './matterbridgeTypes.js';
3
27
  import { BroadcastServer } from './broadcastServer.js';
4
28
  import { hasParameter } from './utils/commandLine.js';
29
+ /**
30
+ * Manages Matterbridge devices.
31
+ */
5
32
  export class DeviceManager {
6
33
  _devices = new Map();
7
34
  log;
8
35
  server;
9
36
  debug = hasParameter('debug') || hasParameter('verbose');
10
37
  verbose = hasParameter('verbose');
38
+ /**
39
+ * Creates an instance of DeviceManager.
40
+ */
11
41
  constructor() {
12
- this.log = new AnsiLogger({ logName: 'DeviceManager', logTimestampFormat: 4, logLevel: hasParameter('debug') ? "debug" : "info" });
42
+ this.log = new AnsiLogger({ logName: 'DeviceManager', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: hasParameter('debug') ? "debug" /* LogLevel.DEBUG */ : "info" /* LogLevel.INFO */ });
13
43
  this.log.debug('Matterbridge device manager starting...');
14
44
  this.server = new BroadcastServer('devices', this.log);
15
45
  this.server.on('broadcast_message', this.msgHandler.bind(this));
@@ -61,18 +91,47 @@ export class DeviceManager {
61
91
  }
62
92
  }
63
93
  }
94
+ /**
95
+ * Gets the number of devices.
96
+ *
97
+ * @returns {number} The number of devices.
98
+ */
64
99
  get length() {
65
100
  return this._devices.size;
66
101
  }
102
+ /**
103
+ * Gets the number of devices.
104
+ *
105
+ * @returns {number} The number of devices.
106
+ */
67
107
  get size() {
68
108
  return this._devices.size;
69
109
  }
110
+ /**
111
+ * Checks if a device with the specified unique ID exists.
112
+ *
113
+ * @param {string} uniqueId - The unique ID of the device.
114
+ * @returns {boolean} True if the device exists, false otherwise.
115
+ */
70
116
  has(uniqueId) {
71
117
  return this._devices.has(uniqueId);
72
118
  }
119
+ /**
120
+ * Gets a device by its unique ID.
121
+ *
122
+ * @param {string} uniqueId - The unique ID of the device.
123
+ * @returns {MatterbridgeEndpoint | undefined} The device, or undefined if not found.
124
+ */
73
125
  get(uniqueId) {
74
126
  return this._devices.get(uniqueId);
75
127
  }
128
+ /**
129
+ * Adds a device to the manager.
130
+ *
131
+ * @param {MatterbridgeEndpoint} device - The device to add.
132
+ * @returns {MatterbridgeEndpoint} The added device.
133
+ * @throws {Error} If the device does not have a unique ID.
134
+ */
76
135
  set(device) {
77
136
  if (!device.uniqueId)
78
137
  throw new Error(`The device ${dev}${device.deviceName}${er} has not been initialized: uniqueId is required`);
@@ -81,6 +140,13 @@ export class DeviceManager {
81
140
  this._devices.set(device.uniqueId, device);
82
141
  return device;
83
142
  }
143
+ /**
144
+ * Removes a device from the manager.
145
+ *
146
+ * @param {MatterbridgeEndpoint} device - The device to remove.
147
+ * @returns {boolean} True if the device was removed, false otherwise.
148
+ * @throws {Error} If the device does not have a unique ID.
149
+ */
84
150
  remove(device) {
85
151
  if (!device.uniqueId)
86
152
  throw new Error(`The device ${dev}${device.deviceName}${er} has not been initialized: uniqueId is required`);
@@ -88,9 +154,18 @@ export class DeviceManager {
88
154
  this.log.error(`The device ${dev}${device.deviceName}${er} with uniqueId ${BLUE}${device.uniqueId}${er} serialNumber ${BLUE}${device.serialNumber}${er} is not registered in the device manager`);
89
155
  return this._devices.delete(device.uniqueId);
90
156
  }
157
+ /**
158
+ * Clears all devices from the manager.
159
+ */
91
160
  clear() {
92
161
  this._devices.clear();
93
162
  }
163
+ /**
164
+ * Converts a MatterbridgeEndpoint to a BaseDevice.
165
+ *
166
+ * @param {MatterbridgeEndpoint} device The MatterbridgeEndpoint to convert.
167
+ * @returns {BaseDevice} The converted BaseDevice.
168
+ */
94
169
  toBaseDevice(device) {
95
170
  return {
96
171
  pluginName: device.plugin,
@@ -104,21 +179,44 @@ export class DeviceManager {
104
179
  configUrl: device.configUrl,
105
180
  };
106
181
  }
182
+ /**
183
+ * Gets an array of all devices.
184
+ *
185
+ * @returns {MatterbridgeEndpoint[]} An array of all devices.
186
+ */
107
187
  array() {
108
188
  return Array.from(this._devices.values());
109
189
  }
190
+ /**
191
+ * Gets a base array of all devices suitable for serialization.
192
+ *
193
+ * @param {string} [pluginName] - Optional plugin name to filter devices.
194
+ * @returns {ApiDevices[]} A base array of all devices.
195
+ */
110
196
  baseArray(pluginName) {
111
197
  const devices = [];
112
198
  for (const device of this._devices.values()) {
199
+ // Filter by pluginName if provided
113
200
  if (pluginName && pluginName !== device.plugin)
114
201
  continue;
115
202
  devices.push(this.toBaseDevice(device));
116
203
  }
117
204
  return devices;
118
205
  }
206
+ /**
207
+ * Iterates over all devices.
208
+ *
209
+ * @returns {IterableIterator<MatterbridgeEndpoint>} An iterator for the devices.
210
+ */
119
211
  [Symbol.iterator]() {
120
212
  return this._devices.values();
121
213
  }
214
+ /**
215
+ * Asynchronously iterates over each device and calls the provided callback function.
216
+ *
217
+ * @param {(device: MatterbridgeEndpoint) => Promise<void>} callback - The callback function to call with each device.
218
+ * @returns {Promise<void>} A promise that resolves when all callbacks have been called.
219
+ */
122
220
  async forEach(callback) {
123
221
  if (this.size === 0)
124
222
  return;
@@ -132,7 +230,13 @@ export class DeviceManager {
132
230
  });
133
231
  await Promise.all(tasks);
134
232
  }
233
+ /**
234
+ * Sets the log level.
235
+ *
236
+ * @param {LogLevel} logLevel - The log level to set.
237
+ */
135
238
  set logLevel(logLevel) {
136
239
  this.log.logLevel = logLevel;
137
240
  }
138
241
  }
242
+ //# sourceMappingURL=deviceManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deviceManager.js","sourceRoot":"","sources":["../src/deviceManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,oBAAoB;AACpB,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,cAAc,EAAE,EAAE,EAA6B,MAAM,kBAAkB,CAAC;AAI7G,OAAO,EAAmB,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD;;GAEG;AACH,MAAM,OAAO,aAAa;IACP,QAAQ,GAAG,IAAI,GAAG,EAAgC,CAAC;IACnD,GAAG,CAAa;IAChB,MAAM,CAAkB;IACxB,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,YAAY,CAAC,SAAS,CAAC,CAAC;IACzD,OAAO,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;IAEnD;;OAEG;IACH;QACE,IAAI,CAAC,GAAG,GAAG,IAAI,UAAU,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,kBAAkB,qCAA6B,EAAE,QAAQ,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,8BAAgB,CAAC,2BAAc,EAAE,CAAC,CAAC;QAC3K,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAC1D,IAAI,CAAC,MAAM,GAAG,IAAI,eAAe,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;QAC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AAI,CAAC,GAAG,CAAC,KAAK,CAAC,mCAAmC,GAAG,GAAG,MAAM,CAAC,UAAU,GAAG,EAAE,iBAAiB,IAAI,GAAG,MAAM,CAAC,YAAY,GAAG,EAAE,cAAc,IAAI,GAAG,MAAM,CAAC,QAAQ,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;YACrL,CAAC;QACH,CAAC,CAAC,CAAC;QACH,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED;;;;OAIG;IACH,IAAI,QAAQ,CAAC,QAAkB;QAC7B,IAAI,CAAC,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC/B,CAAC;CACF"}
@@ -0,0 +1,98 @@
1
+ /**
2
+ * @description This file contains the AirConditioner class.
3
+ * @file src/devices/airConditioner.ts
4
+ * @author Luca Liguori
5
+ * @created 2025-09-04
6
+ * @version 1.0.0
7
+ * @license Apache-2.0
8
+ *
9
+ * Copyright 2025, 2026, 2027 Luca Liguori.
10
+ *
11
+ * Licensed under the Apache License, Version 2.0 (the "License");
12
+ * you may not use this file except in compliance with the License.
13
+ * You may obtain a copy of the License at
14
+ *
15
+ * http://www.apache.org/licenses/LICENSE-2.0
16
+ *
17
+ * Unless required by applicable law or agreed to in writing, software
18
+ * distributed under the License is distributed on an "AS IS" BASIS,
19
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
+ * See the License for the specific language governing permissions and
21
+ * limitations under the License.
22
+ */
23
+ import { ThermostatUserInterfaceConfiguration } from '@matter/types/clusters/thermostat-user-interface-configuration';
24
+ import { FanControl } from '@matter/types/clusters/fan-control';
25
+ import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
26
+ /**
27
+ * Options for configuring an {@link AirConditioner} instance.
28
+ *
29
+ * All temperatures in °C. Typical valid range 0–50 unless otherwise noted.
30
+ */
31
+ export interface AirConditionerOptions {
32
+ /** Local ambient temperature (°C). Default 23. */
33
+ localTemperature?: number;
34
+ /** Occupied heating setpoint (°C). Default 21. */
35
+ occupiedHeatingSetpoint?: number;
36
+ /** Occupied cooling setpoint (°C). Default 25. */
37
+ occupiedCoolingSetpoint?: number;
38
+ /** Minimum setpoint dead band (°C). Default 1. */
39
+ minSetpointDeadBand?: number;
40
+ /** Minimum heat setpoint limit (°C). Default 0. */
41
+ minHeatSetpointLimit?: number;
42
+ /** Maximum heat setpoint limit (°C). Default 50. */
43
+ maxHeatSetpointLimit?: number;
44
+ /** Minimum cool setpoint limit (°C). Default 0. */
45
+ minCoolSetpointLimit?: number;
46
+ /** Maximum cool setpoint limit (°C). Default 50. */
47
+ maxCoolSetpointLimit?: number;
48
+ /** Temperature display mode. Default Celsius. */
49
+ temperatureDisplayMode?: ThermostatUserInterfaceConfiguration.TemperatureDisplayMode;
50
+ /** Keypad lockout mode. Default NoLockout. */
51
+ keypadLockout?: ThermostatUserInterfaceConfiguration.KeypadLockout;
52
+ /** Schedule programming visibility. Default ScheduleProgrammingPermitted. */
53
+ scheduleProgrammingVisibility?: ThermostatUserInterfaceConfiguration.ScheduleProgrammingVisibility;
54
+ /** Fan mode. Default Off. */
55
+ fanMode?: FanControl.FanMode;
56
+ /** Fan mode sequence. Default OffLowMedHighAuto. */
57
+ fanModeSequence?: FanControl.FanModeSequence;
58
+ /** Target fan percent setting (0–100). Default 0. */
59
+ percentSetting?: number;
60
+ /** Current fan percent (0–100). Default 0. */
61
+ percentCurrent?: number;
62
+ }
63
+ export declare class AirConditioner extends MatterbridgeEndpoint {
64
+ /**
65
+ * Creates an instance of the AirConditioner class.
66
+ *
67
+ * A Room Air Conditioner is a device which at a minimum is capable of being turned on and off and of controlling the temperature in the living space.
68
+ * A Room Air Conditioner MAY also support additional capabilities via endpoint composition.
69
+ * The DF (Dead Front) feature is required for the On/Off cluster in this device type.
70
+ *
71
+ * @param {string} name - The name of the air conditioner.
72
+ * @param {string} serial - The serial number of the air conditioner.
73
+ * @param {AirConditionerOptions} [options] - Optional configuration values. Missing fields use defaults.
74
+ *
75
+ * Options defaults:
76
+ * - localTemperature: 23
77
+ * - occupiedHeatingSetpoint: 21
78
+ * - occupiedCoolingSetpoint: 25
79
+ * - minSetpointDeadBand: 1
80
+ * - minHeatSetpointLimit: 0
81
+ * - maxHeatSetpointLimit: 50
82
+ * - minCoolSetpointLimit: 0
83
+ * - maxCoolSetpointLimit: 50
84
+ * - temperatureDisplayMode: Celsius
85
+ * - keypadLockout: NoLockout
86
+ * - scheduleProgrammingVisibility: ScheduleProgrammingPermitted
87
+ * - fanMode: Off
88
+ * - fanModeSequence: OffLowMedHighAuto
89
+ * - percentSetting: 0
90
+ * - percentCurrent: 0
91
+ *
92
+ * @returns {AirConditioner} The AirConditioner instance.
93
+ *
94
+ * @remarks Not supported by Google Home.
95
+ */
96
+ constructor(name: string, serial: string, options?: AirConditionerOptions);
97
+ }
98
+ //# sourceMappingURL=airConditioner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"airConditioner.d.ts","sourceRoot":"","sources":["../../src/devices/airConditioner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAE,oCAAoC,EAAE,MAAM,gEAAgE,CAAC;AACtH,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAIhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,kDAAkD;IAClD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kDAAkD;IAClD,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,kDAAkD;IAClD,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,kDAAkD;IAClD,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mDAAmD;IACnD,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,oDAAoD;IACpD,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,mDAAmD;IACnD,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,oDAAoD;IACpD,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,iDAAiD;IACjD,sBAAsB,CAAC,EAAE,oCAAoC,CAAC,sBAAsB,CAAC;IACrF,8CAA8C;IAC9C,aAAa,CAAC,EAAE,oCAAoC,CAAC,aAAa,CAAC;IACnE,6EAA6E;IAC7E,6BAA6B,CAAC,EAAE,oCAAoC,CAAC,6BAA6B,CAAC;IACnG,6BAA6B;IAC7B,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC;IAC7B,oDAAoD;IACpD,eAAe,CAAC,EAAE,UAAU,CAAC,eAAe,CAAC;IAC7C,qDAAqD;IACrD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,8CAA8C;IAC9C,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,qBAAa,cAAe,SAAQ,oBAAoB;IACtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;gBACS,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,qBAA0B;CA2B9E"}
@@ -1,8 +1,64 @@
1
+ /**
2
+ * @description This file contains the AirConditioner class.
3
+ * @file src/devices/airConditioner.ts
4
+ * @author Luca Liguori
5
+ * @created 2025-09-04
6
+ * @version 1.0.0
7
+ * @license Apache-2.0
8
+ *
9
+ * Copyright 2025, 2026, 2027 Luca Liguori.
10
+ *
11
+ * Licensed under the Apache License, Version 2.0 (the "License");
12
+ * you may not use this file except in compliance with the License.
13
+ * You may obtain a copy of the License at
14
+ *
15
+ * http://www.apache.org/licenses/LICENSE-2.0
16
+ *
17
+ * Unless required by applicable law or agreed to in writing, software
18
+ * distributed under the License is distributed on an "AS IS" BASIS,
19
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
+ * See the License for the specific language governing permissions and
21
+ * limitations under the License.
22
+ */
23
+ // Imports from @matter
1
24
  import { ThermostatUserInterfaceConfiguration } from '@matter/types/clusters/thermostat-user-interface-configuration';
2
25
  import { FanControl } from '@matter/types/clusters/fan-control';
26
+ // Matterbridge
3
27
  import { airConditioner, powerSource } from '../matterbridgeDeviceTypes.js';
4
28
  import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
5
29
  export class AirConditioner extends MatterbridgeEndpoint {
30
+ /**
31
+ * Creates an instance of the AirConditioner class.
32
+ *
33
+ * A Room Air Conditioner is a device which at a minimum is capable of being turned on and off and of controlling the temperature in the living space.
34
+ * A Room Air Conditioner MAY also support additional capabilities via endpoint composition.
35
+ * The DF (Dead Front) feature is required for the On/Off cluster in this device type.
36
+ *
37
+ * @param {string} name - The name of the air conditioner.
38
+ * @param {string} serial - The serial number of the air conditioner.
39
+ * @param {AirConditionerOptions} [options] - Optional configuration values. Missing fields use defaults.
40
+ *
41
+ * Options defaults:
42
+ * - localTemperature: 23
43
+ * - occupiedHeatingSetpoint: 21
44
+ * - occupiedCoolingSetpoint: 25
45
+ * - minSetpointDeadBand: 1
46
+ * - minHeatSetpointLimit: 0
47
+ * - maxHeatSetpointLimit: 50
48
+ * - minCoolSetpointLimit: 0
49
+ * - maxCoolSetpointLimit: 50
50
+ * - temperatureDisplayMode: Celsius
51
+ * - keypadLockout: NoLockout
52
+ * - scheduleProgrammingVisibility: ScheduleProgrammingPermitted
53
+ * - fanMode: Off
54
+ * - fanModeSequence: OffLowMedHighAuto
55
+ * - percentSetting: 0
56
+ * - percentCurrent: 0
57
+ *
58
+ * @returns {AirConditioner} The AirConditioner instance.
59
+ *
60
+ * @remarks Not supported by Google Home.
61
+ */
6
62
  constructor(name, serial, options = {}) {
7
63
  const { localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50, temperatureDisplayMode = ThermostatUserInterfaceConfiguration.TemperatureDisplayMode.Celsius, keypadLockout = ThermostatUserInterfaceConfiguration.KeypadLockout.NoLockout, scheduleProgrammingVisibility = ThermostatUserInterfaceConfiguration.ScheduleProgrammingVisibility.ScheduleProgrammingPermitted, fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHighAuto, percentSetting = 0, percentCurrent = 0, } = options;
8
64
  super([airConditioner, powerSource], { id: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` });
@@ -15,3 +71,4 @@ export class AirConditioner extends MatterbridgeEndpoint {
15
71
  this.createDefaultFanControlClusterServer(fanMode, fanModeSequence, percentSetting, percentCurrent);
16
72
  }
17
73
  }
74
+ //# sourceMappingURL=airConditioner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"airConditioner.js","sourceRoot":"","sources":["../../src/devices/airConditioner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,uBAAuB;AACvB,OAAO,EAAE,oCAAoC,EAAE,MAAM,gEAAgE,CAAC;AACtH,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAEhE,eAAe;AACf,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAwClE,MAAM,OAAO,cAAe,SAAQ,oBAAoB;IACtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,YAAY,IAAY,EAAE,MAAc,EAAE,UAAiC,EAAE;QAC3E,MAAM,EACJ,gBAAgB,GAAG,EAAE,EACrB,uBAAuB,GAAG,EAAE,EAC5B,uBAAuB,GAAG,EAAE,EAC5B,mBAAmB,GAAG,CAAC,EACvB,oBAAoB,GAAG,CAAC,EACxB,oBAAoB,GAAG,EAAE,EACzB,oBAAoB,GAAG,CAAC,EACxB,oBAAoB,GAAG,EAAE,EACzB,sBAAsB,GAAG,oCAAoC,CAAC,sBAAsB,CAAC,OAAO,EAC5F,aAAa,GAAG,oCAAoC,CAAC,aAAa,CAAC,SAAS,EAC5E,6BAA6B,GAAG,oCAAoC,CAAC,6BAA6B,CAAC,4BAA4B,EAC/H,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,EAChC,eAAe,GAAG,UAAU,CAAC,eAAe,CAAC,iBAAiB,EAC9D,cAAc,GAAG,CAAC,EAClB,cAAc,GAAG,CAAC,GACnB,GAAG,OAAO,CAAC;QACZ,KAAK,CAAC,CAAC,cAAc,EAAE,WAAW,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAC1G,IAAI,CAAC,kCAAkC,EAAE,CAAC;QAC1C,IAAI,CAAC,0CAA0C,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,8BAA8B,CAAC,CAAC;QAC9H,IAAI,CAAC,0CAA0C,EAAE,CAAC;QAClD,IAAI,CAAC,iCAAiC,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,oCAAoC,CAAC,gBAAgB,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB,CAAC,CAAC;QAC3N,IAAI,CAAC,8DAA8D,CAAC,sBAAsB,EAAE,aAAa,EAAE,6BAA6B,CAAC,CAAC;QAC1I,IAAI,CAAC,oCAAoC,CAAC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC;IACtG,CAAC;CACF"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * @description This file contains the BatteryStorage class.
3
+ * @file src/devices/batteryStorage.ts
4
+ * @author Luca Liguori
5
+ * @contributor Ludovic BOUÉ
6
+ * @created 2025-06-20
7
+ * @version 1.0.0
8
+ * @license Apache-2.0
9
+ *
10
+ * Copyright 2025, 2026, 2027 Luca Liguori.
11
+ *
12
+ * Licensed under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License.
14
+ * You may obtain a copy of the License at
15
+ *
16
+ * http://www.apache.org/licenses/LICENSE-2.0
17
+ *
18
+ * Unless required by applicable law or agreed to in writing, software
19
+ * distributed under the License is distributed on an "AS IS" BASIS,
20
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ * See the License for the specific language governing permissions and
22
+ * limitations under the License.
23
+ */
24
+ import { PowerSource } from '@matter/types/clusters/power-source';
25
+ import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
26
+ export declare class BatteryStorage extends MatterbridgeEndpoint {
27
+ /**
28
+ * Creates an instance of the BatteryStorage class.
29
+ *
30
+ * @param {string} name - The name of the BatteryStorage.
31
+ * @param {string} serial - The serial number of the BatteryStorage.
32
+ * @param {number} [batPercentRemaining] - The percentage of battery remaining, defaults to `100` if not provided.
33
+ * @param {PowerSource.BatChargeLevel} [batChargeLevel] - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
34
+ * @param {number} voltage - The voltage value in millivolts.
35
+ * @param {number} current - The current value in milliamperes.
36
+ * @param {number} power - The power value in milliwatts.
37
+ * @param {number} energyImported - The total production value in mW/h.
38
+ * @param {number} energyExported - The total production value in mW/h.
39
+ * @param {number} [absMinPower] - Indicate the minimum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
40
+ * @param {number} [absMaxPower] - Indicate the maximum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
41
+ *
42
+ * @remarks
43
+ * - A battery storage inverter that can charge its battery at a maximum power of 2000W and can
44
+ * discharge the battery at a maximum power of 3000W, would have a absMinPower: -3000W, absMaxPower: 2000W.
45
+ */
46
+ constructor(name: string, serial: string, batPercentRemaining?: number, batChargeLevel?: PowerSource.BatChargeLevel, voltage?: number | bigint | null, current?: number | bigint | null, power?: number | bigint | null, energyImported?: number | bigint | null, energyExported?: number | bigint | null, absMinPower?: number, absMaxPower?: number);
47
+ }
48
+ //# sourceMappingURL=batteryStorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batteryStorage.d.ts","sourceRoot":"","sources":["../../src/devices/batteryStorage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAKH,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAGlE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAGlE,qBAAa,cAAe,SAAQ,oBAAoB;IACtD;;;;;;;;;;;;;;;;;;OAkBG;gBAED,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,mBAAmB,GAAE,MAAY,EACjC,cAAc,GAAE,WAAW,CAAC,cAA8C,EAC1E,OAAO,GAAE,MAAM,GAAG,MAAM,GAAG,IAAW,EACtC,OAAO,GAAE,MAAM,GAAG,MAAM,GAAG,IAAW,EACtC,KAAK,GAAE,MAAM,GAAG,MAAM,GAAG,IAAW,EACpC,cAAc,GAAE,MAAM,GAAG,MAAM,GAAG,IAAW,EAC7C,cAAc,GAAE,MAAM,GAAG,MAAM,GAAG,IAAW,EAC7C,WAAW,GAAE,MAAU,EACvB,WAAW,GAAE,MAAU;CA0B1B"}
@@ -1,9 +1,53 @@
1
+ /**
2
+ * @description This file contains the BatteryStorage class.
3
+ * @file src/devices/batteryStorage.ts
4
+ * @author Luca Liguori
5
+ * @contributor Ludovic BOUÉ
6
+ * @created 2025-06-20
7
+ * @version 1.0.0
8
+ * @license Apache-2.0
9
+ *
10
+ * Copyright 2025, 2026, 2027 Luca Liguori.
11
+ *
12
+ * Licensed under the Apache License, Version 2.0 (the "License");
13
+ * you may not use this file except in compliance with the License.
14
+ * You may obtain a copy of the License at
15
+ *
16
+ * http://www.apache.org/licenses/LICENSE-2.0
17
+ *
18
+ * Unless required by applicable law or agreed to in writing, software
19
+ * distributed under the License is distributed on an "AS IS" BASIS,
20
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ * See the License for the specific language governing permissions and
22
+ * limitations under the License.
23
+ */
24
+ // @matter
1
25
  import { PowerSourceTag } from '@matter/node';
2
26
  import { DeviceEnergyManagement } from '@matter/types/clusters/device-energy-management';
3
27
  import { PowerSource } from '@matter/types/clusters/power-source';
28
+ // Matterbridge
4
29
  import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
5
30
  import { deviceEnergyManagement, electricalSensor, batteryStorage, powerSource } from '../matterbridgeDeviceTypes.js';
6
31
  export class BatteryStorage extends MatterbridgeEndpoint {
32
+ /**
33
+ * Creates an instance of the BatteryStorage class.
34
+ *
35
+ * @param {string} name - The name of the BatteryStorage.
36
+ * @param {string} serial - The serial number of the BatteryStorage.
37
+ * @param {number} [batPercentRemaining] - The percentage of battery remaining, defaults to `100` if not provided.
38
+ * @param {PowerSource.BatChargeLevel} [batChargeLevel] - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
39
+ * @param {number} voltage - The voltage value in millivolts.
40
+ * @param {number} current - The current value in milliamperes.
41
+ * @param {number} power - The power value in milliwatts.
42
+ * @param {number} energyImported - The total production value in mW/h.
43
+ * @param {number} energyExported - The total production value in mW/h.
44
+ * @param {number} [absMinPower] - Indicate the minimum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
45
+ * @param {number} [absMaxPower] - Indicate the maximum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
46
+ *
47
+ * @remarks
48
+ * - A battery storage inverter that can charge its battery at a maximum power of 2000W and can
49
+ * discharge the battery at a maximum power of 3000W, would have a absMinPower: -3000W, absMaxPower: 2000W.
50
+ */
7
51
  constructor(name, serial, batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, voltage = null, current = null, power = null, energyImported = null, energyExported = null, absMinPower = 0, absMaxPower = 0) {
8
52
  super([batteryStorage, electricalSensor, deviceEnergyManagement], { id: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` });
9
53
  this.createDefaultIdentifyClusterServer()
@@ -14,10 +58,12 @@ export class BatteryStorage extends MatterbridgeEndpoint {
14
58
  .createDefaultDeviceEnergyManagementClusterServer(DeviceEnergyManagement.EsaType.BatteryStorage, true, DeviceEnergyManagement.EsaState.Online, absMinPower, absMaxPower)
15
59
  .createDefaultDeviceEnergyManagementModeClusterServer()
16
60
  .addRequiredClusterServers();
61
+ // Add separate PowerSource child devices cause in matter.js the PowerSource cluster is not supported with both features Wired and Battery.
62
+ // Probably this is also an error in the specification...
17
63
  this.addChildDeviceType('BatteryPowerSource', powerSource, {
18
64
  tagList: [{ mfgCode: null, namespaceId: PowerSourceTag.Battery.namespaceId, tag: PowerSourceTag.Battery.tag, label: null }],
19
65
  })
20
- .createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining, batChargeLevel, 24_000)
66
+ .createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining, batChargeLevel, 24_000) // Battery voltage in mV (24V).
21
67
  .addRequiredClusterServers();
22
68
  this.addChildDeviceType('GridPowerSource', powerSource, {
23
69
  tagList: [{ mfgCode: null, namespaceId: PowerSourceTag.Grid.namespaceId, tag: PowerSourceTag.Grid.tag, label: null }],
@@ -26,3 +72,4 @@ export class BatteryStorage extends MatterbridgeEndpoint {
26
72
  .addRequiredClusterServers();
27
73
  }
28
74
  }
75
+ //# sourceMappingURL=batteryStorage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batteryStorage.js","sourceRoot":"","sources":["../../src/devices/batteryStorage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,UAAU;AACV,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,iDAAiD,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAElE,eAA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