iobroker.lorawan 1.18.55 → 1.18.56

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,10 @@ 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.56 (2025-12-30)
27
+ * (BenAhrdt) remoove namespace twice remooved
28
+ * (BenAhrdt) serialize getConfigStates
29
+
26
30
  ### 1.18.55 (2025-12-29)
27
31
  * (BenAhrdt) bugfix folderinclusion
28
32
 
package/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "lorawan",
4
- "version": "1.18.55",
4
+ "version": "1.18.56",
5
5
  "news": {
6
+ "1.18.56": {
7
+ "en": "remoove namespace twice remooved\nserialize getConfigStates",
8
+ "de": "remoove namespace zweimal remooved\nserialisieren getConfigStates",
9
+ "ru": "remoove namespace дважды удаляется\nсерийный GetConfigStates",
10
+ "pt": "remoove namespace duas vezes remooved\nserialize getConfigStates",
11
+ "nl": "naamruimte twee keer verplaatsen\nserialiseren getConfigStates",
12
+ "fr": "remove namespace deux fois removed\nsérialiser getConfigStates",
13
+ "it": "rimoove namespace due volte rimuovi\nserializzare ottenereConfigStates",
14
+ "es": "remoove namespace dos remooved\nserialize getConfigStates",
15
+ "pl": "remoove namespace two remooved\nserialize getConfigurations",
16
+ "uk": "remoove namespace двічі remooved\nсертифіковано getConfigStates",
17
+ "zh-cn": "两次重新移动命名空间\n序列化获取配置状态"
18
+ },
6
19
  "1.18.55": {
7
20
  "en": "bugfix folderinclusion",
8
21
  "de": "bugfix ordnerinclusion",
@@ -80,19 +93,6 @@
80
93
  "pl": "filtr w trybie debugowania (narzędzie dev)",
81
94
  "uk": "фільтр в режимі Debug (розробний інструмент)",
82
95
  "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,10 @@ 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();
51
55
  }
52
56
 
53
57
  onFileChange(_id, _fileName, _size) {
@@ -1427,54 +1431,56 @@ class Lorawan extends utils.Adapter {
1427
1431
  }
1428
1432
  } else if (obj.command === 'getStatesForConfig' || obj.command === 'getStatesForClimateConfig') {
1429
1433
  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 += '.';
1434
+ await this.runSerializedMessage(async () => {
1435
+ let myCount = 0;
1436
+ const states = [];
1437
+ const possibleTypes = { state: true };
1438
+ if (obj.command === 'getStatesForConfig') {
1439
+ states[myCount] = { label: '* (Wildcard)', value: '*' };
1440
+ myCount++;
1441
+ possibleTypes.folder = true;
1442
+ }
1443
+ const currentStates = {};
1444
+ const adapterObjects = await this.getAdapterObjectsAsync();
1445
+ for (const adapterObject of Object.values(adapterObjects)) {
1446
+ if (
1447
+ possibleTypes[adapterObject.type] === true &&
1448
+ (adapterObject._id.includes(obj.message.application) ||
1449
+ obj.message.application === '*') &&
1450
+ (adapterObject._id.includes(obj.message.device) || obj.message.device === '*') &&
1451
+ (adapterObject._id.includes(obj.message.folder) ||
1452
+ (obj.message.folder === '*' &&
1453
+ (adapterObject._id.includes('uplink.decoded') ||
1454
+ adapterObject._id.includes('downlink.control'))))
1455
+ ) {
1456
+ //adapterObject._id = this.removeNamespace(adapterObject._id); remooved 30.122025
1457
+ const changeInfo = await this.getChangeInfoCached(adapterObject._id);
1458
+ //if uplink decoded => changed State with folder
1459
+ let fullStatename = changeInfo?.changedState;
1460
+ if (changeInfo?.allElements.length > 6) {
1461
+ fullStatename = '';
1462
+ for (let i = 5; i < changeInfo?.allElements.length; i++) {
1463
+ if (fullStatename !== '') {
1464
+ fullStatename += '.';
1465
+ }
1466
+ fullStatename += changeInfo?.allElements[i];
1460
1467
  }
1461
- fullStatename += changeInfo?.allElements[i];
1462
1468
  }
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++;
1469
+ if (adapterObject.type === 'folder') {
1470
+ fullStatename += '.';
1471
+ }
1472
+ const label = fullStatename;
1473
+ const value = fullStatename;
1474
+ if (!currentStates[value]) {
1475
+ currentStates[value] = value;
1476
+ states[myCount] = { label: label, value: value };
1477
+ myCount++;
1478
+ }
1473
1479
  }
1474
1480
  }
1475
- }
1476
- states.sort(this.sortByLabel);
1477
- this.sendTo(obj.from, obj.command, states, obj.callback);
1481
+ states.sort(this.sortByLabel);
1482
+ this.sendTo(obj.from, obj.command, states, obj.callback);
1483
+ });
1478
1484
  } catch (error) {
1479
1485
  this.log.error(error);
1480
1486
  }
@@ -1613,6 +1619,36 @@ class Lorawan extends utils.Adapter {
1613
1619
  }
1614
1620
  return false;
1615
1621
  }
1622
+
1623
+ async runSerializedMessage(fn) {
1624
+ const run = async () => fn();
1625
+
1626
+ // Queue verlängern
1627
+ const next = this._configQueue.then(run, run);
1628
+
1629
+ // Queue immer weiterführen, Fehler schlucken
1630
+ this._configQueue = next.catch(() => {});
1631
+
1632
+ return next;
1633
+ }
1634
+
1635
+ async getChangeInfoCached(id) {
1636
+ const cleanId = this.removeNamespace(id);
1637
+ const now = Date.now();
1638
+
1639
+ const cached = this._changeInfoCache.get(cleanId);
1640
+ if (cached && cached.expires > now) {
1641
+ return cached.value;
1642
+ }
1643
+
1644
+ const value = await this.getChangeInfo(cleanId);
1645
+ this._changeInfoCache.set(cleanId, {
1646
+ value,
1647
+ expires: now + 30_000, // 10 Sekunden
1648
+ });
1649
+
1650
+ return value;
1651
+ }
1616
1652
  }
1617
1653
 
1618
1654
  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.56",
4
4
  "description": "converts the desired lora gateway data to a ioBroker structure",
5
5
  "author": {
6
6
  "name": "BenAhrdt",