@victronenergy/mfd-modules 10.4.1 → 11.0.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 (234) hide show
  1. package/README.md +1 -1
  2. package/dist/src/Modules/AcLoads/AcLoads.provider.d.ts.map +1 -1
  3. package/dist/src/Modules/AcLoads/AcLoads.provider.js +19 -19
  4. package/dist/src/Modules/AcLoads/AcLoads.provider.js.map +1 -1
  5. package/dist/src/Modules/AcMode/AcMode.provider.d.ts.map +1 -1
  6. package/dist/src/Modules/AcMode/AcMode.provider.js +19 -31
  7. package/dist/src/Modules/AcMode/AcMode.provider.js.map +1 -1
  8. package/dist/src/Modules/ActiveSource/ActiveInValues.provider.js +17 -17
  9. package/dist/src/Modules/ActiveSource/ActiveInValues.provider.js.map +1 -1
  10. package/dist/src/Modules/ActiveSource/ActiveSource.provider.js +11 -11
  11. package/dist/src/Modules/ActiveSource/ActiveSource.provider.js.map +1 -1
  12. package/dist/src/Modules/Alternators/Alternator.provider.d.ts.map +1 -1
  13. package/dist/src/Modules/Alternators/Alternator.provider.js +7 -8
  14. package/dist/src/Modules/Alternators/Alternator.provider.js.map +1 -1
  15. package/dist/src/Modules/Alternators/Alternators.provider.d.ts.map +1 -1
  16. package/dist/src/Modules/Alternators/Alternators.provider.js +16 -14
  17. package/dist/src/Modules/Alternators/Alternators.provider.js.map +1 -1
  18. package/dist/src/Modules/Alternators/Alternators.store.d.ts.map +1 -1
  19. package/dist/src/Modules/Alternators/Alternators.store.js +7 -10
  20. package/dist/src/Modules/Alternators/Alternators.store.js.map +1 -1
  21. package/dist/src/Modules/App/App.provider.d.ts.map +1 -1
  22. package/dist/src/Modules/App/App.provider.js +51 -51
  23. package/dist/src/Modules/App/App.provider.js.map +1 -1
  24. package/dist/src/Modules/App/App.store.d.ts +11 -7
  25. package/dist/src/Modules/App/App.store.d.ts.map +1 -1
  26. package/dist/src/Modules/App/App.store.js +73 -107
  27. package/dist/src/Modules/App/App.store.js.map +1 -1
  28. package/dist/src/Modules/Battery/Batteries.provider.d.ts.map +1 -1
  29. package/dist/src/Modules/Battery/Batteries.provider.js +16 -14
  30. package/dist/src/Modules/Battery/Batteries.provider.js.map +1 -1
  31. package/dist/src/Modules/Battery/Batteries.store.d.ts.map +1 -1
  32. package/dist/src/Modules/Battery/Batteries.store.js +7 -10
  33. package/dist/src/Modules/Battery/Batteries.store.js.map +1 -1
  34. package/dist/src/Modules/Battery/SystemBatteries.provider.js +5 -5
  35. package/dist/src/Modules/Battery/SystemBatteries.provider.js.map +1 -1
  36. package/dist/src/Modules/Chargers/Charger.provider.js +23 -33
  37. package/dist/src/Modules/Chargers/Charger.provider.js.map +1 -1
  38. package/dist/src/Modules/Chargers/Chargers.provider.d.ts.map +1 -1
  39. package/dist/src/Modules/Chargers/Chargers.provider.js +16 -15
  40. package/dist/src/Modules/Chargers/Chargers.provider.js.map +1 -1
  41. package/dist/src/Modules/Chargers/Chargers.store.d.ts.map +1 -1
  42. package/dist/src/Modules/Chargers/Chargers.store.js +7 -10
  43. package/dist/src/Modules/Chargers/Chargers.store.js.map +1 -1
  44. package/dist/src/Modules/DcLoads/DcLoads.provider.d.ts.map +1 -1
  45. package/dist/src/Modules/DcLoads/DcLoads.provider.js +9 -20
  46. package/dist/src/Modules/DcLoads/DcLoads.provider.js.map +1 -1
  47. package/dist/src/Modules/Generators/ConnectedGenset.provider.d.ts.map +1 -1
  48. package/dist/src/Modules/Generators/ConnectedGenset.provider.js +36 -47
  49. package/dist/src/Modules/Generators/ConnectedGenset.provider.js.map +1 -1
  50. package/dist/src/Modules/Generators/ConnectedGensets.provider.d.ts.map +1 -1
  51. package/dist/src/Modules/Generators/ConnectedGensets.provider.js +16 -14
  52. package/dist/src/Modules/Generators/ConnectedGensets.provider.js.map +1 -1
  53. package/dist/src/Modules/Generators/ConnectedGensets.store.d.ts.map +1 -1
  54. package/dist/src/Modules/Generators/ConnectedGensets.store.js +8 -11
  55. package/dist/src/Modules/Generators/ConnectedGensets.store.js.map +1 -1
  56. package/dist/src/Modules/Generators/GeneratorConnectedGenset.provider.js +17 -27
  57. package/dist/src/Modules/Generators/GeneratorConnectedGenset.provider.js.map +1 -1
  58. package/dist/src/Modules/Generators/GeneratorRelay.provider.d.ts +2 -2
  59. package/dist/src/Modules/Generators/GeneratorRelay.provider.d.ts.map +1 -1
  60. package/dist/src/Modules/Generators/GeneratorRelay.provider.js +24 -34
  61. package/dist/src/Modules/Generators/GeneratorRelay.provider.js.map +1 -1
  62. package/dist/src/Modules/Header/Header.provider.js +4 -4
  63. package/dist/src/Modules/Header/Header.provider.js.map +1 -1
  64. package/dist/src/Modules/InverterCharger/InputLimit.provider.js +6 -17
  65. package/dist/src/Modules/InverterCharger/InputLimit.provider.js.map +1 -1
  66. package/dist/src/Modules/InverterCharger/InputLimitSelector.provider.d.ts.map +1 -1
  67. package/dist/src/Modules/InverterCharger/InputLimitSelector.provider.js +12 -26
  68. package/dist/src/Modules/InverterCharger/InputLimitSelector.provider.js.map +1 -1
  69. package/dist/src/Modules/InverterCharger/InverterCharger.provider.d.ts.map +1 -1
  70. package/dist/src/Modules/InverterCharger/InverterCharger.provider.js +16 -27
  71. package/dist/src/Modules/InverterCharger/InverterCharger.provider.js.map +1 -1
  72. package/dist/src/Modules/Inverters/Inverter.provider.d.ts.map +1 -1
  73. package/dist/src/Modules/Inverters/Inverter.provider.js +19 -30
  74. package/dist/src/Modules/Inverters/Inverter.provider.js.map +1 -1
  75. package/dist/src/Modules/Inverters/Inverters.provider.d.ts.map +1 -1
  76. package/dist/src/Modules/Inverters/Inverters.provider.js +14 -13
  77. package/dist/src/Modules/Inverters/Inverters.provider.js.map +1 -1
  78. package/dist/src/Modules/Inverters/Inverters.store.d.ts.map +1 -1
  79. package/dist/src/Modules/Inverters/Inverters.store.js +7 -10
  80. package/dist/src/Modules/Inverters/Inverters.store.js.map +1 -1
  81. package/dist/src/Modules/Inverters/index.js.map +1 -1
  82. package/dist/src/Modules/Language/Language.provider.d.ts +1 -1
  83. package/dist/src/Modules/Language/Language.provider.d.ts.map +1 -1
  84. package/dist/src/Modules/Language/Language.provider.js +21 -56
  85. package/dist/src/Modules/Language/Language.provider.js.map +1 -1
  86. package/dist/src/Modules/Mqtt/Mqtt.constants.js +1 -1
  87. package/dist/src/Modules/Mqtt/Mqtt.constants.js.map +1 -1
  88. package/dist/src/Modules/Mqtt/Mqtt.provider.d.ts +2 -2
  89. package/dist/src/Modules/Mqtt/Mqtt.provider.d.ts.map +1 -1
  90. package/dist/src/Modules/Mqtt/Mqtt.provider.js +4 -4
  91. package/dist/src/Modules/Mqtt/Mqtt.provider.js.map +1 -1
  92. package/dist/src/Modules/Mqtt/Mqtt.store.d.ts +3 -3
  93. package/dist/src/Modules/Mqtt/Mqtt.store.d.ts.map +1 -1
  94. package/dist/src/Modules/Mqtt/Mqtt.store.js +169 -193
  95. package/dist/src/Modules/Mqtt/Mqtt.store.js.map +1 -1
  96. package/dist/src/Modules/Mqtt/Mqtt.types.d.ts +1 -1
  97. package/dist/src/Modules/Mqtt/Mqtt.types.d.ts.map +1 -1
  98. package/dist/src/Modules/Mqtt/Mqtt.types.js +0 -1
  99. package/dist/src/Modules/Mqtt/Mqtt.types.js.map +1 -1
  100. package/dist/src/Modules/PvCharger/PvCharger.provider.js +8 -8
  101. package/dist/src/Modules/PvCharger/PvCharger.provider.js.map +1 -1
  102. package/dist/src/Modules/ShorePowerInput/ShorePowerInput.provider.d.ts +4 -1
  103. package/dist/src/Modules/ShorePowerInput/ShorePowerInput.provider.d.ts.map +1 -1
  104. package/dist/src/Modules/ShorePowerInput/ShorePowerInput.provider.js +24 -35
  105. package/dist/src/Modules/ShorePowerInput/ShorePowerInput.provider.js.map +1 -1
  106. package/dist/src/Modules/ShorePowerInput/index.d.ts +0 -1
  107. package/dist/src/Modules/ShorePowerInput/index.d.ts.map +1 -1
  108. package/dist/src/Modules/ShorePowerInput/index.js +0 -1
  109. package/dist/src/Modules/ShorePowerInput/index.js.map +1 -1
  110. package/dist/src/Modules/SwitchingPane/GenericInput.provider.d.ts +27 -0
  111. package/dist/src/Modules/SwitchingPane/GenericInput.provider.d.ts.map +1 -0
  112. package/dist/src/Modules/SwitchingPane/GenericInput.provider.js +32 -0
  113. package/dist/src/Modules/SwitchingPane/GenericInput.provider.js.map +1 -0
  114. package/dist/src/Modules/{SwitchableOutputs → SwitchingPane}/SwitchableOutput.provider.d.ts +25 -9
  115. package/dist/src/Modules/SwitchingPane/SwitchableOutput.provider.d.ts.map +1 -0
  116. package/dist/src/Modules/SwitchingPane/SwitchableOutput.provider.js +58 -0
  117. package/dist/src/Modules/SwitchingPane/SwitchableOutput.provider.js.map +1 -0
  118. package/dist/src/Modules/SwitchingPane/SwitchingDevice.provider.d.ts.map +1 -0
  119. package/dist/src/Modules/SwitchingPane/SwitchingDevice.provider.js +48 -0
  120. package/dist/src/Modules/SwitchingPane/SwitchingDevice.provider.js.map +1 -0
  121. package/dist/src/Modules/SwitchingPane/SwitchingDevices.store.d.ts.map +1 -0
  122. package/dist/src/Modules/{SwitchableOutputs → SwitchingPane}/SwitchingDevices.store.js +7 -10
  123. package/dist/src/Modules/SwitchingPane/SwitchingDevices.store.js.map +1 -0
  124. package/dist/src/Modules/SwitchingPane/SwitchingPane.provider.d.ts +2 -0
  125. package/dist/src/Modules/SwitchingPane/SwitchingPane.provider.d.ts.map +1 -0
  126. package/dist/src/Modules/SwitchingPane/SwitchingPane.provider.js +256 -0
  127. package/dist/src/Modules/SwitchingPane/SwitchingPane.provider.js.map +1 -0
  128. package/dist/src/Modules/SwitchingPane/SwitchingPane.store.d.ts +50 -0
  129. package/dist/src/Modules/SwitchingPane/SwitchingPane.store.d.ts.map +1 -0
  130. package/dist/src/Modules/{SwitchableOutputs/SwitchableOutputs.store.js → SwitchingPane/SwitchingPane.store.js} +67 -18
  131. package/dist/src/Modules/SwitchingPane/SwitchingPane.store.js.map +1 -0
  132. package/dist/src/Modules/SwitchingPane/index.d.ts +7 -0
  133. package/dist/src/Modules/SwitchingPane/index.d.ts.map +1 -0
  134. package/dist/src/Modules/SwitchingPane/index.js +7 -0
  135. package/dist/src/Modules/SwitchingPane/index.js.map +1 -0
  136. package/dist/src/Modules/SystemState/SystemState.provider.js +5 -5
  137. package/dist/src/Modules/SystemState/SystemState.provider.js.map +1 -1
  138. package/dist/src/Modules/Tanks/Tank.provider.d.ts.map +1 -1
  139. package/dist/src/Modules/Tanks/Tank.provider.js +11 -11
  140. package/dist/src/Modules/Tanks/Tank.provider.js.map +1 -1
  141. package/dist/src/Modules/Tanks/Tanks.provider.d.ts.map +1 -1
  142. package/dist/src/Modules/Tanks/Tanks.provider.js +19 -18
  143. package/dist/src/Modules/Tanks/Tanks.provider.js.map +1 -1
  144. package/dist/src/Modules/Tanks/Tanks.store.d.ts.map +1 -1
  145. package/dist/src/Modules/Tanks/Tanks.store.js +7 -10
  146. package/dist/src/Modules/Tanks/Tanks.store.js.map +1 -1
  147. package/dist/src/Modules/Temperatures/Temperature.provider.d.ts.map +1 -1
  148. package/dist/src/Modules/Temperatures/Temperature.provider.js +29 -29
  149. package/dist/src/Modules/Temperatures/Temperature.provider.js.map +1 -1
  150. package/dist/src/Modules/Temperatures/Temperatures.provider.d.ts.map +1 -1
  151. package/dist/src/Modules/Temperatures/Temperatures.provider.js +18 -17
  152. package/dist/src/Modules/Temperatures/Temperatures.provider.js.map +1 -1
  153. package/dist/src/Modules/Temperatures/Temperatures.store.d.ts.map +1 -1
  154. package/dist/src/Modules/Temperatures/Temperatures.store.js +7 -10
  155. package/dist/src/Modules/Temperatures/Temperatures.store.js.map +1 -1
  156. package/dist/src/Modules/Temperatures/index.d.ts +3 -3
  157. package/dist/src/Modules/Temperatures/index.js +3 -3
  158. package/dist/src/Modules/Temperatures/index.js.map +1 -1
  159. package/dist/src/Modules/Theme/Theme.provider.js +6 -6
  160. package/dist/src/Modules/Theme/Theme.provider.js.map +1 -1
  161. package/dist/src/Modules/Theme/Theme.store.d.ts.map +1 -1
  162. package/dist/src/Modules/Theme/Theme.store.js +35 -38
  163. package/dist/src/Modules/Theme/Theme.store.js.map +1 -1
  164. package/dist/src/Modules/Vebus/Vebus.provider.d.ts.map +1 -1
  165. package/dist/src/Modules/Vebus/Vebus.provider.js +39 -48
  166. package/dist/src/Modules/Vebus/Vebus.provider.js.map +1 -1
  167. package/dist/src/Modules/Vebus/Vebus.store.d.ts.map +1 -1
  168. package/dist/src/Modules/Vebus/Vebus.store.js +11 -14
  169. package/dist/src/Modules/Vebus/Vebus.store.js.map +1 -1
  170. package/dist/src/Modules/Vrm/Vrm.store.d.ts.map +1 -1
  171. package/dist/src/Modules/Vrm/Vrm.store.js +85 -154
  172. package/dist/src/Modules/Vrm/Vrm.store.js.map +1 -1
  173. package/dist/src/Modules/Vrm/Vrm.types.js +0 -1
  174. package/dist/src/Modules/WindGenerators/WindGenerator.provider.d.ts.map +1 -1
  175. package/dist/src/Modules/WindGenerators/WindGenerator.provider.js +6 -7
  176. package/dist/src/Modules/WindGenerators/WindGenerator.provider.js.map +1 -1
  177. package/dist/src/Modules/WindGenerators/WindGenerators.provider.d.ts.map +1 -1
  178. package/dist/src/Modules/WindGenerators/WindGenerators.provider.js +21 -19
  179. package/dist/src/Modules/WindGenerators/WindGenerators.provider.js.map +1 -1
  180. package/dist/src/Modules/WindGenerators/WindGenerators.store.d.ts.map +1 -1
  181. package/dist/src/Modules/WindGenerators/WindGenerators.store.js +7 -10
  182. package/dist/src/Modules/WindGenerators/WindGenerators.store.js.map +1 -1
  183. package/dist/src/index.d.ts +2 -1
  184. package/dist/src/index.d.ts.map +1 -1
  185. package/dist/src/index.js +2 -1
  186. package/dist/src/index.js.map +1 -1
  187. package/dist/src/utils/constants.d.ts +53 -3
  188. package/dist/src/utils/constants.d.ts.map +1 -1
  189. package/dist/src/utils/constants.js +82 -30
  190. package/dist/src/utils/constants.js.map +1 -1
  191. package/dist/src/utils/hsvw.d.ts.map +1 -1
  192. package/dist/src/utils/hsvw.js +24 -25
  193. package/dist/src/utils/hsvw.js.map +1 -1
  194. package/dist/src/utils/logger.d.ts +5 -8
  195. package/dist/src/utils/logger.d.ts.map +1 -1
  196. package/dist/src/utils/logger.js +11 -23
  197. package/dist/src/utils/logger.js.map +1 -1
  198. package/dist/src/utils/storage.d.ts.map +1 -1
  199. package/dist/src/utils/storage.js +7 -6
  200. package/dist/src/utils/storage.js.map +1 -1
  201. package/dist/src/utils/util.d.ts +6 -15
  202. package/dist/src/utils/util.d.ts.map +1 -1
  203. package/dist/src/utils/util.js +8 -100
  204. package/dist/src/utils/util.js.map +1 -1
  205. package/package.json +26 -15
  206. package/dist/eslint.config.d.mts +0 -13
  207. package/dist/eslint.config.d.mts.map +0 -1
  208. package/dist/eslint.config.mjs +0 -28
  209. package/dist/eslint.config.mjs.map +0 -1
  210. package/dist/src/Modules/ShorePowerInput/ShorePowerInput.store.d.ts +0 -11
  211. package/dist/src/Modules/ShorePowerInput/ShorePowerInput.store.d.ts.map +0 -1
  212. package/dist/src/Modules/ShorePowerInput/ShorePowerInput.store.js +0 -37
  213. package/dist/src/Modules/ShorePowerInput/ShorePowerInput.store.js.map +0 -1
  214. package/dist/src/Modules/SwitchableOutputs/SwitchableOutput.provider.d.ts.map +0 -1
  215. package/dist/src/Modules/SwitchableOutputs/SwitchableOutput.provider.js +0 -67
  216. package/dist/src/Modules/SwitchableOutputs/SwitchableOutput.provider.js.map +0 -1
  217. package/dist/src/Modules/SwitchableOutputs/SwitchableOutputs.provider.d.ts +0 -2
  218. package/dist/src/Modules/SwitchableOutputs/SwitchableOutputs.provider.d.ts.map +0 -1
  219. package/dist/src/Modules/SwitchableOutputs/SwitchableOutputs.provider.js +0 -168
  220. package/dist/src/Modules/SwitchableOutputs/SwitchableOutputs.provider.js.map +0 -1
  221. package/dist/src/Modules/SwitchableOutputs/SwitchableOutputs.store.d.ts +0 -38
  222. package/dist/src/Modules/SwitchableOutputs/SwitchableOutputs.store.d.ts.map +0 -1
  223. package/dist/src/Modules/SwitchableOutputs/SwitchableOutputs.store.js.map +0 -1
  224. package/dist/src/Modules/SwitchableOutputs/SwitchingDevice.provider.d.ts.map +0 -1
  225. package/dist/src/Modules/SwitchableOutputs/SwitchingDevice.provider.js +0 -50
  226. package/dist/src/Modules/SwitchableOutputs/SwitchingDevice.provider.js.map +0 -1
  227. package/dist/src/Modules/SwitchableOutputs/SwitchingDevices.store.d.ts.map +0 -1
  228. package/dist/src/Modules/SwitchableOutputs/SwitchingDevices.store.js.map +0 -1
  229. package/dist/src/Modules/SwitchableOutputs/index.d.ts +0 -6
  230. package/dist/src/Modules/SwitchableOutputs/index.d.ts.map +0 -1
  231. package/dist/src/Modules/SwitchableOutputs/index.js +0 -6
  232. package/dist/src/Modules/SwitchableOutputs/index.js.map +0 -1
  233. /package/dist/src/Modules/{SwitchableOutputs → SwitchingPane}/SwitchingDevice.provider.d.ts +0 -0
  234. /package/dist/src/Modules/{SwitchableOutputs → SwitchingPane}/SwitchingDevices.store.d.ts +0 -0
