iobroker.zendure-solarflow 1.13.0 → 1.14.1

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 +15 -2
  2. package/admin/build/index.js +76 -55
  3. package/admin/build/index.js.map +4 -4
  4. package/build/constants/ac2400ControlStates.js +187 -0
  5. package/build/constants/ac2400ControlStates.js.map +7 -0
  6. package/build/constants/ac2400States.js +120 -0
  7. package/build/constants/ac2400States.js.map +7 -0
  8. package/build/constants/aceControlStates.js +196 -0
  9. package/build/constants/aceControlStates.js.map +7 -0
  10. package/build/constants/aceStates.js +7 -1
  11. package/build/constants/aceStates.js.map +2 -2
  12. package/build/constants/aioControlStates.js +173 -0
  13. package/build/constants/aioControlStates.js.map +7 -0
  14. package/build/constants/hubControlStates.js +188 -0
  15. package/build/constants/hubControlStates.js.map +7 -0
  16. package/build/constants/hyperControlStates.js +186 -0
  17. package/build/constants/hyperControlStates.js.map +7 -0
  18. package/build/constants/solarflow800ControlStates.js +187 -0
  19. package/build/constants/solarflow800ControlStates.js.map +7 -0
  20. package/build/constants/solarflow800ProControlStates.js +187 -0
  21. package/build/constants/solarflow800ProControlStates.js.map +7 -0
  22. package/build/constants/solarflow800ProStates.js +95 -0
  23. package/build/constants/solarflow800ProStates.js.map +7 -0
  24. package/build/constants/solarflow800States.js +95 -0
  25. package/build/constants/solarflow800States.js.map +7 -0
  26. package/build/helpers/createCalculationStates.js +37 -39
  27. package/build/helpers/createCalculationStates.js.map +2 -2
  28. package/build/helpers/createControlStates.js +47 -316
  29. package/build/helpers/createControlStates.js.map +2 -2
  30. package/build/helpers/createSolarFlowLocalStates.js +23 -30
  31. package/build/helpers/createSolarFlowLocalStates.js.map +2 -2
  32. package/build/helpers/createSolarFlowStates.js +42 -23
  33. package/build/helpers/createSolarFlowStates.js.map +2 -2
  34. package/build/main.js +64 -56
  35. package/build/main.js.map +2 -2
  36. package/build/models/IPackData.js.map +1 -1
  37. package/build/models/ISolarflowState.js.map +1 -1
  38. package/build/services/adapterService.js +1 -1
  39. package/build/services/adapterService.js.map +2 -2
  40. package/build/services/calculationService.js +1 -5
  41. package/build/services/calculationService.js.map +2 -2
  42. package/build/services/fallbackMqttService.js +2 -2
  43. package/build/services/fallbackMqttService.js.map +2 -2
  44. package/build/services/mqttService.js +145 -74
  45. package/build/services/mqttService.js.map +3 -3
  46. package/io-package.json +54 -54
  47. package/package.json +10 -10
@@ -55,6 +55,15 @@ var import_jobSchedule = require("./jobSchedule");
55
55
  var import_createSolarFlowLocalStates = require("../helpers/createSolarFlowLocalStates");
56
56
  var import_createSolarFlowStates = require("../helpers/createSolarFlowStates");
57
57
  let adapter = void 0;
