iobroker.senec 1.6.2 → 1.6.3

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,9 @@ 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.3 (NoBl)
370
+ * Code optimization
371
+
369
372
  ### 1.6.2 (NoBl)
370
373
  * Added statistics values from API along with some own calculations.
371
374
 
package/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "senec",
4
- "version": "1.6.2",
4
+ "version": "1.6.3",
5
5
  "news": {
6
+ "1.6.3": {
7
+ "en": "Bugfixes for API reading.",
8
+ "de": "Bugfixes im API Handling.",
9
+ "ru": "Bugfixes для чтения API.",
10
+ "pt": "Bugfixes para leitura de API.",
11
+ "nl": "Bugfixes voor API-lezing.",
12
+ "fr": "Bugfixes pour la lecture de l'API.",
13
+ "it": "Bugfixes per la lettura API.",
14
+ "es": "Bugfixes para la lectura de API.",
15
+ "pl": "Bugfixes for API reading (ang.).",
16
+ "uk": "Виправлення помилок для читання API.",
17
+ "zh-cn": "评 注."
18
+ },
6
19
  "1.6.2": {
7
20
  "en": "Added statistics values from API along with some own calculations.",
8
21
  "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]],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.senec",
3
- "version": "1.6.2",
3
+ "version": "1.6.3",
4
4
  "description": "Senec Home",
5
5
  "author": {
6
6
  "name": "NoBl",