iobroker.lorawan 1.18.55 → 1.18.57

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
@@ -23,6 +23,13 @@ For now there is documentation in English here: https://wiki.hafenmeister.de
23
23
  Placeholder for the next version (at the beginning of the line):
24
24
  ### **WORK IN PROGRESS**
25
25
  -->
26
+ ### 1.18.57 (2025-12-31)
27
+ * (BenAhrdt) cache Infos in config for more performance
28
+
29
+ ### 1.18.56 (2025-12-30)
30
+ * (BenAhrdt) remoove namespace twice remooved
31
+ * (BenAhrdt) serialize getConfigStates
32
+
26
33
  ### 1.18.55 (2025-12-29)
27
34
  * (BenAhrdt) bugfix folderinclusion
28
35
 
package/io-package.json CHANGED
@@ -1,8 +1,34 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "lorawan",
4
- "version": "1.18.55",
4
+ "version": "1.18.57",
5
5
  "news": {
6
+ "1.18.57": {
7
+ "en": "cache Infos in config for more performance",
8
+ "de": "cache Infos in config für mehr Leistung",
9
+ "ru": "cache Infos in Config для повышения производительности",
10
+ "pt": "informações de cache em configuração para mais desempenho",
11
+ "nl": "cache-informatie in configuratie voor meer prestaties",
12
+ "fr": "cache Infos en configuration pour plus de performances",
13
+ "it": "cache Infos in config per maggiori prestazioni",
14
+ "es": "cache Infos en config para más rendimiento",
15
+ "pl": "cache Infos w konfiguracji dla większej wydajności",
16
+ "uk": "cache Infos в конфігурації для більшої продуктивності",
17
+ "zh-cn": "为更多性能在配置中缓存信息"
18
+ },
19
+ "1.18.56": {
20
+ "en": "remoove namespace twice remooved\nserialize getConfigStates",
21
+ "de": "remoove namespace zweimal remooved\nserialisieren getConfigStates",
22
+ "ru": "remoove namespace дважды удаляется\nсерийный GetConfigStates",
23
+ "pt": "remoove namespace duas vezes remooved\nserialize getConfigStates",
24
+ "nl": "naamruimte twee keer verplaatsen\nserialiseren getConfigStates",
25
+ "fr": "remove namespace deux fois removed\nsérialiser getConfigStates",
26
+ "it": "rimoove namespace due volte rimuovi\nserializzare ottenereConfigStates",
27
+ "es": "remoove namespace dos remooved\nserialize getConfigStates",
28
+ "pl": "remoove namespace two remooved\nserialize getConfigurations",
29
+ "uk": "remoove namespace двічі remooved\nсертифіковано getConfigStates",
30
+ "zh-cn": "两次重新移动命名空间\n序列化获取配置状态"
31
+ },
6
32
  "1.18.55": {
7
33
  "en": "bugfix folderinclusion",
8
34
  "de": "bugfix ordnerinclusion",
@@ -67,32 +93,6 @@
67
93
  "pl": "dodaj \"Temperatur\" do przypisania automatycznego",
68
94
  "uk": "додати \"Temperatur\" до тематичного знака",
69
95
  "zh-cn": "在自定义中添加“临时”"
70
- },
71
- "1.18.50": {
72
- "en": "filter in Debug mode (dev tool)",
73
- "de": "filter im Debug-Modus (dev tool)",
74
- "ru": "фильтр в режиме Debug (dev tool)",
75
- "pt": "filtro no modo de depuração (ferramenta de dev)",
76
- "nl": "filter in debugmodus (dev tool)",
77
- "fr": "filtre en mode Debug (outil dv)",
78
- "it": "filtro in modalità Debug (attrezzo di sviluppo)",
79
- "es": "filtro en modo Debug (herramienta dev)",
80
- "pl": "filtr w trybie debugowania (narzędzie dev)",
81
- "uk": "фільтр в режимі Debug (розробний інструмент)",
82
- "zh-cn": "调试模式中的过滤器( dev 工具)"
83
- },
84
- "1.18.49": {
85
- "en": "Read and send always all light attributes",
86
- "de": "Lesen und senden Sie immer alle Licht-Attribute",
87
- "ru": "Читайте и отправляйте всегда все световые атрибуты",
88
- "pt": "Ler e enviar sempre todos os atributos de luz",
89
- "nl": "Lees en stuur altijd alle lichtattributen",
90
- "fr": "Lire et envoyer toujours tous les attributs de lumière",
91
- "it": "Leggi e invia sempre tutti gli attributi leggeri",
92
- "es": "Lea y envíe siempre todos los atributos de luz",
93
- "pl": "Czytaj i wysyłaj zawsze wszystkie atrybuty światła",
94
- "uk": "Читайте і надсилайте завжди всі атрибути світла",
95
- "zh-cn": "读取并发送所有光属性"
96
96
  }
97
97
  },
