iobroker.zendure-solarflow 1.12.3 → 1.12.5

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.
@@ -53,6 +53,7 @@ var import_adapterService = require("./adapterService");
53
53
  var import_calculationService = require("./calculationService");
54
54
  var import_jobSchedule = require("./jobSchedule");
55
55
  var import_createSolarFlowLocalStates = require("../helpers/createSolarFlowLocalStates");
56
+ var import_createSolarFlowStates = require("../helpers/createSolarFlowStates");
56
57
  let adapter = void 0;
57
58
  const addOrUpdatePackData = async (productKey, deviceKey, packData, isSolarFlow) => {
58
59
  if (adapter && productKey && deviceKey) {
@@ -74,6 +75,9 @@ const addOrUpdatePackData = async (productKey, deviceKey, packData, isSolarFlow)
74
75
  deviceKey,
75
76
  type: batType
76
77
  });
78
+ adapter.log.debug(
79
+ `[addOrUpdatePackData] Added battery ${batType} with SN ${x.sn} on deviceKey ${deviceKey} to pack2Devices!`
80
+ );
77
81
  }
78
82
  const key = (productKey + "." + deviceKey + ".packData." + x.sn).replace(adapter.FORBIDDEN_CHARS, "");
79
83
  await (adapter == null ? void 0 : adapter.extendObject(key, {
@@ -213,7 +217,7 @@ const addOrUpdatePackData = async (productKey, deviceKey, packData, isSolarFlow)
213
217
  }
214
218
  };
215
219
  const onMessage = async (topic, message) => {
216
- 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;
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;
217
221
  if (adapter) {
218
222
  if (topic.toLowerCase().includes("loginOut/force")) {
219
223
  }
@@ -232,6 +236,7 @@ const onMessage = async (topic, message) => {
232
236
  const productName = await adapter.getStateAsync(
233
237
  `${productKey}.${deviceKey}.productName`
234
238
  );
239
+ adapter.log.debug(`[onMessage] MQTT message: ${obj}`);
235
240
  if (obj.timestamp) {
236
241
  const currentTimeStamp = (/* @__PURE__ */ new Date()).getTime() / 1e3;
237
242
  const diff = currentTimeStamp - obj.timestamp;
@@ -243,9 +248,17 @@ const onMessage = async (topic, message) => {
243
248
  "wifiState",
244
249
  "Disconnected"
245
250
  );
251
+ } else {
252
+ (0, import_adapterService.updateSolarFlowState)(
253
+ adapter,
254
+ productKey,
255
+ deviceKey,
256
+ "wifiState",
257
+ "Connected"
258
+ );
246
259
  }
247
260
  }
248
- if (((_a = productName == null ? void 0 : productName.val) == null ? void 0 : _a.toString().toLowerCase().includes("solarflow")) || ((_b = productName == null ? void 0 : productName.val) == null ? void 0 : _b.toString().toLowerCase().includes("hyper"))) {
261
+ if (productKey != "8bM93H") {
249
262
  isSolarFlow = true;
250
263
  }
251
264
  (0, import_adapterService.updateSolarFlowState)(
@@ -255,7 +268,7 @@ const onMessage = async (topic, message) => {
255
268
  "lastUpdate",
256
269
  (/* @__PURE__ */ new Date()).getTime()
257
270
  );
258
- if (((_c = obj.properties) == null ? void 0 : _c.autoModel) != null && ((_d = obj.properties) == null ? void 0 : _d.autoModel) != void 0) {
271
+ if (((_a = obj.properties) == null ? void 0 : _a.autoModel) != null && ((_b = obj.properties) == null ? void 0 : _b.autoModel) != void 0) {
259
272
  (0, import_adapterService.updateSolarFlowState)(
260
273
  adapter,
261
274
  productKey,
@@ -271,11 +284,11 @@ const onMessage = async (topic, message) => {
271
284
  obj.properties.autoModel
272
285
  );
273
286
  }
274
- if (((_e = obj.properties) == null ? void 0 : _e.heatState) != null && ((_f = obj.properties) == null ? void 0 : _f.heatState) != void 0) {
275
- const value = ((_g = obj.properties) == null ? void 0 : _g.heatState) == 0 ? false : true;
287
+ if (((_c = obj.properties) == null ? void 0 : _c.heatState) != null && ((_d = obj.properties) == null ? void 0 : _d.heatState) != void 0) {
288
+ const value = ((_e = obj.properties) == null ? void 0 : _e.heatState) == 0 ? false : true;
276
289
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "heatState", value);
277
290
  }
278
- if (((_h = obj.properties) == null ? void 0 : _h.electricLevel) != null && ((_i = obj.properties) == null ? void 0 : _i.electricLevel) != void 0) {
291
+ if (((_f = obj.properties) == null ? void 0 : _f.electricLevel) != null && ((_g = obj.properties) == null ? void 0 : _g.electricLevel) != void 0) {
279
292
  (0, import_adapterService.updateSolarFlowState)(
280
293
  adapter,
281
294
  productKey,
@@ -309,27 +322,27 @@ const onMessage = async (topic, message) => {
309
322
  const value = obj.power / 10;
310
323
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "power", value);
311
324
  }
312
- if (((_j = obj.properties) == null ? void 0 : _j.packState) != null && ((_k = obj.properties) == null ? void 0 : _k.packState) != void 0) {
313
- const value = ((_l = obj.properties) == null ? void 0 : _l.packState) == 0 ? "Idle" : ((_m = obj.properties) == null ? void 0 : _m.packState) == 1 ? "Charging" : ((_n = obj.properties) == null ? void 0 : _n.packState) == 2 ? "Discharging" : "Unknown";
325
+ if (((_h = obj.properties) == null ? void 0 : _h.packState) != null && ((_i = obj.properties) == null ? void 0 : _i.packState) != void 0) {
326
+ 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";
314
327
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "packState", value);
315
328
  }
316
- if (((_o = obj.properties) == null ? void 0 : _o.passMode) != null && ((_p = obj.properties) == null ? void 0 : _p.passMode) != void 0) {
317
- const value = ((_q = obj.properties) == null ? void 0 : _q.passMode) == 0 ? "Automatic" : ((_r = obj.properties) == null ? void 0 : _r.passMode) == 1 ? "Always off" : ((_s = obj.properties) == null ? void 0 : _s.passMode) == 2 ? "Always on" : "Unknown";
329
+ if (((_m = obj.properties) == null ? void 0 : _m.passMode) != null && ((_n = obj.properties) == null ? void 0 : _n.passMode) != void 0) {
330
+ 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";
318
331
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "passMode", value);
319
332
  (0, import_adapterService.updateSolarFlowControlState)(
320
333
  adapter,
321
334
  productKey,
322
335
  deviceKey,
323
336
  "passMode",
324
- (_t = obj.properties) == null ? void 0 : _t.passMode
337
+ (_r = obj.properties) == null ? void 0 : _r.passMode
325
338
  );
326
339
  }
327
- if (((_u = obj.properties) == null ? void 0 : _u.pass) != null && ((_v = obj.properties) == null ? void 0 : _v.pass) != void 0) {
328
- const value = ((_w = obj.properties) == null ? void 0 : _w.pass) == 0 ? false : true;
340
+ if (((_s = obj.properties) == null ? void 0 : _s.pass) != null && ((_t = obj.properties) == null ? void 0 : _t.pass) != void 0) {
341
+ const value = ((_u = obj.properties) == null ? void 0 : _u.pass) == 0 ? false : true;
329
342
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "pass", value);
330
343
  }
331
- if (((_x = obj.properties) == null ? void 0 : _x.autoRecover) != null && ((_y = obj.properties) == null ? void 0 : _y.autoRecover) != void 0) {
332
- const value = ((_z = obj.properties) == null ? void 0 : _z.autoRecover) == 0 ? false : true;
344
+ if (((_v = obj.properties) == null ? void 0 : _v.autoRecover) != null && ((_w = obj.properties) == null ? void 0 : _w.autoRecover) != void 0) {
345
+ const value = ((_x = obj.properties) == null ? void 0 : _x.autoRecover) == 0 ? false : true;
333
346
  (0, import_adapterService.updateSolarFlowState)(
334
347
  adapter,
335
348
  productKey,
@@ -345,7 +358,7 @@ const onMessage = async (topic, message) => {
345
358
  value
346
359
  );
347
360
  }
348
- if (((_A = obj.properties) == null ? void 0 : _A.outputHomePower) != null && ((_B = obj.properties) == null ? void 0 : _B.outputHomePower) != void 0) {
361
+ if (((_y = obj.properties) == null ? void 0 : _y.outputHomePower) != null && ((_z = obj.properties) == null ? void 0 : _z.outputHomePower) != void 0) {
349
362
  (0, import_adapterService.updateSolarFlowState)(
350
363
  adapter,
351
364
  productKey,
@@ -354,7 +367,7 @@ const onMessage = async (topic, message) => {
354
367
  obj.properties.outputHomePower
355
368
  );
356
369
  }
357
- if (((_C = obj.properties) == null ? void 0 : _C.energyPower) != null && ((_D = obj.properties) == null ? void 0 : _D.energyPower) != void 0) {
370
+ if (((_A = obj.properties) == null ? void 0 : _A.energyPower) != null && ((_B = obj.properties) == null ? void 0 : _B.energyPower) != void 0) {
358
371
  (0, import_adapterService.updateSolarFlowState)(
359
372
  adapter,
360
373
  productKey,
@@ -363,7 +376,7 @@ const onMessage = async (topic, message) => {
363
376
  obj.properties.energyPower
364
377
  );
365
378
  }
366
- if (((_E = obj.properties) == null ? void 0 : _E.outputLimit) != null && ((_F = obj.properties) == null ? void 0 : _F.outputLimit) != void 0) {
379
+ if (((_C = obj.properties) == null ? void 0 : _C.outputLimit) != null && ((_D = obj.properties) == null ? void 0 : _D.outputLimit) != void 0) {
367
380
  (0, import_adapterService.updateSolarFlowState)(
368
381
  adapter,
369
382
  productKey,
@@ -379,8 +392,8 @@ const onMessage = async (topic, message) => {
379
392
  obj.properties.outputLimit
380
393
  );
381
394
  }
382
- if (((_G = obj.properties) == null ? void 0 : _G.buzzerSwitch) != null && ((_H = obj.properties) == null ? void 0 : _H.buzzerSwitch) != void 0) {
383
- const value = ((_I = obj.properties) == null ? void 0 : _I.buzzerSwitch) == 0 ? false : true;
395
+ if (((_E = obj.properties) == null ? void 0 : _E.buzzerSwitch) != null && ((_F = obj.properties) == null ? void 0 : _F.buzzerSwitch) != void 0) {
396
+ const value = ((_G = obj.properties) == null ? void 0 : _G.buzzerSwitch) == 0 ? false : true;
384
397
  (0, import_adapterService.updateSolarFlowState)(
385
398
  adapter,
386
399
  productKey,
@@ -396,7 +409,7 @@ const onMessage = async (topic, message) => {
396
409
  value
397
410
  );
398
411
  }
399
- if (((_J = obj.properties) == null ? void 0 : _J.outputPackPower) != null && ((_K = obj.properties) == null ? void 0 : _K.outputPackPower) != void 0) {
412
+ if (((_H = obj.properties) == null ? void 0 : _H.outputPackPower) != null && ((_I = obj.properties) == null ? void 0 : _I.outputPackPower) != void 0) {
400
413
  (0, import_adapterService.updateSolarFlowState)(
401
414
  adapter,
402
415
  productKey,
@@ -406,7 +419,7 @@ const onMessage = async (topic, message) => {
406
419
  );
407
420
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "packInputPower", 0);
408
421
  }
409
- if (((_L = obj.properties) == null ? void 0 : _L.packInputPower) != null && ((_M = obj.properties) == null ? void 0 : _M.packInputPower) != void 0) {
422
+ if (((_J = obj.properties) == null ? void 0 : _J.packInputPower) != null && ((_K = obj.properties) == null ? void 0 : _K.packInputPower) != void 0) {
410
423
  let standbyUsage = 0;
411
424
  const solarInputPower = await (adapter == null ? void 0 : adapter.getStateAsync(
412
425
  `${productKey}.${deviceKey}.solarInputPower`
@@ -414,7 +427,7 @@ const onMessage = async (topic, message) => {
414
427
  if (solarInputPower && Number(solarInputPower.val) < 10) {
415
428
  standbyUsage = 7 - Number(solarInputPower.val);
416
429
  }
417
- const device = (_N = adapter == null ? void 0 : adapter.deviceList) == null ? void 0 : _N.find(
430
+ const device = (_L = adapter == null ? void 0 : adapter.deviceList) == null ? void 0 : _L.find(
418
431
  (x) => x.deviceKey == deviceKey && x.productKey == productKey
419
432
  );
420
433
  if (device && device._connectedWithAce) {
@@ -435,7 +448,7 @@ const onMessage = async (topic, message) => {
435
448
  0
436
449
  );
437
450
  }
438
- if (((_O = obj.properties) == null ? void 0 : _O.solarInputPower) != null && ((_P = obj.properties) == null ? void 0 : _P.solarInputPower) != void 0) {
451
+ if (((_M = obj.properties) == null ? void 0 : _M.solarInputPower) != null && ((_N = obj.properties) == null ? void 0 : _N.solarInputPower) != void 0) {
439
452
  (0, import_adapterService.updateSolarFlowState)(
440
453
  adapter,
441
454
  productKey,
@@ -444,7 +457,7 @@ const onMessage = async (topic, message) => {
444
457
  obj.properties.solarInputPower
445
458
  );
446
459
  }
447
- if (((_Q = obj.properties) == null ? void 0 : _Q.pvPower1) != null && ((_R = obj.properties) == null ? void 0 : _R.pvPower1) != void 0) {
460
+ if (((_O = obj.properties) == null ? void 0 : _O.pvPower1) != null && ((_P = obj.properties) == null ? void 0 : _P.pvPower1) != void 0) {
448
461
  (0, import_adapterService.updateSolarFlowState)(
449
462
  adapter,
450
463
  productKey,
@@ -454,7 +467,7 @@ const onMessage = async (topic, message) => {
454
467
  obj.properties.pvPower1
455
468
  );
456
469
  }
457
- if (((_S = obj.properties) == null ? void 0 : _S.pvPower2) != null && ((_T = obj.properties) == null ? void 0 : _T.pvPower2) != void 0) {
470
+ if (((_Q = obj.properties) == null ? void 0 : _Q.pvPower2) != null && ((_R = obj.properties) == null ? void 0 : _R.pvPower2) != void 0) {
458
471
  (0, import_adapterService.updateSolarFlowState)(
459
472
  adapter,
460
473
  productKey,
@@ -464,7 +477,7 @@ const onMessage = async (topic, message) => {
464
477
  obj.properties.pvPower2
465
478
  );
466
479
  }
467
- if (((_U = obj.properties) == null ? void 0 : _U.solarPower1) != null && ((_V = obj.properties) == null ? void 0 : _V.solarPower1) != void 0) {
480
+ if (((_S = obj.properties) == null ? void 0 : _S.solarPower1) != null && ((_T = obj.properties) == null ? void 0 : _T.solarPower1) != void 0) {
468
481
  (0, import_adapterService.updateSolarFlowState)(
469
482
  adapter,
470
483
  productKey,
@@ -473,7 +486,7 @@ const onMessage = async (topic, message) => {
473
486
  obj.properties.solarPower1
474
487
  );
475
488
  }
476
- if (((_W = obj.properties) == null ? void 0 : _W.solarPower2) != null && ((_X = obj.properties) == null ? void 0 : _X.solarPower2) != void 0) {
489
+ if (((_U = obj.properties) == null ? void 0 : _U.solarPower2) != null && ((_V = obj.properties) == null ? void 0 : _V.solarPower2) != void 0) {
477
490
  (0, import_adapterService.updateSolarFlowState)(
478
491
  adapter,
479
492
  productKey,
@@ -482,7 +495,7 @@ const onMessage = async (topic, message) => {
482
495
  obj.properties.solarPower2
483
496
  );
484
497
  }
485
- if (((_Y = obj.properties) == null ? void 0 : _Y.remainOutTime) != null && ((_Z = obj.properties) == null ? void 0 : _Z.remainOutTime) != void 0) {
498
+ if (((_W = obj.properties) == null ? void 0 : _W.remainOutTime) != null && ((_X = obj.properties) == null ? void 0 : _X.remainOutTime) != void 0) {
486
499
  (0, import_adapterService.updateSolarFlowState)(
487
500
  adapter,
488
501
  productKey,
@@ -491,7 +504,7 @@ const onMessage = async (topic, message) => {
491
504
  obj.properties.remainOutTime
492
505
  );
493
506
  }
494
- if (((__ = obj.properties) == null ? void 0 : __.remainInputTime) != null && ((_$ = obj.properties) == null ? void 0 : _$.remainInputTime) != void 0) {
507
+ if (((_Y = obj.properties) == null ? void 0 : _Y.remainInputTime) != null && ((_Z = obj.properties) == null ? void 0 : _Z.remainInputTime) != void 0) {
495
508
  (0, import_adapterService.updateSolarFlowState)(
496
509
  adapter,
497
510
  productKey,
@@ -500,7 +513,7 @@ const onMessage = async (topic, message) => {
500
513
  obj.properties.remainInputTime
501
514
  );
502
515
  }
503
- if (((_aa = obj.properties) == null ? void 0 : _aa.socSet) != null && ((_ba = obj.properties) == null ? void 0 : _ba.socSet) != void 0) {
516
+ if (((__ = obj.properties) == null ? void 0 : __.socSet) != null && ((_$ = obj.properties) == null ? void 0 : _$.socSet) != void 0) {
504
517
  (0, import_adapterService.updateSolarFlowState)(
505
518
  adapter,
506
519
  productKey,
@@ -516,7 +529,7 @@ const onMessage = async (topic, message) => {
516
529
  Number(obj.properties.socSet) / 10
517
530
  );
518
531
  }
519
- if (((_ca = obj.properties) == null ? void 0 : _ca.minSoc) != null && ((_da = obj.properties) == null ? void 0 : _da.minSoc) != void 0) {
532
+ if (((_aa = obj.properties) == null ? void 0 : _aa.minSoc) != null && ((_ba = obj.properties) == null ? void 0 : _ba.minSoc) != void 0) {
520
533
  (0, import_adapterService.updateSolarFlowState)(
521
534
  adapter,
522
535
  productKey,
@@ -532,7 +545,7 @@ const onMessage = async (topic, message) => {
532
545
  Number(obj.properties.minSoc) / 10
533
546
  );
534
547
  }
535
- if (((_ea = obj.properties) == null ? void 0 : _ea.inputLimit) != null && ((_fa = obj.properties) == null ? void 0 : _fa.inputLimit) != void 0) {
548
+ if (((_ca = obj.properties) == null ? void 0 : _ca.inputLimit) != null && ((_da = obj.properties) == null ? void 0 : _da.inputLimit) != void 0) {
536
549
  (0, import_adapterService.updateSolarFlowState)(
537
550
  adapter,
538
551
  productKey,
@@ -540,7 +553,7 @@ const onMessage = async (topic, message) => {
540
553
  "inputLimit",
541
554
  obj.properties.inputLimit
542
555
  );
543
- 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"))) {
556
+ 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"))) {
544
557
  (0, import_adapterService.updateSolarFlowControlState)(
545
558
  adapter,
546
559
  productKey,
@@ -550,7 +563,7 @@ const onMessage = async (topic, message) => {
550
563
  );
551
564
  }
552
565
  }
553
- if (((_ja = obj.properties) == null ? void 0 : _ja.gridInputPower) != null && ((_ka = obj.properties) == null ? void 0 : _ka.gridInputPower) != void 0) {
566
+ if (((_ha = obj.properties) == null ? void 0 : _ha.gridInputPower) != null && ((_ia = obj.properties) == null ? void 0 : _ia.gridInputPower) != void 0) {
554
567
  (0, import_adapterService.updateSolarFlowState)(
555
568
  adapter,
556
569
  productKey,
@@ -559,7 +572,7 @@ const onMessage = async (topic, message) => {
559
572
  obj.properties.gridInputPower
560
573
  );
561
574
  }
562
- if (((_la = obj.properties) == null ? void 0 : _la.acMode) != null && ((_ma = obj.properties) == null ? void 0 : _ma.acMode) != void 0) {
575
+ if (((_ja = obj.properties) == null ? void 0 : _ja.acMode) != null && ((_ka = obj.properties) == null ? void 0 : _ka.acMode) != void 0) {
563
576
  (0, import_adapterService.updateSolarFlowState)(
564
577
  adapter,
565
578
  productKey,
@@ -575,7 +588,7 @@ const onMessage = async (topic, message) => {
575
588
  obj.properties.acMode
576
589
  );
577
590
  }
578
- if (((_na = obj.properties) == null ? void 0 : _na.hyperTmp) != null && ((_oa = obj.properties) == null ? void 0 : _oa.hyperTmp) != void 0) {
591
+ if (((_la = obj.properties) == null ? void 0 : _la.hyperTmp) != null && ((_ma = obj.properties) == null ? void 0 : _ma.hyperTmp) != void 0) {
579
592
  (0, import_adapterService.updateSolarFlowState)(
580
593
  adapter,
581
594
  productKey,
@@ -584,7 +597,7 @@ const onMessage = async (topic, message) => {
584
597
  obj.properties.hyperTmp / 10 - 273.15
585
598
  );
586
599
  }
587
- if (((_pa = obj.properties) == null ? void 0 : _pa.acOutputPower) != null && ((_qa = obj.properties) == null ? void 0 : _qa.acOutputPower) != void 0) {
600
+ if (((_na = obj.properties) == null ? void 0 : _na.acOutputPower) != null && ((_oa = obj.properties) == null ? void 0 : _oa.acOutputPower) != void 0) {
588
601
  (0, import_adapterService.updateSolarFlowState)(
589
602
  adapter,
590
603
  productKey,
@@ -593,7 +606,7 @@ const onMessage = async (topic, message) => {
593
606
  obj.properties.acOutputPower
594
607
  );
595
608
  }
596
- if (((_ra = obj.properties) == null ? void 0 : _ra.gridPower) != null && ((_sa = obj.properties) == null ? void 0 : _sa.gridPower) != void 0) {
609
+ if (((_pa = obj.properties) == null ? void 0 : _pa.gridPower) != null && ((_qa = obj.properties) == null ? void 0 : _qa.gridPower) != void 0) {
597
610
  (0, import_adapterService.updateSolarFlowState)(
598
611
  adapter,
599
612
  productKey,
@@ -602,8 +615,8 @@ const onMessage = async (topic, message) => {
602
615
  obj.properties.gridPower
603
616
  );
604
617
  }
605
- if (((_ta = obj.properties) == null ? void 0 : _ta.acSwitch) != null && ((_ua = obj.properties) == null ? void 0 : _ua.acSwitch) != void 0) {
606
- const value = ((_va = obj.properties) == null ? void 0 : _va.acSwitch) == 0 ? false : true;
618
+ if (((_ra = obj.properties) == null ? void 0 : _ra.acSwitch) != null && ((_sa = obj.properties) == null ? void 0 : _sa.acSwitch) != void 0) {
619
+ const value = ((_ta = obj.properties) == null ? void 0 : _ta.acSwitch) == 0 ? false : true;
607
620
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "acSwitch", value);
608
621
  (0, import_adapterService.updateSolarFlowControlState)(
609
622
  adapter,
@@ -613,8 +626,8 @@ const onMessage = async (topic, message) => {
613
626
  value
614
627
  );
615
628
  }
616
- if (((_wa = obj.properties) == null ? void 0 : _wa.dcSwitch) != null && ((_xa = obj.properties) == null ? void 0 : _xa.dcSwitch) != void 0) {
617
- const value = ((_ya = obj.properties) == null ? void 0 : _ya.dcSwitch) == 0 ? false : true;
629
+ if (((_ua = obj.properties) == null ? void 0 : _ua.dcSwitch) != null && ((_va = obj.properties) == null ? void 0 : _va.dcSwitch) != void 0) {
630
+ const value = ((_wa = obj.properties) == null ? void 0 : _wa.dcSwitch) == 0 ? false : true;
618
631
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "dcSwitch", value);
619
632
  (0, import_adapterService.updateSolarFlowControlState)(
620
633
  adapter,
@@ -624,7 +637,7 @@ const onMessage = async (topic, message) => {
624
637
  value
625
638
  );
626
639
  }
627
- if (((_za = obj.properties) == null ? void 0 : _za.dcOutputPower) != null && ((_Aa = obj.properties) == null ? void 0 : _Aa.dcOutputPower) != void 0) {
640
+ if (((_xa = obj.properties) == null ? void 0 : _xa.dcOutputPower) != null && ((_ya = obj.properties) == null ? void 0 : _ya.dcOutputPower) != void 0) {
628
641
  (0, import_adapterService.updateSolarFlowState)(
629
642
  adapter,
630
643
  productKey,
@@ -633,11 +646,11 @@ const onMessage = async (topic, message) => {
633
646
  obj.properties.dcOutputPower
634
647
  );
635
648
  }
636
- if (((_Ba = obj.properties) == null ? void 0 : _Ba.pvBrand) != null && ((_Ca = obj.properties) == null ? void 0 : _Ca.pvBrand) != void 0) {
637
- 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";
649
+ if (((_za = obj.properties) == null ? void 0 : _za.pvBrand) != null && ((_Aa = obj.properties) == null ? void 0 : _Aa.pvBrand) != void 0) {
650
+ 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";
638
651
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "pvBrand", value);
639
652
  }
640
- if (((_Ka = obj.properties) == null ? void 0 : _Ka.inverseMaxPower) != null && ((_La = obj.properties) == null ? void 0 : _La.inverseMaxPower) != void 0) {
653
+ if (((_Ia = obj.properties) == null ? void 0 : _Ia.inverseMaxPower) != null && ((_Ja = obj.properties) == null ? void 0 : _Ja.inverseMaxPower) != void 0) {
641
654
  (0, import_adapterService.updateSolarFlowState)(
642
655
  adapter,
643
656
  productKey,
@@ -646,7 +659,7 @@ const onMessage = async (topic, message) => {
646
659
  obj.properties.inverseMaxPower
647
660
  );
648
661
  }
649
- if (((_Ma = obj.properties) == null ? void 0 : _Ma.wifiState) != null && ((_Na = obj.properties) == null ? void 0 : _Na.wifiState) != void 0) {
662
+ if (((_Ka = obj.properties) == null ? void 0 : _Ka.wifiState) != null && ((_La = obj.properties) == null ? void 0 : _La.wifiState) != void 0) {
650
663
  (0, import_adapterService.updateSolarFlowState)(
651
664
  adapter,
652
665
  productKey,
@@ -655,7 +668,7 @@ const onMessage = async (topic, message) => {
655
668
  obj.properties.wifiState == 1 ? "Connected" : "Disconnected"
656
669
  );
657
670
  }
658
- if (((_Oa = obj.properties) == null ? void 0 : _Oa.packNum) != null && ((_Pa = obj.properties) == null ? void 0 : _Pa.packNum) != void 0) {
671
+ if (((_Ma = obj.properties) == null ? void 0 : _Ma.packNum) != null && ((_Na = obj.properties) == null ? void 0 : _Na.packNum) != void 0) {
659
672
  (0, import_adapterService.updateSolarFlowState)(
660
673
  adapter,
661
674
  productKey,
@@ -664,7 +677,7 @@ const onMessage = async (topic, message) => {
664
677
  obj.properties.packNum
665
678
  );
666
679
  }
667
- if (((_Qa = obj.properties) == null ? void 0 : _Qa.hubState) != null && ((_Ra = obj.properties) == null ? void 0 : _Ra.hubState) != void 0) {
680
+ if (((_Oa = obj.properties) == null ? void 0 : _Oa.hubState) != null && ((_Pa = obj.properties) == null ? void 0 : _Pa.hubState) != void 0) {
668
681
  (0, import_adapterService.updateSolarFlowState)(
669
682
  adapter,
670
683
  productKey,
@@ -683,6 +696,34 @@ const onMessage = async (topic, message) => {
683
696
  if (obj.packData) {
684
697
  addOrUpdatePackData(productKey, deviceKey, obj.packData, isSolarFlow);
685
698
  }
699
+ if (obj.properties && adapter.log.level == "debug") {
700
+ let type = "solarflow";
701
+ const _productName = (_Qa = productName == null ? void 0 : productName.val) == null ? void 0 : _Qa.toString();
702
+ if (_productName == null ? void 0 : _productName.toLowerCase().includes("hyper")) {
703
+ type = "hyper";
704
+ } else if (_productName == null ? void 0 : _productName.toLowerCase().includes("ace")) {
705
+ type = "ace";
706
+ } else if (_productName == null ? void 0 : _productName.toLowerCase().includes("aio")) {
707
+ type = "aio";
708
+ } else if (_productName == null ? void 0 : _productName.toLowerCase().includes("smart plug")) {
709
+ type = "smartPlug";
710
+ }
711
+ const states = (0, import_createSolarFlowStates.getStateDefinition)(type);
712
+ let found = false;
713
+ Object.entries(obj.properties).forEach(([key, value]) => {
714
+ states.forEach((state) => {
715
+ if (state.title == key) {
716
+ found = true;
717
+ }
718
+ });
719
+ if (found) {
720
+ } else {
721
+ adapter == null ? void 0 : adapter.log.debug(
722
+ `[onMessage] ${productName == null ? void 0 : productName.val}: ${key} with value ${value} is a UNKNOWN Mqtt Property!`
723
+ );
724
+ }
725
+ });
726
+ }
686
727
  }
687
728
  };
688
729
  const setAcMode = async (adapter2, productKey, deviceKey, acMode) => {
@@ -701,7 +742,7 @@ const setAcMode = async (adapter2, productKey, deviceKey, acMode) => {
701
742
  const setChargeLimit = async (adapter2, productKey, deviceKey, socSet) => {
702
743
  var _a;
703
744
  if (adapter2.mqttClient && productKey && deviceKey) {
704
- if (socSet > 40 && socSet <= 100) {
745
+ if (socSet >= 40 && socSet <= 100) {
705
746
  const topic = `iot/${productKey}/${deviceKey}/properties/write`;
706
747
  const socSetLimit = { properties: { socSet: socSet * 10 } };
707
748
  adapter2.log.debug(
@@ -718,7 +759,7 @@ const setChargeLimit = async (adapter2, productKey, deviceKey, socSet) => {
718
759
  const setDischargeLimit = async (adapter2, productKey, deviceKey, minSoc) => {
719
760
  var _a;
720
761
  if (adapter2.mqttClient && productKey && deviceKey) {
721
- if (minSoc > 0 && minSoc < 50) {
762
+ if (minSoc >= 0 && minSoc <= 50) {
722
763
  const topic = `iot/${productKey}/${deviceKey}/properties/write`;
723
764
  const socSetLimit = { properties: { minSoc: minSoc * 10 } };
724
765
  adapter2.log.debug(