iobroker.lorawan 1.18.56 → 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,9 @@ 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
+
26
29
  ### 1.18.56 (2025-12-30)
27
30
  * (BenAhrdt) remoove namespace twice remooved
28
31
  * (BenAhrdt) serialize getConfigStates
package/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "lorawan",
4
- "version": "1.18.56",
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
+ },
6
19
  "1.18.56": {
7
20
  "en": "remoove namespace twice remooved\nserialize getConfigStates",
8
21
  "de": "remoove namespace zweimal remooved\nserialisieren getConfigStates",
@@ -80,19 +93,6 @@
80
93
  "pl": "dodaj \"Temperatur\" do przypisania automatycznego",
81
94
  "uk": "додати \"Temperatur\" до тематичного знака",
82
95
  "zh-cn": "在自定义中添加“临时”"
83
- },
84
- "1.18.50": {
85
- "en": "filter in Debug mode (dev tool)",
86
- "de": "filter im Debug-Modus (dev tool)",
87
- "ru": "фильтр в режиме Debug (dev tool)",
88
- "pt": "filtro no modo de depuração (ferramenta de dev)",
89
- "nl": "filter in debugmodus (dev tool)",
90
- "fr": "filtre en mode Debug (outil dv)",
91
- "it": "filtro in modalità Debug (attrezzo di sviluppo)",
92
- "es": "filtro en modo Debug (herramienta dev)",
93
- "pl": "filtr w trybie debugowania (narzędzie dev)",
94
- "uk": "фільтр в режимі Debug (розробний інструмент)",
95
- "zh-cn": "调试模式中的过滤器( dev 工具)"
96
96
  }
97
97
  },
98
98
  "titleLang": {
package/main.js CHANGED
@@ -52,6 +52,7 @@ class Lorawan extends utils.Adapter {
52
52
  // Serialize getStateConfig
53
53
  this._configQueue = Promise.resolve();
54
54
  this._changeInfoCache = new Map();
55
+ this._adapterObjectsCache = null;
55
56
  }
56
57
 
57
58
  onFileChange(_id, _fileName, _size) {
@@ -1370,11 +1371,11 @@ class Lorawan extends utils.Adapter {
1370
1371
  myCount++;
1371
1372
  }
1372
1373
  const currentApplications = {};
1373
- const adapterObjects = await this.getAdapterObjectsAsync();
1374
+ const adapterObjects = await this.getAdapterObjectsCached();
1374
1375
  for (const adapterObject of Object.values(adapterObjects)) {
1375
1376
  if (adapterObject.type === 'folder' && adapterObject._id.endsWith('uplink')) {
1376
1377
  adapterObject._id = this.removeNamespace(adapterObject._id);
1377
- const changeInfo = await this.getChangeInfo(adapterObject._id);
1378
+ const changeInfo = await this.getChangeInfoCached(adapterObject._id);
1378
1379
  const label = changeInfo?.usedApplicationName;
1379
1380
  const value = changeInfo?.applicationId;
1380
1381
  if (!currentApplications[value]) {
@@ -1397,7 +1398,7 @@ class Lorawan extends utils.Adapter {
1397
1398
  devices[myCount] = { label: '* (Wildcard)', value: '*' };
1398
1399
  myCount++;
1399
1400
  }
1400
- const adapterObjects = await this.getAdapterObjectsAsync();
1401
+ const adapterObjects = await this.getAdapterObjectsCached();
1401
1402
  for (const adapterObject of Object.values(adapterObjects)) {
1402
1403
  if (
1403
1404
  adapterObject.type === 'folder' &&
@@ -1406,7 +1407,7 @@ class Lorawan extends utils.Adapter {
1406
1407
  adapterObject._id.endsWith('uplink')
1407
1408
  ) {
1408
1409
  adapterObject._id = this.removeNamespace(adapterObject._id);
1409
- const changeInfo = await this.getChangeInfo(adapterObject._id);
1410
+ const changeInfo = await this.getChangeInfoCached(adapterObject._id);
1410
1411
  const label = changeInfo?.usedDeviceId;
1411
1412
  const value = changeInfo?.deviceEUI;
1412
1413
  devices[myCount] = { label: label, value: value };
@@ -1431,7 +1432,7 @@ class Lorawan extends utils.Adapter {
1431
1432
  }
1432
1433
  } else if (obj.command === 'getStatesForConfig' || obj.command === 'getStatesForClimateConfig') {
1433
1434
  try {
1434
- await this.runSerializedMessage(async () => {
1435
+ await this.runSerializedStateMessage(async () => {
1435
1436
  let myCount = 0;
1436
1437
  const states = [];
1437
1438
  const possibleTypes = { state: true };
@@ -1441,7 +1442,7 @@ class Lorawan extends utils.Adapter {
1441
1442
  possibleTypes.folder = true;
1442
1443
  }
1443
1444
  const currentStates = {};
1444
- const adapterObjects = await this.getAdapterObjectsAsync();
1445
+ const adapterObjects = await this.getAdapterObjectsCached();
1445
1446
  for (const adapterObject of Object.values(adapterObjects)) {
1446
1447
  if (
1447
1448
  possibleTypes[adapterObject.type] === true &&
@@ -1620,7 +1621,7 @@ class Lorawan extends utils.Adapter {
1620
1621
  return false;
1621
1622
  }
1622
1623
 
1623
- async runSerializedMessage(fn) {
1624
+ async runSerializedStateMessage(fn) {
1624
1625
  const run = async () => fn();
1625
1626
 
1626
1627
  // Queue verlängern
@@ -1633,22 +1634,38 @@ class Lorawan extends utils.Adapter {
1633
1634
  }
1634
1635
 
1635
1636
  async getChangeInfoCached(id) {
1636
- const cleanId = this.removeNamespace(id);
1637
1637
  const now = Date.now();
1638
1638
 
1639
- const cached = this._changeInfoCache.get(cleanId);
1639
+ const cached = this._changeInfoCache.get(id);
1640
1640
  if (cached && cached.expires > now) {
1641
1641
  return cached.value;
1642
1642
  }
1643
1643
 
1644
- const value = await this.getChangeInfo(cleanId);
1645
- this._changeInfoCache.set(cleanId, {
1644
+ const value = await this.getChangeInfo(id);
1645
+ this._changeInfoCache.set(id, {
1646
1646
  value,
1647
1647
  expires: now + 30_000, // 10 Sekunden
1648
1648
  });
1649
1649
 
1650
1650
  return value;
1651
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
+ }
1652
1669
  }
1653
1670
 
1654
1671
  if (require.main !== module) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.lorawan",
3
- "version": "1.18.56",
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",