iobroker.ebus 3.6.2 → 3.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
@@ -76,6 +76,11 @@ in /opt/iobroker/node_modules/iobroker.ebus/lib/scripts you can find a scripts t
76
76
  Placeholder for the next version (at the beginning of the line):
77
77
  ### **WORK IN PROGRESS**
78
78
  -->
79
+ ### 3.6.3 (2025-06-27)
80
+ * (René) get version info for ebusd from github if locally not available
81
+ * (René) update dependencies
82
+ * (René) new testing
83
+
79
84
  ### 3.6.2 (2025-06-09)
80
85
  * (René) (Galileo53) #419 avoid Warning and error when history list is empty
81
86
 
package/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "ebus",
4
- "version": "3.6.2",
4
+ "version": "3.6.3",
5
5
  "news": {
6
+ "3.6.3": {
7
+ "en": "get version info for ebusd from github if locally not available\nupdate dependencies\nnew testing",
8
+ "de": "versionsinformationen für ebusd von github erhalten, wenn lokal nicht verfügbar\naktualisierung der abhängigkeiten\nneue tests",
9
+ "ru": "получить информацию о версии для вытеснения из github, если локально недоступно\nобновление зависимостей\nновые испытания",
10
+ "pt": "obter informações de versão para o ebusd do github se não estiver disponível localmente\natualizar dependências\nnovos testes",
11
+ "nl": "krijgen versie-informatie voor ebusd van github als lokaal niet beschikbaar\nafhankelijkheden bijwerken\nnieuwe tests",
12
+ "fr": "obtenir des informations de version pour ebusd de github si localement pas disponible\nmettre à jour les dépendances\nnouveaux essais",
13
+ "it": "ottenere informazioni sulla versione per ebusd da github se localmente non disponibile\naggiornamento dipendenze\nnuovi test",
14
+ "es": "obtener información de la versión para ebusd de github si localmente no disponible\ndependencias de actualización\nnuevas pruebas",
15
+ "pl": "uzyskać informacje o wersji dla ebusd z github, jeśli lokalnie nie jest dostępny\naktualizacji zależności\nnowe badania",
16
+ "uk": "отримати інформацію про версію для ebusd від github, якщо локально не доступний\nоновлення залежності\nновий тест",
17
+ "zh-cn": "如果本地不可用, 从 github 获取 ebusd 的版本信息\n更新依赖关系\n新测试"
18
+ },
6
19
  "3.6.2": {
7
20
  "en": "(Galileo53) #419 avoid Warning and error when history list is empty",
8
21
  "de": "(Galileo53) #419 vermeiden Warnung und Fehler bei leerer Geschichtsliste",
@@ -80,19 +93,6 @@
80
93
  "pl": "połowów wyjątków reportet przez wartownik\nopcja wyłączenia sprawdzania czasu ostatniej aktualizacji (patrz numer # 391)",
81
94
  "uk": "виняток винятку по відправці\nможливість відключити перевірку останнього часу оновлення (див. проблему #391)",
82
95
  "zh-cn": "按哨兵分列的渔获量例外报告\n选项以禁用上次更新时间的检查(见第391期)"
83
- },
84
- "3.4.0": {
85
- "en": "migration to jsonConfig\nsee issue #383: add optionally parameters to HTTP call",
86
- "de": "Migration nach jsonConfig\nsiehe Ausgabe #383: optionale Parameter zum HTTP-Aufruf hinzufügen",
87
- "ru": "миграции в jsonConfig\n#383: добавить дополнительные параметры к HTTP-звонку",
88
- "pt": "migração para jsonConfig\nveja o problema #383: adicione parâmetros opcionalmente à chamada HTTP",
89
- "nl": "migratie naar jsonConfig\nzie probleem #383: voeg optioneel parameters toe aan HTTP-aanroep",
90
- "fr": "migration vers jsonConfig\nvoir le numéro #383: ajouter optionnellement des paramètres à l'appel HTTP",
91
- "it": "migrazione a jsonConfig\nvedi numero #383: aggiungi parametri opzionalmente alla chiamata HTTP",
92
- "es": "migración a jsonConfig\nver número #383: añadir parámetros opcionalmente a la llamada HTTP",
93
- "pl": "migracja do jsonConfig\nzobacz numer # 383: dodać opcjonalne parametry do wywołania HTTP",
94
- "uk": "міграції в jsonConfig\nпереглянути номер #383: додавати додаткові параметри до HTTP виклику",
95
- "zh-cn": "迁移到 jsonConfig\n参见第383期: 在 HTTP 调用中添加可选参数"
96
96
  }
97
97
  },
98
98
  "titleLang": {
@@ -286,6 +286,26 @@
286
286
  "agree",
287
287
  "cancel"
288
288
  ]