58
+ const knownPackDataProperties = [
59
+ "sn",
60
+ "totalVol",
61
+ "maxVol",
62
+ "minVol",
63
+ "socLevel",
64
+ "maxTemp",
65
+ "soh"
66
+ ];
58
67
  const addOrUpdatePackData = async (productKey, deviceKey, packData, isSolarFlow) => {
59
68
  if (adapter && productKey && deviceKey) {
60
69
  await packData.forEach(async (x) => {
@@ -62,10 +71,18 @@ const addOrUpdatePackData = async (productKey, deviceKey, packData, isSolarFlow)
62
71
  let batType = "";
63
72
  if (productKey == "yWF7hV") {
64
73
  batType = "AIO2400";
65
- } else if (x.sn.startsWith("C")) {
66
- batType = "AB2000";
67
74
  } else if (x.sn.startsWith("A")) {
68
75
  batType = "AB1000";
76
+ } else if (x.sn.startsWith("B")) {
77
+ batType = "AB1000S";
78
+ } else if (x.sn.startsWith("C")) {
79
+ if (x.sn[3] == "F") {
80
+ batType = "AB2000S";
81
+ } else {
82
+ batType = "AB2000";
83
+ }
84
+ } else if (x.sn.startsWith("F")) {
85
+ batType = "AB3000X";
69
86
  }
70
87
  if (!adapter.pack2Devices.some(
71
88
  (y) => y.packSn == x.sn && y.deviceKey == deviceKey
@@ -134,7 +151,8 @@ const addOrUpdatePackData = async (productKey, deviceKey, packData, isSolarFlow)
134
151
  desc: "SOC Level",
135
152
  role: "value",
136
153
  read: true,
137
- write: false
154
+ write: false,
155
+ unit: "%"
138
156
  },
139
157
  native: {}
140
158
  }));
@@ -172,12 +190,29 @@ const addOrUpdatePackData = async (productKey, deviceKey, packData, isSolarFlow)
172
190
  desc: "minVol",
173
191
  role: "value",
174
192
  read: true,
175
- write: false
193
+ write: false,
194
+ unit: "V"
176
195
  },
177
196
  native: {}
178
197
  }));
179
198
  await (adapter == null ? void 0 : adapter.setState(key + ".minVol", x.minVol / 100, true));
180
199
  }
200
+ if (x.batcur) {
201
+ await (adapter == null ? void 0 : adapter.extendObject(key + ".batcur", {
202
+ type: "state",
203
+ common: {
204
+ name: "batcur",
205
+ type: "number",
206
+ desc: "batcur",
207
+ role: "value",
208
+ read: true,
209
+ write: false,
210
+ unit: "A"
211
+ },
212
+ native: {}
213
+ }));
214
+ await (adapter == null ? void 0 : adapter.setState(key + ".batcur", x.batcur / 10, true));
215
+ }
181
216
  if (x.maxVol) {
182
217
  await (adapter == null ? void 0 : adapter.extendObject(key + ".maxVol", {
183
218
  type: "state",
@@ -187,7 +222,8 @@ const addOrUpdatePackData = async (productKey, deviceKey, packData, isSolarFlow)
187
222
  desc: "maxVol",
188
223
  role: "value",
189
224
  read: true,
190
- write: false
225
+ write: false,
226
+ unit: "V"
191
227
  },
192
228
  native: {}
193
229
  }));
@@ -202,7 +238,8 @@ const addOrUpdatePackData = async (productKey, deviceKey, packData, isSolarFlow)
202
238
  desc: "totalVol",
203
239
  role: "value",
204
240
  read: true,
205
- write: false
241
+ write: false,
242
+ unit: "V"
206
243
  },
207
244
  native: {}
208
245
  }));
@@ -212,12 +249,45 @@ const addOrUpdatePackData = async (productKey, deviceKey, packData, isSolarFlow)
212
249
  (0, import_adapterService.checkVoltage)(adapter, productKey, deviceKey, totalVol);
213
250
  }
214
251
  }
252
+ if (x.soh) {
253
+ await (adapter == null ? void 0 : adapter.extendObject(key + ".soh", {
254
+ type: "state",
255
+ common: {
256
+ name: {
257
+ de: "Gesundheitszustand",
258
+ en: "State of Health"
259
+ },
260
+ type: "number",
261
+ desc: "State of Health",
262
+ role: "value",
263
+ read: true,
264
+ write: false,
265
+ unit: "%"
266
+ },
267
+ native: {}
268
+ }));
269
+ await (adapter == null ? void 0 : adapter.setState(key + ".soh", x.soh / 10, true));
270
+ }
271
+ let found = false;
272
+ Object.entries(x).forEach(([key2, value]) => {
273
+ knownPackDataProperties.forEach((property) => {
274
+ if (property == key2) {
275
+ found = true;
276
+ }
277
+ });
278
+ if (found) {
279
+ } else {
280
+ adapter == null ? void 0 : adapter.log.debug(
281
+ `[addOrUpdatePackData] ${key2} with value ${value} is a UNKNOWN PackData Mqtt Property!`
282
+ );
283
+ }
284
+ });
215
285
  }