98
98
  "titleLang": {
package/main.js CHANGED
@@ -48,6 +48,11 @@ class Lorawan extends utils.Adapter {
48
48
  hash: 'f3988f71e0d6248fbf690c414bcb46b0500c3a8b3ec9adb9c66be2774ec12291',
49
49
  salt: 'LoRaWANBeScJoFr',
50
50
  };
51
+
52
+ // Serialize getStateConfig
53
+ this._configQueue = Promise.resolve();
54
+ this._changeInfoCache = new Map();
55
+ this._adapterObjectsCache = null;
51
56
  }
52
57
 
53
58
  onFileChange(_id, _fileName, _size) {
@@ -1366,11 +1371,11 @@ class Lorawan extends utils.Adapter {
1366
1371
  myCount++;
1367
1372
  }
1368
1373
  const currentApplications = {};
1369
- const adapterObjects = await this.getAdapterObjectsAsync();
1374
+ const adapterObjects = await this.getAdapterObjectsCached();
1370
1375
  for (const adapterObject of Object.values(adapterObjects)) {
1371
1376
  if (adapterObject.type === 'folder' && adapterObject._id.endsWith('uplink')) {
1372
1377
  adapterObject._id = this.removeNamespace(adapterObject._id);
1373
- const changeInfo = await this.getChangeInfo(adapterObject._id);
1378
+ const changeInfo = await this.getChangeInfoCached(adapterObject._id);
1374
1379
  const label = changeInfo?.usedApplicationName;
1375
1380
  const value = changeInfo?.applicationId;
1376
1381
  if (!currentApplications[value]) {
@@ -1393,7 +1398,7 @@ class Lorawan extends utils.Adapter {
1393
1398
  devices[myCount] = { label: '* (Wildcard)', value: '*' };
1394
1399
  myCount++;
1395
1400
  }
1396
- const adapterObjects = await this.getAdapterObjectsAsync();
1401
+ const adapterObjects = await this.getAdapterObjectsCached();
1397
1402
  for (const adapterObject of Object.values(adapterObjects)) {
1398
1403
  if (
1399
1404
  adapterObject.type === 'folder' &&
@@ -1402,7 +1407,7 @@ class Lorawan extends utils.Adapter {
1402
1407
  adapterObject._id.endsWith('uplink')
1403
1408
  ) {
1404
1409
  adapterObject._id = this.removeNamespace(adapterObject._id);
1405
- const changeInfo = await this.getChangeInfo(adapterObject._id);
1410
+ const changeInfo = await this.getChangeInfoCached(adapterObject._id);
1406
1411
  const label = changeInfo?.usedDeviceId;
1407
1412
  const value = changeInfo?.deviceEUI;
1408
1413
  devices[myCount] = { label: label, value: value };
@@ -1427,54 +1432,56 @@ class Lorawan extends utils.Adapter {
1427
1432
  }
1428
1433
  } else if (obj.command === 'getStatesForConfig' || obj.command === 'getStatesForClimateConfig') {
1429
1434
  try {
1430
- let myCount = 0;
1431
- const states = [];
1432
- const possibleTypes = { state: true };
1433
- if (obj.command === 'getStatesForConfig') {
1434
- states[myCount] = { label: '* (Wildcard)', value: '*' };
1435
- myCount++;
1436
- possibleTypes.folder = true;
1437
- }
1438
- const currentStates = {};
1439
- const adapterObjects = await this.getAdapterObjectsAsync();
1440
- for (const adapterObject of Object.values(adapterObjects)) {
1441
- if (
1442
- possibleTypes[adapterObject.type] === true &&
1443
- (adapterObject._id.includes(obj.message.application) ||
1444
- obj.message.application === '*') &&
1445
- (adapterObject._id.includes(obj.message.device) || obj.message.device === '*') &&
1446
- (adapterObject._id.includes(obj.message.folder) ||
1447
- (obj.message.folder === '*' &&
1448
- (adapterObject._id.includes('uplink.decoded') ||
1449
- adapterObject._id.includes('downlink.control'))))
1450
- ) {
1451
- adapterObject._id = this.removeNamespace(adapterObject._id);
1452
- const changeInfo = await this.getChangeInfo(adapterObject._id);
1453
- //if uplink decoded => changed State with folder
1454
- let fullStatename = changeInfo?.changedState;
1455
- if (changeInfo?.allElements.length > 6) {
1456
- fullStatename = '';
1457
- for (let i = 5; i < changeInfo?.allElements.length; i++) {
1458
- if (fullStatename !== '') {
1459
- fullStatename += '.';
1435
+ await this.runSerializedStateMessage(async () => {
1436
+ let myCount = 0;
1437
+ const states = [];
1438
+ const possibleTypes = { state: true };
1439
+ if (obj.command === 'getStatesForConfig') {
1440
+ states[myCount] = { label: '* (Wildcard)', value: '*' };
1441
+ myCount++;
1442
+ possibleTypes.folder = true;
1443
+ }
1444
+ const currentStates = {};
1445
+ const adapterObjects = await this.getAdapterObjectsCached();
1446
+ for (const adapterObject of Object.values(adapterObjects)) {
1447
+ if (
1448
+ possibleTypes[adapterObject.type] === true &&
1449
+ (adapterObject._id.includes(obj.message.application) ||
1450
+ obj.message.application === '*') &&
1451
+ (adapterObject._id.includes(obj.message.device) || obj.message.device === '*') &&
1452
+ (adapterObject._id.includes(obj.message.folder) ||
1453
+ (obj.message.folder === '*' &&
1454
+ (adapterObject._id.includes('uplink.decoded') ||
1455
+ adapterObject._id.includes('downlink.control'))))
1456
+ ) {
1457
+ //adapterObject._id = this.removeNamespace(adapterObject._id); remooved 30.122025
1458
+ const changeInfo = await this.getChangeInfoCached(adapterObject._id);
1459
+ //if uplink decoded => changed State with folder
1460
+ let fullStatename = changeInfo?.changedState;
1461
+ if (changeInfo?.allElements.length > 6) {
1462
+ fullStatename = '';
1463
+ for (let i = 5; i < changeInfo?.allElements.length; i++) {
1464
+ if (fullStatename !== '') {
1465
+ fullStatename += '.';
1466
+ }
1467
+ fullStatename += changeInfo?.allElements[i];
1460
1468
  }
1461
- fullStatename += changeInfo?.allElements[i];
1462
1469
  }
1463
- }
1464
- if (adapterObject.type === 'folder') {
1465
- fullStatename += '.';
1466
- }
1467
- const label = fullStatename;
1468
- const value = fullStatename;
1469
- if (!currentStates[value]) {
1470
- currentStates[value] = value;
1471
- states[myCount] = { label: label, value: value };
1472
- myCount++;
1470
+ if (adapterObject.type === 'folder') {
1471
+ fullStatename += '.';
1472
+ }
1473
+ const label = fullStatename;
1474
+ const value = fullStatename;
1475
+ if (!currentStates[value]) {
1476
+ currentStates[value] = value;
1477
+ states[myCount] = { label: label, value: value };
1478
+ myCount++;
1479
+ }
1473
1480
  }
1474
1481
  }
1475
- }
1476
- states.sort(this.sortByLabel);
1477
- this.sendTo(obj.from, obj.command, states, obj.callback);
1482
+ states.sort(this.sortByLabel);
1483
+ this.sendTo(obj.from, obj.command, states, obj.callback);
1484
+ });
1478
1485
  } catch (error) {
1479
1486
  this.log.error(error);
1480
1487
  }
@@ -1613,6 +1620,52 @@ class Lorawan extends utils.Adapter {
1613
1620
  }
1614
1621
  return false;
1615
1622
  }
1623
+
1624
+ async runSerializedStateMessage(fn) {
1625
+ const run = async () => fn();
1626
+
1627
+ // Queue verlängern
1628
+ const next = this._configQueue.then(run, run);
1629
+
1630
+ // Queue immer weiterführen, Fehler schlucken
1631
+ this._configQueue = next.catch(() => {});
1632
+
1633
+ return next;
1634
+ }
1635
+
1636
+ async getChangeInfoCached(id) {
1637
+ const now = Date.now();
1638
+
1639
+ const cached = this._changeInfoCache.get(id);
1640
+ if (cached && cached.expires > now) {
1641
+ return cached.value;
1642
+ }
1643
+
1644
+ const value = await this.getChangeInfo(id);
1645
+ this._changeInfoCache.set(id, {
1646
+ value,
1647
+ expires: now + 30_000, // 10 Sekunden
1648
+ });
1649
+
1650
+ return value;
1651
+ }
1652
+
1653
+ async getAdapterObjectsCached() {
1654
+ const now = Date.now();
1655
+
1656
+ if (this._adapterObjectsCache && this._adapterObjectsCache.expires > now) {
1657
+ return this._adapterObjectsCache.value;
1658
+ }
1659
+
1660
+ const value = await this.getAdapterObjectsAsync();
1661
+
1662
+ this._adapterObjectsCache = {
1663
+ value,
1664
+ expires: now + 30_000, // z.B. 30s
1665
+ };
1666
+
1667
+ return value;
1668
+ }
1616
1669
  }
1617
1670
 
1618
1671
  if (require.main !== module) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.lorawan",
3
- "version": "1.18.55",
3
+ "version": "1.18.57",
4
4
  "description": "converts the desired lora gateway data to a ioBroker structure",
5
5
  "author": {
6
6
  "name": "BenAhrdt",