@pietrolubini/homebridge-ecoflow 1.4.0 → 1.5.0-beta.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 (47) hide show
  1. package/README.md +60 -0
  2. package/config.schema.json +1 -1
  3. package/dist/accessories/batteries/deltapro3/deltaPro3Accessory.d.ts +26 -0
  4. package/dist/accessories/batteries/deltapro3/deltaPro3Accessory.js +100 -0
  5. package/dist/accessories/batteries/deltapro3/deltaPro3Accessory.js.map +1 -0
  6. package/dist/accessories/batteries/deltapro3/deltaPro3Accessory.spec.d.ts +1 -0
  7. package/dist/accessories/batteries/deltapro3/interfaces/deltaPro3HttpApiContracts.d.ts +24 -0
  8. package/dist/accessories/batteries/deltapro3/interfaces/deltaPro3HttpApiContracts.js +10 -0
  9. package/dist/accessories/batteries/deltapro3/interfaces/deltaPro3HttpApiContracts.js.map +1 -0
  10. package/dist/accessories/batteries/deltapro3/interfaces/deltaPro3MqttApiContracts.d.ts +57 -0
  11. package/dist/accessories/batteries/deltapro3/interfaces/deltaPro3MqttApiContracts.js +3 -0
  12. package/dist/accessories/batteries/deltapro3/interfaces/deltaPro3MqttApiContracts.js.map +1 -0
  13. package/dist/accessories/batteries/deltapro3/services/deltaPro3OutletServiceBase.d.ts +5 -0
  14. package/dist/accessories/batteries/deltapro3/services/deltaPro3OutletServiceBase.js +23 -0
  15. package/dist/accessories/batteries/deltapro3/services/deltaPro3OutletServiceBase.js.map +1 -0
  16. package/dist/accessories/batteries/deltapro3/services/outletAcHvService.d.ts +8 -0
  17. package/dist/accessories/batteries/deltapro3/services/outletAcHvService.js +16 -0
  18. package/dist/accessories/batteries/deltapro3/services/outletAcHvService.js.map +1 -0
  19. package/dist/accessories/batteries/deltapro3/services/outletAcHvService.spec.d.ts +1 -0
  20. package/dist/accessories/batteries/deltapro3/services/outletAcLvService.d.ts +8 -0
  21. package/dist/accessories/batteries/deltapro3/services/outletAcLvService.js +16 -0
  22. package/dist/accessories/batteries/deltapro3/services/outletAcLvService.js.map +1 -0
  23. package/dist/accessories/batteries/deltapro3/services/outletAcLvService.spec.d.ts +1 -0
  24. package/dist/accessories/batteries/deltapro3/services/outletDc12vService.d.ts +8 -0
  25. package/dist/accessories/batteries/deltapro3/services/outletDc12vService.js +16 -0
  26. package/dist/accessories/batteries/deltapro3/services/outletDc12vService.js.map +1 -0
  27. package/dist/accessories/batteries/deltapro3/services/outletDc12vService.spec.d.ts +1 -0
  28. package/dist/accessories/batteries/deltapro3/services/switchXboostService.d.ts +9 -0
  29. package/dist/accessories/batteries/deltapro3/services/switchXboostService.js +33 -0
  30. package/dist/accessories/batteries/deltapro3/services/switchXboostService.js.map +1 -0
  31. package/dist/accessories/batteries/deltapro3/services/switchXboostService.spec.d.ts +1 -0
  32. package/dist/accessories/batteries/deltapro3/simulations/deltaPro3Simulator.d.ts +8 -0
  33. package/dist/accessories/batteries/deltapro3/simulations/deltaPro3Simulator.js +76 -0
  34. package/dist/accessories/batteries/deltapro3/simulations/deltaPro3Simulator.js.map +1 -0
  35. package/dist/accessories/ecoFlowAccessoryBase.js +4 -2
  36. package/dist/accessories/ecoFlowAccessoryBase.js.map +1 -1
  37. package/dist/apis/interfaces/mqttApiContracts.d.ts +4 -1
  38. package/dist/apis/interfaces/mqttApiContracts.js.map +1 -1
  39. package/dist/config.d.ts +1 -0
  40. package/dist/config.js +1 -0
  41. package/dist/config.js.map +1 -1
  42. package/dist/homebridge-ui/public/index.html +1 -1
  43. package/dist/homebridge-ui/public/index.js +1 -1
  44. package/dist/platform.js +6 -0
  45. package/dist/platform.js.map +1 -1
  46. package/junit.xml +602 -460
  47. package/package.json +1 -1
