iobroker.influxdb 3.1.8 → 3.2.0

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
@@ -452,6 +452,9 @@ sendTo('influxdb.0', 'getEnabledDPs', {}, function (result) {
452
452
  -->
453
453
 
454
454
  ## Changelog
455
+ ### 3.2.0 (2022-09-19)
456
+ * (Apollon77) Adjust cache file to be different per instance when having multiple instances
457
+
455
458
  ### 3.1.8 (2022-08-13)
456
459
  * (Apollon77) Fix crash cases reported by Sentry
457
460
 
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.8",
16
+ "version": "3.2.0",
17
17
  "title": "Logging data with InfluxDB",
18
18
  "titleLang": {
19
19
  "en": "Logging data with InfluxDB",
@@ -28,6 +28,18 @@
28
28
  "zh-cn": "使用InfluxDB记录数据"
29
29
  },
30
30
  "news": {
31
+ "3.2.0": {
32
+ "en": "Adjust cache file to be different per instance when having multiple instances",
33
+ "de": "Bestimmen Sie die Cache-Datei, um unterschiedlich zu sein pro Instanz, wenn mehrere Instanzen haben",
34
+ "ru": "Отрегулируйте файл кэша для того чтобы быть различным в случае если иметь несколько экземпляров",
35
+ "pt": "Ajuste o arquivo de cache para ser diferente por instância quando tiver várias instâncias",
36
+ "nl": "Geef cachedo aan om anders te zijn als je meerdere instanties hebt",
37
+ "fr": "Ajuster le fichier cache pour être différent par instance lorsqu'il existe plusieurs instances",
38
+ "it": "Regolare il file della cache per essere diverso per istanza quando hanno più istanze",
39
+ "es": "Ajuste el archivo de caché para ser diferente por ejemplo al tener múltiples instancias",
40
+ "pl": "Plik Adjust cache może być różny na przykład, gdy posiada wiele instancji",
41
+ "zh-cn": "当发生多种情况时,独立的理由档案各不相同。"
42
+ },
31
43
  "3.1.8": {
32
44
  "en": "Fix crash cases reported by Sentry",
33
45
  "de": "Reparieren Crashfälle gemeldet von Sentry",
@@ -99,18 +111,6 @@
99
111
  "es": "Problema corregido al probar la conexión a InfluxDBv1 con contraseñas extrañas",
100
112
  "pl": "Naprawiono problem podczas testowania połączenia z InfluxDBv1 za pomocą dziwnych haseł",
101
113
  "zh-cn": "更正了使用奇怪密码测试与 InfluxDBv1 的连接时出现的问题"
102
- },
103
- "3.1.2": {
104
- "en": "Workaround an admin issue when testing connection to InfluxDB",
105
- "de": "Umgehung eines Administratorproblems beim Testen der Verbindung zu InfluxDB",
106
- "ru": "Обход проблемы администратора при тестировании подключения к InfluxDB",
107
- "pt": "Solução alternativa de um problema de administrador ao testar a conexão com o InfluxDB",
108
- "nl": "Tijdelijke oplossing voor een beheerdersprobleem bij het testen van de verbinding met InfluxDB",
109
- "fr": "Contournement d'un problème d'administration lors du test de connexion à InfluxDB",
110
- "it": "Soluzione alternativa a un problema di amministrazione durante il test della connessione a InfluxDB",
111
- "es": "Solución de un problema de administración al probar la conexión a InfluxDB",
112
- "pl": "Obejście problemu administratora podczas testowania połączenia z InfluxDB",
113
- "zh-cn": "在测试与 InfluxDB 的连接时解决管理问题"
114
114
  }
115
115
  },
116
116
  "mode": "daemon",
package/main.js CHANGED
@@ -11,8 +11,8 @@ const fs = require('fs');
11
11
  const path = require('path');
12
12
  const [appName, adapterName] = require('./package.json').name.split('.');
13
13
  const Aggregate = require('./lib/aggregate.js');
14
- const dataDir = path.normalize(`${utils.controllerDir}/${require(`${utils.controllerDir}/lib/tools`).getDefaultDataDir()}`);
15
- const cacheFile = `${dataDir}influxdata.json`;
14
+ const dataDir = utils.getAbsoluteDefaultDataDir();
15
+ let cacheFile = path.join(dataDir, 'influxdata.json');
16
16
 
17
17
  function isObject(it) {
18
18
  // This is necessary because:
@@ -709,6 +709,9 @@ function main(adapter) {
709
709
  adapter.config.retention = (parseInt(adapter.config.customRetentionDuration, 10) || 0) * 24 * 60 * 60;
710
710
  }
711
711
 
712
+ if (adapter.instance !== 0) {
713
+ cacheFile = cacheFile.replace(/\.json$/, `_${adapter.instance}.json`);
714
+ }
712
715
  // analyse if by the last stop the values were cached into file
713
716
  try {
714
717
  if (fs.statSync(cacheFile).isFile()) {
@@ -1714,9 +1717,10 @@ function storeStatePushData(adapter, id, state, applyRules) {
1714
1717
  let pushFunc = applyRules ? pushHistory : pushHelper;
1715
1718
  if (!adapter._influxDPs[id] || !adapter._influxDPs[id][adapter.namespace]) {
1716
1719
  if (applyRules) {
1717
- throw new Error(`history not enabled for ${id}, so can not apply the rules as requested`);
1720
+ throw new Error(`influxdb not enabled for ${id}, so can not apply the rules as requested`);
1718
1721
  }
1719
1722
  adapter._influxDPs[id] = adapter._influxDPs[id] || {};
1723
+ adapter._influxDPs[id].realId = id;
1720
1724
  }
1721
1725
  return new Promise((resolve, reject) => {
1722
1726
  pushFunc(adapter, id, state , err => {
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.8",
4
+ "version": "3.2.0",
5
5
  "author": "bluefox <dogafox@gmail.com>",
6
6
  "contributors": [
7
7
  "bluefox <dogafox@gmail.com>",
@@ -20,17 +20,17 @@
20
20
  ],
21
21
  "optionalDependencies": {},
22
22
  "dependencies": {
23
- "@influxdata/influxdb-client": "^1.28.0",
24
- "@influxdata/influxdb-client-apis": "^1.28.0",
25
- "@iobroker/adapter-core": "^2.6.0",
23
+ "@influxdata/influxdb-client": "^1.29.0",
24
+ "@influxdata/influxdb-client-apis": "^1.29.0",
25
+ "@iobroker/adapter-core": "^2.6.6",
26
26
  "influx": "^4.2.3"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@alcalzone/release-script": "^3.5.9",
30
30
  "@alcalzone/release-script-plugin-iobroker": "^3.5.9",
31
31
  "@alcalzone/release-script-plugin-license": "^3.5.9",
32
- "@iobroker/adapter-dev": "^1.0.0",
33
- "mocha": "^9.2.2",
32
+ "@iobroker/adapter-dev": "^1.1.0",
33
+ "mocha": "^10.0.0",
34
34
  "chai": "^4.3.6"
35
35
  },
36
36
  "bugs": {