289
+ },
290
+ {
291
+ "condition": {
292
+ "operand": "and",
293
+ "rules": [
294
+ "oldVersion<=3.6.2",
295
+ "newVersion>3.6.2"
296
+ ]
297
+ },
298
+ "title": {
299
+ "en": "data structure might be changed"
300
+ },
301
+ "text": {
302
+ "en": "Due to new used parser data structure might be changed. Please verify your settings."
303
+ },
304
+ "level": "warn",
305
+ "buttons": [
306
+ "agree",
307
+ "cancel"
308
+ ]
289
309
  }
290
310
  ]
291
311
  },
@@ -301,6 +321,7 @@
301
321
  "maxretries": 5,
302
322
  "readInterval": 5,
303
323
  "History4Vis2": false,
324
+ "DisableTimeUpdateCheck": false,
304
325
  "HTTPparameter": [
305
326
  {
306
327
  "active": false,
@@ -1,8 +1,10 @@
1
+ /* eslint-disable prefer-template */
1
2
  "use strict";
2
3
 
3
4
  const heatingcontrolDictionary = require("./vis_words.js").heatingcontrolDictionary;
4
5
 
5
6
  /**
7
+ * @param {object} adapter
6
8
  * @param {string} timeVal
7
9
  * @param {string} timeLimit
8
10
  */
@@ -23,22 +25,20 @@ function IsLater(adapter, timeVal, timeLimit) {
23
25
  ret = true;
24
26
  adapter.log.debug("yes, IsLater : " + timeVal + " " + timeLimit);
25
27
  }
26
- }
27
- else {
28
+ } else {
28
29
  adapter.log.error("string does not contain : " + timeVal + " " + timeLimit);
29
30
  }
30
- }
31
- else {
31
+ } else {
32
32
  adapter.log.error("not a string " + typeof timeVal + " " + typeof timeLimit);
33
33
  }
34
- }
35
- catch (e) {
34
+ } catch (e) {
36
35
  adapter.log.error("exception in IsLater [" + e + "]");
37
36
  }
38
37
  return ret;
39
38
  }
40
39
 
41
40
  /**
41
+ * @param {object} adapter
42
42
  * @param {string } timeVal
43
43
  * @param {string } [timeLimit]
44
44
  */
@@ -59,22 +59,20 @@ function IsEarlier(adapter, timeVal, timeLimit) {
59
59
  ret = true;
60
60
  adapter.log.debug("yes, IsEarlier : " + timeVal + " " + timeLimit);
61
61
  }
62
- }
63
- else {
62
+ } else {
64
63
  adapter.log.error("string does not contain : " + timeVal + " " + timeLimit);
65
64
  }
66
- }
67
- else {
65
+ } else {
68
66
  adapter.log.error("not a string " + typeof timeVal + " " + typeof timeLimit);
69
67
  }
70
- }
71
- catch (e) {
68
+ } catch (e) {
72
69
  adapter.log.error("exception in IsEarlier [" + e + "]");
73
70
  }
74
71
  return ret;
75
72
  }
76
73
 
77
74
  /**
75
+ * @param {object} adapter
78
76
  * @param {string} timeVal
79
77
  * @param {string} timeLimit
80
78
  */
@@ -94,16 +92,13 @@ function IsEqual(adapter, timeVal, timeLimit) {
94
92
  ret = true;
95
93
  adapter.log.debug("yes, IsEqual : " + timeVal + " " + timeLimit);
96
94
  }
97
- }
98
- else {
95
+ } else {
99
96
  adapter.log.error("string does not contain : " + timeVal + " " + timeLimit);
100
97
  }
101
- }
102
- else {
98
+ } else {
103
99
  adapter.log.error("not a string " + typeof timeVal + " " + typeof timeLimit);
104
100
  }
105
- }
106
- catch (e) {
101
+ } catch (e) {
107
102
  adapter.log.error("exception in IsEqual [" + e + "]");
108
103
  }
109
104
  return ret;
