iobroker.zendure-solarflow 1.12.4 → 1.12.6

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,9 @@ const onMessage = async (topic, message) => {
232
236
  const productName = await adapter.getStateAsync(
233
237
  `${productKey}.${deviceKey}.productName`
234
238
  );
239
+ if (adapter.log.level == "debug") {
240
+ adapter.log.debug(`[onMessage] MQTT message: ${message.toString()}`);
241
+ }
235
242
  if (obj.timestamp) {
236
243
  const currentTimeStamp = (/* @__PURE__ */ new Date()).getTime() / 1e3;
237
244
  const diff = currentTimeStamp - obj.timestamp;
@@ -243,9 +250,17 @@ const onMessage = async (topic, message) => {
243
250
  "wifiState",
244
251
  "Disconnected"
245
252
  );
253
+ } else {
254
+ (0, import_adapterService.updateSolarFlowState)(
255
+ adapter,
256
+ productKey,
257
+ deviceKey,
258
+ "wifiState",
259
+ "Connected"
260
+ );
246
261
  }
247
262
  }
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"))) {
263
+ if (productKey != "8bM93H") {
249
264
  isSolarFlow = true;
250
265
  }
251
266
  (0, import_adapterService.updateSolarFlowState)(
@@ -255,7 +270,7 @@ const onMessage = async (topic, message) => {
255
270
  "lastUpdate",
256
271
  (/* @__PURE__ */ new Date()).getTime()
257
272
  );
258
- if (((_c = obj.properties) == null ? void 0 : _c.autoModel) != null && ((_d = obj.properties) == null ? void 0 : _d.autoModel) != void 0) {
273
+ if (((_a = obj.properties) == null ? void 0 : _a.autoModel) != null && ((_b = obj.properties) == null ? void 0 : _b.autoModel) != void 0) {
259
274
  (0, import_adapterService.updateSolarFlowState)(
260
275
  adapter,
261
276
  productKey,
@@ -271,11 +286,11 @@ const onMessage = async (topic, message) => {
271
286
  obj.properties.autoModel
272
287
  );
273
288
  }
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;
289
+ if (((_c = obj.properties) == null ? void 0 : _c.heatState) != null && ((_d = obj.properties) == null ? void 0 : _d.heatState) != void 0) {
290
+ const value = ((_e = obj.properties) == null ? void 0 : _e.heatState) == 0 ? false : true;
276
291
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "heatState", value);
277
292
  }
278
- if (((_h = obj.properties) == null ? void 0 : _h.electricLevel) != null && ((_i = obj.properties) == null ? void 0 : _i.electricLevel) != void 0) {
293
+ if (((_f = obj.properties) == null ? void 0 : _f.electricLevel) != null && ((_g = obj.properties) == null ? void 0 : _g.electricLevel) != void 0) {
279
294
  (0, import_adapterService.updateSolarFlowState)(
280
295
  adapter,
281
296
  productKey,
@@ -309,27 +324,27 @@ const onMessage = async (topic, message) => {
309
324
  const value = obj.power / 10;
310
325
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "power", value);
311
326
  }
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";
327
+ if (((_h = obj.properties) == null ? void 0 : _h.packState) != null && ((_i = obj.properties) == null ? void 0 : _i.packState) != void 0) {
328
+ 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
329
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "packState", value);
315
330
  }
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";
331
+ if (((_m = obj.properties) == null ? void 0 : _m.passMode) != null && ((_n = obj.properties) == null ? void 0 : _n.passMode) != void 0) {
332
+ 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
333
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "passMode", value);
319
334
  (0, import_adapterService.updateSolarFlowControlState)(
320
335
  adapter,
321
336
  productKey,
322
337
  deviceKey,
323
338
  "passMode",
324
- (_t = obj.properties) == null ? void 0 : _t.passMode
339
+ (_r = obj.properties) == null ? void 0 : _r.passMode
325
340
  );
326
341
  }
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;
342
+ if (((_s = obj.properties) == null ? void 0 : _s.pass) != null && ((_t = obj.properties) == null ? void 0 : _t.pass) != void 0) {
343
+ const value = ((_u = obj.properties) == null ? void 0 : _u.pass) == 0 ? false : true;
329
344
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "pass", value);
330
345
  }
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;
346
+ if (((_v = obj.properties) == null ? void 0 : _v.autoRecover) != null && ((_w = obj.properties) == null ? void 0 : _w.autoRecover) != void 0) {
347
+ const value = ((_x = obj.properties) == null ? void 0 : _x.autoRecover) == 0 ? false : true;
333
348
  (0, import_adapterService.updateSolarFlowState)(
334
349
  adapter,
335
350
  productKey,
@@ -345,7 +360,7 @@ const onMessage = async (topic, message) => {
345
360
  value
346
361
  );
347
362
  }
348
- if (((_A = obj.properties) == null ? void 0 : _A.outputHomePower) != null && ((_B = obj.properties) == null ? void 0 : _B.outputHomePower) != void 0) {
363
+ if (((_y = obj.properties) == null ? void 0 : _y.outputHomePower) != null && ((_z = obj.properties) == null ? void 0 : _z.outputHomePower) != void 0) {
349
364
  (0, import_adapterService.updateSolarFlowState)(
350
365
  adapter,
351
366
  productKey,
@@ -354,7 +369,7 @@ const onMessage = async (topic, message) => {
354
369
  obj.properties.outputHomePower
355
370
  );
356
371
  }
357
- if (((_C = obj.properties) == null ? void 0 : _C.energyPower) != null && ((_D = obj.properties) == null ? void 0 : _D.energyPower) != void 0) {
372
+ if (((_A = obj.properties) == null ? void 0 : _A.energyPower) != null && ((_B = obj.properties) == null ? void 0 : _B.energyPower) != void 0) {
358
373
  (0, import_adapterService.updateSolarFlowState)(
359
374
  adapter,
360
375
  productKey,
@@ -363,7 +378,7 @@ const onMessage = async (topic, message) => {
363
378
  obj.properties.energyPower
364
379
  );
365
380
  }
366
- if (((_E = obj.properties) == null ? void 0 : _E.outputLimit) != null && ((_F = obj.properties) == null ? void 0 : _F.outputLimit) != void 0) {
381
+ if (((_C = obj.properties) == null ? void 0 : _C.outputLimit) != null && ((_D = obj.properties) == null ? void 0 : _D.outputLimit) != void 0) {
367
382
  (0, import_adapterService.updateSolarFlowState)(
368
383
  adapter,
369
384
  productKey,
@@ -379,8 +394,8 @@ const onMessage = async (topic, message) => {
379
394
  obj.properties.outputLimit
380
395
  );
381
396
  }
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;
397
+ if (((_E = obj.properties) == null ? void 0 : _E.buzzerSwitch) != null && ((_F = obj.properties) == null ? void 0 : _F.buzzerSwitch) != void 0) {
398
+ const value = ((_G = obj.properties) == null ? void 0 : _G.buzzerSwitch) == 0 ? false : true;
384
399
  (0, import_adapterService.updateSolarFlowState)(
385
400
  adapter,
386
401
  productKey,
@@ -396,7 +411,7 @@ const onMessage = async (topic, message) => {
396
411
  value
397
412
  );
398
413
  }
399
- if (((_J = obj.properties) == null ? void 0 : _J.outputPackPower) != null && ((_K = obj.properties) == null ? void 0 : _K.outputPackPower) != void 0) {
414
+ if (((_H = obj.properties) == null ? void 0 : _H.outputPackPower) != null && ((_I = obj.properties) == null ? void 0 : _I.outputPackPower) != void 0) {
400
415
  (0, import_adapterService.updateSolarFlowState)(
401
416
  adapter,
402
417
  productKey,
@@ -406,7 +421,7 @@ const onMessage = async (topic, message) => {
406
421
  );
407
422
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "packInputPower", 0);
408
423
  }
409
- if (((_L = obj.properties) == null ? void 0 : _L.packInputPower) != null && ((_M = obj.properties) == null ? void 0 : _M.packInputPower) != void 0) {
424
+ if (((_J = obj.properties) == null ? void 0 : _J.packInputPower) != null && ((_K = obj.properties) == null ? void 0 : _K.packInputPower) != void 0) {
410
425
  let standbyUsage = 0;
411
426
  const solarInputPower = await (adapter == null ? void 0 : adapter.getStateAsync(
412
427
  `${productKey}.${deviceKey}.solarInputPower`
@@ -414,7 +429,7 @@ const onMessage = async (topic, message) => {
414
429
  if (solarInputPower && Number(solarInputPower.val) < 10) {
415
430
  standbyUsage = 7 - Number(solarInputPower.val);
416
431
  }
417
- const device = (_N = adapter == null ? void 0 : adapter.deviceList) == null ? void 0 : _N.find(
432
+ const device = (_L = adapter == null ? void 0 : adapter.deviceList) == null ? void 0 : _L.find(
418
433
  (x) => x.deviceKey == deviceKey && x.productKey == productKey
419
434
  );
420
435
  if (device && device._connectedWithAce) {
@@ -435,7 +450,7 @@ const onMessage = async (topic, message) => {
435
450
  0
436
451
  );
437
452
  }
438
- if (((_O = obj.properties) == null ? void 0 : _O.solarInputPower) != null && ((_P = obj.properties) == null ? void 0 : _P.solarInputPower) != void 0) {
453
+ if (((_M = obj.properties) == null ? void 0 : _M.solarInputPower) != null && ((_N = obj.properties) == null ? void 0 : _N.solarInputPower) != void 0) {
439
454
  (0, import_adapterService.updateSolarFlowState)(
440
455
  adapter,
441
456
  productKey,
@@ -444,7 +459,7 @@ const onMessage = async (topic, message) => {
444
459
  obj.properties.solarInputPower
445
460
  );
446
461
  }
447
- if (((_Q = obj.properties) == null ? void 0 : _Q.pvPower1) != null && ((_R = obj.properties) == null ? void 0 : _R.pvPower1) != void 0) {
462
+ if (((_O = obj.properties) == null ? void 0 : _O.pvPower1) != null && ((_P = obj.properties) == null ? void 0 : _P.pvPower1) != void 0) {
448
463
  (0, import_adapterService.updateSolarFlowState)(
449
464
  adapter,
450
465
  productKey,
@@ -454,7 +469,7 @@ const onMessage = async (topic, message) => {
454
469
  obj.properties.pvPower1
455
470
  );
456
471
  }
457
- if (((_S = obj.properties) == null ? void 0 : _S.pvPower2) != null && ((_T = obj.properties) == null ? void 0 : _T.pvPower2) != void 0) {
472
+ if (((_Q = obj.properties) == null ? void 0 : _Q.pvPower2) != null && ((_R = obj.properties) == null ? void 0 : _R.pvPower2) != void 0) {
458
473
  (0, import_adapterService.updateSolarFlowState)(
459
474
  adapter,
460
475
  productKey,
@@ -464,7 +479,7 @@ const onMessage = async (topic, message) => {
464
479
  obj.properties.pvPower2
465
480
  );
466
481
  }
467
- if (((_U = obj.properties) == null ? void 0 : _U.solarPower1) != null && ((_V = obj.properties) == null ? void 0 : _V.solarPower1) != void 0) {
482
+ if (((_S = obj.properties) == null ? void 0 : _S.solarPower1) != null && ((_T = obj.properties) == null ? void 0 : _T.solarPower1) != void 0) {
468
483
  (0, import_adapterService.updateSolarFlowState)(
469
484
  adapter,
470
485
  productKey,
@@ -473,7 +488,7 @@ const onMessage = async (topic, message) => {
473
488
  obj.properties.solarPower1
474
489
  );
475
490
  }
476
- if (((_W = obj.properties) == null ? void 0 : _W.solarPower2) != null && ((_X = obj.properties) == null ? void 0 : _X.solarPower2) != void 0) {
491
+ if (((_U = obj.properties) == null ? void 0 : _U.solarPower2) != null && ((_V = obj.properties) == null ? void 0 : _V.solarPower2) != void 0) {
477
492
  (0, import_adapterService.updateSolarFlowState)(
478
493
  adapter,
479
494
  productKey,
@@ -482,7 +497,7 @@ const onMessage = async (topic, message) => {
482
497
  obj.properties.solarPower2
483
498
  );
484
499
  }
485
- if (((_Y = obj.properties) == null ? void 0 : _Y.remainOutTime) != null && ((_Z = obj.properties) == null ? void 0 : _Z.remainOutTime) != void 0) {
500
+ if (((_W = obj.properties) == null ? void 0 : _W.remainOutTime) != null && ((_X = obj.properties) == null ? void 0 : _X.remainOutTime) != void 0) {
486
501
  (0, import_adapterService.updateSolarFlowState)(
487
502
  adapter,
488
503
  productKey,
@@ -491,7 +506,7 @@ const onMessage = async (topic, message) => {
491
506
  obj.properties.remainOutTime
492
507
  );
493
508
  }
494
- if (((__ = obj.properties) == null ? void 0 : __.remainInputTime) != null && ((_$ = obj.properties) == null ? void 0 : _$.remainInputTime) != void 0) {
509
+ if (((_Y = obj.properties) == null ? void 0 : _Y.remainInputTime) != null && ((_Z = obj.properties) == null ? void 0 : _Z.remainInputTime) != void 0) {
495
510
  (0, import_adapterService.updateSolarFlowState)(
496
511
  adapter,
497
512
  productKey,
@@ -500,7 +515,7 @@ const onMessage = async (topic, message) => {
500
515
  obj.properties.remainInputTime
501
516
  );
502
517
  }
503
- if (((_aa = obj.properties) == null ? void 0 : _aa.socSet) != null && ((_ba = obj.properties) == null ? void 0 : _ba.socSet) != void 0) {
518
+ if (((__ = obj.properties) == null ? void 0 : __.socSet) != null && ((_$ = obj.properties) == null ? void 0 : _$.socSet) != void 0) {
504
519
  (0, import_adapterService.updateSolarFlowState)(
505
520
  adapter,
506
521
  productKey,
@@ -516,7 +531,7 @@ const onMessage = async (topic, message) => {
516
531
  Number(obj.properties.socSet) / 10
517
532
  );
518
533
  }
519
- if (((_ca = obj.properties) == null ? void 0 : _ca.minSoc) != null && ((_da = obj.properties) == null ? void 0 : _da.minSoc) != void 0) {
534
+ if (((_aa = obj.properties) == null ? void 0 : _aa.minSoc) != null && ((_ba = obj.properties) == null ? void 0 : _ba.minSoc) != void 0) {
520
535
  (0, import_adapterService.updateSolarFlowState)(
521
536
  adapter,
522
537
  productKey,
@@ -532,7 +547,7 @@ const onMessage = async (topic, message) => {
532
547
  Number(obj.properties.minSoc) / 10
533
548
  );
534
549
  }
535
- if (((_ea = obj.properties) == null ? void 0 : _ea.inputLimit) != null && ((_fa = obj.properties) == null ? void 0 : _fa.inputLimit) != void 0) {
550
+ if (((_ca = obj.properties) == null ? void 0 : _ca.inputLimit) != null && ((_da = obj.properties) == null ? void 0 : _da.inputLimit) != void 0) {
536
551
  (0, import_adapterService.updateSolarFlowState)(
537
552
  adapter,
538
553
  productKey,
@@ -540,7 +555,7 @@ const onMessage = async (topic, message) => {
540
555
  "inputLimit",
541
556
  obj.properties.inputLimit
542
557
  );
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"))) {
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"))) {
544
559
  (0, import_adapterService.updateSolarFlowControlState)(
545
560
  adapter,
546
561
  productKey,
@@ -550,7 +565,7 @@ const onMessage = async (topic, message) => {
550
565
  );
551
566
  }
552
567
  }
553
- if (((_ja = obj.properties) == null ? void 0 : _ja.gridInputPower) != null && ((_ka = obj.properties) == null ? void 0 : _ka.gridInputPower) != void 0) {
568
+ if (((_ha = obj.properties) == null ? void 0 : _ha.gridInputPower) != null && ((_ia = obj.properties) == null ? void 0 : _ia.gridInputPower) != void 0) {
554
569
  (0, import_adapterService.updateSolarFlowState)(
555
570
  adapter,
556
571
  productKey,
@@ -559,7 +574,7 @@ const onMessage = async (topic, message) => {
559
574
  obj.properties.gridInputPower
560
575
  );
561
576
  }
562
- if (((_la = obj.properties) == null ? void 0 : _la.acMode) != null && ((_ma = obj.properties) == null ? void 0 : _ma.acMode) != void 0) {
577
+ if (((_ja = obj.properties) == null ? void 0 : _ja.acMode) != null && ((_ka = obj.properties) == null ? void 0 : _ka.acMode) != void 0) {
563
578
  (0, import_adapterService.updateSolarFlowState)(
564
579
  adapter,
565
580
  productKey,
@@ -575,7 +590,7 @@ const onMessage = async (topic, message) => {
575
590
  obj.properties.acMode
576
591
  );
577
592
  }
578
- if (((_na = obj.properties) == null ? void 0 : _na.hyperTmp) != null && ((_oa = obj.properties) == null ? void 0 : _oa.hyperTmp) != void 0) {
593
+ if (((_la = obj.properties) == null ? void 0 : _la.hyperTmp) != null && ((_ma = obj.properties) == null ? void 0 : _ma.hyperTmp) != void 0) {
579
594
  (0, import_adapterService.updateSolarFlowState)(
580
595
  adapter,
581
596
  productKey,
@@ -584,7 +599,7 @@ const onMessage = async (topic, message) => {
584
599
  obj.properties.hyperTmp / 10 - 273.15
585
600
  );
586
601
  }
587
- if (((_pa = obj.properties) == null ? void 0 : _pa.acOutputPower) != null && ((_qa = obj.properties) == null ? void 0 : _qa.acOutputPower) != void 0) {
602
+ if (((_na = obj.properties) == null ? void 0 : _na.acOutputPower) != null && ((_oa = obj.properties) == null ? void 0 : _oa.acOutputPower) != void 0) {
588
603
  (0, import_adapterService.updateSolarFlowState)(
589
604
  adapter,
590
605
  productKey,
@@ -593,7 +608,7 @@ const onMessage = async (topic, message) => {
593
608
  obj.properties.acOutputPower
594
609
  );
595
610
  }
596
- if (((_ra = obj.properties) == null ? void 0 : _ra.gridPower) != null && ((_sa = obj.properties) == null ? void 0 : _sa.gridPower) != void 0) {
611
+ if (((_pa = obj.properties) == null ? void 0 : _pa.gridPower) != null && ((_qa = obj.properties) == null ? void 0 : _qa.gridPower) != void 0) {
597
612
  (0, import_adapterService.updateSolarFlowState)(
598
613
  adapter,
599
614
  productKey,
@@ -602,8 +617,8 @@ const onMessage = async (topic, message) => {
602
617
  obj.properties.gridPower
603
618
  );
604
619
  }
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;
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;
607
622
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "acSwitch", value);
608
623
  (0, import_adapterService.updateSolarFlowControlState)(
609
624
  adapter,
@@ -613,8 +628,8 @@ const onMessage = async (topic, message) => {
613
628
  value
614
629
  );
615
630
  }
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;
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;
618
633
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "dcSwitch", value);
619
634
  (0, import_adapterService.updateSolarFlowControlState)(
620
635
  adapter,
@@ -624,7 +639,7 @@ const onMessage = async (topic, message) => {
624
639
  value
625
640
  );
626
641
  }
627
- if (((_za = obj.properties) == null ? void 0 : _za.dcOutputPower) != null && ((_Aa = obj.properties) == null ? void 0 : _Aa.dcOutputPower) != void 0) {
642
+ if (((_xa = obj.properties) == null ? void 0 : _xa.dcOutputPower) != null && ((_ya = obj.properties) == null ? void 0 : _ya.dcOutputPower) != void 0) {
628
643
  (0, import_adapterService.updateSolarFlowState)(
629
644
  adapter,
630
645
  productKey,
@@ -633,11 +648,11 @@ const onMessage = async (topic, message) => {
633
648
  obj.properties.dcOutputPower
634
649
  );
635
650
  }
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";
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";
638
653
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "pvBrand", value);
639
654
  }
640
- if (((_Ka = obj.properties) == null ? void 0 : _Ka.inverseMaxPower) != null && ((_La = obj.properties) == null ? void 0 : _La.inverseMaxPower) != void 0) {
655
+ if (((_Ia = obj.properties) == null ? void 0 : _Ia.inverseMaxPower) != null && ((_Ja = obj.properties) == null ? void 0 : _Ja.inverseMaxPower) != void 0) {
641
656
  (0, import_adapterService.updateSolarFlowState)(
642
657
  adapter,
643
658
  productKey,
@@ -646,7 +661,7 @@ const onMessage = async (topic, message) => {
646
661
  obj.properties.inverseMaxPower
647
662
  );
648
663
  }
649
- if (((_Ma = obj.properties) == null ? void 0 : _Ma.wifiState) != null && ((_Na = obj.properties) == null ? void 0 : _Na.wifiState) != void 0) {
664
+ if (((_Ka = obj.properties) == null ? void 0 : _Ka.wifiState) != null && ((_La = obj.properties) == null ? void 0 : _La.wifiState) != void 0) {
650
665
  (0, import_adapterService.updateSolarFlowState)(
651
666
  adapter,
652
667
  productKey,
@@ -655,7 +670,7 @@ const onMessage = async (topic, message) => {
655
670
  obj.properties.wifiState == 1 ? "Connected" : "Disconnected"
656
671
  );
657
672
  }
658
- if (((_Oa = obj.properties) == null ? void 0 : _Oa.packNum) != null && ((_Pa = obj.properties) == null ? void 0 : _Pa.packNum) != void 0) {
673
+ if (((_Ma = obj.properties) == null ? void 0 : _Ma.packNum) != null && ((_Na = obj.properties) == null ? void 0 : _Na.packNum) != void 0) {
659
674
  (0, import_adapterService.updateSolarFlowState)(
660
675
  adapter,
661
676
  productKey,
@@ -664,7 +679,7 @@ const onMessage = async (topic, message) => {
664
679
  obj.properties.packNum
665
680
  );
666
681
  }
667
- if (((_Qa = obj.properties) == null ? void 0 : _Qa.hubState) != null && ((_Ra = obj.properties) == null ? void 0 : _Ra.hubState) != void 0) {
682
+ if (((_Oa = obj.properties) == null ? void 0 : _Oa.hubState) != null && ((_Pa = obj.properties) == null ? void 0 : _Pa.hubState) != void 0) {
668
683
  (0, import_adapterService.updateSolarFlowState)(
669
684
  adapter,
670
685
  productKey,
@@ -683,6 +698,34 @@ const onMessage = async (topic, message) => {
683
698
  if (obj.packData) {
684
699
  addOrUpdatePackData(productKey, deviceKey, obj.packData, isSolarFlow);
685
700
  }
701
+ 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;
719
+ }
720
+ });
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
+ });
728
+ }
686
729
  }
687
730
  };
688
731
  const setAcMode = async (adapter2, productKey, deviceKey, acMode) => {
@@ -701,7 +744,7 @@ const setAcMode = async (adapter2, productKey, deviceKey, acMode) => {
701
744
  const setChargeLimit = async (adapter2, productKey, deviceKey, socSet) => {
702
745
  var _a;
703
746
  if (adapter2.mqttClient && productKey && deviceKey) {
704
- if (socSet > 40 && socSet <= 100) {
747
+ if (socSet >= 40 && socSet <= 100) {
705
748
  const topic = `iot/${productKey}/${deviceKey}/properties/write`;
706
749
  const socSetLimit = { properties: { socSet: socSet * 10 } };
707
750
  adapter2.log.debug(
@@ -718,7 +761,7 @@ const setChargeLimit = async (adapter2, productKey, deviceKey, socSet) => {
718
761
  const setDischargeLimit = async (adapter2, productKey, deviceKey, minSoc) => {
719
762
  var _a;
720
763
  if (adapter2.mqttClient && productKey && deviceKey) {
721
- if (minSoc > 0 && minSoc < 50) {
764
+ if (minSoc >= 0 && minSoc <= 50) {
722
765
  const topic = `iot/${productKey}/${deviceKey}/properties/write`;
723
766
  const socSetLimit = { properties: { minSoc: minSoc * 10 } };
724
767
  adapter2.log.debug(