package/README.md CHANGED
@@ -30,6 +30,7 @@ The goal is to add HomeKit support to EcoFlow devices and make them fully contro
30
30
  - [Delta 2](#delta-2)
31
31
  - [Delta 2 Max](#delta-2-max)
32
32
  - [Delta Pro](#delta-pro)
33
+ - [Delta Pro 3](#delta-pro-3)
33
34
  - [Delta Pro Ultra](#delta-pro-ultra)
34
35
  - [PowerStream Micro-inverter](#powerstream-micro-inverter)
35
36
 
@@ -242,6 +243,65 @@ The following additional characteristics is available:
242
243
  }
243
244
  ```
244
245
 
246
+ ### Delta Pro 3
247
+
248
+ #### Services
249
+
250
+ | EcoFlow Parameter | Service | Characteristic | Standard | Permission |
251
+ | ----------------- | ------------- | ------------------------ | -------- | ---------- |
252
+ | Battery Level | Battery | BatteryLevel | ✅ | Read |
253
+ | Charging State | Battery | ChargingState | ✅ | Read |
254
+ | Battery Level | Battery | StatusLowBattery | ✅ | Read |
255
+ | AC HV | Outlet AC HV | On | ✅ | Read/Write |
256
+ | AC HV Output | Outlet AC HV | OutletInUse | ✅ | Read |
257
+ | Battery Level | Outlet AC HV | Battery Level, % | 🔲 | Read |
258
+ | Input | Outlet AC HV | Input Consumption, W | 🔲 | Read |
259
+ | Output | Outlet AC HV | Output Consumption, W | 🔲 | Read |
260
+ | Charging State | Outlet AC HV | ChargingState, Yes/No | 🔲 | Read |
261
+ | Battery Level | Outlet AC HV | StatusLowBattery, Yes/No | 🔲 | Read |
262
+ | AC LV | Outlet AC LV | On | ✅ | Read/Write |
263
+ | AC LV Output | Outlet AC LV | OutletInUse | ✅ | Read |
264
+ | Battery Level | Outlet AC LV | Battery Level, % | 🔲 | Read |
265
+ | Input | Outlet AC LV | Input Consumption, W | 🔲 | Read |
266
+ | Output | Outlet AC LV | Output Consumption, W | 🔲 | Read |
267
+ | Charging State | Outlet AC LV | ChargingState, Yes/No | 🔲 | Read |
268
+ | Battery Level | Outlet AC LV | StatusLowBattery, Yes/No | 🔲 | Read |
269
+ | DC 12V | Outlet DC 12V | On | ✅ | Read/Write |
270
+ | DC 12V Output | Outlet DC 12V | OutletInUse | ✅ | Read |
271
+ | Battery Level | Outlet DC 12V | Battery Level, % | 🔲 | Read |
272
+ | Input | Outlet DC 12V | Input Consumption, W | 🔲 | Read |
273
+ | Output | Outlet DC 12V | Output Consumption, W | 🔲 | Read |
274
+ | Charging State | Outlet DC 12V | ChargingState, Yes/No | 🔲 | Read |
275
+ | Battery Level | Outlet DC 12V | StatusLowBattery, Yes/No | 🔲 | Read |
276
+ | Switch X-Boost | Switch | On | ✅ | Read/Write |
277
+
278
+ #### Configuration
279
+
280
+ The following additional characteristics is available:
281
+
282
+ - Input Consumption, W
283
+ - Output Consumption, W
284
+ - Battery Level, %
285
+
286
+ ```json
287
+ {
288
+ ...
289
+ "devices": [
290
+ {
291
+ ...
292
+ "model": "Delta Pro 3",
293
+ "battery": {
294
+ "additionalCharacteristics": [
295
+ "Battery Level, %",
296
+ "Input Consumption, W",
297
+ "Output Consumption, W"
298
+ ]
299
+ }
300
+ }
301
+ ],
302
+ }
303
+ ```
304
+
245
305
  ### Delta Pro Ultra
246
306
 
247
307
  > Not Activated (no testing is performed)
@@ -32,7 +32,7 @@
32
32
  "type": "string",
33
33
  "default": "Delta 2",
34
34
  "required": true,
35
- "enum": ["Delta 2", "Delta 2 Max", "PowerStream"]
35
+ "enum": ["Delta 2", "Delta 2 Max", "Delta Pro 3", "PowerStream"]
36
36
  },
37
37
  "serialNumber": {
38
38
  "title": "Serial Number",
@@ -0,0 +1,26 @@
1
+ import { DeltaPro3AllQuotaData } from '@ecoflow/accessories/batteries/deltapro3/interfaces/deltaPro3HttpApiContracts';
2
+ import { EcoFlowAccessoryWithQuotaBase } from '@ecoflow/accessories/ecoFlowAccessoryWithQuotaBase';
3
+ import { EcoFlowHttpApiManager } from '@ecoflow/apis/ecoFlowHttpApiManager';
4
+ import { EcoFlowMqttApiManager } from '@ecoflow/apis/ecoFlowMqttApiManager';
5
+ import { MqttQuotaMessage } from '@ecoflow/apis/interfaces/mqttApiContracts';
6
+ import { DeviceConfig } from '@ecoflow/config';
7
+ import { BatteryStatusProvider } from '@ecoflow/helpers/batteryStatusProvider';
8
+ import { EcoFlowHomebridgePlatform } from '@ecoflow/platform';
9
+ import { ServiceBase } from '@ecoflow/services/serviceBase';
10
+ import { Logging, PlatformAccessory } from 'homebridge';
11
+ export declare class DeltaPro3Accessory extends EcoFlowAccessoryWithQuotaBase<DeltaPro3AllQuotaData> {
12
+ private readonly batteryStatusService;
13
+ private readonly outletAcHvService;
14
+ private readonly outletAcLvService;
15
+ private readonly outletDc12vService;
16
+ private readonly switchXboostService;
17
+ constructor(platform: EcoFlowHomebridgePlatform, accessory: PlatformAccessory, config: DeviceConfig, log: Logging, httpApiManager: EcoFlowHttpApiManager, mqttApiManager: EcoFlowMqttApiManager, batteryStatusProvider: BatteryStatusProvider);
18
+ protected getServices(): ServiceBase[];
19
+ protected processQuotaMessage(message: MqttQuotaMessage): void;
20
+ protected initializeQuota(quota: DeltaPro3AllQuotaData | null): DeltaPro3AllQuotaData;
21
+ protected updateInitialValues(data: DeltaPro3AllQuotaData): void;
22
+ private updateSocValues;
23
+ private updateInputWattsValues;
24
+ private updateOutputWattsValues;
25
+ private updateSwitchStateValues;
26
+ }
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeltaPro3Accessory = void 0;
4
+ const deltaPro3HttpApiContracts_1 = require("@ecoflow/accessories/batteries/deltapro3/interfaces/deltaPro3HttpApiContracts");
5
+ const outletAcHvService_1 = require("@ecoflow/accessories/batteries/deltapro3/services/outletAcHvService");
6
+ const outletAcLvService_1 = require("@ecoflow/accessories/batteries/deltapro3/services/outletAcLvService");
7
+ const outletDc12vService_1 = require("@ecoflow/accessories/batteries/deltapro3/services/outletDc12vService");
8
+ const switchXboostService_1 = require("@ecoflow/accessories/batteries/deltapro3/services/switchXboostService");
9
+ const batteryHttpApiContracts_1 = require("@ecoflow/accessories/batteries/interfaces/batteryHttpApiContracts");
10
+ const ecoFlowAccessoryWithQuotaBase_1 = require("@ecoflow/accessories/ecoFlowAccessoryWithQuotaBase");
11
+ const batteryStatusService_1 = require("@ecoflow/services/batteryStatusService");
12
+ class DeltaPro3Accessory extends ecoFlowAccessoryWithQuotaBase_1.EcoFlowAccessoryWithQuotaBase {
13
+ batteryStatusService;
14
+ outletAcHvService;
15
+ outletAcLvService;
16
+ outletDc12vService;
17
+ switchXboostService;
18
+ constructor(platform, accessory, config, log, httpApiManager, mqttApiManager, batteryStatusProvider) {
19
+ super(platform, accessory, config, log, httpApiManager, mqttApiManager);
20
+ this.batteryStatusService = new batteryStatusService_1.BatteryStatusService(this, batteryStatusProvider);
21
+ this.outletAcHvService = new outletAcHvService_1.OutletAcHvService(this, batteryStatusProvider);
22
+ this.outletAcLvService = new outletAcLvService_1.OutletAcLvService(this, batteryStatusProvider);
23
+ this.outletDc12vService = new outletDc12vService_1.OutletDc12vService(this, batteryStatusProvider);
24
+ this.switchXboostService = new switchXboostService_1.SwitchXboostService(this);
25
+ }
26
+ getServices() {
27
+ return [
28
+ this.batteryStatusService,
29
+ this.outletAcHvService,
30
+ this.outletAcLvService,
31
+ this.outletDc12vService,
32
+ this.switchXboostService,
33
+ ];
34
+ }
35
+ processQuotaMessage(message) {
36
+ const data = message.data;
37
+ Object.assign(this.quota, data);
38
+ this.updateSocValues(data);
39
+ this.updateInputWattsValues(data);
40
+ this.updateOutputWattsValues(data);
41
+ this.updateSwitchStateValues(data);
42
+ }
43
+ initializeQuota(quota) {
44
+ const result = quota ?? {};
45
+ return result;
46
+ }
47
+ updateInitialValues(data) {
48
+ const message = {
49
+ data,
50
+ };
51
+ this.processQuotaMessage(message);
52
+ }
53
+ updateSocValues(params) {
54
+ if (params.cmsBattSoc !== undefined && params.cmsMinDsgSoc !== undefined) {
55
+ this.batteryStatusService.updateBatteryLevel(params.cmsBattSoc, params.cmsMinDsgSoc);
56
+ this.outletAcHvService.updateBatteryLevel(params.cmsBattSoc, params.cmsMinDsgSoc);
57
+ this.outletAcLvService.updateBatteryLevel(params.cmsBattSoc, params.cmsMinDsgSoc);
58
+ this.outletDc12vService.updateBatteryLevel(params.cmsBattSoc, params.cmsMinDsgSoc);
59
+ }
60
+ }
61
+ updateInputWattsValues(params) {
62
+ if (params.powInSumW !== undefined) {
63
+ const isCharging = params.powInSumW > 0 && (params.powOutSumW === undefined || params.powInSumW !== params.powOutSumW);
64
+ this.batteryStatusService.updateChargingState(isCharging);
65
+ this.outletAcHvService.updateChargingState(isCharging);
66
+ this.outletAcLvService.updateChargingState(isCharging);
67
+ this.outletDc12vService.updateChargingState(isCharging);
68
+ this.outletAcHvService.updateInputConsumption(params.powInSumW);
69
+ this.outletAcLvService.updateInputConsumption(params.powInSumW);
70
+ this.outletDc12vService.updateInputConsumption(params.powInSumW);
71
+ }
72
+ }
73
+ updateOutputWattsValues(params) {
74
+ if (params.powGetAcHvOut !== undefined) {
75
+ this.outletAcHvService.updateOutputConsumption(params.powGetAcHvOut);
76
+ }
77
+ if (params.powGetAcLvOut !== undefined) {
78
+ this.outletAcLvService.updateOutputConsumption(params.powGetAcLvOut);
79
+ }
80
+ if (params.powGet12v !== undefined) {
81
+ this.outletDc12vService.updateOutputConsumption(params.powGet12v);
82
+ }
83
+ }
84
+ updateSwitchStateValues(params) {
85
+ if (params.flowInfoAcHvOut !== undefined && params.flowInfoAcHvOut !== deltaPro3HttpApiContracts_1.DeltaPro3AcEnableType.Ignore) {
86
+ this.outletAcHvService.updateState(params.flowInfoAcHvOut === deltaPro3HttpApiContracts_1.DeltaPro3AcEnableType.On);
87
+ }
88
+ if (params.flowInfoAcLvOut !== undefined && params.flowInfoAcLvOut !== deltaPro3HttpApiContracts_1.DeltaPro3AcEnableType.Ignore) {
89
+ this.outletAcLvService.updateState(params.flowInfoAcLvOut === deltaPro3HttpApiContracts_1.DeltaPro3AcEnableType.On);
90
+ }
91
+ if (params.flowInfo12v !== undefined && params.flowInfo12v !== deltaPro3HttpApiContracts_1.DeltaPro3AcEnableType.Ignore) {
92
+ this.outletDc12vService.updateState(params.flowInfo12v === deltaPro3HttpApiContracts_1.DeltaPro3AcEnableType.On);
93
+ }
94
+ if (params.xboostEn !== undefined && params.xboostEn !== batteryHttpApiContracts_1.AcXBoostType.Ignore) {
95
+ this.switchXboostService.updateState(params.xboostEn === batteryHttpApiContracts_1.AcXBoostType.On);
96
+ }
97
+ }
98
+ }
99
+ exports.DeltaPro3Accessory = DeltaPro3Accessory;
100
+ //# sourceMappingURL=deltaPro3Accessory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deltaPro3Accessory.js","sourceRoot":"","sources":["../../../../src/accessories/batteries/deltapro3/deltaPro3Accessory.ts"],"names":[],"mappings":";;;AAAA,6HAGuF;AAEvF,2GAAwG;AACxG,2GAAwG;AACxG,6GAA0G;AAC1G,+GAA4G;AAC5G,+GAAiG;AACjG,sGAAmG;AAOnG,iFAA8E;AAI9E,MAAa,kBAAmB,SAAQ,6DAAoD;IACzE,oBAAoB,CAAuB;IAC3C,iBAAiB,CAAoB;IACrC,iBAAiB,CAAoB;IACrC,kBAAkB,CAAqB;IACvC,mBAAmB,CAAsB;IAE1D,YACE,QAAmC,EACnC,SAA4B,EAC5B,MAAoB,EACpB,GAAY,EACZ,cAAqC,EACrC,cAAqC,EACrC,qBAA4C;QAE5C,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC;QACxE,IAAI,CAAC,oBAAoB,GAAG,IAAI,2CAAoB,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;QAClF,IAAI,CAAC,iBAAiB,GAAG,IAAI,qCAAiB,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;QAC5E,IAAI,CAAC,iBAAiB,GAAG,IAAI,qCAAiB,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;QAC5E,IAAI,CAAC,kBAAkB,GAAG,IAAI,uCAAkB,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;QAC9E,IAAI,CAAC,mBAAmB,GAAG,IAAI,yCAAmB,CAAC,IAAI,CAAC,CAAC;IAC3D,CAAC;IAEkB,WAAW;QAC5B,OAAO;YACL,IAAI,CAAC,oBAAoB;YACzB,IAAI,CAAC,iBAAiB;YACtB,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C;IACH,CAAC;IAEO,uBAAuB,CAAC,MAA6B;QAC3D,IAAI,MAAM,CAAC,eAAe,KAAK,SAAS,IAAI,MAAM,CAAC,eAAe,KAAK,iDAAqB,CAAC,MAAM,EAAE,CAAC;YACpG,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,MAAM,CAAC,eAAe,KAAK,iDAAqB,CAAC,EAAE,CAAC,CAAC;QAC1F,CAAC;QACD,IAAI,MAAM,CAAC,eAAe,KAAK,SAAS,IAAI,MAAM,CAAC,eAAe,KAAK,iDAAqB,CAAC,MAAM,EAAE,CAAC;YACpG,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,MAAM,CAAC,eAAe,KAAK,iDAAqB,CAAC,EAAE,CAAC,CAAC;QAC1F,CAAC;QACD,IAAI,MAAM,CAAC,WAAW,KAAK,SAAS,IAAI,MAAM,CAAC,WAAW,KAAK,iDAAqB,CAAC,MAAM,EAAE,CAAC;YAC5F,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,MAAM,CAAC,WAAW,KAAK,iDAAqB,CAAC,EAAE,CAAC,CAAC;QACvF,CAAC;QACD,IAAI,MAAM,CAAC,QAAQ,KAAK,SAAS,IAAI,MAAM,CAAC,QAAQ,KAAK,sCAAY,CAAC,MAAM,EAAE,CAAC;YAC7E,IAAI,CAAC,mBAAmB,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,KAAK,sCAAY,CAAC,EAAE,CAAC,CAAC;QAC5E,CAAC;IACH,CAAC;CACF;AAxGD,gDAwGC"}
@@ -0,0 +1,24 @@
1
+ import { AcXBoostType } from '@ecoflow/accessories/batteries/interfaces/batteryHttpApiContracts';
2
+ export declare enum DeltaPro3AcEnableType {
3
+ Off = 0,
4
+ On = 2,
5
+ Ignore = 255
6
+ }
7
+ export interface DeltaPro3AllQuotaData {
8
+ cmsBattSoc?: number;
9
+ cmsMinDsgSoc?: number;
10
+ xboostEn?: AcXBoostType;
11
+ powInSumW?: number;
12
+ powOutSumW?: number;
13
+ flowInfoAcLvOut?: DeltaPro3AcEnableType;
14
+ powGetAcLvOut?: number;
15
+ flowInfoAcHvOut?: DeltaPro3AcEnableType;
16
+ powGetAcHvOut?: number;
17
+ powGetAc?: number;
18
+ flowInfo12v?: DeltaPro3AcEnableType;
19
+ powGet12v?: number;
20
+ powGetTypec1?: number;
21
+ powGetTypec2?: number;
22
+ powGetQcusb1?: number;
23
+ powGetQcusb2?: number;
24
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeltaPro3AcEnableType = void 0;
4
+ var DeltaPro3AcEnableType;
5
+ (function (DeltaPro3AcEnableType) {
6
+ DeltaPro3AcEnableType[DeltaPro3AcEnableType["Off"] = 0] = "Off";
7
+ DeltaPro3AcEnableType[DeltaPro3AcEnableType["On"] = 2] = "On";
8
+ DeltaPro3AcEnableType[DeltaPro3AcEnableType["Ignore"] = 255] = "Ignore";
9
+ })(DeltaPro3AcEnableType || (exports.DeltaPro3AcEnableType = DeltaPro3AcEnableType = {}));
10
+ //# sourceMappingURL=deltaPro3HttpApiContracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deltaPro3HttpApiContracts.js","sourceRoot":"","sources":["../../../../../src/accessories/batteries/deltapro3/interfaces/deltaPro3HttpApiContracts.ts"],"names":[],"mappings":";;;AAEA,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC/B,+DAAO,CAAA;IACP,6DAAM,CAAA;IACN,uEAAa,CAAA;AACf,CAAC,EAJW,qBAAqB,qCAArB,qBAAqB,QAIhC"}
@@ -0,0 +1,57 @@
1
+ import { DeltaPro3AcEnableType } from '@ecoflow/accessories/batteries/deltapro3/interfaces/deltaPro3HttpApiContracts';
2
+ import { MqttQuotaMessage, MqttQuotaMessageWithData, MqttSetMessage, MqttSetMessageWithParams, MqttSetReplyMessageData, MqttSetReplyMessageWithData } from '@ecoflow/apis/interfaces/mqttApiContracts';
3
+ export interface DeltaPro3MqttQuotaMessage extends MqttQuotaMessage {
4
+ }
5
+ export interface DeltaPro3MqttQuotaMessageWithParams<TParams> extends MqttQuotaMessageWithData<TParams>, DeltaPro3MqttQuotaMessage {
6
+ }
7
+ export type DeltaPro3MqttSetCmdIdType = 17;
8
+ export type DeltaPro3MqttSetDirType = 1;
9
+ export type DeltaPro3MqttSetCmdFuncType = 254;
10
+ export type DeltaPro3MqttSetDestType = 2;
11
+ export type DeltaPro3MqttSetAckType = true;
12
+ export interface DeltaPro3MqttSetMessage extends MqttSetMessage {
13
+ sn: string;
14
+ cmdId: DeltaPro3MqttSetCmdIdType;
15
+ dirDest: DeltaPro3MqttSetDirType;
16
+ dirSrc: DeltaPro3MqttSetDirType;
17
+ cmdFunc: DeltaPro3MqttSetCmdFuncType;
18
+ dest: DeltaPro3MqttSetDestType;
19
+ needAck: DeltaPro3MqttSetAckType;
20
+ }
21
+ export interface DeltaPro3MqttSetMessageParams {
22
+ }
23
+ export interface DeltaPro3MqttSetMessageWithParams<TParams extends DeltaPro3MqttSetMessageParams> extends MqttSetMessageWithParams<TParams>, DeltaPro3MqttSetMessage {
24
+ }
25
+ export interface DeltaPro3MqttSetAcHvMessageParams extends DeltaPro3MqttSetMessageParams {
26
+ cfgHvAcOutOpen: boolean;
27
+ }
28
+ export interface DeltaPro3MqttSetAcLvMessageParams extends DeltaPro3MqttSetMessageParams {
29
+ cfgLvAcOutOpen: boolean;
30
+ }
31
+ export interface DeltaPro3MqttSetDc12vMessageParams extends DeltaPro3MqttSetMessageParams {
32
+ cfgDc12vOutOpen: boolean;
33
+ }
34
+ export interface DeltaPro3MqttSetXBoostMessageParams extends DeltaPro3MqttSetMessageParams {
35
+ cfgXboostEn: boolean;
36
+ }
37
+ export interface DeltaPro3MqttSetReplyMessageData extends MqttSetReplyMessageData {
38
+ actionId: number;
39
+ }
40
+ export interface DeltaPro3MqttSetAcHvReplyMessageData extends DeltaPro3MqttSetReplyMessageData {
41
+ flowInfoAcHvOut: DeltaPro3AcEnableType;
42
+ }
43
+ export interface DeltaPro3MqttSetAcLvReplyMessageData extends DeltaPro3MqttSetReplyMessageData {
44
+ flowInfoAcLvOut: DeltaPro3AcEnableType;
45
+ }
46
+ export interface DeltaPro3MqttSetDc12vReplyMessageData extends DeltaPro3MqttSetReplyMessageData {
47
+ flowInfo12v: DeltaPro3AcEnableType;
48
+ }
49
+ export interface DeltaPro3MqttSetXBoostReplyMessageData extends DeltaPro3MqttSetReplyMessageData {
50
+ xboostEn: boolean;
51
+ }
52
+ export interface DeltaPro3MqttSetReplyMessage<TData extends DeltaPro3MqttSetReplyMessageData> extends MqttSetReplyMessageWithData<TData> {
53
+ code: string;
54
+ message: string;
55
+ eagleEyeTraceId: string;
56
+ tid: string;
57
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=deltaPro3MqttApiContracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deltaPro3MqttApiContracts.js","sourceRoot":"","sources":["../../../../../src/accessories/batteries/deltapro3/interfaces/deltaPro3MqttApiContracts.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { DeltaPro3MqttSetMessageParams } from '@ecoflow/accessories/batteries/deltapro3/interfaces/deltaPro3MqttApiContracts';
2
+ import { OutletServiceBase } from '@ecoflow/services/outletServiceBase';
3
+ export declare abstract class DeltaPro3OutletServiceBase extends OutletServiceBase {
4
+ protected sendOn<TParams extends DeltaPro3MqttSetMessageParams>(params: TParams, revert: () => void): Promise<void>;
5
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeltaPro3OutletServiceBase = void 0;
4
+ const outletServiceBase_1 = require("@ecoflow/services/outletServiceBase");
5
+ class DeltaPro3OutletServiceBase extends outletServiceBase_1.OutletServiceBase {
6
+ sendOn(params, revert) {
7
+ const message = {
8
+ id: 0,
9
+ version: '',
10
+ sn: this.ecoFlowAccessory.config.serialNumber,
11
+ cmdId: 17,
12
+ dirDest: 1,
13
+ dirSrc: 1,
14
+ cmdFunc: 254,
15
+ dest: 2,
16
+ needAck: true,
17
+ params,
18
+ };
19
+ return this.ecoFlowAccessory.sendSetCommand(message, revert);
20
+ }
21
+ }
22
+ exports.DeltaPro3OutletServiceBase = DeltaPro3OutletServiceBase;
23
+ //# sourceMappingURL=deltaPro3OutletServiceBase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deltaPro3OutletServiceBase.js","sourceRoot":"","sources":["../../../../../src/accessories/batteries/deltapro3/services/deltaPro3OutletServiceBase.ts"],"names":[],"mappings":";;;AAIA,2EAAwE;AAExE,MAAsB,0BAA2B,SAAQ,qCAAiB;IAC9D,MAAM,CAAgD,MAAe,EAAE,MAAkB;QACjG,MAAM,OAAO,GAA+C;YAC1D,EAAE,EAAE,CAAC;YACL,OAAO,EAAE,EAAE;YACX,EAAE,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,YAAY;YAC7C,KAAK,EAAE,EAAE;YACT,OAAO,EAAE,CAAC;YACV,MAAM,EAAE,CAAC;YACT,OAAO,EAAE,GAAG;YACZ,IAAI,EAAE,CAAC;YACP,OAAO,EAAE,IAAI;YACb,MAAM;SACP,CAAC;QAEF,OAAO,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC/D,CAAC;CACF;AAjBD,gEAiBC"}
@@ -0,0 +1,8 @@
1
+ import { DeltaPro3AllQuotaData } from '@ecoflow/accessories/batteries/deltapro3/interfaces/deltaPro3HttpApiContracts';
2
+ import { DeltaPro3OutletServiceBase } from '@ecoflow/accessories/batteries/deltapro3/services/deltaPro3OutletServiceBase';
3
+ import { EcoFlowAccessoryWithQuotaBase } from '@ecoflow/accessories/ecoFlowAccessoryWithQuotaBase';
4
+ import { BatteryStatusProvider } from '@ecoflow/helpers/batteryStatusProvider';
5
+ export declare class OutletAcHvService extends DeltaPro3OutletServiceBase {
6
+ constructor(ecoFlowAccessory: EcoFlowAccessoryWithQuotaBase<DeltaPro3AllQuotaData>, batteryStatusProvider: BatteryStatusProvider);
7
+ protected setOn(value: boolean, revert: () => void): Promise<void>;
8
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OutletAcHvService = void 0;
4
+ const deltaPro3OutletServiceBase_1 = require("@ecoflow/accessories/batteries/deltapro3/services/deltaPro3OutletServiceBase");
5
+ class OutletAcHvService extends deltaPro3OutletServiceBase_1.DeltaPro3OutletServiceBase {
6
+ constructor(ecoFlowAccessory, batteryStatusProvider) {
7
+ super(ecoFlowAccessory, batteryStatusProvider, 'AC HV', ecoFlowAccessory.config.battery?.additionalCharacteristics);
8
+ }
9
+ setOn(value, revert) {
10
+ return this.sendOn({
11
+ cfgHvAcOutOpen: value,
12
+ }, revert);
13
+ }
14
+ }
15
+ exports.OutletAcHvService = OutletAcHvService;
16
+ //# sourceMappingURL=outletAcHvService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outletAcHvService.js","sourceRoot":"","sources":["../../../../../src/accessories/batteries/deltapro3/services/outletAcHvService.ts"],"names":[],"mappings":";;;AAEA,6HAA0H;AAI1H,MAAa,iBAAkB,SAAQ,uDAA0B;IAC/D,YACE,gBAAsE,EACtE,qBAA4C;QAE5C,KAAK,CAAC,gBAAgB,EAAE,qBAAqB,EAAE,OAAO,EAAE,gBAAgB,CAAC,MAAM,CAAC,OAAO,EAAE,yBAAyB,CAAC,CAAC;IACtH,CAAC;IAEkB,KAAK,CAAC,KAAc,EAAE,MAAkB;QACzD,OAAO,IAAI,CAAC,MAAM,CAChB;YACE,cAAc,EAAE,KAAK;SACtB,EACD,MAAM,CACP,CAAC;IACJ,CAAC;CACF;AAhBD,8CAgBC"}
@@ -0,0 +1,8 @@
1
+ import { DeltaPro3AllQuotaData } from '@ecoflow/accessories/batteries/deltapro3/interfaces/deltaPro3HttpApiContracts';
2
+ import { DeltaPro3OutletServiceBase } from '@ecoflow/accessories/batteries/deltapro3/services/deltaPro3OutletServiceBase';
3
+ import { EcoFlowAccessoryWithQuotaBase } from '@ecoflow/accessories/ecoFlowAccessoryWithQuotaBase';
4
+ import { BatteryStatusProvider } from '@ecoflow/helpers/batteryStatusProvider';
5
+ export declare class OutletAcLvService extends DeltaPro3OutletServiceBase {
6
+ constructor(ecoFlowAccessory: EcoFlowAccessoryWithQuotaBase<DeltaPro3AllQuotaData>, batteryStatusProvider: BatteryStatusProvider);
7
+ protected setOn(value: boolean, revert: () => void): Promise<void>;
8
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OutletAcLvService = void 0;
4
+ const deltaPro3OutletServiceBase_1 = require("@ecoflow/accessories/batteries/deltapro3/services/deltaPro3OutletServiceBase");
5
+ class OutletAcLvService extends deltaPro3OutletServiceBase_1.DeltaPro3OutletServiceBase {
6
+ constructor(ecoFlowAccessory, batteryStatusProvider) {
7
+ super(ecoFlowAccessory, batteryStatusProvider, 'AC LV', ecoFlowAccessory.config.battery?.additionalCharacteristics);
8
+ }
9
+ setOn(value, revert) {
10
+ return this.sendOn({
11
+ cfgLvAcOutOpen: value,
12
+ }, revert);
13
+ }
14
+ }
15
+ exports.OutletAcLvService = OutletAcLvService;
16
+ //# sourceMappingURL=outletAcLvService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outletAcLvService.js","sourceRoot":"","sources":["../../../../../src/accessories/batteries/deltapro3/services/outletAcLvService.ts"],"names":[],"mappings":";;;AAEA,6HAA0H;AAI1H,MAAa,iBAAkB,SAAQ,uDAA0B;IAC/D,YACE,gBAAsE,EACtE,qBAA4C;QAE5C,KAAK,CAAC,gBAAgB,EAAE,qBAAqB,EAAE,OAAO,EAAE,gBAAgB,CAAC,MAAM,CAAC,OAAO,EAAE,yBAAyB,CAAC,CAAC;IACtH,CAAC;IAEkB,KAAK,CAAC,KAAc,EAAE,MAAkB;QACzD,OAAO,IAAI,CAAC,MAAM,CAChB;YACE,cAAc,EAAE,KAAK;SACtB,EACD,MAAM,CACP,CAAC;IACJ,CAAC;CACF;AAhBD,8CAgBC"}
@@ -0,0 +1,8 @@
1
+ import { DeltaPro3AllQuotaData } from '@ecoflow/accessories/batteries/deltapro3/interfaces/deltaPro3HttpApiContracts';
2
+ import { DeltaPro3OutletServiceBase } from '@ecoflow/accessories/batteries/deltapro3/services/deltaPro3OutletServiceBase';
3
+ import { EcoFlowAccessoryWithQuotaBase } from '@ecoflow/accessories/ecoFlowAccessoryWithQuotaBase';
4
+ import { BatteryStatusProvider } from '@ecoflow/helpers/batteryStatusProvider';
5
+ export declare class OutletDc12vService extends DeltaPro3OutletServiceBase {
6
+ constructor(ecoFlowAccessory: EcoFlowAccessoryWithQuotaBase<DeltaPro3AllQuotaData>, batteryStatusProvider: BatteryStatusProvider);
7
+ protected setOn(value: boolean, revert: () => void): Promise<void>;
8
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OutletDc12vService = void 0;
4
+ const deltaPro3OutletServiceBase_1 = require("@ecoflow/accessories/batteries/deltapro3/services/deltaPro3OutletServiceBase");
5
+ class OutletDc12vService extends deltaPro3OutletServiceBase_1.DeltaPro3OutletServiceBase {
6
+ constructor(ecoFlowAccessory, batteryStatusProvider) {
7
+ super(ecoFlowAccessory, batteryStatusProvider, 'DC 12V', ecoFlowAccessory.config.battery?.additionalCharacteristics);
8
+ }
9
+ setOn(value, revert) {
10
+ return this.sendOn({
11
+ cfgDc12vOutOpen: value,
12
+ }, revert);
13
+ }
14
+ }
15
+ exports.OutletDc12vService = OutletDc12vService;
16
+ //# sourceMappingURL=outletDc12vService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outletDc12vService.js","sourceRoot":"","sources":["../../../../../src/accessories/batteries/deltapro3/services/outletDc12vService.ts"],"names":[],"mappings":";;;AAEA,6HAA0H;AAI1H,MAAa,kBAAmB,SAAQ,uDAA0B;IAChE,YACE,gBAAsE,EACtE,qBAA4C;QAE5C,KAAK,CAAC,gBAAgB,EAAE,qBAAqB,EAAE,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,OAAO,EAAE,yBAAyB,CAAC,CAAC;IACvH,CAAC;IAEkB,KAAK,CAAC,KAAc,EAAE,MAAkB;QACzD,OAAO,IAAI,CAAC,MAAM,CAChB;YACE,eAAe,EAAE,KAAK;SACvB,EACD,MAAM,CACP,CAAC;IACJ,CAAC;CACF;AAhBD,gDAgBC"}
@@ -0,0 +1,9 @@
1
+ import { DeltaPro3AllQuotaData } from '@ecoflow/accessories/batteries/deltapro3/interfaces/deltaPro3HttpApiContracts';
2
+ import { EcoFlowAccessoryWithQuotaBase } from '@ecoflow/accessories/ecoFlowAccessoryWithQuotaBase';
3
+ import { SwitchXboostServiceBase } from '@ecoflow/services/switchXboostServiceBase';
4
+ export declare class SwitchXboostService extends SwitchXboostServiceBase {
5
+ protected readonly ecoFlowAccessory: EcoFlowAccessoryWithQuotaBase<DeltaPro3AllQuotaData>;
6
+ constructor(ecoFlowAccessory: EcoFlowAccessoryWithQuotaBase<DeltaPro3AllQuotaData>);
7
+ protected setOn(value: boolean, revert: () => void): Promise<void>;
8
+ private sendOn;
9
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SwitchXboostService = void 0;
4
+ const switchXboostServiceBase_1 = require("@ecoflow/services/switchXboostServiceBase");
5
+ class SwitchXboostService extends switchXboostServiceBase_1.SwitchXboostServiceBase {
6
+ ecoFlowAccessory;
7
+ constructor(ecoFlowAccessory) {
8
+ super(ecoFlowAccessory);
9
+ this.ecoFlowAccessory = ecoFlowAccessory;
10
+ }
11
+ setOn(value, revert) {
12
+ return this.sendOn({
13
+ cfgXboostEn: value,
14
+ }, revert);
15
+ }
16
+ sendOn(params, revert) {
17
+ const message = {
18
+ id: 0,
19
+ version: '',
20
+ sn: this.ecoFlowAccessory.config.serialNumber,
21
+ cmdId: 17,
22
+ dirDest: 1,
23
+ dirSrc: 1,
24
+ cmdFunc: 254,
25
+ dest: 2,
26
+ needAck: true,
27
+ params,
28
+ };
29
+ return this.ecoFlowAccessory.sendSetCommand(message, revert);
30
+ }
31
+ }
32
+ exports.SwitchXboostService = SwitchXboostService;
33
+ //# sourceMappingURL=switchXboostService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switchXboostService.js","sourceRoot":"","sources":["../../../../../src/accessories/batteries/deltapro3/services/switchXboostService.ts"],"names":[],"mappings":";;;AAOA,uFAAoF;AAEpF,MAAa,mBAAoB,SAAQ,iDAAuB;IAC/B;IAA/B,YAA+B,gBAAsE;QACnG,KAAK,CAAC,gBAAgB,CAAC,CAAC;QADK,qBAAgB,GAAhB,gBAAgB,CAAsD;IAErG,CAAC;IAEkB,KAAK,CAAC,KAAc,EAAE,MAAkB;QACzD,OAAO,IAAI,CAAC,MAAM,CAChB;YACE,WAAW,EAAE,KAAK;SACnB,EACD,MAAM,CACP,CAAC;IACJ,CAAC;IAEO,MAAM,CAAgD,MAAe,EAAE,MAAkB;QAC/F,MAAM,OAAO,GAA+C;YAC1D,EAAE,EAAE,CAAC;YACL,OAAO,EAAE,EAAE;YACX,EAAE,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,YAAY;YAC7C,KAAK,EAAE,EAAE;YACT,OAAO,EAAE,CAAC;YACV,MAAM,EAAE,CAAC;YACT,OAAO,EAAE,GAAG;YACZ,IAAI,EAAE,CAAC;YACP,OAAO,EAAE,IAAI;YACb,MAAM;SACP,CAAC;QAEF,OAAO,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC/D,CAAC;CACF;AA9BD,kDA8BC"}
@@ -0,0 +1,8 @@
1
+ import { DeltaPro3MqttSetMessageParams, DeltaPro3MqttSetMessageWithParams } from '@ecoflow/accessories/batteries/deltapro3/interfaces/deltaPro3MqttApiContracts';
2
+ import { SimulatorTyped } from '@ecoflow/apis/simulations/simulator';
3
+ export declare class DeltaPro3Simulator extends SimulatorTyped<DeltaPro3MqttSetMessageWithParams<DeltaPro3MqttSetMessageParams>> {
4
+ generateQuota(): object;
5
+ generateSetReplyTyped(message: DeltaPro3MqttSetMessageWithParams<DeltaPro3MqttSetMessageParams>): object;
6
+ private castData;
7
+ private castParams;
8
+ }
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeltaPro3Simulator = void 0;
4
+ const deltaPro3HttpApiContracts_1 = require("@ecoflow/accessories/batteries/deltapro3/interfaces/deltaPro3HttpApiContracts");
5
+ const batteryHttpApiContracts_1 = require("@ecoflow/accessories/batteries/interfaces/batteryHttpApiContracts");
6
+ const simulator_1 = require("@ecoflow/apis/simulations/simulator");
7
+ class DeltaPro3Simulator extends simulator_1.SimulatorTyped {
8
+ generateQuota() {
9
+ const quota = {
10
+ data: {
11
+ cmsBattSoc: this.getRandomNumber(0, 100),
12
+ cmsMinDsgSoc: this.getRandomNumber(0, 20),
13
+ flowInfo12v: this.getRandomBoolean() ? deltaPro3HttpApiContracts_1.DeltaPro3AcEnableType.On : deltaPro3HttpApiContracts_1.DeltaPro3AcEnableType.Off,
14
+ flowInfoAcHvOut: this.getRandomBoolean() ? deltaPro3HttpApiContracts_1.DeltaPro3AcEnableType.On : deltaPro3HttpApiContracts_1.DeltaPro3AcEnableType.Off,
15
+ flowInfoAcLvOut: this.getRandomBoolean() ? deltaPro3HttpApiContracts_1.DeltaPro3AcEnableType.On : deltaPro3HttpApiContracts_1.DeltaPro3AcEnableType.Off,
16
+ powGet12v: this.getRandomNumber(0, 100),
17
+ powGetAc: this.getRandomNumber(0, 1000),
18
+ powGetAcHvOut: this.getRandomNumber(0, 1000),
19
+ powGetAcLvOut: this.getRandomNumber(0, 1000),
20
+ powGetQcusb1: this.getRandomNumber(0, 100),
21
+ powGetQcusb2: this.getRandomNumber(0, 100),
22
+ powGetTypec1: this.getRandomNumber(0, 100),
23
+ powGetTypec2: this.getRandomNumber(0, 100),
24
+ powInSumW: this.getRandomNumber(0, 1000),
25
+ powOutSumW: this.getRandomNumber(0, 1000),
26
+ xboostEn: this.getRandomBoolean() ? batteryHttpApiContracts_1.AcXBoostType.On : batteryHttpApiContracts_1.AcXBoostType.Off,
27
+ },
28
+ };
29
+ return quota;
30
+ }
31
+ generateSetReplyTyped(message) {
32
+ const reply = {
33
+ id: message.id,
34
+ version: message.version,
35
+ code: '0',
36
+ message: 'Success',
37
+ eagleEyeTraceId: '',
38
+ tid: '',
39
+ data: {
40
+ configOk: true,
41
+ actionId: Math.round(this.getRandomNumber(0, 100)),
42
+ },
43
+ };
44
+ if (this.castParams(message.params).cfgHvAcOutOpen !== undefined) {
45
+ this.castData(reply.data).flowInfoAcHvOut =
46
+ this.castParams(message.params).cfgHvAcOutOpen
47
+ ? deltaPro3HttpApiContracts_1.DeltaPro3AcEnableType.On
48
+ : deltaPro3HttpApiContracts_1.DeltaPro3AcEnableType.Off;
49
+ }
50
+ else if (this.castParams(message.params).cfgLvAcOutOpen !== undefined) {
51
+ this.castData(reply.data).flowInfoAcLvOut =
52
+ this.castParams(message.params).cfgLvAcOutOpen
53
+ ? deltaPro3HttpApiContracts_1.DeltaPro3AcEnableType.On
54
+ : deltaPro3HttpApiContracts_1.DeltaPro3AcEnableType.Off;
55
+ }
56
+ else if (this.castParams(message.params).cfgDc12vOutOpen !== undefined) {
57
+ this.castData(reply.data).flowInfo12v =
58
+ this.castParams(message.params).cfgDc12vOutOpen
59
+ ? deltaPro3HttpApiContracts_1.DeltaPro3AcEnableType.On
60
+ : deltaPro3HttpApiContracts_1.DeltaPro3AcEnableType.Off;
61
+ }
62
+ else if (this.castParams(message.params).cfgXboostEn !== undefined) {
63
+ this.castData(reply.data).xboostEn =
64
+ this.castParams(message.params).cfgXboostEn;
65
+ }
66
+ return reply;
67
+ }
68
+ castData(data) {
69
+ return data;
70
+ }
71
+ castParams(params) {
72
+ return params;
73
+ }
74
+ }
75
+ exports.DeltaPro3Simulator = DeltaPro3Simulator;
76
+ //# sourceMappingURL=deltaPro3Simulator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deltaPro3Simulator.js","sourceRoot":"","sources":["../../../../../src/accessories/batteries/deltapro3/simulations/deltaPro3Simulator.ts"],"names":[],"mappings":";;;AAAA,6HAGuF;AAgBvF,+GAAiG;AACjG,mEAAqE;AAErE,MAAa,kBAAmB,SAAQ,0BAEvC;IACiB,aAAa;QAC3B,MAAM,KAAK,GAA+D;YACxE,IAAI,EAAE;gBACJ,UAAU,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,GAAG,CAAC;gBACxC,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,EAAE,CAAC;gBACzC,WAAW,EAAE,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,iDAAqB,CAAC,EAAE,CAAC,CAAC,CAAC,iDAAqB,CAAC,GAAG;gBAC3F,eAAe,EAAE,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,iDAAqB,CAAC,EAAE,CAAC,CAAC,CAAC,iDAAqB,CAAC,GAAG;gBAC/F,eAAe,EAAE,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,iDAAqB,CAAC,EAAE,CAAC,CAAC,CAAC,iDAAqB,CAAC,GAAG;gBAC/F,SAAS,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,GAAG,CAAC;gBACvC,QAAQ,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,IAAI,CAAC;gBACvC,aAAa,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,IAAI,CAAC;gBAC5C,aAAa,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,IAAI,CAAC;gBAC5C,YAAY,EAAE,IAAI,C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