@@ -190,16 +185,14 @@ function timeConverter(SystemLanguage,time, timeonly = false) {
190
185
 
191
186
  if (time != null) {
192
187
  a = new Date(time);
193
- }
194
- else {
188
+ } else {
195
189
  a = new Date();
196
190
  }
197
191
  let months;
198
192
 
199
193
  if (SystemLanguage === "de") {
200
194
  months = ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"];
201
- }
202
- else {
195
+ } else {
203
196
  months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
204
197
  }
205
198
  const year = a.getFullYear();
@@ -216,8 +209,7 @@ function timeConverter(SystemLanguage,time, timeonly = false) {
216
209
  let sRet = "";
217
210
  if (timeonly) {
218
211
  sRet = hour + ":" + min + ":" + sec;
219
- }
220
- else {
212
+ } else {
221
213
  sRet = date + " " + month + " " + year + " " + hour + ":" + min + ":" + sec;
222
214
  }
223
215
 
@@ -231,25 +223,20 @@ function CheckValidTime(adapter, id, time) {
231
223
  if (time === "null" || typeof time === undefined) {
232
224
  adapter.log.error("time value not found for " + id);
233
225
 
234
- }
235
- else if (typeof time !== "string") {
226
+ } else if (typeof time !== "string") {
236
227
  adapter.log.error("time should be a string but is " + typeof time.val + " for " + id);
237
228
 
238
- }
239
- else if (time.length < 3) {
229
+ } else if (time.length < 3) {
240
230
  adapter.log.error("time not long enough for " + id);
241
231
 
242
- }
243
- else if (!time.includes(":")) {
232
+ } else if (!time.includes(":")) {
244
233
  adapter.log.error("time ':' missing for " + id);
245
- }
246
- else {
234
+ } else {
247
235
  const times = time.split(":");
248
236
  sRet = "0" + times[0].slice(-2) + ":" + "0" + times[1].slice(-2);
249
237
  }
250
238
 
251
- }
252
- catch (e) {
239
+ } catch (e) {
253
240
  adapter.log.error("exception in CheckValidTime [" + e + "] for " + id + " " + JSON.stringify(time));
254
241
 
255
242
  }
@@ -270,13 +257,11 @@ function Check4ValidTemperature(adapter, temperature) {
270
257
 
271
258
  adapter.log.debug("try to convert " + temperature + " to a number");
272
259
  return Number(temperature);
273
- }
274
- else {
260
+ } else {
275
261
  return temperature;
276
262
  }
277
263
 
278
- }
279
- catch (e) {
264
+ } catch (e) {
280
265
  adapter.log.error("exception in Check4ValidTemperature [" + e + "]");
281
266
  return 0;
282
267
  }
@@ -315,8 +300,7 @@ function IsSummerTime(adapter, sStartDate, sEndDate) {
315
300
  //end already past, increase end year
316
301
  EndDate.setFullYear(EndDate.getFullYear() + 1);
317
302
  adapter.log.debug("corrected End " + EndDate.toDateString());
318
- }
319
- else {
303
+ } else {
320
304
  //else decrease Start year
321
305
  StartDate.setFullYear(StartDate.getFullYear() - 1);
322
306
  adapter.log.debug("corrected Start " + StartDate.toDateString());
@@ -326,15 +310,13 @@ function IsSummerTime(adapter, sStartDate, sEndDate) {
326
310
  if (now >= StartDate && now <= EndDate) {
327
311
  adapter.log.debug("we are in period");
328
312
  ret = true;
329
- }
330
- else {
313
+ } else {
331
314
  adapter.log.debug("we are not in period, after start " + StartDate.toDateString() + " and before end " + EndDate.toDateString());
332
315
  ret = false;
333
316
  }
334
317
  }
335
318
  }
336
- }
337
- catch (e) {
319
+ } catch (e) {
338
320
  adapter.log.error("exception catch in IsSummerTime [" + e + "] ");
339
321
  }
340
322
  return ret;
package/lib/tools.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const axios = require('axios').default;
2
2
 
3
+ //Tests whether the given variable is a real object and not an Array
3
4
  /**
4
- * Tests whether the given variable is a real object and not an Array
5
5
  * @param {any} it The variable to test
6
6
  * @returns {it is Record<string, any>}
7
7
  */
@@ -13,18 +13,20 @@ function isObject(it) {
13
13
  return Object.prototype.toString.call(it) === '[object Object]';
14
14
  }
15
15
 
16
+ //Tests whether the given variable is really an Array
16
17
  /**
17
- * Tests whether the given variable is really an Array
18
18
  * @param {any} it The variable to test
19
19
  * @returns {it is any[]}
20
20
  */
21
21
  function isArray(it) {
22
- if (typeof Array.isArray === 'function') return Array.isArray(it);
22
+ if (typeof Array.isArray === 'function') {
23
+ return Array.isArray(it);
24
+ }
23
25
  return Object.prototype.toString.call(it) === '[object Array]';
24
26
  }
25
27
 
28
+ //Translates text to the target language.Automatically chooses the right translation API.
26
29
  /**
27
- * Translates text to the target language. Automatically chooses the right translation API.
28
30
  * @param {string} text The text to translate
29
31
  * @param {string} targetLang The target languate
30
32
  * @param {string} [yandexApiKey] The yandex API key. You can create one for free at https://translate.yandex.com/developers
@@ -43,8 +45,8 @@ async function translateText(text, targetLang, yandexApiKey) {
43
45
  }
44
46
  }
45
47
 
48
+ //Translates text with Yandex API
46
49
  /**
47
- * Translates text with Yandex API
48
50
  * @param {string} text The text to translate
49
51
  * @param {string} targetLang The target languate
50
52
  * @param {string} apiKey The yandex API key. You can create one for free at https://translate.yandex.com/developers
@@ -66,8 +68,8 @@ async function translateYandex(text, targetLang, apiKey) {
66
68
  }
67
69
  }
68
70
 
71
+ //Translates text with Google API
69
72
  /**
70
- * Translates text with Google API
71
73
  * @param {string} text The text to translate
72
74
  * @param {string} targetLang The target languate
73
75
  * @returns {Promise<string>}