iobroker.senec 1.6.2 → 1.6.4

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
@@ -366,6 +366,12 @@ This channel contains calculated values. Currently these are day/week/month/year
366
366
  *Read-only number, which designates the number of wallbox [0..3]. This is only available on systems with configured wallboxes.*
367
367
 
368
368
  ## Changelog
369
+ ### 1.6.4 (NoBl)
370
+ * Bugfix (numbers are numbers again)
371
+
372
+ ### 1.6.3 (NoBl)
373
+ * Code optimization
374
+
369
375
  ### 1.6.2 (NoBl)
370
376
  * Added statistics values from API along with some own calculations.
371
377
 
package/io-package.json CHANGED
@@ -1,8 +1,34 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "senec",
4
- "version": "1.6.2",
4
+ "version": "1.6.4",
5
5
  "news": {
6
+ "1.6.4": {
7
+ "en": "Numbers are numbers again",
8
+ "de": "Zahlen sind wieder Zahlen",
9
+ "ru": "Номера снова",
10
+ "pt": "Os números são números novamente",
11
+ "nl": "Nummers zijn weer getallen",
12
+ "fr": "Les nombres sont de nouveau des nombres",
13
+ "it": "I numeri sono di nuovo numeri",
14
+ "es": "Números son números de nuevo",
15
+ "pl": "Liczby są ponownie numerami",
16
+ "uk": "Кількість чисел знову",
17
+ "zh-cn": "数字再次编号"
18
+ },
19
+ "1.6.3": {
20
+ "en": "Bugfixes for API reading.",
21
+ "de": "Bugfixes im API Handling.",
22
+ "ru": "Bugfixes для чтения API.",
23
+ "pt": "Bugfixes para leitura de API.",
24
+ "nl": "Bugfixes voor API-lezing.",
25
+ "fr": "Bugfixes pour la lecture de l'API.",
26
+ "it": "Bugfixes per la lettura API.",
27
+ "es": "Bugfixes para la lectura de API.",
28
+ "pl": "Bugfixes for API reading (ang.).",
29
+ "uk": "Виправлення помилок для читання API.",
30
+ "zh-cn": "评 注."
31
+ },
6
32
  "1.6.2": {
7
33
  "en": "Added statistics values from API along with some own calculations.",
8
34
  "de": "Statistikwerte von API zusammen mit einigen eigenen Berechnungen hinzugefügt.",
package/main.js CHANGED
@@ -69,7 +69,7 @@ class Senec extends utils.Adapter {
69
69
  if (apiConnected) await this.getApiSystems();
70
70
  await this.pollSenec(true, 0); // highPrio
71
71
  await this.pollSenec(false, 0); // lowPrio
72
- await this.pollSenecAppApi(0); // App API
72
+ if (apiConnected) await this.pollSenecAppApi(0); // App API
73
73
  this.setState('info.connection', true, true);
74
74
  } catch (error) {
75
75
  this.log.error(error);
@@ -267,6 +267,7 @@ class Senec extends utils.Adapter {
267
267
  apiConnected = true;
268
268
  axios.defaults.headers.get['authorization'] = apiLoginToken;
269
269
  } catch (error) {
270
+ apiConnected = false;
270
271
  throw new Error("Error connecting to Senec AppAPI. Exiting! (" + error + ").");
271
272
  }
272
273
  }
@@ -390,6 +391,10 @@ class Senec extends utils.Adapter {
390
391
  * Read values from Senec App API
391
392
  */
392
393
  async pollSenecAppApi(retry) {
394
+ if (!this.config.api_use || !apiConnected) {
395
+ this.log.info('Usage of SENEC App API not configured or not connected.');
396
+ return;
397
+ }
393
398
  const interval = this.config.api_interval * 60000;
394
399
  const dates = new Map([
395
400
  ["THIS_DAY", new Date().toISOString().split('T')[0]],
@@ -449,9 +454,9 @@ class Senec extends utils.Adapter {
449
454
  this.doState(pfx + key, value, "", "", false);
450
455
  } else {
451
456
  for (const[key2, value2] of Object.entries(value)) {
452
- this.doState(pfx + key + "." + key2, (value2.wert).toFixed(2), "", value2.einheit, false);
457
+ this.doState(pfx + key + "." + key2, Number((value2.wert).toFixed(2)), "", value2.einheit, false);
453
458
  if (kiloList.includes(value2.einheit)) {
454
- this.doState(pfx + key + "." + key2 + " (k" + value2.einheit + ")", (value2.wert / 1000).toFixed(2), "", "k" + value2.einheit, false);
459
+ this.doState(pfx + key + "." + key2 + " (k" + value2.einheit + ")", Number((value2.wert / 1000).toFixed(2)), "", "k" + value2.einheit, false);
455
460
  }
456
461
  }
457
462
  }
@@ -466,13 +471,13 @@ class Senec extends utils.Adapter {
466
471
  if (key == "startzeitpunkt") {
467
472
  this.doState(pfx + key, value, "", "", false);
468
473
  } else {
469
- this.doState(pfx + key, (value.wert).toFixed(2), "", value.einheit, false);
474
+ this.doState(pfx + key, Number((value.wert).toFixed(2)), "", value.einheit, false);
470
475
  if (kiloList.includes(value.einheit)) {
471
- this.doState(pfx + key + " (k"+ value.einheit + ")", (value.wert / 1000).toFixed(2), "", "k" + value.einheit, false);
476
+ this.doState(pfx + key + " (k"+ value.einheit + ")", Number((value.wert / 1000).toFixed(2)), "", "k" + value.einheit, false);
472
477
  }
473
478
  }
474
479
  }
475
- const autarky = (((obj.aggregation.stromerzeugung.wert - obj.aggregation.netzeinspeisung.wert - obj.aggregation.speicherbeladung.wert + obj.aggregation.speicherentnahme.wert) / obj.aggregation.stromverbrauch.wert) * 100).toFixed(2);
480
+ const autarky = Number((((obj.aggregation.stromerzeugung.wert - obj.aggregation.netzeinspeisung.wert - obj.aggregation.speicherbeladung.wert + obj.aggregation.speicherentnahme.wert) / obj.aggregation.stromverbrauch.wert) * 100).toFixed(2));
476
481
  this.doState(pfx + "Autarkie", autarky, "", "%", false);
477
482
  }
478
483
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.senec",
3
- "version": "1.6.2",
3
+ "version": "1.6.4",
4
4
  "description": "Senec Home",
5
5
  "author": {
6
6
  "name": "NoBl",