216
286
  });
217
287
  }
218
288
  };
219
289
  const onMessage = async (topic, message) => {
220
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa;
290
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa;
221
291
  if (adapter) {
222
292
  if (topic.toLowerCase().includes("loginOut/force")) {
223
293
  }
@@ -422,25 +492,12 @@ const onMessage = async (topic, message) => {
422
492
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "packInputPower", 0);
423
493
  }
424
494
  if (((_J = obj.properties) == null ? void 0 : _J.packInputPower) != null && ((_K = obj.properties) == null ? void 0 : _K.packInputPower) != void 0) {
425
- let standbyUsage = 0;
426
- const solarInputPower = await (adapter == null ? void 0 : adapter.getStateAsync(
427
- `${productKey}.${deviceKey}.solarInputPower`
428
- ));
429
- if (solarInputPower && Number(solarInputPower.val) < 10) {
430
- standbyUsage = 7 - Number(solarInputPower.val);
431
- }
432
- const device = (_L = adapter == null ? void 0 : adapter.deviceList) == null ? void 0 : _L.find(
433
- (x) => x.deviceKey == deviceKey && x.productKey == productKey
434
- );
435
- if (device && device._connectedWithAce) {
436
- standbyUsage += 7;
437
- }
438
495
  (0, import_adapterService.updateSolarFlowState)(
439
496
  adapter,
440
497
  productKey,
441
498
  deviceKey,
442
499
  "packInputPower",
443
- obj.properties.packInputPower + standbyUsage
500
+ obj.properties.packInputPower
444
501
  );
445
502
  (0, import_adapterService.updateSolarFlowState)(
446
503
  adapter,
@@ -450,7 +507,7 @@ const onMessage = async (topic, message) => {
450
507
  0
451
508
  );
452
509
  }
453
- if (((_M = obj.properties) == null ? void 0 : _M.solarInputPower) != null && ((_N = obj.properties) == null ? void 0 : _N.solarInputPower) != void 0) {
510
+ if (((_L = obj.properties) == null ? void 0 : _L.solarInputPower) != null && ((_M = obj.properties) == null ? void 0 : _M.solarInputPower) != void 0) {
454
511
  (0, import_adapterService.updateSolarFlowState)(
455
512
  adapter,
456
513
  productKey,
@@ -459,7 +516,7 @@ const onMessage = async (topic, message) => {
459
516
  obj.properties.solarInputPower
460
517
  );
461
518
  }
462
- if (((_O = obj.properties) == null ? void 0 : _O.pvPower1) != null && ((_P = obj.properties) == null ? void 0 : _P.pvPower1) != void 0) {
519
+ if (((_N = obj.properties) == null ? void 0 : _N.pvPower1) != null && ((_O = obj.properties) == null ? void 0 : _O.pvPower1) != void 0) {
463
520
  (0, import_adapterService.updateSolarFlowState)(
464
521
  adapter,
465
522
  productKey,
@@ -469,7 +526,7 @@ const onMessage = async (topic, message) => {
469
526
  obj.properties.pvPower1
470
527
  );
471
528
  }
472
- if (((_Q = obj.properties) == null ? void 0 : _Q.pvPower2) != null && ((_R = obj.properties) == null ? void 0 : _R.pvPower2) != void 0) {
529
+ if (((_P = obj.properties) == null ? void 0 : _P.pvPower2) != null && ((_Q = obj.properties) == null ? void 0 : _Q.pvPower2) != void 0) {
473
530
  (0, import_adapterService.updateSolarFlowState)(
474
531
  adapter,
475
532
  productKey,
@@ -479,7 +536,7 @@ const onMessage = async (topic, message) => {
479
536
  obj.properties.pvPower2
480
537
  );
481
538
  }
482
- if (((_S = obj.properties) == null ? void 0 : _S.solarPower1) != null && ((_T = obj.properties) == null ? void 0 : _T.solarPower1) != void 0) {
539
+ if (((_R = obj.properties) == null ? void 0 : _R.solarPower1) != null && ((_S = obj.properties) == null ? void 0 : _S.solarPower1) != void 0) {
483
540
  (0, import_adapterService.updateSolarFlowState)(
484
541
  adapter,
485
542
  productKey,
@@ -488,7 +545,7 @@ const onMessage = async (topic, message) => {
488
545
  obj.properties.solarPower1
489
546
  );
490
547
  }
491
- if (((_U = obj.properties) == null ? void 0 : _U.solarPower2) != null && ((_V = obj.properties) == null ? void 0 : _V.solarPower2) != void 0) {
548
+ if (((_T = obj.properties) == null ? void 0 : _T.solarPower2) != null && ((_U = obj.properties) == null ? void 0 : _U.solarPower2) != void 0) {
492
549
  (0, import_adapterService.updateSolarFlowState)(
493
550
  adapter,
494
551
  productKey,
@@ -497,7 +554,7 @@ const onMessage = async (topic, message) => {
497
554
  obj.properties.solarPower2
498
555
  );
499
556
  }
500
- if (((_W = obj.properties) == null ? void 0 : _W.remainOutTime) != null && ((_X = obj.properties) == null ? void 0 : _X.remainOutTime) != void 0) {
557
+ if (((_V = obj.properties) == null ? void 0 : _V.remainOutTime) != null && ((_W = obj.properties) == null ? void 0 : _W.remainOutTime) != void 0) {
501
558
  (0, import_adapterService.updateSolarFlowState)(
502
559
  adapter,
503
560
  productKey,
@@ -506,7 +563,7 @@ const onMessage = async (topic, message) => {
506
563
  obj.properties.remainOutTime
507
564
  );
508
565
  }
509
- if (((_Y = obj.properties) == null ? void 0 : _Y.remainInputTime) != null && ((_Z = obj.properties) == null ? void 0 : _Z.remainInputTime) != void 0) {
566
+ if (((_X = obj.properties) == null ? void 0 : _X.remainInputTime) != null && ((_Y = obj.properties) == null ? void 0 : _Y.remainInputTime) != void 0) {
510
567
  (0, import_adapterService.updateSolarFlowState)(
511
568
  adapter,
512
569
  productKey,
@@ -515,7 +572,7 @@ const onMessage = async (topic, message) => {
515
572
  obj.properties.remainInputTime
516
573
  );
517
574
  }
518
- if (((__ = obj.properties) == null ? void 0 : __.socSet) != null && ((_$ = obj.properties) == null ? void 0 : _$.socSet) != void 0) {
575
+ if (((_Z = obj.properties) == null ? void 0 : _Z.socSet) != null && ((__ = obj.properties) == null ? void 0 : __.socSet) != void 0) {
519
576
  (0, import_adapterService.updateSolarFlowState)(
520
577
  adapter,
521
578
  productKey,
@@ -531,7 +588,7 @@ const onMessage = async (topic, message) => {
531
588
  Number(obj.properties.socSet) / 10
532
589
  );
533
590
  }
534
- if (((_aa = obj.properties) == null ? void 0 : _aa.minSoc) != null && ((_ba = obj.properties) == null ? void 0 : _ba.minSoc) != void 0) {
591
+ if (((_$ = obj.properties) == null ? void 0 : _$.minSoc) != null && ((_aa = obj.properties) == null ? void 0 : _aa.minSoc) != void 0) {
535
592
  (0, import_adapterService.updateSolarFlowState)(
536
593
  adapter,
537
594
  productKey,
@@ -547,7 +604,7 @@ const onMessage = async (topic, message) => {
547
604
  Number(obj.properties.minSoc) / 10
548
605
  );
549
606
  }
550
- if (((_ca = obj.properties) == null ? void 0 : _ca.inputLimit) != null && ((_da = obj.properties) == null ? void 0 : _da.inputLimit) != void 0) {
607
+ if (((_ba = obj.properties) == null ? void 0 : _ba.inputLimit) != null && ((_ca = obj.properties) == null ? void 0 : _ca.inputLimit) != void 0) {
551
608
  (0, import_adapterService.updateSolarFlowState)(
552
609
  adapter,
553
610
  productKey,
@@ -555,7 +612,7 @@ const onMessage = async (topic, message) => {
555
612
  "inputLimit",
556
613
  obj.properties.inputLimit
557
614
  );
558
- if (((_ea = productName == null ? void 0 : productName.val) == null ? void 0 : _ea.toString().toLowerCase().includes("solarflow")) || ((_fa = productName == null ? void 0 : productName.val) == null ? void 0 : _fa.toString().toLowerCase().includes("ace")) || ((_ga = productName == null ? void 0 : productName.val) == null ? void 0 : _ga.toString().toLowerCase().includes("hyper"))) {
615
+ if (((_da = productName == null ? void 0 : productName.val) == null ? void 0 : _da.toString().toLowerCase().includes("solarflow")) || ((_ea = productName == null ? void 0 : productName.val) == null ? void 0 : _ea.toString().toLowerCase().includes("ace")) || ((_fa = productName == null ? void 0 : productName.val) == null ? void 0 : _fa.toString().toLowerCase().includes("hyper"))) {
559
616
  (0, import_adapterService.updateSolarFlowControlState)(
560
617
  adapter,
561
618
  productKey,
@@ -565,7 +622,7 @@ const onMessage = async (topic, message) => {
565
622
  );
566
623
  }
567
624
  }
568
- if (((_ha = obj.properties) == null ? void 0 : _ha.gridInputPower) != null && ((_ia = obj.properties) == null ? void 0 : _ia.gridInputPower) != void 0) {
625
+ if (((_ga = obj.properties) == null ? void 0 : _ga.gridInputPower) != null && ((_ha = obj.properties) == null ? void 0 : _ha.gridInputPower) != void 0) {
569
626
  (0, import_adapterService.updateSolarFlowState)(
570
627
  adapter,
571
628
  productKey,
@@ -574,7 +631,7 @@ const onMessage = async (topic, message) => {
574
631
  obj.properties.gridInputPower
575
632
  );
576
633
  }
577
- if (((_ja = obj.properties) == null ? void 0 : _ja.acMode) != null && ((_ka = obj.properties) == null ? void 0 : _ka.acMode) != void 0) {
634
+ if (((_ia = obj.properties) == null ? void 0 : _ia.acMode) != null && ((_ja = obj.properties) == null ? void 0 : _ja.acMode) != void 0) {
578
635
  (0, import_adapterService.updateSolarFlowState)(
579
636
  adapter,
580
637
  productKey,
@@ -590,7 +647,7 @@ const onMessage = async (topic, message) => {
590
647
  obj.properties.acMode
591
648
  );
592
649
  }
593
- if (((_la = obj.properties) == null ? void 0 : _la.hyperTmp) != null && ((_ma = obj.properties) == null ? void 0 : _ma.hyperTmp) != void 0) {
650
+ if (((_ka = obj.properties) == null ? void 0 : _ka.hyperTmp) != null && ((_la = obj.properties) == null ? void 0 : _la.hyperTmp) != void 0) {
594
651
  (0, import_adapterService.updateSolarFlowState)(
595
652
  adapter,
596
653
  productKey,
@@ -599,7 +656,7 @@ const onMessage = async (topic, message) => {
599
656
  obj.properties.hyperTmp / 10 - 273.15
600
657
  );
601
658
  }
602
- if (((_na = obj.properties) == null ? void 0 : _na.acOutputPower) != null && ((_oa = obj.properties) == null ? void 0 : _oa.acOutputPower) != void 0) {
659
+ if (((_ma = obj.properties) == null ? void 0 : _ma.acOutputPower) != null && ((_na = obj.properties) == null ? void 0 : _na.acOutputPower) != void 0) {
603
660
  (0, import_adapterService.updateSolarFlowState)(
604
661
  adapter,
605
662
  productKey,
@@ -608,7 +665,7 @@ const onMessage = async (topic, message) => {
608
665
  obj.properties.acOutputPower
609
666
  );
610
667
  }
611
- if (((_pa = obj.properties) == null ? void 0 : _pa.gridPower) != null && ((_qa = obj.properties) == null ? void 0 : _qa.gridPower) != void 0) {
668
+ if (((_oa = obj.properties) == null ? void 0 : _oa.gridPower) != null && ((_pa = obj.properties) == null ? void 0 : _pa.gridPower) != void 0) {
612
669
  (0, import_adapterService.updateSolarFlowState)(
613
670
  adapter,
614
671
  productKey,
@@ -617,8 +674,8 @@ const onMessage = async (topic, message) => {
617
674
  obj.properties.gridPower
618
675
  );
619
676
  }
620
- if (((_ra = obj.properties) == null ? void 0 : _ra.acSwitch) != null && ((_sa = obj.properties) == null ? void 0 : _sa.acSwitch) != void 0) {
621
- const value = ((_ta = obj.properties) == null ? void 0 : _ta.acSwitch) == 0 ? false : true;
677
+ if (((_qa = obj.properties) == null ? void 0 : _qa.acSwitch) != null && ((_ra = obj.properties) == null ? void 0 : _ra.acSwitch) != void 0) {
678
+ const value = ((_sa = obj.properties) == null ? void 0 : _sa.acSwitch) == 0 ? false : true;
622
679
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "acSwitch", value);
623
680
  (0, import_adapterService.updateSolarFlowControlState)(
624
681
  adapter,
@@ -628,8 +685,8 @@ const onMessage = async (topic, message) => {
628
685
  value
629
686
  );
630
687
  }
631
- if (((_ua = obj.properties) == null ? void 0 : _ua.dcSwitch) != null && ((_va = obj.properties) == null ? void 0 : _va.dcSwitch) != void 0) {
632
- const value = ((_wa = obj.properties) == null ? void 0 : _wa.dcSwitch) == 0 ? false : true;
688
+ if (((_ta = obj.properties) == null ? void 0 : _ta.dcSwitch) != null && ((_ua = obj.properties) == null ? void 0 : _ua.dcSwitch) != void 0) {
689
+ const value = ((_va = obj.properties) == null ? void 0 : _va.dcSwitch) == 0 ? false : true;
633
690
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "dcSwitch", value);
634
691
  (0, import_adapterService.updateSolarFlowControlState)(
635
692
  adapter,
@@ -639,7 +696,7 @@ const onMessage = async (topic, message) => {
639
696
  value
640
697
  );
641
698
  }
642
- if (((_xa = obj.properties) == null ? void 0 : _xa.dcOutputPower) != null && ((_ya = obj.properties) == null ? void 0 : _ya.dcOutputPower) != void 0) {
699
+ if (((_wa = obj.properties) == null ? void 0 : _wa.dcOutputPower) != null && ((_xa = obj.properties) == null ? void 0 : _xa.dcOutputPower) != void 0) {
643
700
  (0, import_adapterService.updateSolarFlowState)(
644
701
  adapter,
645
702
  productKey,
@@ -648,11 +705,11 @@ const onMessage = async (topic, message) => {
648
705
  obj.properties.dcOutputPower
649
706
  );
650
707
  }
651
- if (((_za = obj.properties) == null ? void 0 : _za.pvBrand) != null && ((_Aa = obj.properties) == null ? void 0 : _Aa.pvBrand) != void 0) {
652
- const value = ((_Ba = obj.properties) == null ? void 0 : _Ba.pvBrand) == 0 ? "Others" : ((_Ca = obj.properties) == null ? void 0 : _Ca.pvBrand) == 1 ? "Hoymiles" : ((_Da = obj.properties) == null ? void 0 : _Da.pvBrand) == 2 ? "Enphase" : ((_Ea = obj.properties) == null ? void 0 : _Ea.pvBrand) == 3 ? "APSystems" : ((_Fa = obj.properties) == null ? void 0 : _Fa.pvBrand) == 4 ? "Anker" : ((_Ga = obj.properties) == null ? void 0 : _Ga.pvBrand) == 5 ? "Deye" : ((_Ha = obj.properties) == null ? void 0 : _Ha.pvBrand) == 6 ? "Bosswerk" : "Unknown";
708
+ if (((_ya = obj.properties) == null ? void 0 : _ya.pvBrand) != null && ((_za = obj.properties) == null ? void 0 : _za.pvBrand) != void 0) {
709
+ const value = ((_Aa = obj.properties) == null ? void 0 : _Aa.pvBrand) == 0 ? "Others" : ((_Ba = obj.properties) == null ? void 0 : _Ba.pvBrand) == 1 ? "Hoymiles" : ((_Ca = obj.properties) == null ? void 0 : _Ca.pvBrand) == 2 ? "Enphase" : ((_Da = obj.properties) == null ? void 0 : _Da.pvBrand) == 3 ? "APSystems" : ((_Ea = obj.properties) == null ? void 0 : _Ea.pvBrand) == 4 ? "Anker" : ((_Fa = obj.properties) == null ? void 0 : _Fa.pvBrand) == 5 ? "Deye" : ((_Ga = obj.properties) == null ? void 0 : _Ga.pvBrand) == 6 ? "Bosswerk" : "Unknown";
653
710
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "pvBrand", value);
654
711
  }
655
- if (((_Ia = obj.properties) == null ? void 0 : _Ia.inverseMaxPower) != null && ((_Ja = obj.properties) == null ? void 0 : _Ja.inverseMaxPower) != void 0) {
712
+ if (((_Ha = obj.properties) == null ? void 0 : _Ha.inverseMaxPower) != null && ((_Ia = obj.properties) == null ? void 0 : _Ia.inverseMaxPower) != void 0) {
656
713
  (0, import_adapterService.updateSolarFlowState)(
657
714
  adapter,
658
715
  productKey,
@@ -661,7 +718,7 @@ const onMessage = async (topic, message) => {
661
718
  obj.properties.inverseMaxPower
662
719
  );
663
720
  }
664
- if (((_Ka = obj.properties) == null ? void 0 : _Ka.wifiState) != null && ((_La = obj.properties) == null ? void 0 : _La.wifiState) != void 0) {
721
+ if (((_Ja = obj.properties) == null ? void 0 : _Ja.wifiState) != null && ((_Ka = obj.properties) == null ? void 0 : _Ka.wifiState) != void 0) {
665
722
  (0, import_adapterService.updateSolarFlowState)(
666
723
  adapter,
667
724
  productKey,
@@ -670,7 +727,7 @@ const onMessage = async (topic, message) => {
670
727
  obj.properties.wifiState == 1 ? "Connected" : "Disconnected"
671
728
  );
672
729
  }
673
- if (((_Ma = obj.properties) == null ? void 0 : _Ma.packNum) != null && ((_Na = obj.properties) == null ? void 0 : _Na.packNum) != void 0) {
730
+ if (((_La = obj.properties) == null ? void 0 : _La.packNum) != null && ((_Ma = obj.properties) == null ? void 0 : _Ma.packNum) != void 0) {
674
731
  (0, import_adapterService.updateSolarFlowState)(
675
732
  adapter,
676
733
  productKey,
@@ -679,7 +736,7 @@ const onMessage = async (topic, message) => {
679
736
  obj.properties.packNum
680
737
  );
681
738
  }
682
- if (((_Oa = obj.properties) == null ? void 0 : _Oa.hubState) != null && ((_Pa = obj.properties) == null ? void 0 : _Pa.hubState) != void 0) {
739
+ if (((_Na = obj.properties) == null ? void 0 : _Na.hubState) != null && ((_Oa = obj.properties) == null ? void 0 : _Oa.hubState) != void 0) {
683
740
  (0, import_adapterService.updateSolarFlowState)(
684
741
  adapter,
685
742
  productKey,
@@ -699,32 +756,24 @@ const onMessage = async (topic, message) => {
699
756
  addOrUpdatePackData(productKey, deviceKey, obj.packData, isSolarFlow);
700
757
  }
701
758
  if (obj.properties && adapter.log.level == "debug") {
702
- let type = "solarflow";
703
- const _productName = (_Qa = productName == null ? void 0 : productName.val) == null ? void 0 : _Qa.toString();
704
- if (_productName == null ? void 0 : _productName.toLowerCase().includes("hyper")) {
705
- type = "hyper";
706
- } else if (_productName == null ? void 0 : _productName.toLowerCase().includes("ace")) {
707
- type = "ace";
708
- } else if (_productName == null ? void 0 : _productName.toLowerCase().includes("aio")) {
709
- type = "aio";
710
- } else if (_productName == null ? void 0 : _productName.toLowerCase().includes("smart plug")) {
711
- type = "smartPlug";
712
- }
713
- const states = (0, import_createSolarFlowStates.getStateDefinition)(type);
714
- let found = false;
715
- Object.entries(obj.properties).forEach(([key, value]) => {
716
- states.forEach((state) => {
717
- if (state.title == key) {
718
- found = true;
759
+ const _productName = (_Pa = productName == null ? void 0 : productName.val) == null ? void 0 : _Pa.toString();
760
+ if (_productName) {
761
+ const states = (0, import_createSolarFlowStates.getStateDefinition)(_productName);
762
+ let found = false;
763
+ Object.entries(obj.properties).forEach(([key, value]) => {
764
+ states.forEach((state) => {
765
+ if (state.title == key) {
766
+ found = true;
767
+ }
768
+ });
769
+ if (found) {
770
+ } else {
771
+ adapter == null ? void 0 : adapter.log.debug(
772
+ `[onMessage] ${productName == null ? void 0 : productName.val}: ${key} with value ${value} is a UNKNOWN Mqtt Property!`
773
+ );
719
774
  }
720
775
  });
721
- if (found) {
722
- } else {
723
- adapter == null ? void 0 : adapter.log.debug(
724
- `[onMessage] ${productName == null ? void 0 : productName.val}: ${key} with value ${value} is a UNKNOWN Mqtt Property!`
725
- );
726
- }
727
- });
776
+ }
728
777
  }
729
778
  }
730
779
  };
@@ -894,9 +943,31 @@ const setAutoModel = async (adapter2, productKey, deviceKey, autoModel) => {
894
943
  var _a;
895
944
  if (adapter2.mqttClient && productKey && deviceKey) {
896
945
  const topic = `iot/${productKey}/${deviceKey}/properties/write`;
897
- const setAutoModelContent = { properties: { autoModel } };
946
+ let setAutoModelContent = { properties: { autoModel } };
947
+ switch (autoModel) {
948
+ case 8:
949
+ setAutoModelContent = {
950
+ properties: {
951
+ autoModelProgram: 1,
952
+ autoModelValue: { chargingType: 0, chargingPower: 0, outPower: 0 },
953
+ msgType: 1,
954
+ autoModel: 8
955
+ }
956
+ };
957
+ break;
958
+ case 9:
959
+ setAutoModelContent = {
960
+ properties: {
961
+ autoModelProgram: 2,
962
+ autoModelValue: { chargingType: 3, chargingPower: 0, outPower: 0 },
963
+ msgType: 1,
964
+ autoModel: 9
965
+ }
966
+ };
967
+ break;
968
+ }
898
969
  adapter2.log.debug(
899
- `[setBuzzer] Setting autoModel for device key ${deviceKey} to ${autoModel}!`
970
+ `[setAutoModel] Setting autoModel for device key ${deviceKey} to ${autoModel}!`
900
971
  );
901
972
  (_a = adapter2.mqttClient) == null ? void 0 : _a.publish(topic, JSON.stringify(setAutoModelContent));
902
973
  }