iobroker.zendure-solarflow 1.10.7 → 1.12.0-alpha.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.
- package/README.md +17 -11
- package/admin/build/index.js +32 -32
- package/admin/build/index.js.map +3 -3
- package/build/constants/sharedStates.js +22 -0
- package/build/constants/sharedStates.js.map +2 -2
- package/build/helpers/createCalculationStates.js +1 -1
- package/build/helpers/createCalculationStates.js.map +2 -2
- package/build/helpers/createControlStates.js +28 -3
- package/build/helpers/createControlStates.js.map +2 -2
- package/build/helpers/createSolarFlowLocalStates.js +133 -0
- package/build/helpers/createSolarFlowLocalStates.js.map +7 -0
- package/build/main.js +7 -2
- package/build/main.js.map +2 -2
- package/build/models/ISolarFlowMqttProperties.js +1 -0
- package/build/models/ISolarFlowMqttProperties.js.map +2 -2
- package/build/services/jobSchedule.js +25 -15
- package/build/services/jobSchedule.js.map +2 -2
- package/build/services/mqttService.js +166 -64
- package/build/services/mqttService.js.map +2 -2
- package/io-package.json +27 -27
- package/package.json +1 -1
|
@@ -29,9 +29,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
var mqttService_exports = {};
|
|
30
30
|
__export(mqttService_exports, {
|
|
31
31
|
addOrUpdatePackData: () => addOrUpdatePackData,
|
|
32
|
-
|
|
32
|
+
connectCloudMqttClient: () => connectCloudMqttClient,
|
|
33
|
+
connectLocalMqttClient: () => connectLocalMqttClient,
|
|
33
34
|
setAcMode: () => setAcMode,
|
|
34
35
|
setAcSwitch: () => setAcSwitch,
|
|
36
|
+
setAutoModel: () => setAutoModel,
|
|
35
37
|
setAutoRecover: () => setAutoRecover,
|
|
36
38
|
setBuzzerSwitch: () => setBuzzerSwitch,
|
|
37
39
|
setChargeLimit: () => setChargeLimit,
|
|
@@ -48,6 +50,7 @@ var mqtt = __toESM(require("mqtt"));
|
|
|
48
50
|
var import_adapterService = require("./adapterService");
|
|
49
51
|
var import_calculationService = require("./calculationService");
|
|
50
52
|
var import_jobSchedule = require("./jobSchedule");
|
|
53
|
+
var import_createSolarFlowLocalStates = require("../helpers/createSolarFlowLocalStates");
|
|
51
54
|
let adapter = void 0;
|
|
52
55
|
const addOrUpdatePackData = async (productKey, deviceKey, packData, isSolarFlow) => {
|
|
53
56
|
if (adapter && productKey && deviceKey) {
|
|
@@ -206,7 +209,7 @@ const addOrUpdatePackData = async (productKey, deviceKey, packData, isSolarFlow)
|
|
|
206
209
|
}
|
|
207
210
|
};
|
|
208
211
|
const onMessage = async (topic, message) => {
|
|
209
|
-
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;
|
|
212
|
+
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;
|
|
210
213
|
if (adapter) {
|
|
211
214
|
if (topic.toLowerCase().includes("loginOut/force")) {
|
|
212
215
|
}
|
|
@@ -235,7 +238,27 @@ const onMessage = async (topic, message) => {
|
|
|
235
238
|
"lastUpdate",
|
|
236
239
|
(/* @__PURE__ */ new Date()).getTime()
|
|
237
240
|
);
|
|
238
|
-
if (((_c = obj.properties) == null ? void 0 : _c.
|
|
241
|
+
if (((_c = obj.properties) == null ? void 0 : _c.autoModel) != null && ((_d = obj.properties) == null ? void 0 : _d.autoModel) != void 0) {
|
|
242
|
+
(0, import_adapterService.updateSolarFlowState)(
|
|
243
|
+
adapter,
|
|
244
|
+
productKey,
|
|
245
|
+
deviceKey,
|
|
246
|
+
"autoModel",
|
|
247
|
+
obj.properties.autoModel
|
|
248
|
+
);
|
|
249
|
+
(0, import_adapterService.updateSolarFlowControlState)(
|
|
250
|
+
adapter,
|
|
251
|
+
productKey,
|
|
252
|
+
deviceKey,
|
|
253
|
+
"autoModel",
|
|
254
|
+
obj.properties.autoModel
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
if (((_e = obj.properties) == null ? void 0 : _e.heatState) != null && ((_f = obj.properties) == null ? void 0 : _f.heatState) != void 0) {
|
|
258
|
+
const value = ((_g = obj.properties) == null ? void 0 : _g.heatState) == 0 ? false : true;
|
|
259
|
+
(0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "heatState", value);
|
|
260
|
+
}
|
|
261
|
+
if (((_h = obj.properties) == null ? void 0 : _h.electricLevel) != null && ((_i = obj.properties) == null ? void 0 : _i.electricLevel) != void 0) {
|
|
239
262
|
(0, import_adapterService.updateSolarFlowState)(
|
|
240
263
|
adapter,
|
|
241
264
|
productKey,
|
|
@@ -269,27 +292,27 @@ const onMessage = async (topic, message) => {
|
|
|
269
292
|
const value = obj.power / 10;
|
|
270
293
|
(0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "power", value);
|
|
271
294
|
}
|
|
272
|
-
if (((
|
|
273
|
-
const value = ((
|
|
295
|
+
if (((_j = obj.properties) == null ? void 0 : _j.packState) != null && ((_k = obj.properties) == null ? void 0 : _k.packState) != void 0) {
|
|
296
|
+
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";
|
|
274
297
|
(0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "packState", value);
|
|
275
298
|
}
|
|
276
|
-
if (((
|
|
277
|
-
const value = ((
|
|
299
|
+
if (((_o = obj.properties) == null ? void 0 : _o.passMode) != null && ((_p = obj.properties) == null ? void 0 : _p.passMode) != void 0) {
|
|
300
|
+
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";
|
|
278
301
|
(0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "passMode", value);
|
|
279
302
|
(0, import_adapterService.updateSolarFlowControlState)(
|
|
280
303
|
adapter,
|
|
281
304
|
productKey,
|
|
282
305
|
deviceKey,
|
|
283
306
|
"passMode",
|
|
284
|
-
(
|
|
307
|
+
(_t = obj.properties) == null ? void 0 : _t.passMode
|
|
285
308
|
);
|
|
286
309
|
}
|
|
287
|
-
if (((
|
|
288
|
-
const value = ((
|
|
310
|
+
if (((_u = obj.properties) == null ? void 0 : _u.pass) != null && ((_v = obj.properties) == null ? void 0 : _v.pass) != void 0) {
|
|
311
|
+
const value = ((_w = obj.properties) == null ? void 0 : _w.pass) == 0 ? false : true;
|
|
289
312
|
(0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "pass", value);
|
|
290
313
|
}
|
|
291
|
-
if (((
|
|
292
|
-
const value = ((
|
|
314
|
+
if (((_x = obj.properties) == null ? void 0 : _x.autoRecover) != null && ((_y = obj.properties) == null ? void 0 : _y.autoRecover) != void 0) {
|
|
315
|
+
const value = ((_z = obj.properties) == null ? void 0 : _z.autoRecover) == 0 ? false : true;
|
|
293
316
|
(0, import_adapterService.updateSolarFlowState)(
|
|
294
317
|
adapter,
|
|
295
318
|
productKey,
|
|
@@ -305,7 +328,7 @@ const onMessage = async (topic, message) => {
|
|
|
305
328
|
value
|
|
306
329
|
);
|
|
307
330
|
}
|
|
308
|
-
if (((
|
|
331
|
+
if (((_A = obj.properties) == null ? void 0 : _A.outputHomePower) != null && ((_B = obj.properties) == null ? void 0 : _B.outputHomePower) != void 0) {
|
|
309
332
|
(0, import_adapterService.updateSolarFlowState)(
|
|
310
333
|
adapter,
|
|
311
334
|
productKey,
|
|
@@ -314,7 +337,7 @@ const onMessage = async (topic, message) => {
|
|
|
314
337
|
obj.properties.outputHomePower
|
|
315
338
|
);
|
|
316
339
|
}
|
|
317
|
-
if (((
|
|
340
|
+
if (((_C = obj.properties) == null ? void 0 : _C.energyPower) != null && ((_D = obj.properties) == null ? void 0 : _D.energyPower) != void 0) {
|
|
318
341
|
(0, import_adapterService.updateSolarFlowState)(
|
|
319
342
|
adapter,
|
|
320
343
|
productKey,
|
|
@@ -323,7 +346,7 @@ const onMessage = async (topic, message) => {
|
|
|
323
346
|
obj.properties.energyPower
|
|
324
347
|
);
|
|
325
348
|
}
|
|
326
|
-
if (((
|
|
349
|
+
if (((_E = obj.properties) == null ? void 0 : _E.outputLimit) != null && ((_F = obj.properties) == null ? void 0 : _F.outputLimit) != void 0) {
|
|
327
350
|
(0, import_adapterService.updateSolarFlowState)(
|
|
328
351
|
adapter,
|
|
329
352
|
productKey,
|
|
@@ -339,8 +362,8 @@ const onMessage = async (topic, message) => {
|
|
|
339
362
|
obj.properties.outputLimit
|
|
340
363
|
);
|
|
341
364
|
}
|
|
342
|
-
if (((
|
|
343
|
-
const value = ((
|
|
365
|
+
if (((_G = obj.properties) == null ? void 0 : _G.buzzerSwitch) != null && ((_H = obj.properties) == null ? void 0 : _H.buzzerSwitch) != void 0) {
|
|
366
|
+
const value = ((_I = obj.properties) == null ? void 0 : _I.buzzerSwitch) == 0 ? false : true;
|
|
344
367
|
(0, import_adapterService.updateSolarFlowState)(
|
|
345
368
|
adapter,
|
|
346
369
|
productKey,
|
|
@@ -356,7 +379,7 @@ const onMessage = async (topic, message) => {
|
|
|
356
379
|
value
|
|
357
380
|
);
|
|
358
381
|
}
|
|
359
|
-
if (((
|
|
382
|
+
if (((_J = obj.properties) == null ? void 0 : _J.outputPackPower) != null && ((_K = obj.properties) == null ? void 0 : _K.outputPackPower) != void 0) {
|
|
360
383
|
(0, import_adapterService.updateSolarFlowState)(
|
|
361
384
|
adapter,
|
|
362
385
|
productKey,
|
|
@@ -366,19 +389,19 @@ const onMessage = async (topic, message) => {
|
|
|
366
389
|
);
|
|
367
390
|
(0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "packInputPower", 0);
|
|
368
391
|
}
|
|
369
|
-
if (((
|
|
392
|
+
if (((_L = obj.properties) == null ? void 0 : _L.packInputPower) != null && ((_M = obj.properties) == null ? void 0 : _M.packInputPower) != void 0) {
|
|
370
393
|
let standbyUsage = 0;
|
|
371
394
|
const solarInputPower = await (adapter == null ? void 0 : adapter.getStateAsync(
|
|
372
395
|
`${productKey}.${deviceKey}.solarInputPower`
|
|
373
396
|
));
|
|
374
397
|
if (solarInputPower && Number(solarInputPower.val) < 10) {
|
|
375
|
-
standbyUsage =
|
|
398
|
+
standbyUsage = 7 - Number(solarInputPower.val);
|
|
376
399
|
}
|
|
377
|
-
const device = (
|
|
400
|
+
const device = (_N = adapter == null ? void 0 : adapter.deviceList) == null ? void 0 : _N.find(
|
|
378
401
|
(x) => x.deviceKey == deviceKey && x.productKey == productKey
|
|
379
402
|
);
|
|
380
403
|
if (device && device._connectedWithAce) {
|
|
381
|
-
standbyUsage +=
|
|
404
|
+
standbyUsage += 7;
|
|
382
405
|
}
|
|
383
406
|
(0, import_adapterService.updateSolarFlowState)(
|
|
384
407
|
adapter,
|
|
@@ -395,7 +418,7 @@ const onMessage = async (topic, message) => {
|
|
|
395
418
|
0
|
|
396
419
|
);
|
|
397
420
|
}
|
|
398
|
-
if (((
|
|
421
|
+
if (((_O = obj.properties) == null ? void 0 : _O.solarInputPower) != null && ((_P = obj.properties) == null ? void 0 : _P.solarInputPower) != void 0) {
|
|
399
422
|
(0, import_adapterService.updateSolarFlowState)(
|
|
400
423
|
adapter,
|
|
401
424
|
productKey,
|
|
@@ -404,7 +427,7 @@ const onMessage = async (topic, message) => {
|
|
|
404
427
|
obj.properties.solarInputPower
|
|
405
428
|
);
|
|
406
429
|
}
|
|
407
|
-
if (((
|
|
430
|
+
if (((_Q = obj.properties) == null ? void 0 : _Q.pvPower1) != null && ((_R = obj.properties) == null ? void 0 : _R.pvPower1) != void 0) {
|
|
408
431
|
(0, import_adapterService.updateSolarFlowState)(
|
|
409
432
|
adapter,
|
|
410
433
|
productKey,
|
|
@@ -414,7 +437,7 @@ const onMessage = async (topic, message) => {
|
|
|
414
437
|
obj.properties.pvPower1
|
|
415
438
|
);
|
|
416
439
|
}
|
|
417
|
-
if (((
|
|
440
|
+
if (((_S = obj.properties) == null ? void 0 : _S.pvPower2) != null && ((_T = obj.properties) == null ? void 0 : _T.pvPower2) != void 0) {
|
|
418
441
|
(0, import_adapterService.updateSolarFlowState)(
|
|
419
442
|
adapter,
|
|
420
443
|
productKey,
|
|
@@ -424,7 +447,7 @@ const onMessage = async (topic, message) => {
|
|
|
424
447
|
obj.properties.pvPower2
|
|
425
448
|
);
|
|
426
449
|
}
|
|
427
|
-
if (((
|
|
450
|
+
if (((_U = obj.properties) == null ? void 0 : _U.solarPower1) != null && ((_V = obj.properties) == null ? void 0 : _V.solarPower1) != void 0) {
|
|
428
451
|
(0, import_adapterService.updateSolarFlowState)(
|
|
429
452
|
adapter,
|
|
430
453
|
productKey,
|
|
@@ -433,7 +456,7 @@ const onMessage = async (topic, message) => {
|
|
|
433
456
|
obj.properties.solarPower1
|
|
434
457
|
);
|
|
435
458
|
}
|
|
436
|
-
if (((
|
|
459
|
+
if (((_W = obj.properties) == null ? void 0 : _W.solarPower2) != null && ((_X = obj.properties) == null ? void 0 : _X.solarPower2) != void 0) {
|
|
437
460
|
(0, import_adapterService.updateSolarFlowState)(
|
|
438
461
|
adapter,
|
|
439
462
|
productKey,
|
|
@@ -442,7 +465,7 @@ const onMessage = async (topic, message) => {
|
|
|
442
465
|
obj.properties.solarPower2
|
|
443
466
|
);
|
|
444
467
|
}
|
|
445
|
-
if (((
|
|
468
|
+
if (((_Y = obj.properties) == null ? void 0 : _Y.remainOutTime) != null && ((_Z = obj.properties) == null ? void 0 : _Z.remainOutTime) != void 0) {
|
|
446
469
|
(0, import_adapterService.updateSolarFlowState)(
|
|
447
470
|
adapter,
|
|
448
471
|
productKey,
|
|
@@ -451,7 +474,7 @@ const onMessage = async (topic, message) => {
|
|
|
451
474
|
obj.properties.remainOutTime
|
|
452
475
|
);
|
|
453
476
|
}
|
|
454
|
-
if (((
|
|
477
|
+
if (((__ = obj.properties) == null ? void 0 : __.remainInputTime) != null && ((_$ = obj.properties) == null ? void 0 : _$.remainInputTime) != void 0) {
|
|
455
478
|
(0, import_adapterService.updateSolarFlowState)(
|
|
456
479
|
adapter,
|
|
457
480
|
productKey,
|
|
@@ -460,7 +483,7 @@ const onMessage = async (topic, message) => {
|
|
|
460
483
|
obj.properties.remainInputTime
|
|
461
484
|
);
|
|
462
485
|
}
|
|
463
|
-
if (((
|
|
486
|
+
if (((_aa = obj.properties) == null ? void 0 : _aa.socSet) != null && ((_ba = obj.properties) == null ? void 0 : _ba.socSet) != void 0) {
|
|
464
487
|
(0, import_adapterService.updateSolarFlowState)(
|
|
465
488
|
adapter,
|
|
466
489
|
productKey,
|
|
@@ -476,7 +499,7 @@ const onMessage = async (topic, message) => {
|
|
|
476
499
|
Number(obj.properties.socSet) / 10
|
|
477
500
|
);
|
|
478
501
|
}
|
|
479
|
-
if (((
|
|
502
|
+
if (((_ca = obj.properties) == null ? void 0 : _ca.minSoc) != null && ((_da = obj.properties) == null ? void 0 : _da.minSoc) != void 0) {
|
|
480
503
|
(0, import_adapterService.updateSolarFlowState)(
|
|
481
504
|
adapter,
|
|
482
505
|
productKey,
|
|
@@ -492,7 +515,7 @@ const onMessage = async (topic, message) => {
|
|
|
492
515
|
Number(obj.properties.minSoc) / 10
|
|
493
516
|
);
|
|
494
517
|
}
|
|
495
|
-
if (((
|
|
518
|
+
if (((_ea = obj.properties) == null ? void 0 : _ea.inputLimit) != null && ((_fa = obj.properties) == null ? void 0 : _fa.inputLimit) != void 0) {
|
|
496
519
|
(0, import_adapterService.updateSolarFlowState)(
|
|
497
520
|
adapter,
|
|
498
521
|
productKey,
|
|
@@ -500,7 +523,7 @@ const onMessage = async (topic, message) => {
|
|
|
500
523
|
"inputLimit",
|
|
501
524
|
obj.properties.inputLimit
|
|
502
525
|
);
|
|
503
|
-
if (((
|
|
526
|
+
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"))) {
|
|
504
527
|
(0, import_adapterService.updateSolarFlowControlState)(
|
|
505
528
|
adapter,
|
|
506
529
|
productKey,
|
|
@@ -510,7 +533,7 @@ const onMessage = async (topic, message) => {
|
|
|
510
533
|
);
|
|
511
534
|
}
|
|
512
535
|
}
|
|
513
|
-
if (((
|
|
536
|
+
if (((_ja = obj.properties) == null ? void 0 : _ja.gridInputPower) != null && ((_ka = obj.properties) == null ? void 0 : _ka.gridInputPower) != void 0) {
|
|
514
537
|
(0, import_adapterService.updateSolarFlowState)(
|
|
515
538
|
adapter,
|
|
516
539
|
productKey,
|
|
@@ -519,7 +542,7 @@ const onMessage = async (topic, message) => {
|
|
|
519
542
|
obj.properties.gridInputPower
|
|
520
543
|
);
|
|
521
544
|
}
|
|
522
|
-
if (((
|
|
545
|
+
if (((_la = obj.properties) == null ? void 0 : _la.acMode) != null && ((_ma = obj.properties) == null ? void 0 : _ma.acMode) != void 0) {
|
|
523
546
|
(0, import_adapterService.updateSolarFlowState)(
|
|
524
547
|
adapter,
|
|
525
548
|
productKey,
|
|
@@ -535,7 +558,7 @@ const onMessage = async (topic, message) => {
|
|
|
535
558
|
obj.properties.acMode
|
|
536
559
|
);
|
|
537
560
|
}
|
|
538
|
-
if (((
|
|
561
|
+
if (((_na = obj.properties) == null ? void 0 : _na.hyperTmp) != null && ((_oa = obj.properties) == null ? void 0 : _oa.hyperTmp) != void 0) {
|
|
539
562
|
(0, import_adapterService.updateSolarFlowState)(
|
|
540
563
|
adapter,
|
|
541
564
|
productKey,
|
|
@@ -544,7 +567,7 @@ const onMessage = async (topic, message) => {
|
|
|
544
567
|
obj.properties.hyperTmp / 10 - 273.15
|
|
545
568
|
);
|
|
546
569
|
}
|
|
547
|
-
if (((
|
|
570
|
+
if (((_pa = obj.properties) == null ? void 0 : _pa.acOutputPower) != null && ((_qa = obj.properties) == null ? void 0 : _qa.acOutputPower) != void 0) {
|
|
548
571
|
(0, import_adapterService.updateSolarFlowState)(
|
|
549
572
|
adapter,
|
|
550
573
|
productKey,
|
|
@@ -553,17 +576,17 @@ const onMessage = async (topic, message) => {
|
|
|
553
576
|
obj.properties.acOutputPower
|
|
554
577
|
);
|
|
555
578
|
}
|
|
556
|
-
if (((
|
|
579
|
+
if (((_ra = obj.properties) == null ? void 0 : _ra.gridPower) != null && ((_sa = obj.properties) == null ? void 0 : _sa.gridPower) != void 0) {
|
|
557
580
|
(0, import_adapterService.updateSolarFlowState)(
|
|
558
581
|
adapter,
|
|
559
582
|
productKey,
|
|
560
583
|
deviceKey,
|
|
561
|
-
"
|
|
584
|
+
"gridInputPower",
|
|
562
585
|
obj.properties.gridPower
|
|
563
586
|
);
|
|
564
587
|
}
|
|
565
|
-
if (((
|
|
566
|
-
const value = ((
|
|
588
|
+
if (((_ta = obj.properties) == null ? void 0 : _ta.acSwitch) != null && ((_ua = obj.properties) == null ? void 0 : _ua.acSwitch) != void 0) {
|
|
589
|
+
const value = ((_va = obj.properties) == null ? void 0 : _va.acSwitch) == 0 ? false : true;
|
|
567
590
|
(0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "acSwitch", value);
|
|
568
591
|
(0, import_adapterService.updateSolarFlowControlState)(
|
|
569
592
|
adapter,
|
|
@@ -573,8 +596,8 @@ const onMessage = async (topic, message) => {
|
|
|
573
596
|
value
|
|
574
597
|
);
|
|
575
598
|
}
|
|
576
|
-
if (((
|
|
577
|
-
const value = ((
|
|
599
|
+
if (((_wa = obj.properties) == null ? void 0 : _wa.dcSwitch) != null && ((_xa = obj.properties) == null ? void 0 : _xa.dcSwitch) != void 0) {
|
|
600
|
+
const value = ((_ya = obj.properties) == null ? void 0 : _ya.dcSwitch) == 0 ? false : true;
|
|
578
601
|
(0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "dcSwitch", value);
|
|
579
602
|
(0, import_adapterService.updateSolarFlowControlState)(
|
|
580
603
|
adapter,
|
|
@@ -584,7 +607,7 @@ const onMessage = async (topic, message) => {
|
|
|
584
607
|
value
|
|
585
608
|
);
|
|
586
609
|
}
|
|
587
|
-
if (((
|
|
610
|
+
if (((_za = obj.properties) == null ? void 0 : _za.dcOutputPower) != null && ((_Aa = obj.properties) == null ? void 0 : _Aa.dcOutputPower) != void 0) {
|
|
588
611
|
(0, import_adapterService.updateSolarFlowState)(
|
|
589
612
|
adapter,
|
|
590
613
|
productKey,
|
|
@@ -593,11 +616,11 @@ const onMessage = async (topic, message) => {
|
|
|
593
616
|
obj.properties.dcOutputPower
|
|
594
617
|
);
|
|
595
618
|
}
|
|
596
|
-
if (((
|
|
597
|
-
const value = ((
|
|
619
|
+
if (((_Ba = obj.properties) == null ? void 0 : _Ba.pvBrand) != null && ((_Ca = obj.properties) == null ? void 0 : _Ca.pvBrand) != void 0) {
|
|
620
|
+
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";
|
|
598
621
|
(0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "pvBrand", value);
|
|
599
622
|
}
|
|
600
|
-
if (((
|
|
623
|
+
if (((_Ka = obj.properties) == null ? void 0 : _Ka.inverseMaxPower) != null && ((_La = obj.properties) == null ? void 0 : _La.inverseMaxPower) != void 0) {
|
|
601
624
|
(0, import_adapterService.updateSolarFlowState)(
|
|
602
625
|
adapter,
|
|
603
626
|
productKey,
|
|
@@ -606,7 +629,7 @@ const onMessage = async (topic, message) => {
|
|
|
606
629
|
obj.properties.inverseMaxPower
|
|
607
630
|
);
|
|
608
631
|
}
|
|
609
|
-
if (((
|
|
632
|
+
if (((_Ma = obj.properties) == null ? void 0 : _Ma.wifiState) != null && ((_Na = obj.properties) == null ? void 0 : _Na.wifiState) != void 0) {
|
|
610
633
|
(0, import_adapterService.updateSolarFlowState)(
|
|
611
634
|
adapter,
|
|
612
635
|
productKey,
|
|
@@ -615,7 +638,7 @@ const onMessage = async (topic, message) => {
|
|
|
615
638
|
obj.properties.wifiState == 1 ? "Connected" : "Disconnected"
|
|
616
639
|
);
|
|
617
640
|
}
|
|
618
|
-
if (((
|
|
641
|
+
if (((_Oa = obj.properties) == null ? void 0 : _Oa.packNum) != null && ((_Pa = obj.properties) == null ? void 0 : _Pa.packNum) != void 0) {
|
|
619
642
|
(0, import_adapterService.updateSolarFlowState)(
|
|
620
643
|
adapter,
|
|
621
644
|
productKey,
|
|
@@ -624,7 +647,7 @@ const onMessage = async (topic, message) => {
|
|
|
624
647
|
obj.properties.packNum
|
|
625
648
|
);
|
|
626
649
|
}
|
|
627
|
-
if (((
|
|
650
|
+
if (((_Qa = obj.properties) == null ? void 0 : _Qa.hubState) != null && ((_Ra = obj.properties) == null ? void 0 : _Ra.hubState) != void 0) {
|
|
628
651
|
(0, import_adapterService.updateSolarFlowState)(
|
|
629
652
|
adapter,
|
|
630
653
|
productKey,
|
|
@@ -708,8 +731,15 @@ const setHubState = async (adapter2, productKey, deviceKey, hubState) => {
|
|
|
708
731
|
}
|
|
709
732
|
};
|
|
710
733
|
const setOutputLimit = async (adapter2, productKey, deviceKey, limit) => {
|
|
711
|
-
var _a, _b, _c, _d;
|
|
734
|
+
var _a, _b, _c, _d, _e;
|
|
712
735
|
if (adapter2.mqttClient && productKey && deviceKey) {
|
|
736
|
+
const autoModel = (_a = await adapter2.getStateAsync(productKey + "." + deviceKey + ".autoModel")) == null ? void 0 : _a.val;
|
|
737
|
+
if (autoModel != 0) {
|
|
738
|
+
adapter2.log.warn(
|
|
739
|
+
"Operation mode (autoModel) is not set to '0', we can't set the output limit!"
|
|
740
|
+
);
|
|
741
|
+
return;
|
|
742
|
+
}
|
|
713
743
|
if (limit) {
|
|
714
744
|
limit = Math.round(limit);
|
|
715
745
|
} else {
|
|
@@ -729,8 +759,8 @@ const setOutputLimit = async (adapter2, productKey, deviceKey, limit) => {
|
|
|
729
759
|
limit = 0;
|
|
730
760
|
}
|
|
731
761
|
}
|
|
732
|
-
const currentLimit = (
|
|
733
|
-
const productName = (
|
|
762
|
+
const currentLimit = (_b = await adapter2.getStateAsync(productKey + "." + deviceKey + ".outputLimit")) == null ? void 0 : _b.val;
|
|
763
|
+
const productName = (_d = (_c = await adapter2.getStateAsync(productKey + "." + deviceKey + ".productName")) == null ? void 0 : _c.val) == null ? void 0 : _d.toString().toLowerCase();
|
|
734
764
|
if (currentLimit != null && currentLimit != void 0) {
|
|
735
765
|
if (currentLimit != limit) {
|
|
736
766
|
if (limit < 100 && limit != 90 && limit != 60 && limit != 30 && limit != 0) {
|
|
@@ -749,7 +779,7 @@ const setOutputLimit = async (adapter2, productKey, deviceKey, limit) => {
|
|
|
749
779
|
}
|
|
750
780
|
const topic = `iot/${productKey}/${deviceKey}/properties/write`;
|
|
751
781
|
const outputlimit = { properties: { outputLimit: limit } };
|
|
752
|
-
(
|
|
782
|
+
(_e = adapter2.mqttClient) == null ? void 0 : _e.publish(topic, JSON.stringify(outputlimit));
|
|
753
783
|
}
|
|
754
784
|
}
|
|
755
785
|
}
|
|
@@ -791,11 +821,24 @@ const setBuzzerSwitch = async (adapter2, productKey, deviceKey, buzzerOn) => {
|
|
|
791
821
|
var _a;
|
|
792
822
|
if (adapter2.mqttClient && productKey && deviceKey) {
|
|
793
823
|
const topic = `iot/${productKey}/${deviceKey}/properties/write`;
|
|
794
|
-
const
|
|
824
|
+
const setBuzzerSwitchContent = {
|
|
825
|
+
properties: { buzzerSwitch: buzzerOn ? 1 : 0 }
|
|
826
|
+
};
|
|
795
827
|
adapter2.log.debug(
|
|
796
828
|
`[setBuzzer] Setting Buzzer for device key ${deviceKey} to ${buzzerOn}!`
|
|
797
829
|
);
|
|
798
|
-
(_a = adapter2.mqttClient) == null ? void 0 : _a.publish(topic, JSON.stringify(
|
|
830
|
+
(_a = adapter2.mqttClient) == null ? void 0 : _a.publish(topic, JSON.stringify(setBuzzerSwitchContent));
|
|
831
|
+
}
|
|
832
|
+
};
|
|
833
|
+
const setAutoModel = async (adapter2, productKey, deviceKey, autoModel) => {
|
|
834
|
+
var _a;
|
|
835
|
+
if (adapter2.mqttClient && productKey && deviceKey) {
|
|
836
|
+
const topic = `iot/${productKey}/${deviceKey}/properties/write`;
|
|
837
|
+
const setAutoModelContent = { properties: { autoModel } };
|
|
838
|
+
adapter2.log.debug(
|
|
839
|
+
`[setBuzzer] Setting autoModel for device key ${deviceKey} to ${autoModel}!`
|
|
840
|
+
);
|
|
841
|
+
(_a = adapter2.mqttClient) == null ? void 0 : _a.publish(topic, JSON.stringify(setAutoModelContent));
|
|
799
842
|
}
|
|
800
843
|
};
|
|
801
844
|
const triggerFullTelemetryUpdate = async (adapter2, productKey, deviceKey) => {
|
|
@@ -880,11 +923,11 @@ const onSubscribeIotTopic = (error, productKey, deviceKey) => {
|
|
|
880
923
|
triggerFullTelemetryUpdate(adapter, productKey, deviceKey);
|
|
881
924
|
}
|
|
882
925
|
};
|
|
883
|
-
const
|
|
926
|
+
const connectCloudMqttClient = (_adapter) => {
|
|
884
927
|
var _a, _b;
|
|
885
928
|
adapter = _adapter;
|
|
886
929
|
if (!((_a = adapter.paths) == null ? void 0 : _a.mqttPassword)) {
|
|
887
|
-
adapter.log.error(`[
|
|
930
|
+
adapter.log.error(`[connectCloudMqttClient] MQTT Password is missing!`);
|
|
888
931
|
return;
|
|
889
932
|
}
|
|
890
933
|
const mqttPassword = atob((_b = adapter.paths) == null ? void 0 : _b.mqttPassword);
|
|
@@ -897,7 +940,7 @@ const connectMqttClient = (_adapter) => {
|
|
|
897
940
|
};
|
|
898
941
|
if (mqtt && adapter && adapter.paths && adapter.deviceList) {
|
|
899
942
|
adapter.log.debug(
|
|
900
|
-
`[
|
|
943
|
+
`[connectCloudMqttClient] Connecting to MQTT broker ${adapter.paths.mqttUrl + ":" + adapter.paths.mqttPort}...`
|
|
901
944
|
);
|
|
902
945
|
adapter.mqttClient = mqtt.connect(
|
|
903
946
|
"mqtt://" + adapter.paths.mqttUrl + ":" + adapter.paths.mqttPort,
|
|
@@ -921,7 +964,7 @@ const connectMqttClient = (_adapter) => {
|
|
|
921
964
|
var _a2;
|
|
922
965
|
if (adapter) {
|
|
923
966
|
adapter.log.debug(
|
|
924
|
-
`[
|
|
967
|
+
`[connectCloudMqttClient] Subscribing to MQTT Topic: ${reportTopic}`
|
|
925
968
|
);
|
|
926
969
|
(_a2 = adapter.mqttClient) == null ? void 0 : _a2.subscribe(
|
|
927
970
|
reportTopic,
|
|
@@ -936,7 +979,7 @@ const connectMqttClient = (_adapter) => {
|
|
|
936
979
|
() => {
|
|
937
980
|
var _a2;
|
|
938
981
|
adapter == null ? void 0 : adapter.log.debug(
|
|
939
|
-
`[
|
|
982
|
+
`[connectCloudMqttClient] Subscribing to MQTT Topic: ${iotTopic}`
|
|
940
983
|
);
|
|
941
984
|
(_a2 = adapter == null ? void 0 : adapter.mqttClient) == null ? void 0 : _a2.subscribe(iotTopic, (error) => {
|
|
942
985
|
onSubscribeIotTopic(
|
|
@@ -958,7 +1001,7 @@ const connectMqttClient = (_adapter) => {
|
|
|
958
1001
|
var _a2;
|
|
959
1002
|
if (adapter) {
|
|
960
1003
|
adapter.log.debug(
|
|
961
|
-
`[
|
|
1004
|
+
`[connectCloudMqttClient] Subscribing to MQTT Topic: ${reportTopic2}`
|
|
962
1005
|
);
|
|
963
1006
|
(_a2 = adapter.mqttClient) == null ? void 0 : _a2.subscribe(
|
|
964
1007
|
reportTopic2,
|
|
@@ -969,7 +1012,7 @@ const connectMqttClient = (_adapter) => {
|
|
|
969
1012
|
setTimeout(() => {
|
|
970
1013
|
var _a2;
|
|
971
1014
|
adapter == null ? void 0 : adapter.log.debug(
|
|
972
|
-
`[
|
|
1015
|
+
`[connectCloudMqttClient] Subscribing to MQTT Topic: ${iotTopic2}`
|
|
973
1016
|
);
|
|
974
1017
|
(_a2 = adapter == null ? void 0 : adapter.mqttClient) == null ? void 0 : _a2.subscribe(iotTopic2, (error) => {
|
|
975
1018
|
onSubscribeIotTopic(
|
|
@@ -994,12 +1037,71 @@ const connectMqttClient = (_adapter) => {
|
|
|
994
1037
|
}
|
|
995
1038
|
}
|
|
996
1039
|
};
|
|
1040
|
+
const connectLocalMqttClient = (_adapter) => {
|
|
1041
|
+
adapter = _adapter;
|
|
1042
|
+
const options = {
|
|
1043
|
+
clientId: "bla"
|
|
1044
|
+
};
|
|
1045
|
+
if (mqtt && adapter && adapter.config && adapter.config.localMqttUrl) {
|
|
1046
|
+
adapter.log.debug(
|
|
1047
|
+
`[connectLocalMqttClient] Connecting to MQTT broker ${adapter.config.localMqttUrl + ":1883"}...`
|
|
1048
|
+
);
|
|
1049
|
+
adapter.mqttClient = mqtt.connect(
|
|
1050
|
+
"mqtt://" + adapter.config.localMqttUrl + ":1883",
|
|
1051
|
+
options
|
|
1052
|
+
);
|
|
1053
|
+
if (adapter && adapter.mqttClient) {
|
|
1054
|
+
adapter.mqttClient.on("connect", onConnected);
|
|
1055
|
+
adapter.mqttClient.on("error", onError);
|
|
1056
|
+
adapter.setState("info.connection", true, true);
|
|
1057
|
+
if (adapter.config.localDevice1ProductKey && adapter.config.localDevice1DeviceKey) {
|
|
1058
|
+
(0, import_createSolarFlowLocalStates.createSolarFlowLocalStates)(
|
|
1059
|
+
adapter,
|
|
1060
|
+
adapter.config.localDevice1ProductKey,
|
|
1061
|
+
adapter.config.localDevice1DeviceKey
|
|
1062
|
+
);
|
|
1063
|
+
const reportTopic = `/${adapter.config.localDevice1ProductKey}/${adapter.config.localDevice1DeviceKey}/#`;
|
|
1064
|
+
const iotTopic = `iot/${adapter.config.localDevice1ProductKey}/${adapter.config.localDevice1DeviceKey}/`;
|
|
1065
|
+
setTimeout(() => {
|
|
1066
|
+
var _a;
|
|
1067
|
+
if (adapter) {
|
|
1068
|
+
adapter.log.debug(
|
|
1069
|
+
`[connectLocalMqttClient] Subscribing to MQTT Topic: ${reportTopic}`
|
|
1070
|
+
);
|
|
1071
|
+
(_a = adapter.mqttClient) == null ? void 0 : _a.subscribe(reportTopic, onSubscribeReportTopic);
|
|
1072
|
+
}
|
|
1073
|
+
}, 1e3);
|
|
1074
|
+
setTimeout(() => {
|
|
1075
|
+
var _a;
|
|
1076
|
+
adapter == null ? void 0 : adapter.log.debug(
|
|
1077
|
+
`[connectLocalMqttClient] Subscribing to MQTT Topic: ${iotTopic}`
|
|
1078
|
+
);
|
|
1079
|
+
(_a = adapter == null ? void 0 : adapter.mqttClient) == null ? void 0 : _a.subscribe(iotTopic, (error) => {
|
|
1080
|
+
onSubscribeIotTopic(
|
|
1081
|
+
error,
|
|
1082
|
+
adapter == null ? void 0 : adapter.config.localDevice1ProductKey,
|
|
1083
|
+
adapter == null ? void 0 : adapter.config.localDevice1DeviceKey
|
|
1084
|
+
);
|
|
1085
|
+
});
|
|
1086
|
+
}, 2e3);
|
|
1087
|
+
}
|
|
1088
|
+
adapter.mqttClient.on("message", onMessage);
|
|
1089
|
+
(0, import_jobSchedule.startResetValuesJob)(adapter);
|
|
1090
|
+
(0, import_jobSchedule.startCheckStatesAndConnectionJob)(adapter);
|
|
1091
|
+
if (adapter.config.useCalculation) {
|
|
1092
|
+
(0, import_jobSchedule.startCalculationJob)(adapter);
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
};
|
|
997
1097
|
// Annotate the CommonJS export names for ESM import in node:
|
|
998
1098
|
0 && (module.exports = {
|
|
999
1099
|
addOrUpdatePackData,
|
|
1000
|
-
|
|
1100
|
+
connectCloudMqttClient,
|
|
1101
|
+
connectLocalMqttClient,
|
|
1001
1102
|
setAcMode,
|
|
1002
1103
|
setAcSwitch,
|
|
1104
|
+
setAutoModel,
|
|
1003
1105
|
setAutoRecover,
|
|
1004
1106
|
setBuzzerSwitch,
|
|
1005
1107
|
setChargeLimit,
|