iobroker.influxdb 3.1.4 → 3.1.7

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
@@ -450,6 +450,15 @@ sendTo('influxdb.0', 'getEnabledDPs', {}, function (result) {
450
450
  -->
451
451
 
452
452
  ## Changelog
453
+ ### 3.1.7 (2022-06-27)
454
+ * (Apollon77) Allow to remove a configuration value for "round" in config again
455
+
456
+ ### 3.1.6 (2022-06-27)
457
+ * (Apollon77) When not count is provided for aggregate "none" or "onchange" then the limit (default 2000) is used as count to define the number of data to return.
458
+
459
+ ### 3.1.5 (2022-06-12)
460
+ * (Apollon77) Make sure debug log is active according to the settings
461
+
453
462
  ### 3.1.4 (2022-06-08)
454
463
  * (Apollon77) Performance optimizations for GetHistory calls, especially for "minmax" aggregate method
455
464
  * (Apollon77) Prevent crash case reported by Sentry
@@ -303,7 +303,7 @@
303
303
  },
304
304
  "round": {
305
305
  "newLine": true,
306
- "type": "number",
306
+ "type": "text",
307
307
  "label": "Round real to",
308
308
  "sm": 12,
309
309
  "md": 4,
package/io-package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "pl": "Logowanie stanów do InfluxDB",
14
14
  "zh-cn": "将状态记录到InfluxDB中"
15
15
  },
16
- "version": "3.1.4",
16
+ "version": "3.1.7",
17
17
  "title": "Logging data with InfluxDB",
18
18
  "titleLang": {
19
19
  "en": "Logging data with InfluxDB",
@@ -28,6 +28,42 @@
28
28
  "zh-cn": "使用InfluxDB记录数据"
29
29
  },
30
30
  "news": {
31
+ "3.1.7": {
32
+ "en": "Allow to remove a configuration value for \"round\" in config again",
33
+ "de": "Lassen Sie einen Konfigurationswert für Runde in config wieder entfernen",
34
+ "ru": "Разрешить удалить конфигурационную ценность для раунда в config снова",
35
+ "pt": "Permitir remover um valor de configuração para round em config novamente",
36
+ "nl": "Sta toe om weer een configuratiewaarde te verwijderen voor ronde in het leger",
37
+ "fr": "Permettre de supprimer une valeur de configuration pour round in config à nouveau",
38
+ "it": "Permette di rimuovere un valore di configurazione per round in config di nuovo",
39
+ "es": "Permitir eliminar de nuevo un valor de configuración para redondear en configuración",
40
+ "pl": "Allow, aby usunąć wartość konfiguracyjna w zakręcie ponownie w konfigunie",
41
+ "zh-cn": "允许再次取消一轮谈判的组合价值"
42
+ },
43
+ "3.1.6": {
44
+ "en": "When not count is provided for aggregate \"none\" or \"onchange\" then the limit (default 2000) is used as count to define the number of data to return.",
45
+ "de": "Wenn für die Aggregate keine oder Onchange keine Zählung vorgesehen ist, wird die Grenze (Standard 2000) als Zählung verwendet, um die Anzahl der Daten zu definieren, um zurückzukehren.",
46
+ "ru": "Когда не считать предоставляется для агрегата ни один или онмен, то предел (по умолчанию 2000) используется как считать, чтобы определить количество данных для возврата.",
47
+ "pt": "Quando não a contagem é fornecida para agregar nenhum ou onchange, então o limite (padrão 2000) é usado como contagem para definir o número de dados para retornar.",
48
+ "nl": "Als de tel niet wordt toegewezen voor aggregate noch onchange, dan wordt de limiet 2000 gebruikt om het aantal data te definiëren om terug te keren.",
49
+ "fr": "Lorsqu'il n'y a pas de comptage pour l'agrégat ou le changement, la limite (par défaut 2000) est utilisée pour définir le nombre de données à retourner.",
50
+ "it": "Quando il conteggio non viene fornito per aggregato nessuno o cambio, il limite (default 2000) viene utilizzato come conteggio per definire il numero di dati da restituire.",
51
+ "es": "Cuando no se cuenta se proporciona para agregado ninguno o cambio entonces el límite (por defecto 2000) se utiliza como cuenta para definir el número de datos para regresar.",
52
+ "pl": "Jeśli nieliczanie jest dostarczane dla agregacji ani zmian, to limit (default 2000) jest używany jako określenie liczby danych do powrotu.",
53
+ "zh-cn": "当没有计算总额时,或当时的汇率(2000年)用来确定返回的数据数量。."
54
+ },
55
+ "3.1.5": {
56
+ "en": "Make sure debug log is active according to the settings",
57
+ "de": "Stellen Sie sicher, dass das Debug-Log gemäß den Einstellungen aktiv ist",
58
+ "ru": "Убедитесь, что журнал debug активен в соответствии с настройками",
59
+ "pt": "Certifique-se de que o log de depuração está ativo de acordo com as configurações",
60
+ "nl": "Zorg ervoor dat het logboek actief is volgens de instellingen",
61
+ "fr": "Assurez-vous que le journal debug est actif selon les paramètres",
62
+ "it": "Assicurarsi che il registro di debug sia attivo in base alle impostazioni",
63
+ "es": "Asegúrese de que el registro de depuración está activo según la configuración",
64
+ "pl": "Umożliwia to, że log debug jest aktywny zgodnie z ustawieniami",
65
+ "zh-cn": "B. 根据环境,确保有色色逻辑积极。"
66
+ },
31
67
  "3.1.4": {
32
68
  "en": "Performance optimizations for GetHistory calls, especially for \"minmax\" aggregate method\nPrevent crash case reported by Sentry",
33
69
  "de": "Leistungsoptimierungen für GetHistory-Anrufe, insbesondere für minmax-Aggregatmethode\nVerhindern Crashfall berichtet von Sentry",
@@ -75,42 +111,6 @@
75
111
  "es": "Los datos no se convierten en números si son otros tipos de datos en getHistory para respetar los formatos de datos guardados como se define en la configuración del punto de datos para el almacenamiento.\nArreglar el cambio de retención para bajar la casilla de verificación en la interfaz de usuario\nPermita que storeState vuelva a escribir en InfluxDB para \"identificadores de estado desconocidos\": el uso de \"reglas\" no es compatible con esto y storeState se descartaría silenciosamente en este caso.\nSolucione varios casos de bloqueo informados por Sentry\nAsegúrese de deshabilitar \"Registrar solo cambios\" y realmente no registre más los cambios\nPermitir que storeState y GetHistory también se llamen para \"identificadores desconocidos\"",
76
112
  "pl": "Dane nie są konwertowane na liczby, jeśli są to inne typy danych w getHistory, aby przestrzegać zapisanych formatów danych zdefiniowanych w ustawieniach punktu danych dla przechowywania.\nNapraw zmianę przechowywania w dolnym polu wyboru w interfejsie użytkownika\nZezwól storeState ponownie na zapis do InfluxDB dla \"nieznanych identyfikatorów stanu\" - użycie \"reguł\" nie jest w tym przypadku obsługiwane, a storeState zostanie w tym przypadku po cichu odrzucone!\nNapraw kilka przypadków awarii zgłoszonych przez Sentry\nUpewnij się, że wyłączenie opcji „Zapisuj tylko zmiany” również naprawdę nie powoduje już rejestrowania zmian\nZezwalaj na wywoływanie storeState i GetHistory również dla „nieznanych identyfikatorów”",
77
113
  "zh-cn": "如果数据是 getHistory 上的其他数据类型,则数据不会转换为数字,以尊重数据点设置中定义的已保存数据格式以进行存储。\n将保留更改修复为 UI 中的较低复选框\n再次允许 storeState 为“未知状态 id”写入 InfluxDB - 不支持使用“规则”,在这种情况下 storeState 将被静默丢弃!\n修复 Sentry 报告的几个崩溃案例\n确保禁用“仅记录更改”也确实不再记录更改\n还允许为“未知 ID”调用 storeState 和 GetHistory"
78
- },
79
- "3.0.2": {
80
- "en": "handle an empty Path for InfluxDB 2.0 correctly in all cases",
81
- "de": "Behandeln Sie einen leeren Pfad für InfluxDB 2.0 in allen Fällen korrekt",
82
- "ru": "правильно обрабатывать пустой путь для InfluxDB 2.0 во всех случаях",
83
- "pt": "manipular um caminho vazio para o InfluxDB 2.0 corretamente em todos os casos",
84
- "nl": "behandel een leeg pad voor InfluxDB 2.0 in alle gevallen correct",
85
- "fr": "gérer correctement un chemin vide pour InfluxDB 2.0 dans tous les cas",
86
- "it": "gestire correttamente un percorso vuoto per InfluxDB 2.0 in tutti i casi",
87
- "es": "manejar una ruta vacía para InfluxDB 2.0 correctamente en todos los casos",
88
- "pl": "we wszystkich przypadkach poprawnie obsłużyć pustą ścieżkę dla InfluxDB 2.0",
89
- "zh-cn": "在所有情况下正确处理 InfluxDB 2.0 的空路径"
90
- },
91
- "3.0.1": {
92
- "en": "BREAKING: Configuration is only working in the new Admin 5 UI!\nDid bigger adjustments to the recording logic and added a lot of new Features. Please refer to Changelog and Forum post for details.",
93
- "de": "BREAKING: Die Konfiguration funktioniert nur in der neuen Admin 5-Benutzeroberfläche!\nGrößere Anpassungen an der Aufnahmelogik vorgenommen und viele neue Features hinzugefügt. Einzelheiten finden Sie im Änderungsprotokoll und im Forumsbeitrag.",
94
- "ru": "НАРУШЕНИЕ: Конфигурация работает только в новом пользовательском интерфейсе Admin 5!\nВнесены большие коррективы в логику записи и добавлено много новых функций. Пожалуйста, обратитесь к журналу изменений и сообщению на форуме для получения подробной информации.",
95
- "pt": "URGENTE: a configuração está funcionando apenas na nova interface do usuário do Admin 5!\nFez ajustes maiores na lógica de gravação e adicionou muitos novos recursos. Consulte o Changelog e a postagem do fórum para obter detalhes.",
96
- "nl": "BREAKING: Configuratie werkt alleen in de nieuwe Admin 5 UI!\nHeeft grotere aanpassingen gedaan aan de opnamelogica en veel nieuwe functies toegevoegd. Raadpleeg de Changelog en Forumpost voor details.",
97
- "fr": "RUPTURE : La configuration ne fonctionne que dans la nouvelle interface utilisateur d'Admin 5 !\nA apporté de plus grands ajustements à la logique d'enregistrement et ajouté de nombreuses nouvelles fonctionnalités. Veuillez vous référer au changelog et au post du forum pour plus de détails.",
98
- "it": "ROTTURA: la configurazione funziona solo nella nuova interfaccia utente di Admin 5!\nHa apportato maggiori modifiche alla logica di registrazione e aggiunto molte nuove funzionalità. Si prega di fare riferimento a Changelog e post sul forum per i dettagli.",
99
- "es": "ÚLTIMA HORA: ¡La configuración solo funciona en la nueva interfaz de usuario de Admin 5!\nHizo ajustes más grandes a la lógica de grabación y agregó muchas características nuevas. Consulte el registro de cambios y la publicación del foro para obtener más detalles.",
100
- "pl": "ŁAMANIE: Konfiguracja działa tylko w nowym interfejsie użytkownika Admin 5!\nWprowadziłem większe poprawki w logice nagrywania i dodałem wiele nowych funkcji. Więcej informacji można znaleźć w dzienniku zmian i poście na forum.",
101
- "zh-cn": "突破:配置仅在新的 Admin 5 UI 中有效!\n对录制逻辑进行了更大的调整,并添加了许多新功能。有关详细信息,请参阅变更日志和论坛帖子。"
102
- },
103
- "2.6.3": {
104
- "en": "Fix potential crash cases (Sentry IOBROKER-INFLUXDB-4Q)",
105
- "de": "Mögliche Absturzfälle beheben (Sentry IOBROKER-INFLUXDB-4Q)",
106
- "ru": "Исправление возможных случаев сбоя (Sentry IOBROKER-INFLUXDB-4Q)",
107
- "pt": "Corrigir possíveis casos de travamento (Sentry IOBROKER-INFLUXDB-4Q)",
108
- "nl": "Mogelijke crashgevallen oplossen (Sentry IOBROKER-INFLUXDB-4Q)",
109
- "fr": "Correction des cas de plantage potentiels (Sentry IOBROKER-INFLUXDB-4Q)",
110
- "it": "Risolvi potenziali casi di crash (Sentry IOBROKER-INFLUXDB-4Q)",
111
- "es": "Solucionar posibles casos de bloqueo (Sentry IOBROKER-INFLUXDB-4Q)",
112
- "pl": "Napraw potencjalne przypadki awarii (Sentry IOBROKER-INFLUXDB-4Q)",
113
- "zh-cn": "修复潜在的崩溃案例 (Sentry IOBROKER-INFLUXDB-4Q)"
114
114
  }
115
115
  },
116
116
  "mode": "daemon",
package/lib/aggregate.js CHANGED
@@ -48,7 +48,12 @@ function initAggregate(options) {
48
48
 
49
49
  log(`${options.logId} Initialize: maxIndex = ${options.maxIndex}, step = ${options.step}, start = ${options.start}, end = ${options.end}`);
50
50
  // pre-fill the result with timestamps (add one before start and one after end)
51
- options.result.length = options.maxIndex + 2;
51
+ try {
52
+ options.result.length = options.maxIndex + 2;
53
+ } catch (err) {
54
+ err.message += `: ${options.maxIndex + 2}`;
55
+ throw err;
56
+ }
52
57
  // We define the array length but do not prefill values, we do that on runtime when needed
53
58
  options.result[0] = {
54
59
  val: {ts: null, val: null},
package/main.js CHANGED
@@ -1911,6 +1911,16 @@ function getHistory(adapter, msg) {
1911
1911
  logId: (msg.message.id ? msg.message.id : 'all') + Date.now() + Math.random()
1912
1912
  };
1913
1913
 
1914
+ adapter.log.debug(`${options.logId} getHistory message: ${JSON.stringify(msg.message)}`);
1915
+
1916
+ if (!options.count || isNaN(options.count)) {
1917
+ if (options.aggregate === 'none' || options.aggregate === 'onchange') {
1918
+ options.count = options.limit;
1919
+ } else {
1920
+ options.count = 500;
1921
+ }
1922
+ }
1923
+
1914
1924
  try {
1915
1925
  if (options.start && typeof options.start !== 'number') {
1916
1926
  options.start = new Date(options.start).getTime();
@@ -1949,8 +1959,6 @@ function getHistory(adapter, msg) {
1949
1959
  adapter._influxDPs[options.id] = adapter._influxDPs[options.id] || {};
1950
1960
  const debugLog = options.debugLog = !!(adapter._influxDPs[options.id] && adapter._influxDPs[options.id][adapter.namespace] && adapter._influxDPs[options.id][adapter.namespace].enableDebugLogs);
1951
1961
 
1952
- debugLog && adapter.log.debug(`${options.logId} getHistory (InfluxDB1) call: ${JSON.stringify(options)}`);
1953
-
1954
1962
  if (options.id && adapter._aliasMap[options.id]) {
1955
1963
  options.id = adapter._aliasMap[options.id];
1956
1964
  }
@@ -1980,6 +1988,8 @@ function getHistory(adapter, msg) {
1980
1988
  options.start = options.end - 86400000; // - 1 day
1981
1989
  }
1982
1990
 
1991
+ debugLog && adapter.log.debug(`${options.logId} getHistory (InfluxDB1) call: ${JSON.stringify(options)}`);
1992
+
1983
1993
  let resultsFromInfluxDB = options.aggregate !== 'onchange' && options.aggregate !== 'none' && options.aggregate !== 'minmax';
1984
1994
  if (options.aggregate === 'integral' && options.integralInterpolation === 'linear') {
1985
1995
  resultsFromInfluxDB = false;
@@ -2140,7 +2150,11 @@ function getHistory(adapter, msg) {
2140
2150
  result = result.sort(sortByTs);
2141
2151
  }
2142
2152
 
2143
- Aggregate.sendResponse(adapter, msg, options, (error ? error.toString() : null) || result, startTime);
2153
+ try {
2154
+ Aggregate.sendResponse(adapter, msg, options, (error ? error.toString() : null) || result, startTime);
2155
+ } catch (e) {
2156
+ Aggregate.sendResponse(adapter, msg, options, e.toString(), startTime);
2157
+ }
2144
2158
  });
2145
2159
  }, storedCount ? 50 : 0);
2146
2160
  });
@@ -2175,6 +2189,16 @@ function getHistoryIflx2(adapter, msg) {
2175
2189
  logId: (msg.message.id ? msg.message.id : 'all') + Date.now() + Math.random()
2176
2190
  };
2177
2191
 
2192
+ adapter.log.debug(`${options.logId} getHistory message: ${JSON.stringify(msg.message)}`);
2193
+
2194
+ if (!options.count || isNaN(options.count)) {
2195
+ if (options.aggregate === 'none' || options.aggregate === 'onchange') {
2196
+ options.count = options.limit;
2197
+ } else {
2198
+ options.count = 500;
2199
+ }
2200
+ }
2201
+
2178
2202
  try {
2179
2203
  if (options.start && typeof options.start !== 'number') {
2180
2204
  options.start = new Date(options.start).getTime();
@@ -2211,9 +2235,7 @@ function getHistoryIflx2(adapter, msg) {
2211
2235
  }
2212
2236
 
2213
2237
  adapter._influxDPs[options.id] = adapter._influxDPs[options.id] || {};
2214
- const debugLog = options.debugLog = !!(adapter._influxDPs[options.id] && adapter._influxDPs[options.id][adapter.namespace] && adapter._influxDPs[options.id][adapter.namespace].enableDebugLogs);
2215
-
2216
- debugLog && adapter.log.debug(`${options.logId} getHistory (InfluxDB2) call: ${JSON.stringify(options)}`);
2238
+ const debugLog = options.debugLog = !!((adapter._influxDPs[options.id] && adapter._influxDPs[options.id][adapter.namespace] && adapter._influxDPs[options.id][adapter.namespace].enableDebugLogs) || adapter.config.enableDebugLogs);
2217
2239
 
2218
2240
  if (options.id && adapter._aliasMap[options.id]) {
2219
2241
  options.id = adapter._aliasMap[options.id];
@@ -2244,6 +2266,8 @@ function getHistoryIflx2(adapter, msg) {
2244
2266
  options.start = options.end - 86400000; // - 1 day
2245
2267
  }
2246
2268
 
2269
+ debugLog && adapter.log.debug(`${options.logId} getHistory (InfluxDB2) options final: ${JSON.stringify(options)}`);
2270
+
2247
2271
  const resultsFromInfluxDB = options.aggregate !== 'onchange' && options.aggregate !== 'none' && options.aggregate !== 'minmax';
2248
2272
 
2249
2273
  // query one timegroup-value more than requested originally at start and end
@@ -2321,10 +2345,9 @@ function getHistoryIflx2(adapter, msg) {
2321
2345
  fluxQuery += ` |> range(${(options.start) ? `start: ${new Date(options.start).toISOString()}, ` : `start: ${new Date(options.end - (adapter.config.retention || 31536000) * 1000).toISOString()}, `}stop: ${new Date(options.end).toISOString()})`;
2322
2346
  fluxQuery += ` |> filter(fn: (r) => r["_measurement"] == "${options.id}")`;
2323
2347
 
2324
- if (adapter.config.usetags)
2325
- fluxQuery += ' |> duplicate(column: "_value", as: "value")';
2326
- else
2348
+ if (!adapter.config.usetags) {
2327
2349
  fluxQuery += ' |> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")';
2350
+ }
2328
2351
 
2329
2352
  if (resultsFromInfluxDB && supportsAggregates) {
2330
2353
  if ((options.step !== null) && (options.step > 0))
@@ -2386,6 +2409,10 @@ function getHistoryIflx2(adapter, msg) {
2386
2409
  }
2387
2410
  }
2388
2411
 
2412
+ if (adapter.config.usetags) {
2413
+ fluxQuery += ' |> duplicate(column: "_value", as: "value")';
2414
+ }
2415
+
2389
2416
  fluxQueries.push(fluxQuery);
2390
2417
 
2391
2418
  // select one datapoint more than wanted
@@ -2438,6 +2465,12 @@ function getHistoryIflx2(adapter, msg) {
2438
2465
  rows[qr][rr].val = rows[qr][rr].value;
2439
2466
  delete rows[qr][rr].value;
2440
2467
  }
2468
+ if (rows[qr][rr]._value !== undefined) {
2469
+ delete rows[qr][rr]._value;
2470
+ }
2471
+ if (rows[qr][rr]._field !== undefined) {
2472
+ delete rows[qr][rr]._field;
2473
+ }
2441
2474
 
2442
2475
  if (typeof rows[qr][rr].val === 'number' && options.round) {
2443
2476
  rows[qr][rr].val = Math.round(rows[qr][rr].val * options.round) / options.round;
@@ -2449,7 +2482,7 @@ function getHistoryIflx2(adapter, msg) {
2449
2482
  } else if (rows[qr][rr]._start && rows[qr][rr]._stop) {
2450
2483
  const startTime = new Date(rows[qr][rr]._start).getTime();
2451
2484
  const stopTime = new Date(rows[qr][rr]._stop).getTime();
2452
- rows[qr][rr].ts = startTime + (stopTime - startTime) / 2;
2485
+ rows[qr][rr].ts = Math.round(startTime + (stopTime - startTime) / 2);
2453
2486
  delete rows[qr][rr]._start;
2454
2487
  delete rows[qr][rr]._stop;
2455
2488
  }
@@ -2472,7 +2505,11 @@ function getHistoryIflx2(adapter, msg) {
2472
2505
  options.log = adapter.log.debug;
2473
2506
  }
2474
2507
 
2475
- Aggregate.sendResponse(adapter, msg, options, (error ? error.toString() : null) || result, startTime);
2508
+ try {
2509
+ Aggregate.sendResponse(adapter, msg, options, (error ? error.toString() : null) || result, startTime);
2510
+ } catch (e) {
2511
+ Aggregate.sendResponse(adapter, msg, options, e.toString(), startTime);
2512
+ }
2476
2513
  });
2477
2514
  });
2478
2515
  }, storedCount ? 50 : 0);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "iobroker.influxdb",
3
3
  "description": "Log states in InfluxDB",
4
- "version": "3.1.4",
4
+ "version": "3.1.7",
5
5
  "author": "bluefox <dogafox@gmail.com>",
6
6
  "contributors": [
7
7
  "bluefox <dogafox@gmail.com>",