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.
- package/README.md +10 -0
- package/build/helpers/createControlStates.js +1 -1
- package/build/helpers/createControlStates.js.map +1 -1
- package/build/main.js +1 -0
- package/build/main.js.map +2 -2
- package/build/models/ISolarFlowMqttProperties.js +4 -1
- package/build/models/ISolarFlowMqttProperties.js.map +2 -2
- package/build/services/calculationService.js +7 -12
- package/build/services/calculationService.js.map +2 -2
- package/build/services/jobSchedule.js.map +2 -2
- package/build/services/mqttService.js +93 -52
- package/build/services/mqttService.js.map +2 -2
- package/io-package.json +27 -27
- package/package.json +1 -1
|
@@ -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
|
|
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 (
|
|
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 (((
|
|
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 (((
|
|
275
|
-
const value = ((
|
|
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 (((
|
|
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 (((
|
|
313
|
-
const value = ((
|
|
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 (((
|
|
317
|
-
const value = ((
|
|
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
|
-
(
|
|
337
|
+
(_r = obj.properties) == null ? void 0 : _r.passMode
|
|
325
338
|
);
|
|
326
339
|
}
|
|
327
|
-
if (((
|
|
328
|
-
const value = ((
|
|
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 (((
|
|
332
|
-
const value = ((
|
|
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 (((
|
|
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 (((
|
|
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 (((
|
|
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 (((
|
|
383
|
-
const value = ((
|
|
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 (((
|
|
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 (((
|
|
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 = (
|
|
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 (((
|
|
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 (((
|
|
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 (((
|
|
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 (((
|
|
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 (((
|
|
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 (((
|
|
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 (((
|
|
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 (((
|
|
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 (((
|
|
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 (((
|
|
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 (((
|
|
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 (((
|
|
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 (((
|
|
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 (((
|
|
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 (((
|
|
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 (((
|
|
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 (((
|
|
606
|
-
const value = ((
|
|
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 (((
|
|
617
|
-
const value = ((
|
|
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 (((
|
|
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 (((
|
|
637
|
-
const value = ((
|
|
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 (((
|
|
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 (((
|
|
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 (((
|
|
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 (((
|
|
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
|
|
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
|
|
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(
|