iobroker.zendure-solarflow 1.14.3 → 1.15.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.
@@ -54,6 +54,7 @@ var import_calculationService = require("./calculationService");
54
54
  var import_jobSchedule = require("./jobSchedule");
55
55
  var import_createSolarFlowLocalStates = require("../helpers/createSolarFlowLocalStates");
56
56
  var import_createSolarFlowStates = require("../helpers/createSolarFlowStates");
57
+ var import_helpers = require("../helpers/helpers");
57
58
  let adapter = void 0;
58
59
  const knownPackDataProperties = [
59
60
  "sn",
@@ -287,7 +288,7 @@ const addOrUpdatePackData = async (productKey, deviceKey, packData, isSolarFlow)
287
288
  }
288
289
  };
289
290
  const onMessage = async (topic, message) => {
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;
291
+ 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, _Ra, _Sa;
291
292
  if (adapter) {
292
293
  if (topic.toLowerCase().includes("loginOut/force")) {
293
294
  }
@@ -397,24 +398,27 @@ const onMessage = async (topic, message) => {
397
398
  if (((_h = obj.properties) == null ? void 0 : _h.packState) != null && ((_i = obj.properties) == null ? void 0 : _i.packState) != void 0) {
398
399
  const value = ((_j = obj.properties) == null ? void 0 : _j.packState) == 0 ? "Idle" : ((_k = obj.properties) == null ? void 0 : _k.packState) == 1 ? "Charging" : ((_l = obj.properties) == null ? void 0 : _l.packState) == 2 ? "Discharging" : "Unknown";
399
400
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "packState", value);
401
+ if ((_m = obj.properties) == null ? void 0 : _m.packState) {
402
+ (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "packPower", 0);
403
+ }
400
404
  }
401
- if (((_m = obj.properties) == null ? void 0 : _m.passMode) != null && ((_n = obj.properties) == null ? void 0 : _n.passMode) != void 0) {
402
- const value = ((_o = obj.properties) == null ? void 0 : _o.passMode) == 0 ? "Automatic" : ((_p = obj.properties) == null ? void 0 : _p.passMode) == 1 ? "Always off" : ((_q = obj.properties) == null ? void 0 : _q.passMode) == 2 ? "Always on" : "Unknown";
405
+ if (((_n = obj.properties) == null ? void 0 : _n.passMode) != null && ((_o = obj.properties) == null ? void 0 : _o.passMode) != void 0) {
406
+ const value = ((_p = obj.properties) == null ? void 0 : _p.passMode) == 0 ? "Automatic" : ((_q = obj.properties) == null ? void 0 : _q.passMode) == 1 ? "Always off" : ((_r = obj.properties) == null ? void 0 : _r.passMode) == 2 ? "Always on" : "Unknown";
403
407
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "passMode", value);
404
408
  (0, import_adapterService.updateSolarFlowControlState)(
405
409
  adapter,
406
410
  productKey,
407
411
  deviceKey,
408
412
  "passMode",
409
- (_r = obj.properties) == null ? void 0 : _r.passMode
413
+ (_s = obj.properties) == null ? void 0 : _s.passMode
410
414
  );
411
415
  }
412
- if (((_s = obj.properties) == null ? void 0 : _s.pass) != null && ((_t = obj.properties) == null ? void 0 : _t.pass) != void 0) {
413
- const value = ((_u = obj.properties) == null ? void 0 : _u.pass) == 0 ? false : true;
416
+ if (((_t = obj.properties) == null ? void 0 : _t.pass) != null && ((_u = obj.properties) == null ? void 0 : _u.pass) != void 0) {
417
+ const value = ((_v = obj.properties) == null ? void 0 : _v.pass) == 0 ? false : true;
414
418
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "pass", value);
415
419
  }
416
- if (((_v = obj.properties) == null ? void 0 : _v.autoRecover) != null && ((_w = obj.properties) == null ? void 0 : _w.autoRecover) != void 0) {
417
- const value = ((_x = obj.properties) == null ? void 0 : _x.autoRecover) == 0 ? false : true;
420
+ if (((_w = obj.properties) == null ? void 0 : _w.autoRecover) != null && ((_x = obj.properties) == null ? void 0 : _x.autoRecover) != void 0) {
421
+ const value = ((_y = obj.properties) == null ? void 0 : _y.autoRecover) == 0 ? false : true;
418
422
  (0, import_adapterService.updateSolarFlowState)(
419
423
  adapter,
420
424
  productKey,
@@ -430,7 +434,7 @@ const onMessage = async (topic, message) => {
430
434
  value
431
435
  );
432
436
  }
433
- if (((_y = obj.properties) == null ? void 0 : _y.outputHomePower) != null && ((_z = obj.properties) == null ? void 0 : _z.outputHomePower) != void 0) {
437
+ if (((_z = obj.properties) == null ? void 0 : _z.outputHomePower) != null && ((_A = obj.properties) == null ? void 0 : _A.outputHomePower) != void 0) {
434
438
  (0, import_adapterService.updateSolarFlowState)(
435
439
  adapter,
436
440
  productKey,
@@ -439,7 +443,7 @@ const onMessage = async (topic, message) => {
439
443
  obj.properties.outputHomePower
440
444
  );
441
445
  }
442
- if (((_A = obj.properties) == null ? void 0 : _A.energyPower) != null && ((_B = obj.properties) == null ? void 0 : _B.energyPower) != void 0) {
446
+ if (((_B = obj.properties) == null ? void 0 : _B.energyPower) != null && ((_C = obj.properties) == null ? void 0 : _C.energyPower) != void 0) {
443
447
  (0, import_adapterService.updateSolarFlowState)(
444
448
  adapter,
445
449
  productKey,
@@ -448,7 +452,7 @@ const onMessage = async (topic, message) => {
448
452
  obj.properties.energyPower
449
453
  );
450
454
  }
451
- if (((_C = obj.properties) == null ? void 0 : _C.outputLimit) != null && ((_D = obj.properties) == null ? void 0 : _D.outputLimit) != void 0) {
455
+ if (((_D = obj.properties) == null ? void 0 : _D.outputLimit) != null && ((_E = obj.properties) == null ? void 0 : _E.outputLimit) != void 0) {
452
456
  (0, import_adapterService.updateSolarFlowState)(
453
457
  adapter,
454
458
  productKey,
@@ -464,8 +468,8 @@ const onMessage = async (topic, message) => {
464
468
  obj.properties.outputLimit
465
469
  );
466
470
  }
467
- if (((_E = obj.properties) == null ? void 0 : _E.buzzerSwitch) != null && ((_F = obj.properties) == null ? void 0 : _F.buzzerSwitch) != void 0) {
468
- const value = ((_G = obj.properties) == null ? void 0 : _G.buzzerSwitch) == 0 ? false : true;
471
+ if (((_F = obj.properties) == null ? void 0 : _F.buzzerSwitch) != null && ((_G = obj.properties) == null ? void 0 : _G.buzzerSwitch) != void 0) {
472
+ const value = ((_H = obj.properties) == null ? void 0 : _H.buzzerSwitch) == 0 ? false : true;
469
473
  (0, import_adapterService.updateSolarFlowState)(
470
474
  adapter,
471
475
  productKey,
@@ -481,7 +485,7 @@ const onMessage = async (topic, message) => {
481
485
  value
482
486
  );
483
487
  }
484
- if (((_H = obj.properties) == null ? void 0 : _H.outputPackPower) != null && ((_I = obj.properties) == null ? void 0 : _I.outputPackPower) != void 0) {
488
+ if (((_I = obj.properties) == null ? void 0 : _I.outputPackPower) != null && ((_J = obj.properties) == null ? void 0 : _J.outputPackPower) != void 0) {
485
489
  (0, import_adapterService.updateSolarFlowState)(
486
490
  adapter,
487
491
  productKey,
@@ -489,9 +493,18 @@ const onMessage = async (topic, message) => {
489
493
  "outputPackPower",
490
494
  obj.properties.outputPackPower
491
495
  );
496
+ if (((_K = obj.properties) == null ? void 0 : _K.outputPackPower) > 0) {
497
+ (0, import_adapterService.updateSolarFlowState)(
498
+ adapter,
499
+ productKey,
500
+ deviceKey,
501
+ "packPower",
502
+ obj.properties.outputPackPower
503
+ );
504
+ }
492
505
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "packInputPower", 0);
493
506
  }
494
- if (((_J = obj.properties) == null ? void 0 : _J.packInputPower) != null && ((_K = obj.properties) == null ? void 0 : _K.packInputPower) != void 0) {
507
+ if (((_L = obj.properties) == null ? void 0 : _L.packInputPower) != null && ((_M = obj.properties) == null ? void 0 : _M.packInputPower) != void 0) {
495
508
  (0, import_adapterService.updateSolarFlowState)(
496
509
  adapter,
497
510
  productKey,
@@ -499,6 +512,15 @@ const onMessage = async (topic, message) => {
499
512
  "packInputPower",
500
513
  obj.properties.packInputPower
501
514
  );
515
+ if (((_N = obj.properties) == null ? void 0 : _N.packInputPower) > 0) {
516
+ (0, import_adapterService.updateSolarFlowState)(
517
+ adapter,
518
+ productKey,
519
+ deviceKey,
520
+ "packPower",
521
+ -Math.abs(obj.properties.packInputPower)
522
+ );
523
+ }
502
524
  (0, import_adapterService.updateSolarFlowState)(
503
525
  adapter,
504
526
  productKey,
@@ -507,7 +529,7 @@ const onMessage = async (topic, message) => {
507
529
  0
508
530
  );
509
531
  }
510
- if (((_L = obj.properties) == null ? void 0 : _L.solarInputPower) != null && ((_M = obj.properties) == null ? void 0 : _M.solarInputPower) != void 0) {
532
+ if (((_O = obj.properties) == null ? void 0 : _O.solarInputPower) != null && ((_P = obj.properties) == null ? void 0 : _P.solarInputPower) != void 0) {
511
533
  (0, import_adapterService.updateSolarFlowState)(
512
534
  adapter,
513
535
  productKey,
@@ -516,7 +538,7 @@ const onMessage = async (topic, message) => {
516
538
  obj.properties.solarInputPower
517
539
  );
518
540
  }
519
- if (((_N = obj.properties) == null ? void 0 : _N.pvPower1) != null && ((_O = obj.properties) == null ? void 0 : _O.pvPower1) != void 0) {
541
+ if (((_Q = obj.properties) == null ? void 0 : _Q.pvPower1) != null && ((_R = obj.properties) == null ? void 0 : _R.pvPower1) != void 0) {
520
542
  (0, import_adapterService.updateSolarFlowState)(
521
543
  adapter,
522
544
  productKey,
@@ -526,7 +548,7 @@ const onMessage = async (topic, message) => {
526
548
  obj.properties.pvPower1
527
549
  );
528
550
  }
529
- if (((_P = obj.properties) == null ? void 0 : _P.pvPower2) != null && ((_Q = obj.properties) == null ? void 0 : _Q.pvPower2) != void 0) {
551
+ if (((_S = obj.properties) == null ? void 0 : _S.pvPower2) != null && ((_T = obj.properties) == null ? void 0 : _T.pvPower2) != void 0) {
530
552
  (0, import_adapterService.updateSolarFlowState)(
531
553
  adapter,
532
554
  productKey,
@@ -536,7 +558,7 @@ const onMessage = async (topic, message) => {
536
558
  obj.properties.pvPower2
537
559
  );
538
560
  }
539
- if (((_R = obj.properties) == null ? void 0 : _R.solarPower1) != null && ((_S = obj.properties) == null ? void 0 : _S.solarPower1) != void 0) {
561
+ if (((_U = obj.properties) == null ? void 0 : _U.solarPower1) != null && ((_V = obj.properties) == null ? void 0 : _V.solarPower1) != void 0) {
540
562
  (0, import_adapterService.updateSolarFlowState)(
541
563
  adapter,
542
564
  productKey,
@@ -545,7 +567,7 @@ const onMessage = async (topic, message) => {
545
567
  obj.properties.solarPower1
546
568
  );
547
569
  }
548
- if (((_T = obj.properties) == null ? void 0 : _T.solarPower2) != null && ((_U = obj.properties) == null ? void 0 : _U.solarPower2) != void 0) {
570
+ if (((_W = obj.properties) == null ? void 0 : _W.solarPower2) != null && ((_X = obj.properties) == null ? void 0 : _X.solarPower2) != void 0) {
549
571
  (0, import_adapterService.updateSolarFlowState)(
550
572
  adapter,
551
573
  productKey,
@@ -554,7 +576,7 @@ const onMessage = async (topic, message) => {
554
576
  obj.properties.solarPower2
555
577
  );
556
578
  }
557
- if (((_V = obj.properties) == null ? void 0 : _V.remainOutTime) != null && ((_W = obj.properties) == null ? void 0 : _W.remainOutTime) != void 0) {
579
+ if (((_Y = obj.properties) == null ? void 0 : _Y.remainOutTime) != null && ((_Z = obj.properties) == null ? void 0 : _Z.remainOutTime) != void 0) {
558
580
  (0, import_adapterService.updateSolarFlowState)(
559
581
  adapter,
560
582
  productKey,
@@ -563,7 +585,7 @@ const onMessage = async (topic, message) => {
563
585
  obj.properties.remainOutTime
564
586
  );
565
587
  }
566
- if (((_X = obj.properties) == null ? void 0 : _X.remainInputTime) != null && ((_Y = obj.properties) == null ? void 0 : _Y.remainInputTime) != void 0) {
588
+ if (((__ = obj.properties) == null ? void 0 : __.remainInputTime) != null && ((_$ = obj.properties) == null ? void 0 : _$.remainInputTime) != void 0) {
567
589
  (0, import_adapterService.updateSolarFlowState)(
568
590
  adapter,
569
591
  productKey,
@@ -572,7 +594,7 @@ const onMessage = async (topic, message) => {
572
594
  obj.properties.remainInputTime
573
595
  );
574
596
  }
575
- if (((_Z = obj.properties) == null ? void 0 : _Z.socSet) != null && ((__ = obj.properties) == null ? void 0 : __.socSet) != void 0) {
597
+ if (((_aa = obj.properties) == null ? void 0 : _aa.socSet) != null && ((_ba = obj.properties) == null ? void 0 : _ba.socSet) != void 0) {
576
598
  (0, import_adapterService.updateSolarFlowState)(
577
599
  adapter,
578
600
  productKey,
@@ -588,7 +610,7 @@ const onMessage = async (topic, message) => {
588
610
  Number(obj.properties.socSet) / 10
589
611
  );
590
612
  }
591
- if (((_$ = obj.properties) == null ? void 0 : _$.minSoc) != null && ((_aa = obj.properties) == null ? void 0 : _aa.minSoc) != void 0) {
613
+ if (((_ca = obj.properties) == null ? void 0 : _ca.minSoc) != null && ((_da = obj.properties) == null ? void 0 : _da.minSoc) != void 0) {
592
614
  (0, import_adapterService.updateSolarFlowState)(
593
615
  adapter,
594
616
  productKey,
@@ -604,7 +626,7 @@ const onMessage = async (topic, message) => {
604
626
  Number(obj.properties.minSoc) / 10
605
627
  );
606
628
  }
607
- if (((_ba = obj.properties) == null ? void 0 : _ba.inputLimit) != null && ((_ca = obj.properties) == null ? void 0 : _ca.inputLimit) != void 0) {
629
+ if (((_ea = obj.properties) == null ? void 0 : _ea.inputLimit) != null && ((_fa = obj.properties) == null ? void 0 : _fa.inputLimit) != void 0) {
608
630
  (0, import_adapterService.updateSolarFlowState)(
609
631
  adapter,
610
632
  productKey,
@@ -612,7 +634,7 @@ const onMessage = async (topic, message) => {
612
634
  "inputLimit",
613
635
  obj.properties.inputLimit
614
636
  );
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"))) {
637
+ if (((_ga = productName == null ? void 0 : productName.val) == null ? void 0 : _ga.toString().toLowerCase().includes("solarflow")) || ((_ha = productName == null ? void 0 : productName.val) == null ? void 0 : _ha.toString().toLowerCase().includes("ace")) || ((_ia = productName == null ? void 0 : productName.val) == null ? void 0 : _ia.toString().toLowerCase().includes("hyper"))) {
616
638
  (0, import_adapterService.updateSolarFlowControlState)(
617
639
  adapter,
618
640
  productKey,
@@ -622,7 +644,7 @@ const onMessage = async (topic, message) => {
622
644
  );
623
645
  }
624
646
  }
625
- if (((_ga = obj.properties) == null ? void 0 : _ga.gridInputPower) != null && ((_ha = obj.properties) == null ? void 0 : _ha.gridInputPower) != void 0) {
647
+ if (((_ja = obj.properties) == null ? void 0 : _ja.gridInputPower) != null && ((_ka = obj.properties) == null ? void 0 : _ka.gridInputPower) != void 0) {
626
648
  (0, import_adapterService.updateSolarFlowState)(
627
649
  adapter,
628
650
  productKey,
@@ -631,7 +653,7 @@ const onMessage = async (topic, message) => {
631
653
  obj.properties.gridInputPower
632
654
  );
633
655
  }
634
- if (((_ia = obj.properties) == null ? void 0 : _ia.acMode) != null && ((_ja = obj.properties) == null ? void 0 : _ja.acMode) != void 0) {
656
+ if (((_la = obj.properties) == null ? void 0 : _la.acMode) != null && ((_ma = obj.properties) == null ? void 0 : _ma.acMode) != void 0) {
635
657
  (0, import_adapterService.updateSolarFlowState)(
636
658
  adapter,
637
659
  productKey,
@@ -647,7 +669,7 @@ const onMessage = async (topic, message) => {
647
669
  obj.properties.acMode
648
670
  );
649
671
  }
650
- if (((_ka = obj.properties) == null ? void 0 : _ka.hyperTmp) != null && ((_la = obj.properties) == null ? void 0 : _la.hyperTmp) != void 0) {
672
+ if (((_na = obj.properties) == null ? void 0 : _na.hyperTmp) != null && ((_oa = obj.properties) == null ? void 0 : _oa.hyperTmp) != void 0) {
651
673
  (0, import_adapterService.updateSolarFlowState)(
652
674
  adapter,
653
675
  productKey,
@@ -656,7 +678,7 @@ const onMessage = async (topic, message) => {
656
678
  obj.properties.hyperTmp / 10 - 273.15
657
679
  );
658
680
  }
659
- if (((_ma = obj.properties) == null ? void 0 : _ma.acOutputPower) != null && ((_na = obj.properties) == null ? void 0 : _na.acOutputPower) != void 0) {
681
+ if (((_pa = obj.properties) == null ? void 0 : _pa.acOutputPower) != null && ((_qa = obj.properties) == null ? void 0 : _qa.acOutputPower) != void 0) {
660
682
  (0, import_adapterService.updateSolarFlowState)(
661
683
  adapter,
662
684
  productKey,
@@ -665,7 +687,7 @@ const onMessage = async (topic, message) => {
665
687
  obj.properties.acOutputPower
666
688
  );
667
689
  }
668
- if (((_oa = obj.properties) == null ? void 0 : _oa.gridPower) != null && ((_pa = obj.properties) == null ? void 0 : _pa.gridPower) != void 0) {
690
+ if (((_ra = obj.properties) == null ? void 0 : _ra.gridPower) != null && ((_sa = obj.properties) == null ? void 0 : _sa.gridPower) != void 0) {
669
691
  (0, import_adapterService.updateSolarFlowState)(
670
692
  adapter,
671
693
  productKey,
@@ -674,8 +696,8 @@ const onMessage = async (topic, message) => {
674
696
  obj.properties.gridPower
675
697
  );
676
698
  }
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;
699
+ if (((_ta = obj.properties) == null ? void 0 : _ta.acSwitch) != null && ((_ua = obj.properties) == null ? void 0 : _ua.acSwitch) != void 0) {
700
+ const value = ((_va = obj.properties) == null ? void 0 : _va.acSwitch) == 0 ? false : true;
679
701
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "acSwitch", value);
680
702
  (0, import_adapterService.updateSolarFlowControlState)(
681
703
  adapter,
@@ -685,8 +707,8 @@ const onMessage = async (topic, message) => {
685
707
  value
686
708
  );
687
709
  }
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;
710
+ if (((_wa = obj.properties) == null ? void 0 : _wa.dcSwitch) != null && ((_xa = obj.properties) == null ? void 0 : _xa.dcSwitch) != void 0) {
711
+ const value = ((_ya = obj.properties) == null ? void 0 : _ya.dcSwitch) == 0 ? false : true;
690
712
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "dcSwitch", value);
691
713
  (0, import_adapterService.updateSolarFlowControlState)(
692
714
  adapter,
@@ -696,7 +718,7 @@ const onMessage = async (topic, message) => {
696
718
  value
697
719
  );
698
720
  }
699
- if (((_wa = obj.properties) == null ? void 0 : _wa.dcOutputPower) != null && ((_xa = obj.properties) == null ? void 0 : _xa.dcOutputPower) != void 0) {
721
+ if (((_za = obj.properties) == null ? void 0 : _za.dcOutputPower) != null && ((_Aa = obj.properties) == null ? void 0 : _Aa.dcOutputPower) != void 0) {
700
722
  (0, import_adapterService.updateSolarFlowState)(
701
723
  adapter,
702
724
  productKey,
@@ -705,11 +727,11 @@ const onMessage = async (topic, message) => {
705
727
  obj.properties.dcOutputPower
706
728
  );
707
729
  }
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";
730
+ if (((_Ba = obj.properties) == null ? void 0 : _Ba.pvBrand) != null && ((_Ca = obj.properties) == null ? void 0 : _Ca.pvBrand) != void 0) {
731
+ const value = ((_Da = obj.properties) == null ? void 0 : _Da.pvBrand) == 0 ? "Others" : ((_Ea = obj.properties) == null ? void 0 : _Ea.pvBrand) == 1 ? "Hoymiles" : ((_Fa = obj.properties) == null ? void 0 : _Fa.pvBrand) == 2 ? "Enphase" : ((_Ga = obj.properties) == null ? void 0 : _Ga.pvBrand) == 3 ? "APSystems" : ((_Ha = obj.properties) == null ? void 0 : _Ha.pvBrand) == 4 ? "Anker" : ((_Ia = obj.properties) == null ? void 0 : _Ia.pvBrand) == 5 ? "Deye" : ((_Ja = obj.properties) == null ? void 0 : _Ja.pvBrand) == 6 ? "Bosswerk" : "Unknown";
710
732
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "pvBrand", value);
711
733
  }
712
- if (((_Ha = obj.properties) == null ? void 0 : _Ha.inverseMaxPower) != null && ((_Ia = obj.properties) == null ? void 0 : _Ia.inverseMaxPower) != void 0) {
734
+ if (((_Ka = obj.properties) == null ? void 0 : _Ka.inverseMaxPower) != null && ((_La = obj.properties) == null ? void 0 : _La.inverseMaxPower) != void 0) {
713
735
  (0, import_adapterService.updateSolarFlowState)(
714
736
  adapter,
715
737
  productKey,
@@ -718,7 +740,7 @@ const onMessage = async (topic, message) => {
718
740
  obj.properties.inverseMaxPower
719
741
  );
720
742
  }
721
- if (((_Ja = obj.properties) == null ? void 0 : _Ja.wifiState) != null && ((_Ka = obj.properties) == null ? void 0 : _Ka.wifiState) != void 0) {
743
+ if (((_Ma = obj.properties) == null ? void 0 : _Ma.wifiState) != null && ((_Na = obj.properties) == null ? void 0 : _Na.wifiState) != void 0) {
722
744
  (0, import_adapterService.updateSolarFlowState)(
723
745
  adapter,
724
746
  productKey,
@@ -727,7 +749,7 @@ const onMessage = async (topic, message) => {
727
749
  obj.properties.wifiState == 1 ? "Connected" : "Disconnected"
728
750
  );
729
751
  }
730
- if (((_La = obj.properties) == null ? void 0 : _La.packNum) != null && ((_Ma = obj.properties) == null ? void 0 : _Ma.packNum) != void 0) {
752
+ if (((_Oa = obj.properties) == null ? void 0 : _Oa.packNum) != null && ((_Pa = obj.properties) == null ? void 0 : _Pa.packNum) != void 0) {
731
753
  (0, import_adapterService.updateSolarFlowState)(
732
754
  adapter,
733
755
  productKey,
@@ -736,7 +758,7 @@ const onMessage = async (topic, message) => {
736
758
  obj.properties.packNum
737
759
  );
738
760
  }
739
- if (((_Na = obj.properties) == null ? void 0 : _Na.hubState) != null && ((_Oa = obj.properties) == null ? void 0 : _Oa.hubState) != void 0) {
761
+ if (((_Qa = obj.properties) == null ? void 0 : _Qa.hubState) != null && ((_Ra = obj.properties) == null ? void 0 : _Ra.hubState) != void 0) {
740
762
  (0, import_adapterService.updateSolarFlowState)(
741
763
  adapter,
742
764
  productKey,
@@ -756,7 +778,7 @@ const onMessage = async (topic, message) => {
756
778
  addOrUpdatePackData(productKey, deviceKey, obj.packData, isSolarFlow);
757
779
  }
758
780
  if (obj.properties && adapter.log.level == "debug") {
759
- const _productName = (_Pa = productName == null ? void 0 : productName.val) == null ? void 0 : _Pa.toString();
781
+ const _productName = (_Sa = productName == null ? void 0 : productName.val) == null ? void 0 : _Sa.toString();
760
782
  if (_productName) {
761
783
  const states = (0, import_createSolarFlowStates.getStateDefinition)(_productName);
762
784
  let found = false;
@@ -840,7 +862,7 @@ const setHubState = async (adapter2, productKey, deviceKey, hubState) => {
840
862
  }
841
863
  };
842
864
  const setOutputLimit = async (adapter2, productKey, deviceKey, limit) => {
843
- var _a, _b, _c, _d, _e;
865
+ var _a, _b, _c;
844
866
  if (adapter2.mqttClient && productKey && deviceKey) {
845
867
  const autoModel = (_a = await adapter2.getStateAsync(productKey + "." + deviceKey + ".autoModel")) == null ? void 0 : _a.val;
846
868
  if (autoModel != 0) {
@@ -870,16 +892,14 @@ const setOutputLimit = async (adapter2, productKey, deviceKey, limit) => {
870
892
  }
871
893
  const currentLimit = (_b = await adapter2.getStateAsync(productKey + "." + deviceKey + ".outputLimit")) == null ? void 0 : _b.val;
872
894
  if (currentLimit != null && currentLimit != void 0) {
873
- const productName = (_d = (_c = await adapter2.getStateAsync(
874
- productKey + "." + deviceKey + ".productName"
875
- )) == null ? void 0 : _c.val) == null ? void 0 : _d.toString().toLowerCase();
895
+ const productName = (0, import_helpers.getProductNameFromProductKey)(productKey);
876
896
  if (currentLimit != limit) {
877
897
  if (limit < 100 && limit != 90 && limit != 60 && limit != 30 && limit != 0) {
878
- if (limit < 100 && limit > 90 && !(productName == null ? void 0 : productName.includes("hyper"))) {
898
+ if (limit < 100 && limit > 90 && !(productName == null ? void 0 : productName.includes("hyper")) && !(productName == null ? void 0 : productName.includes("2400 ac")) && !(productName == null ? void 0 : productName.includes("solarflow 800"))) {
879
899
  limit = 90;
880
- } else if (limit > 60 && limit < 90 && !(productName == null ? void 0 : productName.includes("hyper"))) {
900
+ } else if (limit > 60 && limit < 90 && !(productName == null ? void 0 : productName.includes("hyper")) && !(productName == null ? void 0 : productName.includes("2400 ac")) && !(productName == null ? void 0 : productName.includes("solarflow 800"))) {
881
901
  limit = 60;
882
- } else if (limit > 30 && limit < 60 && !(productName == null ? void 0 : productName.includes("hyper"))) {
902
+ } else if (limit > 30 && limit < 60 && !(productName == null ? void 0 : productName.includes("hyper")) && !(productName == null ? void 0 : productName.includes("2400 ac")) && !(productName == null ? void 0 : productName.includes("solarflow 800"))) {
883
903
  limit = 30;
884
904
  } else if (limit < 30) {
885
905
  limit = 30;
@@ -926,13 +946,13 @@ const setOutputLimit = async (adapter2, productKey, deviceKey, limit) => {
926
946
  }
927
947
  const topic = `iot/${productKey}/${deviceKey}/properties/write`;
928
948
  const outputlimit = { properties: { outputLimit: limit } };
929
- (_e = adapter2.mqttClient) == null ? void 0 : _e.publish(topic, JSON.stringify(outputlimit));
949
+ (_c = adapter2.mqttClient) == null ? void 0 : _c.publish(topic, JSON.stringify(outputlimit));
930
950
  }
931
951
  }
932
952
  }
933
953
  };
934
954
  const setInputLimit = async (adapter2, productKey, deviceKey, limit) => {
935
- var _a, _b, _c, _d;
955
+ var _a, _b;
936
956
  if (adapter2.mqttClient && productKey && deviceKey) {
937
957
  if (limit) {
938
958
  limit = Math.round(limit);
@@ -941,7 +961,7 @@ const setInputLimit = async (adapter2, productKey, deviceKey, limit) => {
941
961
  }
942
962
  let maxLimit = 900;
943
963
  const currentLimit = (_a = await adapter2.getStateAsync(productKey + "." + deviceKey + ".inputLimit")) == null ? void 0 : _a.val;
944
- const productName = (_c = (_b = await adapter2.getStateAsync(productKey + "." + deviceKey + ".productName")) == null ? void 0 : _b.val) == null ? void 0 : _c.toString().toLowerCase();
964
+ const productName = (0, import_helpers.getProductNameFromProductKey)(productKey);
945
965
  if (productName == null ? void 0 : productName.includes("hyper")) {
946
966
  maxLimit = 1200;
947
967
  }
@@ -965,7 +985,7 @@ const setInputLimit = async (adapter2, productKey, deviceKey, limit) => {
965
985
  if (currentLimit != limit) {
966
986
  const topic = `iot/${productKey}/${deviceKey}/properties/write`;
967
987
  const inputLimitContent = { properties: { inputLimit: limit } };
968
- (_d = adapter2.mqttClient) == null ? void 0 : _d.publish(topic, JSON.stringify(inputLimitContent));
988
+ (_b = adapter2.mqttClient) == null ? void 0 : _b.publish(topic, JSON.stringify(inputLimitContent));
969
989
  }
970
990
  }
971
991
  }