iobroker.zendure-solarflow 1.6.7 → 1.7.1

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.
@@ -30,10 +30,13 @@ var mqttService_exports = {};
30
30
  __export(mqttService_exports, {
31
31
  addOrUpdatePackData: () => addOrUpdatePackData,
32
32
  connectMqttClient: () => connectMqttClient,
33
+ setAcSwitch: () => setAcSwitch,
33
34
  setAutoRecover: () => setAutoRecover,
34
35
  setBuzzerSwitch: () => setBuzzerSwitch,
35
36
  setChargeLimit: () => setChargeLimit,
37
+ setDcSwitch: () => setDcSwitch,
36
38
  setDischargeLimit: () => setDischargeLimit,
39
+ setInputLimit: () => setInputLimit,
37
40
  setOutputLimit: () => setOutputLimit,
38
41
  setPassMode: () => setPassMode,
39
42
  triggerFullTelemetryUpdate: () => triggerFullTelemetryUpdate
@@ -42,14 +45,15 @@ module.exports = __toCommonJS(mqttService_exports);
42
45
  var mqtt = __toESM(require("mqtt"));
43
46
  var import_adapterService = require("./adapterService");
44
47
  var import_calculationService = require("./calculationService");
48
+ var import_ISolarFlowMqttProperties = require("../models/ISolarFlowMqttProperties");
45
49
  var import_jobSchedule = require("./jobSchedule");
46
50
  let adapter = void 0;
47
- const addOrUpdatePackData = async (productKey, deviceKey, packData) => {
51
+ const addOrUpdatePackData = async (productKey, deviceKey, packData, isSolarFlow) => {
48
52
  if (adapter && productKey && deviceKey) {
49
53
  await packData.forEach(async (x) => {
50
54
  if (x.sn && adapter) {
51
55
  const key = (productKey + "." + deviceKey + ".packData." + x.sn).replace(adapter.FORBIDDEN_CHARS, "");
52
- await (adapter == null ? void 0 : adapter.extendObjectAsync(key + ".sn", {
56
+ await (adapter == null ? void 0 : adapter.extendObject(key + ".sn", {
53
57
  type: "state",
54
58
  common: {
55
59
  name: {
@@ -66,7 +70,7 @@ const addOrUpdatePackData = async (productKey, deviceKey, packData) => {
66
70
  }));
67
71
  await (adapter == null ? void 0 : adapter.setStateAsync(key + ".sn", x.sn, true));
68
72
  if (x.socLevel) {
69
- await (adapter == null ? void 0 : adapter.extendObjectAsync(key + ".socLevel", {
73
+ await (adapter == null ? void 0 : adapter.extendObject(key + ".socLevel", {
70
74
  type: "state",
71
75
  common: {
72
76
  name: {
@@ -84,7 +88,7 @@ const addOrUpdatePackData = async (productKey, deviceKey, packData) => {
84
88
  await (adapter == null ? void 0 : adapter.setStateAsync(key + ".socLevel", x.socLevel, true));
85
89
  }
86
90
  if (x.maxTemp) {
87
- await (adapter == null ? void 0 : adapter.extendObjectAsync(key + ".maxTemp", {
91
+ await (adapter == null ? void 0 : adapter.extendObject(key + ".maxTemp", {
88
92
  type: "state",
89
93
  common: {
90
94
  name: {
@@ -106,7 +110,7 @@ const addOrUpdatePackData = async (productKey, deviceKey, packData) => {
106
110
  ));
107
111
  }
108
112
  if (x.minVol) {
109
- await (adapter == null ? void 0 : adapter.extendObjectAsync(key + ".minVol", {
113
+ await (adapter == null ? void 0 : adapter.extendObject(key + ".minVol", {
110
114
  type: "state",
111
115
  common: {
112
116
  name: "minVol",
@@ -121,7 +125,7 @@ const addOrUpdatePackData = async (productKey, deviceKey, packData) => {
121
125
  await (adapter == null ? void 0 : adapter.setStateAsync(key + ".minVol", x.minVol / 100, true));
122
126
  }
123
127
  if (x.maxVol) {
124
- await (adapter == null ? void 0 : adapter.extendObjectAsync(key + ".maxVol", {
128
+ await (adapter == null ? void 0 : adapter.extendObject(key + ".maxVol", {
125
129
  type: "state",
126
130
  common: {
127
131
  name: "maxVol",
@@ -133,10 +137,10 @@ const addOrUpdatePackData = async (productKey, deviceKey, packData) => {
133
137
  },
134
138
  native: {}
135
139
  }));
136
- await (adapter == null ? void 0 : adapter.setStateAsync(key + ".maxVol", x.maxVol / 100, true));
140
+ await (adapter == null ? void 0 : adapter.setState(key + ".maxVol", x.maxVol / 100, true));
137
141
  }
138
142
  if (x.totalVol) {
139
- await (adapter == null ? void 0 : adapter.extendObjectAsync(key + ".totalVol", {
143
+ await (adapter == null ? void 0 : adapter.extendObject(key + ".totalVol", {
140
144
  type: "state",
141
145
  common: {
142
146
  name: "totalVol",
@@ -149,15 +153,17 @@ const addOrUpdatePackData = async (productKey, deviceKey, packData) => {
149
153
  native: {}
150
154
  }));
151
155
  const totalVol = x.totalVol / 100;
152
- await (adapter == null ? void 0 : adapter.setStateAsync(key + ".totalVol", totalVol, true));
153
- (0, import_adapterService.checkVoltage)(adapter, productKey, deviceKey, totalVol);
156
+ await (adapter == null ? void 0 : adapter.setState(key + ".totalVol", totalVol, true));
157
+ if (isSolarFlow) {
158
+ (0, import_adapterService.checkVoltage)(adapter, productKey, deviceKey, totalVol);
159
+ }
154
160
  }
155
161
  }
156
162
  });
157
163
  }
158
164
  };
159
165
  const onMessage = async (topic, message) => {
160
- 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;
166
+ 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;
161
167
  if (adapter) {
162
168
  const topicSplitted = topic.split("/");
163
169
  const productKey = topicSplitted[1];
@@ -169,6 +175,13 @@ const onMessage = async (topic, message) => {
169
175
  const txt = message.toString();
170
176
  adapter.log.error(`[JSON PARSE ERROR] ${txt}`);
171
177
  }
178
+ let isSolarFlow = false;
179
+ const productName = await adapter.getStateAsync(
180
+ `${productKey}.${deviceKey}.productName`
181
+ );
182
+ 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"))) {
183
+ isSolarFlow = true;
184
+ }
172
185
  (0, import_adapterService.updateSolarFlowState)(
173
186
  adapter,
174
187
  productKey,
@@ -176,7 +189,7 @@ const onMessage = async (topic, message) => {
176
189
  "lastUpdate",
177
190
  (/* @__PURE__ */ new Date()).getTime()
178
191
  );
179
- if (((_a = obj.properties) == null ? void 0 : _a.electricLevel) != null && ((_b = obj.properties) == null ? void 0 : _b.electricLevel) != void 0) {
192
+ if (((_c = obj.properties) == null ? void 0 : _c.electricLevel) != null && ((_d = obj.properties) == null ? void 0 : _d.electricLevel) != void 0) {
180
193
  (0, import_adapterService.updateSolarFlowState)(
181
194
  adapter,
182
195
  productKey,
@@ -184,37 +197,37 @@ const onMessage = async (topic, message) => {
184
197
  "electricLevel",
185
198
  obj.properties.electricLevel
186
199
  );
187
- if ((adapter == null ? void 0 : adapter.config.useCalculation) && obj.properties.electricLevel == 100) {
200
+ if ((adapter == null ? void 0 : adapter.config.useCalculation) && obj.properties.electricLevel == 100 && isSolarFlow) {
188
201
  (0, import_calculationService.setEnergyWhMax)(adapter, productKey, deviceKey);
189
202
  }
190
203
  const minSoc = await (adapter == null ? void 0 : adapter.getStateAsync(
191
204
  `${productKey}.${deviceKey}.minSoc`
192
205
  ));
193
- if ((adapter == null ? void 0 : adapter.config.useCalculation) && minSoc && minSoc.val && obj.properties.electricLevel <= Number(minSoc.val)) {
206
+ if ((adapter == null ? void 0 : adapter.config.useCalculation) && minSoc && minSoc.val && obj.properties.electricLevel <= Number(minSoc.val) && isSolarFlow) {
194
207
  (0, import_calculationService.setSocToZero)(adapter, productKey, deviceKey);
195
208
  }
196
209
  }
197
- if (((_c = obj.properties) == null ? void 0 : _c.packState) != null && ((_d = obj.properties) == null ? void 0 : _d.packState) != void 0) {
198
- const value = ((_e = obj.properties) == null ? void 0 : _e.packState) == 0 ? "Idle" : ((_f = obj.properties) == null ? void 0 : _f.packState) == 1 ? "Charging" : ((_g = obj.properties) == null ? void 0 : _g.packState) == 2 ? "Discharging" : "Unknown";
210
+ if (((_e = obj.properties) == null ? void 0 : _e.packState) != null && ((_f = obj.properties) == null ? void 0 : _f.packState) != void 0) {
211
+ const value = ((_g = obj.properties) == null ? void 0 : _g.packState) == 0 ? "Idle" : ((_h = obj.properties) == null ? void 0 : _h.packState) == 1 ? "Charging" : ((_i = obj.properties) == null ? void 0 : _i.packState) == 2 ? "Discharging" : "Unknown";
199
212
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "packState", value);
200
213
  }
201
- if (((_h = obj.properties) == null ? void 0 : _h.passMode) != null && ((_i = obj.properties) == null ? void 0 : _i.passMode) != void 0) {
202
- const value = ((_j = obj.properties) == null ? void 0 : _j.passMode) == 0 ? "Automatic" : ((_k = obj.properties) == null ? void 0 : _k.passMode) == 1 ? "Always off" : ((_l = obj.properties) == null ? void 0 : _l.passMode) == 2 ? "Always on" : "Unknown";
214
+ if (((_j = obj.properties) == null ? void 0 : _j.passMode) != null && ((_k = obj.properties) == null ? void 0 : _k.passMode) != void 0) {
215
+ const value = ((_l = obj.properties) == null ? void 0 : _l.passMode) == 0 ? "Automatic" : ((_m = obj.properties) == null ? void 0 : _m.passMode) == 1 ? "Always off" : ((_n = obj.properties) == null ? void 0 : _n.passMode) == 2 ? "Always on" : "Unknown";
203
216
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "passMode", value);
204
217
  (0, import_adapterService.updateSolarFlowControlState)(
205
218
  adapter,
206
219
  productKey,
207
220
  deviceKey,
208
221
  "passMode",
209
- (_m = obj.properties) == null ? void 0 : _m.passMode
222
+ (_o = obj.properties) == null ? void 0 : _o.passMode
210
223
  );
211
224
  }
212
- if (((_n = obj.properties) == null ? void 0 : _n.pass) != null && ((_o = obj.properties) == null ? void 0 : _o.pass) != void 0) {
213
- const value = ((_p = obj.properties) == null ? void 0 : _p.pass) == 0 ? false : true;
225
+ if (((_p = obj.properties) == null ? void 0 : _p.pass) != null && ((_q = obj.properties) == null ? void 0 : _q.pass) != void 0) {
226
+ const value = ((_r = obj.properties) == null ? void 0 : _r.pass) == 0 ? false : true;
214
227
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "pass", value);
215
228
  }
216
- if (((_q = obj.properties) == null ? void 0 : _q.autoRecover) != null && ((_r = obj.properties) == null ? void 0 : _r.autoRecover) != void 0) {
217
- const value = ((_s = obj.properties) == null ? void 0 : _s.autoRecover) == 0 ? false : true;
229
+ if (((_s = obj.properties) == null ? void 0 : _s.autoRecover) != null && ((_t = obj.properties) == null ? void 0 : _t.autoRecover) != void 0) {
230
+ const value = ((_u = obj.properties) == null ? void 0 : _u.autoRecover) == 0 ? false : true;
218
231
  (0, import_adapterService.updateSolarFlowState)(
219
232
  adapter,
220
233
  productKey,
@@ -230,7 +243,7 @@ const onMessage = async (topic, message) => {
230
243
  value
231
244
  );
232
245
  }
233
- if (((_t = obj.properties) == null ? void 0 : _t.outputHomePower) != null && ((_u = obj.properties) == null ? void 0 : _u.outputHomePower) != void 0) {
246
+ if (((_v = obj.properties) == null ? void 0 : _v.outputHomePower) != null && ((_w = obj.properties) == null ? void 0 : _w.outputHomePower) != void 0) {
234
247
  (0, import_adapterService.updateSolarFlowState)(
235
248
  adapter,
236
249
  productKey,
@@ -239,7 +252,16 @@ const onMessage = async (topic, message) => {
239
252
  obj.properties.outputHomePower
240
253
  );
241
254
  }
242
- if (((_v = obj.properties) == null ? void 0 : _v.outputLimit) != null && ((_w = obj.properties) == null ? void 0 : _w.outputLimit) != void 0) {
255
+ if (((_x = obj.properties) == null ? void 0 : _x.energyPower) != null && ((_y = obj.properties) == null ? void 0 : _y.energyPower) != void 0) {
256
+ (0, import_adapterService.updateSolarFlowState)(
257
+ adapter,
258
+ productKey,
259
+ deviceKey,
260
+ "energyPower",
261
+ obj.properties.energyPower
262
+ );
263
+ }
264
+ if (((_z = obj.properties) == null ? void 0 : _z.outputLimit) != null && ((_A = obj.properties) == null ? void 0 : _A.outputLimit) != void 0) {
243
265
  (0, import_adapterService.updateSolarFlowState)(
244
266
  adapter,
245
267
  productKey,
@@ -255,8 +277,8 @@ const onMessage = async (topic, message) => {
255
277
  obj.properties.outputLimit
256
278
  );
257
279
  }
258
- if (((_x = obj.properties) == null ? void 0 : _x.buzzerSwitch) != null && ((_y = obj.properties) == null ? void 0 : _y.buzzerSwitch) != void 0) {
259
- const value = ((_z = obj.properties) == null ? void 0 : _z.buzzerSwitch) == 0 ? false : true;
280
+ if (((_B = obj.properties) == null ? void 0 : _B.buzzerSwitch) != null && ((_C = obj.properties) == null ? void 0 : _C.buzzerSwitch) != void 0) {
281
+ const value = ((_D = obj.properties) == null ? void 0 : _D.buzzerSwitch) == 0 ? false : true;
260
282
  (0, import_adapterService.updateSolarFlowState)(
261
283
  adapter,
262
284
  productKey,
@@ -272,7 +294,7 @@ const onMessage = async (topic, message) => {
272
294
  value
273
295
  );
274
296
  }
275
- if (((_A = obj.properties) == null ? void 0 : _A.outputPackPower) != null && ((_B = obj.properties) == null ? void 0 : _B.outputPackPower) != void 0) {
297
+ if (((_E = obj.properties) == null ? void 0 : _E.outputPackPower) != null && ((_F = obj.properties) == null ? void 0 : _F.outputPackPower) != void 0) {
276
298
  (0, import_adapterService.updateSolarFlowState)(
277
299
  adapter,
278
300
  productKey,
@@ -282,7 +304,7 @@ const onMessage = async (topic, message) => {
282
304
  );
283
305
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "packInputPower", 0);
284
306
  }
285
- if (((_C = obj.properties) == null ? void 0 : _C.packInputPower) != null && ((_D = obj.properties) == null ? void 0 : _D.packInputPower) != void 0) {
307
+ if (((_G = obj.properties) == null ? void 0 : _G.packInputPower) != null && ((_H = obj.properties) == null ? void 0 : _H.packInputPower) != void 0) {
286
308
  let standbyUsage = 0;
287
309
  const solarInputPower = await (adapter == null ? void 0 : adapter.getStateAsync(
288
310
  `${productKey}.${deviceKey}.solarInputPower`
@@ -305,7 +327,7 @@ const onMessage = async (topic, message) => {
305
327
  0
306
328
  );
307
329
  }
308
- if (((_E = obj.properties) == null ? void 0 : _E.solarInputPower) != null && ((_F = obj.properties) == null ? void 0 : _F.solarInputPower) != void 0) {
330
+ if (((_I = obj.properties) == null ? void 0 : _I.solarInputPower) != null && ((_J = obj.properties) == null ? void 0 : _J.solarInputPower) != void 0) {
309
331
  (0, import_adapterService.updateSolarFlowState)(
310
332
  adapter,
311
333
  productKey,
@@ -314,7 +336,7 @@ const onMessage = async (topic, message) => {
314
336
  obj.properties.solarInputPower
315
337
  );
316
338
  }
317
- if (((_G = obj.properties) == null ? void 0 : _G.pvPower1) != null && ((_H = obj.properties) == null ? void 0 : _H.pvPower1) != void 0) {
339
+ if (((_K = obj.properties) == null ? void 0 : _K.pvPower1) != null && ((_L = obj.properties) == null ? void 0 : _L.pvPower1) != void 0) {
318
340
  (0, import_adapterService.updateSolarFlowState)(
319
341
  adapter,
320
342
  productKey,
@@ -324,7 +346,7 @@ const onMessage = async (topic, message) => {
324
346
  obj.properties.pvPower1
325
347
  );
326
348
  }
327
- if (((_I = obj.properties) == null ? void 0 : _I.pvPower2) != null && ((_J = obj.properties) == null ? void 0 : _J.pvPower2) != void 0) {
349
+ if (((_M = obj.properties) == null ? void 0 : _M.pvPower2) != null && ((_N = obj.properties) == null ? void 0 : _N.pvPower2) != void 0) {
328
350
  (0, import_adapterService.updateSolarFlowState)(
329
351
  adapter,
330
352
  productKey,
@@ -334,7 +356,7 @@ const onMessage = async (topic, message) => {
334
356
  obj.properties.pvPower2
335
357
  );
336
358
  }
337
- if (((_K = obj.properties) == null ? void 0 : _K.solarPower1) != null && ((_L = obj.properties) == null ? void 0 : _L.solarPower1) != void 0) {
359
+ if (((_O = obj.properties) == null ? void 0 : _O.solarPower1) != null && ((_P = obj.properties) == null ? void 0 : _P.solarPower1) != void 0) {
338
360
  (0, import_adapterService.updateSolarFlowState)(
339
361
  adapter,
340
362
  productKey,
@@ -343,7 +365,7 @@ const onMessage = async (topic, message) => {
343
365
  obj.properties.solarPower1
344
366
  );
345
367
  }
346
- if (((_M = obj.properties) == null ? void 0 : _M.solarPower2) != null && ((_N = obj.properties) == null ? void 0 : _N.solarPower2) != void 0) {
368
+ if (((_Q = obj.properties) == null ? void 0 : _Q.solarPower2) != null && ((_R = obj.properties) == null ? void 0 : _R.solarPower2) != void 0) {
347
369
  (0, import_adapterService.updateSolarFlowState)(
348
370
  adapter,
349
371
  productKey,
@@ -352,7 +374,7 @@ const onMessage = async (topic, message) => {
352
374
  obj.properties.solarPower2
353
375
  );
354
376
  }
355
- if (((_O = obj.properties) == null ? void 0 : _O.remainOutTime) != null && ((_P = obj.properties) == null ? void 0 : _P.remainOutTime) != void 0) {
377
+ if (((_S = obj.properties) == null ? void 0 : _S.remainOutTime) != null && ((_T = obj.properties) == null ? void 0 : _T.remainOutTime) != void 0) {
356
378
  (0, import_adapterService.updateSolarFlowState)(
357
379
  adapter,
358
380
  productKey,
@@ -361,7 +383,7 @@ const onMessage = async (topic, message) => {
361
383
  obj.properties.remainOutTime
362
384
  );
363
385
  }
364
- if (((_Q = obj.properties) == null ? void 0 : _Q.remainInputTime) != null && ((_R = obj.properties) == null ? void 0 : _R.remainInputTime) != void 0) {
386
+ if (((_U = obj.properties) == null ? void 0 : _U.remainInputTime) != null && ((_V = obj.properties) == null ? void 0 : _V.remainInputTime) != void 0) {
365
387
  (0, import_adapterService.updateSolarFlowState)(
366
388
  adapter,
367
389
  productKey,
@@ -370,7 +392,7 @@ const onMessage = async (topic, message) => {
370
392
  obj.properties.remainInputTime
371
393
  );
372
394
  }
373
- if (((_S = obj.properties) == null ? void 0 : _S.socSet) != null && ((_T = obj.properties) == null ? void 0 : _T.socSet) != void 0) {
395
+ if (((_W = obj.properties) == null ? void 0 : _W.socSet) != null && ((_X = obj.properties) == null ? void 0 : _X.socSet) != void 0) {
374
396
  (0, import_adapterService.updateSolarFlowState)(
375
397
  adapter,
376
398
  productKey,
@@ -386,7 +408,7 @@ const onMessage = async (topic, message) => {
386
408
  Number(obj.properties.socSet) / 10
387
409
  );
388
410
  }
389
- if (((_U = obj.properties) == null ? void 0 : _U.minSoc) != null && ((_V = obj.properties) == null ? void 0 : _V.minSoc) != void 0) {
411
+ if (((_Y = obj.properties) == null ? void 0 : _Y.minSoc) != null && ((_Z = obj.properties) == null ? void 0 : _Z.minSoc) != void 0) {
390
412
  (0, import_adapterService.updateSolarFlowState)(
391
413
  adapter,
392
414
  productKey,
@@ -402,11 +424,64 @@ const onMessage = async (topic, message) => {
402
424
  Number(obj.properties.minSoc) / 10
403
425
  );
404
426
  }
405
- if (((_W = obj.properties) == null ? void 0 : _W.pvBrand) != null && ((_X = obj.properties) == null ? void 0 : _X.pvBrand) != void 0) {
406
- const value = ((_Y = obj.properties) == null ? void 0 : _Y.pvBrand) == 0 ? "Others" : ((_Z = obj.properties) == null ? void 0 : _Z.pvBrand) == 1 ? "Hoymiles" : ((__ = obj.properties) == null ? void 0 : __.pvBrand) == 2 ? "Enphase" : ((_$ = obj.properties) == null ? void 0 : _$.pvBrand) == 3 ? "APSystems" : ((_aa = obj.properties) == null ? void 0 : _aa.pvBrand) == 4 ? "Anker" : ((_ba = obj.properties) == null ? void 0 : _ba.pvBrand) == 5 ? "Deye" : ((_ca = obj.properties) == null ? void 0 : _ca.pvBrand) == 6 ? "Bosswerk" : "Unknown";
427
+ if (((__ = obj.properties) == null ? void 0 : __.inputLimit) != null && ((_$ = obj.properties) == null ? void 0 : _$.inputLimit) != void 0) {
428
+ (0, import_adapterService.updateSolarFlowState)(
429
+ adapter,
430
+ productKey,
431
+ deviceKey,
432
+ "inputLimit",
433
+ obj.properties.inputLimit
434
+ );
435
+ }
436
+ if (((_aa = obj.properties) == null ? void 0 : _aa.gridInputPower) != null && ((_ba = obj.properties) == null ? void 0 : _ba.gridInputPower) != void 0) {
437
+ (0, import_adapterService.updateSolarFlowState)(
438
+ adapter,
439
+ productKey,
440
+ deviceKey,
441
+ "gridInputPower",
442
+ obj.properties.gridInputPower
443
+ );
444
+ }
445
+ if (((_ca = obj.properties) == null ? void 0 : _ca.acOutputPower) != null && ((_da = obj.properties) == null ? void 0 : _da.acOutputPower) != void 0) {
446
+ (0, import_adapterService.updateSolarFlowState)(
447
+ adapter,
448
+ productKey,
449
+ deviceKey,
450
+ "acOutputPower",
451
+ obj.properties.acOutputPower
452
+ );
453
+ }
454
+ if (((_ea = obj.properties) == null ? void 0 : _ea.gridPower) != null && ((_fa = obj.properties) == null ? void 0 : _fa.gridPower) != void 0) {
455
+ (0, import_adapterService.updateSolarFlowState)(
456
+ adapter,
457
+ productKey,
458
+ deviceKey,
459
+ "gridPower",
460
+ obj.properties.gridPower
461
+ );
462
+ }
463
+ if (((_ga = obj.properties) == null ? void 0 : _ga.acSwitch) != null && ((_ha = obj.properties) == null ? void 0 : _ha.acSwitch) != void 0) {
464
+ const value = ((_ia = obj.properties) == null ? void 0 : _ia.acSwitch) == 0 ? false : true;
465
+ (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "acSwitch", value);
466
+ }
467
+ if (((_ja = obj.properties) == null ? void 0 : _ja.dcSwitch) != null && ((_ka = obj.properties) == null ? void 0 : _ka.dcSwitch) != void 0) {
468
+ const value = ((_la = obj.properties) == null ? void 0 : _la.dcSwitch) == 0 ? false : true;
469
+ (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "dcSwitch", value);
470
+ }
471
+ if (((_ma = obj.properties) == null ? void 0 : _ma.dcOutputPower) != null && ((_na = obj.properties) == null ? void 0 : _na.dcOutputPower) != void 0) {
472
+ (0, import_adapterService.updateSolarFlowState)(
473
+ adapter,
474
+ productKey,
475
+ deviceKey,
476
+ "dcOutputPower",
477
+ obj.properties.dcOutputPower
478
+ );
479
+ }
480
+ if (((_oa = obj.properties) == null ? void 0 : _oa.pvBrand) != null && ((_pa = obj.properties) == null ? void 0 : _pa.pvBrand) != void 0) {
481
+ const value = ((_qa = obj.properties) == null ? void 0 : _qa.pvBrand) == 0 ? "Others" : ((_ra = obj.properties) == null ? void 0 : _ra.pvBrand) == 1 ? "Hoymiles" : ((_sa = obj.properties) == null ? void 0 : _sa.pvBrand) == 2 ? "Enphase" : ((_ta = obj.properties) == null ? void 0 : _ta.pvBrand) == 3 ? "APSystems" : ((_ua = obj.properties) == null ? void 0 : _ua.pvBrand) == 4 ? "Anker" : ((_va = obj.properties) == null ? void 0 : _va.pvBrand) == 5 ? "Deye" : ((_wa = obj.properties) == null ? void 0 : _wa.pvBrand) == 6 ? "Bosswerk" : "Unknown";
407
482
  (0, import_adapterService.updateSolarFlowState)(adapter, productKey, deviceKey, "pvBrand", value);
408
483
  }
409
- if (((_da = obj.properties) == null ? void 0 : _da.inverseMaxPower) != null && ((_ea = obj.properties) == null ? void 0 : _ea.inverseMaxPower) != void 0) {
484
+ if (((_xa = obj.properties) == null ? void 0 : _xa.inverseMaxPower) != null && ((_ya = obj.properties) == null ? void 0 : _ya.inverseMaxPower) != void 0) {
410
485
  (0, import_adapterService.updateSolarFlowState)(
411
486
  adapter,
412
487
  productKey,
@@ -415,7 +490,7 @@ const onMessage = async (topic, message) => {
415
490
  obj.properties.inverseMaxPower
416
491
  );
417
492
  }
418
- if (((_fa = obj.properties) == null ? void 0 : _fa.wifiState) != null && ((_ga = obj.properties) == null ? void 0 : _ga.wifiState) != void 0) {
493
+ if (((_za = obj.properties) == null ? void 0 : _za.wifiState) != null && ((_Aa = obj.properties) == null ? void 0 : _Aa.wifiState) != void 0) {
419
494
  (0, import_adapterService.updateSolarFlowState)(
420
495
  adapter,
421
496
  productKey,
@@ -424,7 +499,16 @@ const onMessage = async (topic, message) => {
424
499
  obj.properties.wifiState == 1 ? "Connected" : "Disconnected"
425
500
  );
426
501
  }
427
- if (((_ha = obj.properties) == null ? void 0 : _ha.hubState) != null && ((_ia = obj.properties) == null ? void 0 : _ia.hubState) != void 0) {
502
+ if (((_Ba = obj.properties) == null ? void 0 : _Ba.packNum) != null && ((_Ca = obj.properties) == null ? void 0 : _Ca.packNum) != void 0) {
503
+ (0, import_adapterService.updateSolarFlowState)(
504
+ adapter,
505
+ productKey,
506
+ deviceKey,
507
+ "packNum",
508
+ obj.properties.packNum
509
+ );
510
+ }
511
+ if (((_Da = obj.properties) == null ? void 0 : _Da.hubState) != null && ((_Ea = obj.properties) == null ? void 0 : _Ea.hubState) != void 0) {
428
512
  (0, import_adapterService.updateSolarFlowState)(
429
513
  adapter,
430
514
  productKey,
@@ -434,7 +518,17 @@ const onMessage = async (topic, message) => {
434
518
  );
435
519
  }
436
520
  if (obj.packData) {
437
- addOrUpdatePackData(productKey, deviceKey, obj.packData);
521
+ addOrUpdatePackData(productKey, deviceKey, obj.packData, isSolarFlow);
522
+ }
523
+ if (obj.properties) {
524
+ Object.entries(obj.properties).forEach(([key, value]) => {
525
+ if (import_ISolarFlowMqttProperties.knownMqttProps.includes(key)) {
526
+ } else {
527
+ console.log(
528
+ `${productName == null ? void 0 : productName.val}: ${key} with value ${value} is a UNKNOWN Mqtt Prop!`
529
+ );
530
+ }
531
+ });
438
532
  }
439
533
  }
440
534
  };
@@ -500,7 +594,25 @@ const setOutputLimit = async (adapter2, productKey, deviceKey, limit) => {
500
594
  const topic = `iot/${productKey}/${deviceKey}/properties/write`;
501
595
  const outputlimit = { properties: { outputLimit: limit } };
502
596
  (_b = adapter2.mqttClient) == null ? void 0 : _b.publish(topic, JSON.stringify(outputlimit));
503
- } else {
597
+ }
598
+ }
599
+ }
600
+ };
601
+ const setInputLimit = async (adapter2, productKey, deviceKey, limit) => {
602
+ var _a, _b;
603
+ if (adapter2.mqttClient && productKey && deviceKey) {
604
+ const currentLimit = (_a = await adapter2.getStateAsync(productKey + "." + deviceKey + ".inputLimit")) == null ? void 0 : _a.val;
605
+ limit = Math.ceil(limit / 100) * 100;
606
+ if (limit < 0) {
607
+ limit = 0;
608
+ } else if (limit > 900) {
609
+ limit = 900;
610
+ }
611
+ if (currentLimit != null && currentLimit != void 0) {
612
+ if (currentLimit != limit) {
613
+ const topic = `iot/${productKey}/${deviceKey}/properties/write`;
614
+ const inputLimitContent = { properties: { inputLimit: limit } };
615
+ (_b = adapter2.mqttClient) == null ? void 0 : _b.publish(topic, JSON.stringify(inputLimitContent));
504
616
  }
505
617
  }
506
618
  }
@@ -551,6 +663,32 @@ const setAutoRecover = async (adapter2, productKey, deviceKey, autoRecover) => {
551
663
  (_a = adapter2.mqttClient) == null ? void 0 : _a.publish(topic, JSON.stringify(setAutoRecoverContent));
552
664
  }
553
665
  };
666
+ const setDcSwitch = async (adapter2, productKey, deviceKey, dcSwitch) => {
667
+ var _a;
668
+ if (adapter2.mqttClient && productKey && deviceKey) {
669
+ const topic = `iot/${productKey}/${deviceKey}/properties/write`;
670
+ const setDcSwitchContent = {
671
+ properties: { dcSwitch: dcSwitch ? 1 : 0 }
672
+ };
673
+ adapter2.log.debug(
674
+ `[setPassMode] Set DC Switch for device ${deviceKey} to ${dcSwitch}!`
675
+ );
676
+ (_a = adapter2.mqttClient) == null ? void 0 : _a.publish(topic, JSON.stringify(setDcSwitchContent));
677
+ }
678
+ };
679
+ const setAcSwitch = async (adapter2, productKey, deviceKey, dcSwitch) => {
680
+ var _a;
681
+ if (adapter2.mqttClient && productKey && deviceKey) {
682
+ const topic = `iot/${productKey}/${deviceKey}/properties/write`;
683
+ const setDcSwitchContent = {
684
+ properties: { dcSwitch: dcSwitch ? 1 : 0 }
685
+ };
686
+ adapter2.log.debug(
687
+ `[setPassMode] Set AC Switch for device ${deviceKey} to ${dcSwitch}!`
688
+ );
689
+ (_a = adapter2.mqttClient) == null ? void 0 : _a.publish(topic, JSON.stringify(setDcSwitchContent));
690
+ }
691
+ };
554
692
  const onConnected = () => {
555
693
  adapter == null ? void 0 : adapter.log.info("[onConnected] Connected with MQTT!");
556
694
  };
@@ -618,6 +756,39 @@ const connectMqttClient = (_adapter) => {
618
756
  onSubscribeIotTopic(error, device.productKey, device.deviceKey);
619
757
  });
620
758
  }, 1500 * index);
759
+ if (device.packList && device.packList.length > 0) {
760
+ device.packList.forEach(async (subDevice) => {
761
+ if (subDevice.productName.toLocaleLowerCase() == "ace 1500") {
762
+ const reportTopic2 = `/${subDevice.productKey}/${subDevice.deviceKey}/properties/report`;
763
+ const iotTopic2 = `iot/${subDevice.productKey}/${subDevice.deviceKey}/#`;
764
+ setTimeout(() => {
765
+ var _a;
766
+ if (adapter) {
767
+ adapter.log.debug(
768
+ `[connectMqttClient] Subscribing to MQTT Topic: ${reportTopic2}`
769
+ );
770
+ (_a = adapter.mqttClient) == null ? void 0 : _a.subscribe(
771
+ reportTopic2,
772
+ onSubscribeReportTopic
773
+ );
774
+ }
775
+ }, 1e3 * index);
776
+ setTimeout(() => {
777
+ var _a;
778
+ adapter == null ? void 0 : adapter.log.debug(
779
+ `[connectMqttClient] Subscribing to MQTT Topic: ${iotTopic2}`
780
+ );
781
+ (_a = adapter == null ? void 0 : adapter.mqttClient) == null ? void 0 : _a.subscribe(iotTopic2, (error) => {
782
+ onSubscribeIotTopic(
783
+ error,
784
+ subDevice.productKey,
785
+ subDevice.deviceKey
786
+ );
787
+ });
788
+ }, 1500 * index);
789
+ }
790
+ });
791
+ }
621
792
  }
622
793
  }
623
794
  );
@@ -635,10 +806,13 @@ const connectMqttClient = (_adapter) => {
635
806
  0 && (module.exports = {
636
807
  addOrUpdatePackData,
637
808
  connectMqttClient,
809
+ setAcSwitch,
638
810
  setAutoRecover,
639
811
  setBuzzerSwitch,
640
812
  setChargeLimit,
813
+ setDcSwitch,
641
814
  setDischargeLimit,
815
+ setInputLimit,
642
816
  setOutputLimit,
643
817
  setPassMode,
644
818
  triggerFullTelemetryUpdate