@@ -1,17 +1,8 @@
1
- export function parseTopic(topic: any): Topic;
2
- export function getMessageJson(message: any): any;
3
- export function objectValues(data: any): any[];
4
- export function isPathOfType(dbusPath: any, enumObject: any): boolean;
5
- export function arrayToSubscriptionMap(toSubscribe: any): any;
6
- export function getParameterByName(name: any, url: any): string | null;
7
- export function flatten(arrays: any): never[];
8
- export function systemStateFormatter(value: any): "Off" | "Low power" | "VE.Bus Fault condition" | "Bulk charging" | "Absorption charging" | "Float charging" | "Storage mode" | "Equalisation charging" | "Passthru" | "Inverting" | "Assisting" | "Power supply mode" | "Discharging" | "Sustain" | "--";
9
- export function versionToHumanReadable(version: any): any;
10
- export type Topic = {
11
- type: "N" | "R" | "W";
12
- portalId: string;
13
- serviceType: string;
14
- deviceInstance: string;
15
- dbusPath: string;
1
+ export declare const getMessageJson: (message: {
2
+ toString(): string;
3
+ }) => {
4
+ value: string | undefined;
5
+ [key: string]: unknown;
16
6
  };
7
+ export declare const versionToHumanReadable: (version: number) => string;
17
8
  //# sourceMappingURL=util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"/","sources":["src/utils/util.js"],"names":[],"mappings":"AAuBO,wCAFM,KAAK,CAajB;AAEM,kDAON;AAEM,+CAEN;AAEM,sEAGN;AAEM,8DAKN;AAEM,uEAQN;AAEM,8CAEN;AAEM,2SAiCN;AAEM,0DAQN;;UA/GS,GAAG,GAAG,GAAG,GAAG,GAAG;cACf,MAAM;iBACN,MAAM;oBACN,MAAM;cACN,MAAM"}
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"/","sources":["src/utils/util.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,GAAI,SAAS;IACtC,QAAQ,IAAI,MAAM,CAAA;CACnB,KAAG;IAAE,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAOtD,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,SAAS,MAAM,KAAG,MAQxD,CAAA"}
@@ -1,112 +1,20 @@
1
1
  import Logger from "./logger";
2
- import { VEBUS_SYSTEM_STATE } from "./constants";
3
- /**
4
- * @typedef {object} Topic
5
- *
6
- * @prop {"N" | "R" | "W"} type
7
- * @prop {string} portalId
8
- * @prop {string} serviceType
9
- * @prop {string} deviceInstance
10
- * @prop {string} dbusPath
11
- */
12
- /**
13
- * Splits a topic string into an object with properties for each "part"
14
- *
15
- * Topic structure is:
16
- * N/<portal ID>/<service_type>/<device instance>/<D-Bus path>
17
- *
18
- * See details at https://github.com/victronenergy/dbus-mqtt
19
- * @returns {Topic}
20
- */
21
- export var parseTopic = function (topic) {
22
- var parts = topic.split("/");
23
- var dbusPathParts = parts.splice(4);
24
- var isAcIn = dbusPathParts[0] === "Ac" && dbusPathParts[1] === "In";
25
- return {
26
- type: parts[0],
27
- portalId: parts[1],
28
- serviceType: parts[2],
29
- deviceInstance: parts[3] === "+" ? "+" : parseInt(parts[3]),
30
- dbusPath: "/" + (isAcIn ? dbusPathParts.splice(3).join("/") : dbusPathParts.join("/")),
31
- };
32
- };
33
- export var getMessageJson = function (message) {
2
+ export const getMessageJson = (message) => {
34
3
  try {
35
4
  return JSON.parse(message.toString());
36
5
  }
37
- catch (e) {
6
+ catch (_a) {
38
7
  Logger.error("Could not parse message: ", message.toString());
39
- return { value: null };
40
- }
41
- };
42
- export var objectValues = function (data) {
43
- return Object.keys(data).map(function (key) { return data[key]; });
44
- };
45
- export var isPathOfType = function (dbusPath, enumObject) {
46
- var paths = objectValues(enumObject);
47
- return paths.includes(dbusPath);
48
- };
49
- export var arrayToSubscriptionMap = function (toSubscribe) {
50
- return toSubscribe.reduce(function (acc, value) {
51
- acc[value] = 0;
52
- return acc;
53
- }, {});
54
- };
55
- export var getParameterByName = function (name, url) {
56
- if (!url)
57
- url = window.location.href;
58
- name = name.replace(/[[\]]/g, "\\$&");
59
- var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), results = regex.exec(url);
60
- if (!results)
61
- return null;
62
- if (!results[2])
63
- return "";
64
- return decodeURIComponent(results[2].replace(/\+/g, " "));
65
- };
66
- export var flatten = function (arrays) {
67
- return [].concat.apply([], arrays);
68
- };
69
- export var systemStateFormatter = function (value) {
70
- switch (value) {
71
- case VEBUS_SYSTEM_STATE.OFF:
72
- return "Off";
73
- case VEBUS_SYSTEM_STATE.LOW_POWER:
74
- return "Low power";
75
- case VEBUS_SYSTEM_STATE.FAULT_CONDITION:
76
- return "VE.Bus Fault condition";
77
- case VEBUS_SYSTEM_STATE.BULK_CHARGING:
78
- return "Bulk charging";
79
- case VEBUS_SYSTEM_STATE.ABSORPTION_CHARGINNG:
80
- return "Absorption charging";
81
- case VEBUS_SYSTEM_STATE.FLOAT_CHARGING:
82
- return "Float charging";
83
- case VEBUS_SYSTEM_STATE.STORAGE_MODE:
84
- return "Storage mode";
85
- case VEBUS_SYSTEM_STATE.EQUALISATION_CHARGING:
86
- return "Equalisation charging";
87
- case VEBUS_SYSTEM_STATE.PASSTHRU:
88
- return "Passthru";
89
- case VEBUS_SYSTEM_STATE.INVERTING:
90
- return "Inverting";
91
- case VEBUS_SYSTEM_STATE.ASSISTING:
92
- return "Assisting";
93
- case VEBUS_SYSTEM_STATE.POWER_SUPPLY_MODE:
94
- return "Power supply mode";
95
- case VEBUS_SYSTEM_STATE.DISCHARGING:
96
- return "Discharging";
97
- case VEBUS_SYSTEM_STATE.SUSTAIN:
98
- return "Sustain";
99
- default:
100
- return "--";
8
+ return { value: undefined };
101
9
  }
102
10
  };
103
- export var versionToHumanReadable = function (version) {
11
+ export const versionToHumanReadable = (version) => {
104
12
  if (typeof version !== "number" || isNaN(version)) {
105
- return version;
13
+ return String(version);
106
14
  }
107
- var major = version >> 16;
108
- var minor = (version >> 8) & 255;
109
- var rev = version & 255;
15
+ const major = version >> 16;
16
+ const minor = (version >> 8) & 255;
17
+ const rev = version & 255;
110
18
  return "v" + major.toString(16) + "." + minor.toString(16) + (rev ? "~" + rev.toString(16) : "");
111
19
  };
112
20
  //# sourceMappingURL=util.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sourceRoot":"/","sources":["src/utils/util.js"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAA;AAE7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAEhD;;;;;;;;GAQG;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAC,IAAM,UAAU,GAAG,UAAC,KAAK;IAC9B,IAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC9B,IAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;IACrC,IAAM,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,aAAa,CAAC,CAAC,CAAC,KAAK,IAAI,CAAA;IACrE,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;QACd,QAAQ,EAAE,KAAK,CAAC,CA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STATE } from \"./constants\"\n\n/**\n * @typedef {object} Topic\n *\n * @prop {\"N\" | \"R\" | \"W\"} type\n * @prop {string} portalId\n * @prop {string} serviceType\n * @prop {string} deviceInstance\n * @prop {string} dbusPath\n */\n\n/**\n * Splits a topic string into an object with properties for each \"part\"\n *\n * Topic structure is:\n * N/<portal ID>/<service_type>/<device instance>/<D-Bus path>\n *\n * See details at https://github.com/victronenergy/dbus-mqtt\n * @returns {Topic}\n */\nexport const parseTopic = (topic) => {\n const parts = topic.split(\"/\")\n const dbusPathParts = parts.splice(4)\n const isAcIn = dbusPathParts[0] === \"Ac\" && dbusPathParts[1] === \"In\"\n return {\n type: parts[0],\n portalId: parts[1],\n serviceType: parts[2],\n deviceInstance: parts[3] === \"+\" ? \"+\" : parseInt(parts[3]),\n dbusPath: \"/\" + (isAcIn ? dbusPathParts.splice(3).join(\"/\") : dbusPathParts.join(\"/\")),\n }\n}\n\nexport const getMessageJson = (message) => {\n try {\n return JSON.parse(message.toString())\n } catch (e) {\n Logger.error(\"Could not parse message: \", message.toString())\n return { value: null }\n }\n}\n\nexport const objectValues = (data) => {\n return Object.keys(data).map((key) => data[key])\n}\n\nexport const isPathOfType = (dbusPath, enumObject) => {\n const paths = objectValues(enumObject)\n return paths.includes(dbusPath)\n}\n\nexport const arrayToSubscriptionMap = (toSubscribe) => {\n return toSubscribe.reduce((acc, value) => {\n acc[value] = 0\n return acc\n }, {})\n}\n\nexport const getParameterByName = (name, url) => {\n if (!url) url = window.location.href\n name = name.replace(/[[\\]]/g, \"\\\\$&\")\n var regex = new RegExp(\"[?&]\" + name + \"(=([^&#]*)|&|#|$)\"),\n results = regex.exec(url)\n if (!results) return null\n if (!results[2]) return \"\"\n return decodeURIComponent(results[2].replace(/\\+/g, \" \"))\n}\n\nexport const flatten = (arrays) => {\n return [].concat(...arrays)\n}\n\nexport const systemStateFormatter = (value) => {\n switch (value) {\n case VEBUS_SYSTEM_STATE.OFF:\n return \"Off\"\n case VEBUS_SYSTEM_STATE.LOW_POWER:\n return \"Low power\"\n case VEBUS_SYSTEM_STATE.FAULT_CONDITION:\n return \"VE.Bus Fault condition\"\n case VEBUS_SYSTEM_STATE.BULK_CHARGING:\n return \"Bulk charging\"\n case VEBUS_SYSTEM_STATE.ABSORPTION_CHARGINNG:\n return \"Absorption charging\"\n case VEBUS_SYSTEM_STATE.FLOAT_CHARGING:\n return \"Float charging\"\n case VEBUS_SYSTEM_STATE.STORAGE_MODE:\n return \"Storage mode\"\n case VEBUS_SYSTEM_STATE.EQUALISATION_CHARGING:\n return \"Equalisation charging\"\n case VEBUS_SYSTEM_STATE.PASSTHRU:\n return \"Passthru\"\n case VEBUS_SYSTEM_STATE.INVERTING:\n return \"Inverting\"\n case VEBUS_SYSTEM_STATE.ASSISTING:\n return \"Assisting\"\n case VEBUS_SYSTEM_STATE.POWER_SUPPLY_MODE:\n return \"Power supply mode\"\n case VEBUS_SYSTEM_STATE.DISCHARGING:\n return \"Discharging\"\n case VEBUS_SYSTEM_STATE.SUSTAIN:\n return \"Sustain\"\n default:\n return \"--\"\n }\n}\n\nexport const versionToHumanReadable = (version) => {\n if (typeof version !== \"number\" || isNaN(version)) {\n return version\n }\n const major = version >> 16\n const minor = (version >> 8) & 255\n const rev = version & 255\n return \"v\" + major.toString(16) + \".\" + minor.toString(16) + (rev ? \"~\" + rev.toString(16) : \"\") \n}"]}
1
+ {"version":3,"file":"util.js","sourceRoot":"/","sources":["src/utils/util.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAA;AAE7B,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAE9B,EAAyD,EAAE;IAC1D,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAA;IACvC,CAAC;IAAC,WAAM,CAAC;QACP,MAAM,CAAC,KAAK,CAAC,2BAA2B,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAA;QAC7D,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAA;IAC7B,CAAC;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,OAAe,EAAU,EAAE;IAChE,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QAClD,OAAO,MAAM,CAAC,OAAO,CAAC,CAAA;IACxB,CAAC;IACD,MAAM,KAAK,GAAG,OAAO,IAAI,EAAE,CAAA;IAC3B,MAAM,KAAK,GAAG,CAAC,OAAO,IAAI,CAAC,CAAC,GAAG,GAAG,CAAA;IAClC,MAAM,GAAG,GAAG,OAAO,GAAG,GAAG,CAAA;IACzB,OAAO,GAAG,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,GAAG,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;AAClG,CAAC,CAAA","sourcesContent":["import Logger from \"./logger\"\n\nexport const getMessageJson = (message: {\n toString(): string\n}): { value: string | undefined; [key: string]: unknown } => {\n try {\n return JSON.parse(message.toString())\n } catch {\n Logger.error(\"Could not parse message: \", message.toString())\n return { value: undefined }\n }\n}\n\nexport const versionToHumanReadable = (version: number): string => {\n if (typeof version !== \"number\" || isNaN(version)) {\n return String(version)\n }\n const major = version >> 16\n const minor = (version >> 8) & 255\n const rev = version & 255\n return \"v\" + major.toString(16) + \".\" + minor.toString(16) + (rev ? \"~\" + rev.toString(16) : \"\")\n}\n"]}
package/package.json CHANGED
@@ -1,14 +1,16 @@
1
1
  {
2
2
  "name": "@victronenergy/mfd-modules",
3
- "version": "10.4.1",
3
+ "version": "11.0.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {
8
8
  "test": "echo \"Error: no test specified\" && exit 1",
9
9
  "build": "tsc",
10
+ "postbuild": "es-check es2015 'dist/**/*.js' --module",
10
11
  "semantic-release": "semantic-release",
11
- "lint": "eslint src/ --fix"
12
+ "lint": "eslint src/ --fix",
13
+ "type-check": "tsc --noEmit"
12
14
  },
13
15
  "publishConfig": {
14
16
  "access": "public"
@@ -19,31 +21,40 @@
19
21
  "author": "",
20
22
  "license": "ISC",
21
23
  "dependencies": {
22
- "axios": "^1.12.2",
23
- "js-cookie": "^3.0.5",
24
+ "axios": "^1.17.0",
25
+ "js-cookie": "^3.0.8",
24
26
  "localforage": "^1.10.0",
25
- "lodash-es": "^4.17.21",
26
- "mobx": "^6.15.0",
27
+ "lodash-es": "^4.18.1",
28
+ "mobx": "^6.15.4",
27
29
  "mobx-persist-store": "^1.1.8",
28
30
  "mobx-utils": "^6.1.1",
29
31
  "mqtt": "^4.3.8"
30
32
  },
31
33
  "devDependencies": {
32
- "@eslint/js": "^9.37.0",
34
+ "@eslint/js": "^10.0.1",
33
35
  "@semantic-release/git": "^10.0.1",
34
36
  "@semantic-release/npm": "^13.1.5",
35
37
  "@types/js-cookie": "^3.0.6",
36
38
  "@types/lodash-es": "^4.17.12",
37
- "@types/react": "^18.3.11",
38
- "eslint": "^9.37.0",
39
+ "@types/react": "^19.2.16",
40
+ "es-check": "^9.6.4",
41
+ "eslint": "^10.4.1",
39
42
  "eslint-config-prettier": "^10.1.8",
40
- "eslint-plugin-prettier": "^5.5.4",
41
- "prettier": "^3.6.2",
43
+ "eslint-plugin-compat": "^7.0.2",
44
+ "eslint-plugin-prettier": "^5.5.6",
45
+ "eslint-plugin-react-hooks": "^7.1.1",
46
+ "prettier": "^3.8.3",
42
47
  "semantic-release": "^25.0.3",
43
- "typescript": "^5.9.3",
44
- "typescript-eslint": "^8.46.0"
48
+ "typescript": "^6.0.3",
49
+ "typescript-eslint": "^8.60.1"
45
50
  },
46
51
  "peerDependencies": {
47
- "react": "17 || 18"
48
- }
52
+ "react": "17 || 18 || 19"
53
+ },
54
+ "engines": {
55
+ "node": ">=22"
56
+ },
57
+ "browserslist": [
58
+ "chrome >= 51"
59
+ ]
49
60
  }
@@ -1,13 +0,0 @@
1
- declare const _default: ({
2
- readonly rules: Readonly<import("eslint").Linter.RulesRecord>;
3
- } | import("typescript-eslint/dist/compatibility-types").CompatibleConfig | {
4
- files: string[];
5
- plugins: {
6
- prettier: import("eslint").ESLint.Plugin;
7
- };
8
- rules: {
9
- 'prettier/prettier': string;
10
- };
11
- })[];
12
- export default _default;
13
- //# sourceMappingURL=eslint.config.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"eslint.config.d.mts","sourceRoot":"/","sources":["eslint.config.mjs"],"names":[],"mappings":""}
@@ -1,28 +0,0 @@
1
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3
- if (ar || !(i in from)) {
4
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
5
- ar[i] = from[i];
6
- }
7
- }
8
- return to.concat(ar || Array.prototype.slice.call(from));
9
- };
10
- import js from '@eslint/js';
11
- import tseslint from 'typescript-eslint';
12
- import eslintConfigPrettier from 'eslint-config-prettier';
13
- import eslintPluginPrettier from 'eslint-plugin-prettier';
14
- export default __spreadArray(__spreadArray([
15
- js.configs.recommended
16
- ], tseslint.configs.recommended, true), [
17
- {
18
- files: ['**/*.ts', '**/*.tsx'],
19
- plugins: {
20
- prettier: eslintPluginPrettier,
21
- },
22
- rules: {
23
- 'prettier/prettier': 'warn', // or 'error'
24
- },
25
- },
26
- eslintConfigPrettier,
27
- ], false);
28
- //# sourceMappingURL=eslint.config.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"eslint.config.mjs","sourceRoot":"/","sources":["eslint.config.mjs"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAC1D,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAE1D;IACE,EAAE,CAAC,OAAO,CAAC,WAAW;GACnB,QAAQ,CAAC,OAAO,CAAC,WAAW;IAC/B;QACE,KAAK,EAAE,CAAC,SAAS,EAAE,UAAU,CAAC;QAC9B,OAAO,EAAE;YACP,QAAQ,EAAE,oBAAoB;SAC/B;QACD,KAAK,EAAE;YACL,mBAAmB,EAAE,MAAM,EAAE,aAAa;SAC3C;KACF;IACD,oBAAoB;UACpB","sourcesContent":["import js from '@eslint/js';\nimport tseslint from 'typescript-eslint';\nimport eslintConfigPrettier from 'eslint-config-prettier';\nimport eslintPluginPrettier from 'eslint-plugin-prettier';\n\nexport default [\n js.configs.recommended,\n ...tseslint.configs.recommended,\n {\n files: ['**/*.ts', '**/*.tsx'],\n plugins: {\n prettier: eslintPluginPrettier,\n },\n rules: {\n 'prettier/prettier': 'warn', // or 'error'\n },\n },\n eslintConfigPrettier,\n];\n"]}
@@ -1,11 +0,0 @@
1
- export type ShorePowerInputId = number | null | undefined;
2
- export interface ShorePowerInputState {
3
- inputId: ShorePowerInputId;
4
- }
5
- export declare class ShorePowerInputStore {
6
- inputId: ShorePowerInputId;
7
- constructor();
8
- setInputId: (inputId: ShorePowerInputId) => ShorePowerInputId;
9
- }
10
- export declare function useShorePowerInputStore(): ShorePowerInputStore;
11
- //# sourceMappingURL=ShorePowerInput.store.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ShorePowerInput.store.d.ts","sourceRoot":"/","sources":["src/Modules/ShorePowerInput/ShorePowerInput.store.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;AAEzD,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,iBAAiB,CAAA;CAC3B;AAED,qBAAa,oBAAoB;IAC/B,OAAO,EAAE,iBAAiB,CAAA;;IAM1B,UAAU,GAAI,SAAS,iBAAiB,uBAA2B;CACpE;AAYD,wBAAgB,uBAAuB,yBAEtC"}
@@ -1,37 +0,0 @@
1
- import { action, makeAutoObservable } from "mobx";
2
- import { useMemo } from "react";
3
- var store;
4
- var ShorePowerInputStore = /** @class */ (function () {
5
- function ShorePowerInputStore() {
6
- var _this = this;
7
- Object.defineProperty(this, "inputId", {
8
- enumerable: true,
9
- configurable: true,
10
- writable: true,
11
- value: void 0
12
- });
13
- Object.defineProperty(this, "setInputId", {
14
- enumerable: true,
15
- configurable: true,
16
- writable: true,
17
- value: function (inputId) { return _this.inputId = inputId; }
18
- });
19
- makeAutoObservable(this, { setInputId: action });
20
- }
21
- return ShorePowerInputStore;
22
- }());
23
- export { ShorePowerInputStore };
24
- function initializeStore() {
25
- var _store = store !== null && store !== void 0 ? store : new ShorePowerInputStore();
26
- // For SSG and SSR always create a new store
27
- if (typeof window === "undefined")
28
- return _store;
29
- // Create the store once in the client
30
- if (!store)
31
- store = _store;
32
- return _store;
33
- }
34
- export function useShorePowerInputStore() {
35
- return useMemo(function () { return initializeStore(); }, []);
36
- }
37
- //# sourceMappingURL=ShorePowerInput.store.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ShorePowerInput.store.js","sourceRoot":"/","sources":["src/Modules/ShorePowerInput/ShorePowerInput.store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAE/B,IAAI,KAA2B,CAAA;AAQ/B;IAGE;QAAA,iBAEC;QAJD;;;;;WAA0B;QAM1B;;;;mBAAa,UAAC,OAA0B,IAAK,OAAA,KAAI,CAAC,OAAO,GAAG,OAAO,EAAtB,CAAsB;WAAA;QAHjE,kBAAkB,CAAC,IAAI,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAA;IAClD,CAAC;IAGH,2BAAC;AAAD,CAAC,AARD,IAQC;;AAED,SAAS,eAAe;IACtB,IAAM,MAAM,GAAG,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,IAAI,oBAAoB,EAAE,CAAA;IAClD,4CAA4C;IAC5C,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO,MAAM,CAAA;IAChD,sCAAsC;IACtC,IAAI,CAAC,KAAK;QAAE,KAAK,GAAG,MAAM,CAAA;IAE1B,OAAO,MAAM,CAAA;AACf,CAAC;AAED,MAAM,UAAU,uBAAuB;IACrC,OAAO,OAAO,CAAC,cAAM,OAAA,eAAe,EAAE,EAAjB,CAAiB,EAAE,EAAE,CAAC,CAAA;AAC7C,CAAC","sourcesContent":["import { action, makeAutoObservable } from \"mobx\"\nimport { useMemo } from \"react\"\n\nlet store: ShorePowerInputStore\n\nexport type ShorePowerInputId = number | null | undefined\n\nexport interface ShorePowerInputState {\n inputId: ShorePowerInputId\n}\n\nexport class ShorePowerInputStore {\n inputId: ShorePowerInputId\n\n constructor() {\n makeAutoObservable(this, { setInputId: action })\n }\n\n setInputId = (inputId: ShorePowerInputId) => this.inputId = inputId\n}\n\nfunction initializeStore() {\n const _store = store ?? new ShorePowerInputStore()\n // For SSG and SSR always create a new store\n if (typeof window === \"undefined\") return _store\n // Create the store once in the client\n if (!store) store = _store\n\n return _store\n}\n\nexport function useShorePowerInputStore() {\n return useMemo(() => initializeStore(), [])\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SwitchableOutput.provider.d.ts","sourceRoot":"/","sources":["src/Modules/SwitchableOutputs/SwitchableOutput.provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAA2B,MAAM,SAAS,CAAA;AAEnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,iCAAiC,EACjC,0BAA0B,EAC3B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAmB,cAAc,EAAE,MAA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,UAAU,kBAAkB;;;;;;CAO5B,CAAA;AAEF,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,oBAAoB,EAC1B,QAAQ,EAAE,yBAAyB,EACnC,QAAQ,EAAE,kBAAkB,GAC3B,wBAAwB,CA2B1B"}
@@ -1,67 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- import { useMqtt, useTopicsState } from "../Mqtt";
13
- import { useMemo } from "react";
14
- import { hsvwArrayToJSON } from "../../utils/hsvw";
15
- export var SWITCHABLE_OUTPUT_TREES = ["system", "switch"];
16
- export function switchableOutputSupportsType(validType, type) {
17
- return (validType & (1 << type)) !== 0;
18
- }
19
- export var getSwitchableOutputNameForDisplay = function (state, switchingDeviceName) {
20
- // when custom name defined, or group not overriden
21
- if (state.customName || state.group === "") {
22
- return state.customName || state.name;
23
- }
24
- // otherwise prepend switching device name
25
- return "".concat(switchingDeviceName, " | ").concat(state.name);
26
- };
27
- export var getSwitchableOutputStateTopics = function (portalId, tree, deviceId, outputId) { return ({
28
- type: "N/".concat(portalId, "/").concat(tree, "/").concat(deviceId, "/SwitchableOutput/").concat(outputId, "/Settings/Type"),
29
- validTypes: "N/".concat(portalId, "/").concat(tree, "/").concat(deviceId, "/SwitchableOutput/").concat(outputId, "/Settings/ValidTypes"),
30
- status: "N/".concat(portalId, "/").concat(tree, "/").concat(deviceId, "/SwitchableOutput/").concat(outputId, "/Status"),
31
- name: "N/".concat(portalId, "/").concat(tree, "/").concat(deviceId, "/SwitchableOutput/").concat(outputId, "/Name"),
32
- customName: "N/".concat(portalId, "/").concat(tree, "/").concat(deviceId, "/SwitchableOutput/").concat(outputId, "/Settings/CustomName"),
33
- group: "N/".concat(portalId, "/").concat(tree, "/").concat(deviceId, "/SwitchableOutput/").concat(outputId, "/Settings/Group"),
34
- showUIControl: "N/".concat(portalId, "/").concat(tree, "/").concat(deviceId, "/SwitchableOutput/").concat(outputId, "/Settings/ShowUIControl"),
35
- auto: "N/".concat(portalId, "/").concat(tree, "/").concat(deviceId, "/SwitchableOutput/").concat(outputId, "/Auto"),
36
- state: "N/".concat(portalId, "/").concat(tree, "/").concat(deviceId, "/SwitchableOutput/").concat(outputId, "/State"),
37
- dimming: "N/".concat(portalId, "/").concat(tree, "/").concat(deviceId, "/SwitchableOutput/").concat(outputId, "/Dimming"),
38
- dimmingMin: "N/".concat(portalId, "/").concat(tree, "/").concat(deviceId, "/SwitchableOutput/").concat(outputId, "/Settings/DimmingMin"),
39
- dimmingMax: "N/".concat(portalId, "/").concat(tree, "/").concat(deviceId, "/SwitchableOutput/").concat(outputId, "/Settings/DimmingMax"),
40
- stepSize: "N/".concat(portalId, "/").concat(tree, "/").concat(deviceId, "/SwitchableOutput/").concat(outputId, "/Settings/StepSize"),
41
- measurement: "N/".concat(portalId, "/").concat(tree, "/").concat(deviceId, "/SwitchableOutput/").concat(outputId, "/Measurement"),
42
- unit: "N/".concat(portalId, "/").concat(tree, "/").concat(deviceId, "/SwitchableOutput/").concat(outputId, "/Settings/Unit"),
43
- decimals: "N/".concat(portalId, "/").concat(tree, "/").concat(deviceId, "/SwitchableOutput/").concat(outputId, "/Settings/Decimals"),
44
- labels: "N/".concat(portalId, "/").concat(tree, "/").concat(deviceId, "/SwitchableOutput/").concat(outputId, "/Settings/Labels"),
45
- lightControls: "N/".concat(portalId, "/").concat(tree, "/").concat(deviceId, "/SwitchableOutput/").concat(outputId, "/LightControls"),
46
- }); };
47
- export var getSwitchableOutputWriteTopics = function (portalId, tree, deviceId, outputId) { return ({
48
- type: "W/".concat(portalId, "/").concat(tree, "/").concat(deviceId, "/SwitchableOutput/").concat(outputId, "/Settings/Type"),
49
- auto: "W/".concat(portalId, "/").concat(tree, "/").concat(deviceId, "/SwitchableOutput/").concat(outputId, "/Auto"),
50
- state: "W/".concat(portalId, "/").concat(tree, "/").concat(deviceId, "/SwitchableOutput/").concat(outputId, "/State"),
51
- dimming: "W/".concat(portalId, "/").concat(tree, "/").concat(deviceId, "/SwitchableOutput/").concat(outputId, "/Dimming"),
52
- lightControls: "W/".concat(portalId, "/").concat(tree, "/").concat(deviceId, "/SwitchableOutput/").concat(outputId, "/LightControls"),
53
- }); };
54
- export function useSwitchableOutput(tree, deviceId, outputId) {
55
- var mqtt = useMqtt();
56
- var topics = useMemo(function () { return getSwitchableOutputStateTopics(mqtt.portalId, tree, deviceId, outputId); }, [mqtt.portalId, deviceId, outputId]);
57
- var writeTopics = useMemo(function () { return getSwitchableOutputWriteTopics(mqtt.portalId, tree, deviceId, outputId); }, [mqtt.portalId, deviceId, outputId]);
58
- var updateType = function (type) { return mqtt.publish(writeTopics.type, type); };
59
- var updateAuto = function (auto) { return mqtt.publish(writeTopics.auto, auto); };
60
- var updateState = function (state) { return mqtt.publish(writeTopics.state, state); };
61
- var updateDimming = function (dimming) { return mqtt.publish(writeTopics.dimming, dimming); };
62
- var updateLightControls = function (hsvwa) {
63
- return mqtt.publish(writeTopics.lightControls, { raw: hsvwArrayToJSON(hsvwa) });
64
- };
65
- return __assign(__assign({}, useTopicsState(topics)), { tree: tree, updateType: updateType, updateAuto: updateAuto, updateState: updateState, updateDimming: updateDimming, updateLightControls: updateLightControls });
66
- }
67
- //# sourceMappingURL=SwitchableOutput.provider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SwitchableOutput.provider.js","sourceRoot":"/","sources":["src/Modules/SwitchableOutputs/SwitchableOutput.provider.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAoB,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAQ/B,OAAO,EAAE,eAAe,EAAkB,MAAM,kBAAkB,CAAA;AAElE,MAAM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AC,OAAO,EAAE,OAAO,CAAC,EAA3C,CAA2C,CAAA;IACtF,IAAM,mBAAmB,GAAG,UAAC,KAAqB;QAChD,OAAA,IAAI,CAAC,OAAO,CAAC,WAAY,CAAC,aAAa,EAAE,EAAE,GAAG,EAAE,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;IAAzE,CAAyE,CAAA;IAE3E,6BACK,cAAc,CAAwB,MAAM,CAAC,KAChD,IAAI,EAAE,IAAI,EACV,UAAU,YAAA,EACV,UAAU,YAAA,EACV,WAAW,aAAA,EACX,aAAa,eAAA,EACb,mBAAmB,qBAAA,IACpB;AACH,CAAC","sourcesContent":["import { PortalId, Topics, useMqtt, useTopicsState } from \"../Mqtt\"\nimport { useMemo } from \"react\"\nimport { SwitchingDeviceInstanceId } from \"./SwitchingDevice.provider\"\nimport {\n SwitchableOutputStatus,\n SwitchableOutputType,\n SwitchableOutputValidTypesBitmask,\n SwitchableOutputVisibility,\n} from \"../../utils/constants\"\nimport { hsvwArrayToJSON, HSVWColorArray } from \"../../utils/hsvw\"\n\nexport const SWITCHABLE_OUTPUT_TREES = [\"system\", \"switch\"] as const\nexport type SwitchableOutputTree = (typeof SWITCHABLE_OUTPUT_TREES)[number]\nexport type SwitchableOutputId = string\nexport type SwitchableOutputUnit = string | \"/Speed\" | \"/Temperature\" | \"/Volume\"\n\nexport interface SwitchableOutputState {\n tree: SwitchableOutputTree\n deviceId: SwitchingDeviceInstanceId\n outputId: SwitchableOutputId\n type: SwitchableOutputType\n validTypes: SwitchableOutputValidTypesBitmask\n status: SwitchableOutputStatus\n name: string\n customName: string\n group: string\n parentDeviceName: string\n showUIControl: SwitchableOutputVisibility\n auto: 0 | 1\n state: 0 | 1\n dimming?: number\n dimmingMin?: number\n dimmingMax?: number\n // NOTE: stepSize can be of any precision, respect the precision in the UI\n stepSize?: number\n measurement?: number\n unit: SwitchableOutputUnit\n decimals?: number\n // NOTE: JSON encoded string array\n labels: string\n lightControls: HSVWColorArray\n}\n\nexport interface SwitchableOutputProvider extends SwitchableOutputState {\n updateType: (type: SwitchableOutputType) => void\n updateAuto: (auto: 0 | 1) => void\n updateState: (state: 0 | 1) => void\n updateDimming: (dimming: number) => void\n updateLightControls: (hsvwa: HSVWColorArray) => void\n}\n\nexport function switchableOutputSupportsType(\n validType: SwitchableOutputValidTypesBitmask,\n type: SwitchableOutputType\n): boolean {\n return (validType & (1 << type)) !== 0\n}\n\nexport interface SwitchableOutputTopics extends Topics {\n type?: string\n validTypes?: string\n status?: string\n name?: string\n customName?: string\n group?: string\n showUIControl?: string\n auto?: string\n state?: string\n dimming?: string\n dimmingMin?: string\n dimmingMax?: string\n stepSize?: string\n measurement?: string\n unit?: string\n labels?: string[]\n}\n\nexport const getSwitchableOutputNameForDisplay = (state: SwitchableOutputState, switchingDeviceName: string) => {\n // when custom name defined, or group not overriden\n if (state.customName || state.group === \"\") {\n return state.customName || state.name\n }\n // otherwise prepend switching device name\n return `${switchingDeviceName} | ${state.name}`\n}\n\nexport const getSwitchableOutputStateTopics = (\n portalId: PortalId,\n tree: SwitchableOutputTree,\n deviceId: SwitchingDeviceInstanceId,\n outputId: SwitchableOutputId\n) => ({\n type: `N/${portalId}/${tree}/${deviceId}/SwitchableOutput/${outputId}/Settings/Type`,\n validTypes: `N/${portalId}/${tree}/${deviceId}/SwitchableOutput/${outputId}/Settings/ValidTypes`,\n status: `N/${portalId}/${tree}/${deviceId}/SwitchableOutput/${outputId}/Status`,\n name: `N/${portalId}/${tree}/${deviceId}/SwitchableOutput/${outputId}/Name`,\n customName: `N/${portalId}/${tree}/${deviceId}/SwitchableOutput/${outputId}/Settings/CustomName`,\n group: `N/${portalId}/${tree}/${deviceId}/SwitchableOutput/${outputId}/Settings/Group`,\n showUIControl: `N/${portalId}/${tree}/${deviceId}/SwitchableOutput/${outputId}/Settings/ShowUIControl`,\n auto: `N/${portalId}/${tree}/${deviceId}/SwitchableOutput/${outputId}/Auto`,\n state: `N/${portalId}/${tree}/${deviceId}/SwitchableOutput/${outputId}/State`,\n dimming: `N/${portalId}/${tree}/${deviceId}/SwitchableOutput/${outputId}/Dimming`,\n dimmingMin: `N/${portalId}/${tree}/${deviceId}/SwitchableOutput/${outputId}/Settings/DimmingMin`,\n dimmingMax: `N/${portalId}/${tree}/${deviceId}/SwitchableOutput/${outputId}/Settings/DimmingMax`,\n stepSize: `N/${portalId}/${tree}/${deviceId}/SwitchableOutput/${outputId}/Settings/StepSize`,\n measurement: `N/${portalId}/${tree}/${deviceId}/SwitchableOutput/${outputId}/Measurement`,\n unit: `N/${portalId}/${tree}/${deviceId}/SwitchableOutput/${outputId}/Settings/Unit`,\n decimals: `N/${portalId}/${tree}/${deviceId}/SwitchableOutput/${outputId}/Settings/Decimals`,\n labels: `N/${portalId}/${tree}/${deviceId}/SwitchableOutput/${outputId}/Settings/Labels`,\n lightControls: `N/${portalId}/${tree}/${deviceId}/SwitchableOutput/${outputId}/LightControls`,\n})\n\nexport const getSwitchableOutputWriteTopics = (\n portalId: PortalId,\n tree: SwitchableOutputTree,\n deviceId: SwitchingDeviceInstanceId,\n outputId: SwitchableOutputId\n) => ({\n type: `W/${portalId}/${tree}/${deviceId}/SwitchableOutput/${outputId}/Settings/Type`,\n auto: `W/${portalId}/${tree}/${deviceId}/SwitchableOutput/${outputId}/Auto`,\n state: `W/${portalId}/${tree}/${deviceId}/SwitchableOutput/${outputId}/State`,\n dimming: `W/${portalId}/${tree}/${deviceId}/SwitchableOutput/${outputId}/Dimming`,\n lightControls: `W/${portalId}/${tree}/${deviceId}/SwitchableOutput/${outputId}/LightControls`,\n})\n\nexport function useSwitchableOutput(\n tree: SwitchableOutputTree,\n deviceId: SwitchingDeviceInstanceId,\n outputId: SwitchableOutputId\n): SwitchableOutputProvider {\n const mqtt = useMqtt()\n const topics = useMemo(\n () => getSwitchableOutputStateTopics(mqtt.portalId, tree, deviceId, outputId),\n [mqtt.portalId, deviceId, outputId]\n )\n const writeTopics = useMemo(\n () => getSwitchableOutputWriteTopics(mqtt.portalId, tree, deviceId, outputId),\n [mqtt.portalId, deviceId, outputId]\n )\n\n const updateType = (type: SwitchableOutputType) => mqtt.publish(writeTopics!.type, type)\n const updateAuto = (auto: 0 | 1) => mqtt.publish(writeTopics!.auto, auto)\n const updateState = (state: 0 | 1) => mqtt.publish(writeTopics!.state, state)\n const updateDimming = (dimming: number) => mqtt.publish(writeTopics!.dimming, dimming)\n const updateLightControls = (hsvwa: HSVWColorArray) =>\n mqtt.publish(writeTopics!.lightControls, { raw: hsvwArrayToJSON(hsvwa) })\n\n return {\n ...useTopicsState<SwitchableOutputState>(topics),\n tree: tree,\n updateType,\n updateAuto,\n updateState,\n updateDimming,\n updateLightControls,\n }\n}\n"]}
@@ -1,2 +0,0 @@
1
- export declare const useSwitchableOutputs: (gxDeviceRelaysGroupName: string) => import("./SwitchableOutputs.store").SwitchableOutputsStore;
2
- //# sourceMappingURL=SwitchableOutputs.provider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SwitchableOutputs.provider.d.ts","sourceRoot":"/","sources":["src/Modules/SwitchableOutputs/SwitchableOutputs.provider.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,oBAAoB,GAAI,yBAAyB,MAAM,+DAsKnE,CAAA"}