homebridge-smartsystem 6.2.6 → 6.3.2

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 CHANGED
@@ -275,6 +275,10 @@ Homebridge UI version
275
275
  - 4: fixed empty name bug in unit-def / new accessory()
276
276
  - 5: fixed bad displayNames in published units
277
277
  - 6: power: 5% instead of 10% for power rules
278
+
279
+ ### v6.3.x - 23-09-2022 - Shelly PM release
280
+ - 1: first test 1 PM
281
+ - 2: logging now more according to debug true/false in the config file
278
282
 
279
283
 
280
284
  ## Hardware
package/config.json CHANGED
@@ -2,6 +2,7 @@
2
2
  "manufacturer": "Duotecno-Coppieterscc",
3
3
  "platform": "DuotecnoPlatform",
4
4
  "smappee": {
5
+ "debug": false,
5
6
  "rules": [
6
7
  {
7
8
  "type": "sun",
@@ -140,7 +141,6 @@
140
141
  ],
141
142
  "address": "192.168.0.186",
142
143
  "uid": "57e3e0d8-bb05-4b04-8662-1a9871998f3f",
143
- "debug": false,
144
144
  "bindings": [
145
145
  {
146
146
  "logicalNodeAddress": 252,
@@ -189,6 +189,7 @@
189
189
  ]
190
190
  },
191
191
  "p1": {
192
+ "debug": false,
192
193
  "rules": [
193
194
  {
194
195
  "type": "power",
@@ -247,9 +248,15 @@
247
248
  "power": null
248
249
  }
249
250
  ],
250
- "address": "192.168.0.214"
251
+ "address": "192.168.0.207"
252
+ },
253
+ "shelly": {
254
+ "debug": false,
255
+ "address": "192.168.0.95",
256
+ "addresses": "192.168.0.95,192.168.0.95",
257
+ "rules": [],
258
+ "bindings": []
251
259
  },
252
- "shelly": false,
253
260
  "smartapp": {
254
261
  "apiPort": 8581,
255
262
  "apiHost": "192.168.0.99",
@@ -373,184 +380,16 @@
373
380
  }
374
381
  ],
375
382
  "cunits": [
376
- {
377
- "logicalNodeAddress": 252,
378
- "logicalAddress": 102,
379
- "masterAddress": "192.168.0.97",
380
- "masterPort": 5001,
381
- "name": "unit 252:102",
382
- "displayName": "unit 252:102",
383
- "extendedType": 0,
384
- "active": "N",
385
- "used": "N",
386
- "group": 0
387
- },
388
- {
389
- "logicalNodeAddress": 252,
390
- "logicalAddress": 103,
391
- "masterAddress": "192.168.0.97",
392
- "masterPort": 5001,
393
- "name": "unit 252:103",
394
- "displayName": "unit 252:103",
395
- "extendedType": 0,
396
- "active": "N",
397
- "used": "N",
398
- "group": 0
399
- },
400
- {
401
- "logicalNodeAddress": 252,
402
- "logicalAddress": 100,
403
- "masterAddress": "192.168.0.97",
404
- "masterPort": 5001,
405
- "name": "unit 252:100",
406
- "displayName": "unit 252:100",
407
- "extendedType": 0,
408
- "active": "N",
409
- "used": "N",
410
- "group": 0
411
- },
412
- {
413
- "logicalNodeAddress": 252,
414
- "logicalAddress": 101,
415
- "masterAddress": "192.168.0.97",
416
- "masterPort": 5001,
417
- "name": "unit 252:101",
418
- "displayName": "unit 252:101",
419
- "extendedType": 0,
420
- "active": "N",
421
- "used": "N",
422
- "group": 0
423
- },
424
- {
425
- "logicalNodeAddress": 252,
426
- "logicalAddress": 105,
427
- "masterAddress": "192.168.0.97",
428
- "masterPort": 5001,
429
- "name": "unit 252:105",
430
- "displayName": "unit 252:105",
431
- "extendedType": 0,
432
- "active": "N",
433
- "used": "N",
434
- "group": 0
435
- },
436
- {
437
- "logicalNodeAddress": 252,
438
- "logicalAddress": 104,
439
- "masterAddress": "192.168.0.97",
440
- "masterPort": 5001,
441
- "name": "unit 252:104",
442
- "displayName": "unit 252:104",
443
- "extendedType": 0,
444
- "active": "N",
445
- "used": "N",
446
- "group": 0
447
- },
448
- {
449
- "logicalNodeAddress": 252,
450
- "logicalAddress": 106,
451
- "masterAddress": "192.168.0.97",
452
- "masterPort": 5001,
453
- "name": "unit 252:106",
454
- "displayName": "unit 252:106",
455
- "extendedType": 0,
456
- "active": "N",
457
- "used": "N",
458
- "group": 0
459
- },
460
- {
461
- "logicalNodeAddress": 3,
462
- "logicalAddress": 1,
463
- "masterAddress": "192.168.0.97",
464
- "masterPort": 5001,
465
- "name": "unit 3:1",
466
- "displayName": "unit 3:1",
467
- "extendedType": 0,
468
- "active": "N",
469
- "used": "N",
470
- "group": 0
471
- },
472
- {
473
- "logicalNodeAddress": 3,
474
- "logicalAddress": 0,
475
- "masterAddress": "192.168.0.97",
476
- "masterPort": 5001,
477
- "name": "unit 3:0",
478
- "displayName": "unit 3:0",
479
- "extendedType": 0,
480
- "active": "N",
481
- "used": "N",
482
- "group": 0
483
- },
484
383
  {
485
384
  "logicalNodeAddress": 3,
486
- "logicalAddress": 30,
487
- "masterAddress": "192.168.0.97",
488
- "masterPort": 5001,
489
- "name": "unit 3:30",
490
- "displayName": "unit 3:30",
491
- "extendedType": 0,
492
- "active": "N",
493
- "used": "N",
494
- "group": 0
495
- },
496
- {
497
- "logicalNodeAddress": 3,
498
- "logicalAddress": 29,
499
- "masterAddress": "192.168.0.97",
500
- "masterPort": 5001,
501
- "name": "unit 3:29",
502
- "displayName": "unit 3:29",
503
- "extendedType": 0,
504
- "active": "N",
505
- "used": "N",
506
- "group": 0
507
- },
508
- {
509
- "logicalNodeAddress": 3,
510
- "logicalAddress": 35,
511
- "masterAddress": "192.168.0.97",
512
- "masterPort": 5001,
513
- "name": "unit 3:35",
514
- "displayName": "unit 3:35",
515
- "extendedType": 0,
516
- "active": "N",
517
- "used": "N",
518
- "group": 0
519
- },
520
- {
521
- "logicalNodeAddress": 3,
522
- "logicalAddress": 34,
523
- "masterAddress": "192.168.0.97",
524
- "masterPort": 5001,
525
- "name": "unit 3:34",
526
- "displayName": "unit 3:34",
527
- "extendedType": 0,
528
- "active": "N",
529
- "used": "N",
530
- "group": 0
531
- },
532
- {
533
- "logicalNodeAddress": 3,
534
- "logicalAddress": 33,
535
- "masterAddress": "192.168.0.97",
536
- "masterPort": 5001,
537
- "name": "unit 3:33",
538
- "displayName": "unit 3:33",
539
- "extendedType": 0,
540
- "active": "N",
541
- "used": "N",
542
- "group": 0
543
- },
544
- {
545
- "logicalNodeAddress": 3,
546
- "logicalAddress": 36,
385
+ "logicalAddress": 4,
547
386
  "masterAddress": "192.168.0.97",
548
387
  "masterPort": 5001,
549
- "name": "unit 3:36",
550
- "displayName": "unit 3:36",
551
- "extendedType": 0,
552
- "active": "N",
553
- "used": "N",
388
+ "name": "All off",
389
+ "displayName": "Alles uitje",
390
+ "extendedType": 7,
391
+ "active": "Y",
392
+ "used": "Y",
554
393
  "group": 0
555
394
  },
556
395
  {
@@ -558,23 +397,11 @@
558
397
  "logicalAddress": 5,
559
398
  "masterAddress": "192.168.0.97",
560
399
  "masterPort": 5001,
561
- "name": "unit 3:5",
562
- "displayName": "unit 3:5",
563
- "extendedType": 0,
564
- "active": "N",
565
- "used": "N",
566
- "group": 0
567
- },
568
- {
569
- "logicalNodeAddress": 3,
570
- "logicalAddress": 4,
571
- "masterAddress": "192.168.0.97",
572
- "masterPort": 5001,
573
- "name": "unit 3:4",
574
- "displayName": "unit 3:4",
575
- "extendedType": 0,
576
- "active": "N",
577
- "used": "N",
400
+ "name": "All on",
401
+ "displayName": "Alles aantje",
402
+ "extendedType": 7,
403
+ "active": "Y",
404
+ "used": "Y",
578
405
  "group": 0
579
406
  }
580
407
  ]
@@ -18,6 +18,7 @@ exports.logSettings = {
18
18
  "protocol": LogLevel.noLog,
19
19
  "webapp": LogLevel.log,
20
20
  "p1": LogLevel.log,
21
+ "shelly": LogLevel.log,
21
22
  "power": LogLevel.log,
22
23
  "smartapp": LogLevel.log
23
24
  };
@@ -13,6 +13,7 @@ export const logSettings = {
13
13
  "protocol": LogLevel.noLog,
14
14
  "webapp": LogLevel.log,
15
15
  "p1": LogLevel.log,
16
+ "shelly": LogLevel.log,
16
17
  "power": LogLevel.log,
17
18
  "smartapp": LogLevel.log
18
19
  };
@@ -466,6 +466,7 @@ class Master extends base_1.Base {
466
466
  receiveUnitInfo(message) {
467
467
  const unitInfo = protocol_1.Protocol.makeUnitInfo(message);
468
468
  let unit = this.findUnit(unitInfo.logicalNodeAddress, unitInfo.logicalAddress);
469
+ this.info("> received unit info: " + unitInfo.name + " (" + unitInfo.logicalNodeAddress + "," + unitInfo.logicalAddress + ") for unit: " + (unit === null || unit === void 0 ? void 0 : unit.name));
469
470
  if (!unit) {
470
471
  // find if in config
471
472
  const cunit = this.system.config.cunits.find(u => ((u.logicalNodeAddress == unitInfo.logicalNodeAddress) && (u.logicalAddress == unitInfo.logicalAddress)));
@@ -473,7 +474,6 @@ class Master extends base_1.Base {
473
474
  unitInfo.extendedType = cunit.extendedType;
474
475
  const node = this.findNode(unitInfo.logicalNodeAddress);
475
476
  if (node) {
476
- this.info("> received unit info: " + unitInfo.name + " (" + unitInfo.logicalNodeAddress + "," + unitInfo.logicalAddress + ")");
477
477
  unit = new protocol_1.Unit(node, unitInfo, this.system.config.mood);
478
478
  node.units.push(unit);
479
479
  }
@@ -520,6 +520,8 @@ export class Master extends Base {
520
520
 
521
521
  let unit = this.findUnit(unitInfo.logicalNodeAddress, unitInfo.logicalAddress);
522
522
 
523
+ this.info("> received unit info: " + unitInfo.name + " ("+unitInfo.logicalNodeAddress+","+unitInfo.logicalAddress+") for unit: " + unit?.name);
524
+
523
525
  if (!unit) {
524
526
  // find if in config
525
527
  const cunit = this.system.config.cunits.find(u => ((u.logicalNodeAddress == unitInfo.logicalNodeAddress) && (u.logicalAddress == unitInfo.logicalAddress)));
@@ -527,7 +529,6 @@ export class Master extends Base {
527
529
 
528
530
  const node = this.findNode(unitInfo.logicalNodeAddress);
529
531
  if (node) {
530
- this.info("> received unit info: " + unitInfo.name + " ("+unitInfo.logicalNodeAddress+","+unitInfo.logicalAddress+")");
531
532
  unit = new Unit(node, unitInfo, this.system.config.mood);
532
533
  node.units.push(unit);
533
534
  } else {
@@ -159,28 +159,33 @@ class System extends base_1.Base {
159
159
  this.writeConfig();
160
160
  }
161
161
  setActiveState(item) {
162
+ // for nodes
162
163
  if (item instanceof protocol_1.Node) {
163
164
  const masterAddress = item.master.getAddress();
164
165
  const masterPort = item.master.getPort();
166
+ // check if at least 1 unit is used
165
167
  const unitConfig = this.config.cunits.find((cu) => (cu.logicalNodeAddress === item.logicalAddress) &&
166
168
  (cu.masterAddress === masterAddress) &&
167
169
  (cu.masterPort == masterPort));
168
- // there exists an active unit of this node
170
+ // if there is: set active to true of this node
169
171
  item.active = !!unitConfig;
170
172
  }
173
+ // for units
171
174
  if (item instanceof protocol_1.Unit) {
172
175
  const masterAddress = item.node.master.getAddress();
173
176
  const masterPort = item.node.master.getPort();
177
+ // see if there is a config record for this unit
174
178
  const unitConfig = this.config.cunits.find((cu) => (cu.logicalAddress === item.logicalAddress) &&
175
179
  (cu.logicalNodeAddress === item.logicalNodeAddress) &&
176
180
  (cu.masterAddress === masterAddress) &&
177
181
  (cu.masterPort == masterPort));
178
- ;
182
+ // if there is: copy active, used, displayName and group
179
183
  if (unitConfig) {
180
184
  item.active = (unitConfig.active === "Y");
181
185
  item.used = (unitConfig.used === "Y");
182
186
  item.displayName = unitConfig.displayName || unitConfig.name;
183
187
  item.group = unitConfig.group;
188
+ (0, logger_1.log)("system", "System.setActiveState(unit) -> config name: " + unitConfig.name + ", item name: " + item.name);
184
189
  }
185
190
  else {
186
191
  item.active = false;
@@ -166,31 +166,40 @@ export class System extends Base {
166
166
  }
167
167
 
168
168
  setActiveState(item: Node | Unit) {
169
+ // for nodes
169
170
  if (item instanceof Node) {
170
171
  const masterAddress = item.master.getAddress();
171
172
  const masterPort = item.master.getPort();
173
+
174
+ // check if at least 1 unit is used
172
175
  const unitConfig = this.config.cunits.find((cu: UnitConfig) =>
173
176
  (cu.logicalNodeAddress === item.logicalAddress) &&
174
177
  (cu.masterAddress === masterAddress) &&
175
178
  (cu.masterPort == masterPort));
176
179
 
177
- // there exists an active unit of this node
180
+ // if there is: set active to true of this node
178
181
  item.active = !! unitConfig;
179
182
  }
183
+
184
+ // for units
180
185
  if (item instanceof Unit) {
181
186
  const masterAddress = item.node.master.getAddress();
182
187
  const masterPort = item.node.master.getPort();
188
+
189
+ // see if there is a config record for this unit
183
190
  const unitConfig = this.config.cunits.find((cu: UnitConfig) =>
184
191
  (cu.logicalAddress === item.logicalAddress) &&
185
192
  (cu.logicalNodeAddress === item.logicalNodeAddress) &&
186
193
  (cu.masterAddress === masterAddress) &&
187
194
  (cu.masterPort == masterPort));
188
- ;
195
+
196
+ // if there is: copy active, used, displayName and group
189
197
  if (unitConfig) {
190
198
  item.active = (unitConfig.active === "Y");
191
199
  item.used = (unitConfig.used === "Y");
192
200
  item.displayName = unitConfig.displayName || unitConfig.name;
193
201
  item.group = unitConfig.group;
202
+ log("system", "System.setActiveState(unit) -> config name: " + unitConfig.name + ", item name: " + item.name);
194
203
  } else {
195
204
  item.active = false;
196
205
  }
package/duotecno/types.js CHANGED
@@ -254,6 +254,7 @@ exports.Sanitizers = {
254
254
  powerbase: function (config) {
255
255
  if (!config)
256
256
  config = {};
257
+ config.debug = config.debug || false;
257
258
  config.rules = config.rules || [];
258
259
  config.rules = config.rules.map(sw => exports.Sanitizers.ruleConfig(sw));
259
260
  config.bindings = config.bindings || [];
@@ -269,12 +270,17 @@ exports.Sanitizers = {
269
270
  return cfg;
270
271
  },
271
272
  p1: function (config) {
272
- config = exports.Sanitizers.powerbase(config);
273
- return config;
273
+ if (!config)
274
+ config = {};
275
+ const cfg = exports.Sanitizers.powerbase(config);
276
+ return cfg;
274
277
  },
275
278
  shelly: function (config) {
276
- config = exports.Sanitizers.powerbase(config);
277
- return config;
279
+ if (!config)
280
+ config = {};
281
+ const cfg = exports.Sanitizers.powerbase(config);
282
+ cfg.addresses = (config === null || config === void 0 ? void 0 : config.addresses) || "";
283
+ return cfg;
278
284
  },
279
285
  switchConfig: function (aSwitch) {
280
286
  const sw = exports.Sanitizers.unitDef(aSwitch);
@@ -324,6 +330,9 @@ exports.Sanitizers = {
324
330
  b.power = binding.power || NaN;
325
331
  return b;
326
332
  },
333
+ //////////////
334
+ // Duotecno //
335
+ //////////////
327
336
  masterConfig: function (config) {
328
337
  config = (config) ? Object.assign({}, config) : {};
329
338
  config.name = config.name || "IP Master";
package/duotecno/types.ts CHANGED
@@ -259,6 +259,13 @@ export interface SmartAppConfig extends BaseConfig {
259
259
  switches: Array<Switch>;
260
260
  }
261
261
 
262
+ /////////////////////
263
+ // Smartapp config //
264
+ /////////////////////
265
+ export interface BaseConfig {
266
+ debug?: boolean;
267
+ }
268
+
262
269
  ///////////
263
270
  // Power //
264
271
  ///////////
@@ -273,6 +280,7 @@ export interface SmappeeConfig extends PowerBaseConfig {
273
280
  export interface P1Config extends PowerBaseConfig {
274
281
  }
275
282
  export interface ShellyConfig extends PowerBaseConfig {
283
+ addresses: string;
276
284
  }
277
285
 
278
286
  ////////////////
@@ -291,9 +299,7 @@ export interface Bridge {
291
299
  pin: string // "577-02-003"
292
300
  };
293
301
 
294
- export interface BaseConfig {
295
- debug?: boolean;
296
- }
302
+
297
303
  export interface PlatformConfig extends BaseConfig {
298
304
  manufacturer: string;
299
305
  platform: string;
@@ -428,6 +434,7 @@ export const Sanitizers = {
428
434
 
429
435
  powerbase: function(config: PowerBaseConfig): PowerBaseConfig {
430
436
  if (!config) config = <PowerBaseConfig>{};
437
+ config.debug = config.debug || false;
431
438
 
432
439
  config.rules = config.rules || [];
433
440
  config.rules = config.rules.map(sw => Sanitizers.ruleConfig(sw));
@@ -441,21 +448,23 @@ export const Sanitizers = {
441
448
 
442
449
  smappee: function(config: SmappeeConfig): SmappeeConfig {
443
450
  if (!config) config = <SmappeeConfig>{};
444
-
445
451
  const cfg = <SmappeeConfig> Sanitizers.powerbase(config);
446
452
 
447
453
  cfg.uid = config.uid || "--none--";
448
454
  return cfg;
449
455
  },
450
456
  p1: function(config: P1Config): P1Config {
451
- config = Sanitizers.powerbase(config);
457
+ if (!config) config = <P1Config>{};
458
+ const cfg = Sanitizers.powerbase(config);
452
459
 
453
- return config;
460
+ return cfg;
454
461
  },
455
462
  shelly: function(config: ShellyConfig): ShellyConfig {
456
- config = Sanitizers.powerbase(config);
457
-
458
- return config;
463
+ if (!config) config = <ShellyConfig>{};
464
+ const cfg = <ShellyConfig> Sanitizers.powerbase(config);
465
+
466
+ cfg.addresses = config?.addresses || "";
467
+ return cfg;
459
468
  },
460
469
 
461
470
  switchConfig: function(aSwitch): Switch {
@@ -510,6 +519,9 @@ export const Sanitizers = {
510
519
  return b;
511
520
  },
512
521
 
522
+ //////////////
523
+ // Duotecno //
524
+ //////////////
513
525
  masterConfig: function(config?: MasterConfig): MasterConfig {
514
526
  config = (config) ? {...config} : <MasterConfig>{};
515
527
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "homebridge-smartsystem",
3
3
  "displayname": "Duotecno Bridge",
4
- "version": "6.2.6",
4
+ "version": "6.3.2",
5
5
  "description": "SmartServer (Proxy Websockets to TCP sockets, Smappee MQTT, Duotecno IP Nodes, Homekit interface)",
6
6
  "main": "index.js",
7
7
  "author": "Johan Coppieters",
package/server/base.js CHANGED
@@ -14,7 +14,9 @@ class Base {
14
14
  else
15
15
  this.readConfig();
16
16
  if (this.debug)
17
- logger_1.logSettings["system"] = logger_1.LogLevel.debug;
17
+ logger_1.logSettings[this.type] = logger_1.LogLevel.debug;
18
+ else if (logger_1.logSettings[this.type] == logger_1.LogLevel.debug)
19
+ logger_1.logSettings[this.type] = logger_1.LogLevel.log;
18
20
  (0, logger_1.debug)("system", "==== read config -> " + JSON.stringify(this.config));
19
21
  }
20
22
  //////////////////
package/server/base.ts CHANGED
@@ -21,7 +21,9 @@ export class Base {
21
21
  this.readConfig();
22
22
 
23
23
  if (this.debug)
24
- logSettings["system"] = LogLevel.debug;
24
+ logSettings[this.type] = LogLevel.debug;
25
+ else if (logSettings[this.type] == LogLevel.debug)
26
+ logSettings[this.type] = LogLevel.log;
25
27
 
26
28
  debug("system", "==== read config -> " + JSON.stringify(this.config))
27
29
  }
package/server/p1.js CHANGED
@@ -92,48 +92,48 @@ class P1 extends powerbase_1.PowerBase {
92
92
  });
93
93
  }
94
94
  consume(data) {
95
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
95
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
96
96
  if (!data['32.7.0'])
97
97
  return;
98
- this.voltages = [(_a = data['32.7.0']) === null || _a === void 0 ? void 0 : _a.value, (_b = data['52.7.0']) === null || _b === void 0 ? void 0 : _b.value, (_c = data['72.7.0']) === null || _c === void 0 ? void 0 : _c.value];
99
- this.realtime = { totalPower: ((_d = data['1.7.0']) === null || _d === void 0 ? void 0 : _d.value) * 1000,
100
- totalReactivePower: ((_e = data['2.7.0']) === null || _e === void 0 ? void 0 : _e.value) * 1000,
101
- totalExportEnergy: ((_f = data['2.8.1']) === null || _f === void 0 ? void 0 : _f.value) + ((_g = data['2.8.2']) === null || _g === void 0 ? void 0 : _g.value),
102
- totalImportEnergy: ((_h = data['1.8.1']) === null || _h === void 0 ? void 0 : _h.value) + ((_j = data['1.8.2']) === null || _j === void 0 ? void 0 : _j.value),
103
- monitorStatus: 0, utcTimeStamp: new Date().getTime() };
104
98
  this.channels = {
105
99
  0: {
106
- name: "Zonnepanelen L1", type: "CT", flow: "PRODUCTION",
107
- power: ((_k = data['22.7.0']) === null || _k === void 0 ? void 0 : _k.value) * 1000, exportEnergy: 0, importEnergy: 0, phaseId: 0,
100
+ name: "Zonnepanelen L1", type: "CT", flow: "PRODUCTION", voltage: (_a = data['32.7.0']) === null || _a === void 0 ? void 0 : _a.value,
101
+ power: ((_b = data['22.7.0']) === null || _b === void 0 ? void 0 : _b.value) * 1000, exportEnergy: 0, importEnergy: 0, phaseId: 0,
108
102
  current: 0, apparentPower: 0, cosPhi: 0, formula: ""
109
103
  },
110
104
  1: {
111
- name: "Zonnepanelen L2", type: "CT", flow: "PRODUCTION",
112
- power: ((_l = data['42.7.0']) === null || _l === void 0 ? void 0 : _l.value) * 1000, exportEnergy: 0, importEnergy: 0, phaseId: 1,
105
+ name: "Zonnepanelen L2", type: "CT", flow: "PRODUCTION", voltage: (_c = data['52.7.0']) === null || _c === void 0 ? void 0 : _c.value,
106
+ power: ((_d = data['42.7.0']) === null || _d === void 0 ? void 0 : _d.value) * 1000, exportEnergy: 0, importEnergy: 0, phaseId: 1,
113
107
  current: 0, apparentPower: 0, cosPhi: 0, formula: ""
114
108
  },
115
109
  2: {
116
- name: "Zonnepanelen L3", type: "CT", flow: "PRODUCTION",
117
- power: ((_m = data['62.7.0']) === null || _m === void 0 ? void 0 : _m.value) * 1000, exportEnergy: 0, importEnergy: 0, phaseId: 2,
110
+ name: "Zonnepanelen L3", type: "CT", flow: "PRODUCTION", voltage: (_e = data['72.7.0']) === null || _e === void 0 ? void 0 : _e.value,
111
+ power: ((_f = data['62.7.0']) === null || _f === void 0 ? void 0 : _f.value) * 1000, exportEnergy: 0, importEnergy: 0, phaseId: 2,
118
112
  current: 0, apparentPower: 0, cosPhi: 0, formula: ""
119
113
  },
120
114
  3: {
121
- name: "Grid L1", type: "CT", flow: "CONSUMPTION",
122
- power: ((_o = data['21.7.0']) === null || _o === void 0 ? void 0 : _o.value) * 1000, exportEnergy: 0, importEnergy: 0, phaseId: 0,
123
- current: (_p = data['31.7.0']) === null || _p === void 0 ? void 0 : _p.value, apparentPower: 0, cosPhi: 0, formula: ""
115
+ name: "Grid L1", type: "CT", flow: "CONSUMPTION", voltage: (_g = data['32.7.0']) === null || _g === void 0 ? void 0 : _g.value,
116
+ power: ((_h = data['21.7.0']) === null || _h === void 0 ? void 0 : _h.value) * 1000, exportEnergy: 0, importEnergy: 0, phaseId: 0,
117
+ current: (_j = data['31.7.0']) === null || _j === void 0 ? void 0 : _j.value, apparentPower: 0, cosPhi: 0, formula: ""
124
118
  },
125
119
  4: {
126
- name: "Grid L2", type: "CT", flow: "CONSUMPTION",
127
- power: ((_q = data['41.7.0']) === null || _q === void 0 ? void 0 : _q.value) * 1000, exportEnergy: 0, importEnergy: 0, phaseId: 1,
128
- current: (_r = data['51.7.0']) === null || _r === void 0 ? void 0 : _r.value, apparentPower: 0, cosPhi: 0, formula: ""
120
+ name: "Grid L2", type: "CT", flow: "CONSUMPTION", voltage: (_k = data['52.7.0']) === null || _k === void 0 ? void 0 : _k.value,
121
+ power: ((_l = data['41.7.0']) === null || _l === void 0 ? void 0 : _l.value) * 1000, exportEnergy: 0, importEnergy: 0, phaseId: 1,
122
+ current: (_m = data['51.7.0']) === null || _m === void 0 ? void 0 : _m.value, apparentPower: 0, cosPhi: 0, formula: ""
129
123
  },
130
124
  5: {
131
- name: "Grid L3", type: "CT", flow: "CONSUMPTION",
132
- power: ((_s = data['61.7.0']) === null || _s === void 0 ? void 0 : _s.value) * 1000, exportEnergy: 0, importEnergy: 0, phaseId: 2,
133
- current: (_t = data['71.7.0']) === null || _t === void 0 ? void 0 : _t.value, apparentPower: 0, cosPhi: 0, formula: ""
125
+ name: "Grid L3", type: "CT", flow: "CONSUMPTION", voltage: (_o = data['72.7.0']) === null || _o === void 0 ? void 0 : _o.value,
126
+ power: ((_p = data['61.7.0']) === null || _p === void 0 ? void 0 : _p.value) * 1000, exportEnergy: 0, importEnergy: 0, phaseId: 2,
127
+ current: (_q = data['71.7.0']) === null || _q === void 0 ? void 0 : _q.value, apparentPower: 0, cosPhi: 0, formula: ""
134
128
  }
135
129
  };
136
130
  // console.log(data);
131
+ this.voltages = [(_r = data['32.7.0']) === null || _r === void 0 ? void 0 : _r.value, (_s = data['52.7.0']) === null || _s === void 0 ? void 0 : _s.value, (_t = data['72.7.0']) === null || _t === void 0 ? void 0 : _t.value];
132
+ this.realtime = { totalPower: ((_u = data['1.7.0']) === null || _u === void 0 ? void 0 : _u.value) * 1000,
133
+ totalReactivePower: ((_v = data['2.7.0']) === null || _v === void 0 ? void 0 : _v.value) * 1000,
134
+ totalExportEnergy: ((_w = data['2.8.1']) === null || _w === void 0 ? void 0 : _w.value) + ((_x = data['2.8.2']) === null || _x === void 0 ? void 0 : _x.value),
135
+ totalImportEnergy: ((_y = data['1.8.1']) === null || _y === void 0 ? void 0 : _y.value) + ((_z = data['1.8.2']) === null || _z === void 0 ? void 0 : _z.value),
136
+ monitorStatus: 0, utcTimeStamp: new Date().getTime() };
137
137
  this.production = this.realtime.totalPower;
138
138
  this.consumption = this.realtime.totalReactivePower;
139
139
  }