iobroker.lorawan 1.18.57 → 1.18.59

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 BenAhrdt <bsahrdt@gmail.com>
3
+ Copyright (c) 2025-2026 BenAhrdt <bsahrdt@gmail.com>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -23,6 +23,12 @@ 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.59 (2026-01-01)
27
+ * (BenAhrdt) Chuck checkAllStatesForBridgeWork for better performance
28
+
29
+ ### 1.18.58 (2025-12-31)
30
+ * (BenAhrdt) serialize and cache the config messagens
31
+
26
32
  ### 1.18.57 (2025-12-31)
27
33
  * (BenAhrdt) cache Infos in config for more performance
28
34
 
@@ -857,7 +863,7 @@ For now there is documentation in English here: https://wiki.hafenmeister.de
857
863
  ## License
858
864
  MIT License
859
865
 
860
- Copyright (c) 2025 BenAhrdt <bsahrdt@gmail.com>
866
+ Copyright (c) 2025-2026 BenAhrdt <bsahrdt@gmail.com>
861
867
  Copyright (c) 2025 Joerg Froehner <LoraWan@hafenmeister.com>
862
868
 
863
869
  Permission is hereby granted, free of charge, to any person obtaining a copy
package/io-package.json CHANGED
@@ -1,8 +1,34 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "lorawan",
4
- "version": "1.18.57",
4
+ "version": "1.18.59",
5
5
  "news": {
6
+ "1.18.59": {
7
+ "en": "Chuck checkAllStatesForBridgeWork for better performance",
8
+ "de": "Chuck-Check AllStatesForBridgeWork für bessere Leistung",
9
+ "ru": "Проверка Чака AllStatesForBridgeWork для повышения производительности",
10
+ "pt": "Chuck, verifica. AllStatesForBridgeTrabalhar para melhor desempenho",
11
+ "nl": "Chuck check AllStatesForBridgeWork voor betere prestaties",
12
+ "fr": "Contrôle Chuck AllStatesForBridgeWork pour une meilleure performance",
13
+ "it": "Controllo Chuck AllStatesForBridgeWork per prestazioni migliori",
14
+ "es": "Chuck. AllStatesForBridgeWork para un mejor rendimiento",
15
+ "pl": "Chuck sprawdził Wszystkie państwa dla BridgeWork dla lepszej wydajności",
16
+ "uk": "Перевірка качки AllStatesForBridgeWork для кращої продуктивності",
17
+ "zh-cn": "查克检查 为更好的业绩而努力"
18
+ },
19
+ "1.18.58": {
20
+ "en": "serialize and cache the config messagens",
21
+ "de": "serialisieren und kache die config messagens",
22
+ "ru": "сериализировать и кэшировать config messagens",
23
+ "pt": "serialize e cache as mensagens de configuração",
24
+ "nl": "serialiseren en cache de config messages",
25
+ "fr": "sérialisez et cachez les messages de configuration",
26
+ "it": "serializzare e memorizzare i messaggi di configurazione",
27
+ "es": "serialize y cache los mensajes de config",
28
+ "pl": "serializuj i buforuj wiadomości konfiguracyjne",
29
+ "uk": "послідовність і кешування конфігураційних повідомлень",
30
+ "zh-cn": "序列化和缓存配置信件"
31
+ },
6
32
  "1.18.57": {
7
33
  "en": "cache Infos in config for more performance",
8
34
  "de": "cache Infos in config für mehr Leistung",
@@ -67,32 +93,6 @@
67
93
  "pl": "dodać możliwość dodawania folderów do",
68
94
  "uk": "додати можливість додати папки до",
69
95
  "zh-cn": "添加文件夹到"
70
- },
71
- "1.18.52": {
72
- "en": "add possibility to set Devicesuffix in LoraWAN States",
73
- "de": "möglichkeit hinzufügen, Devicesuffix in LoraWAN-Staaten einzustellen",
74
- "ru": "добавить возможность установки Devicesuffix в штатах LoraWAN",
75
- "pt": "adicionar possibilidade de definir Dispositivosuffix nos Estados de LoraWAN",
76
- "nl": "voeg mogelijkheid toe om Devicesuffix in LoraWAN Staten in te stellen",
77
- "fr": "ajouter la possibilité de définir Devicesuffix dans les États de LoraWAN",
78
- "it": "aggiungere la possibilità di impostare Devicesuffix in LoraWAN States",
79
- "es": "añadir posibilidad para establecer Dispositivosuffix en Estados LoraWAN",
80
- "pl": "dodać możliwość ustawienia Devicesuffix w państwach LoraWAN",
81
- "uk": "додати можливість встановити Devicesuffix в LoraWAN",
82
- "zh-cn": "添加在 LoraWAN 州设置设备后缀的可能性"
83
- },
84
- "1.18.51": {
85
- "en": "add \"Temperatur\" to autmatic assign",
86
- "de": "\"Temperatur\" zu autmatic assign hinzufügen",
87
- "ru": "добавить \"Temperatur\" в аутматическое назначение",
88
- "pt": "adicionar \"Temperatur\" à atribuição autmática",
89
- "nl": "\"Temperatur\" toevoegen aan autmatisch toewijzen",
90
- "fr": "ajouter \"Temperatur\" à l'attribut autmatique",
91
- "it": "aggiungere \"Temperatur\" all'assegnazione autmatica",
92
- "es": "añadir \"Temperatur\" a la asignación autmática",
93
- "pl": "dodaj \"Temperatur\" do przypisania automatycznego",
94
- "uk": "додати \"Temperatur\" до тематичного знака",
95
- "zh-cn": "在自定义中添加“临时”"
96
96
  }
97
97
  },
98
98
  "titleLang": {
@@ -1749,6 +1749,78 @@ class bridgeClass {
1749
1749
  *
1750
1750
  * @param options options to special functions
1751
1751
  */
1752
+ async checkAllStatesForBridgeWork(options) {
1753
+ const activeFunction = 'bridge.js - checkAllStatesForBridgeWork';
1754
+ this.adapter.log.debug(`Function ${activeFunction} started.`);
1755
+
1756
+ try {
1757
+ // get old Discovered ids
1758
+ this.OldDiscoveredIds = JSON.parse((await this.adapter.getStateAsync('info.discoveredIds')).val);
1759
+ this.oldDiscoveredDevices = this.generateOldDevices(this.OldDiscoveredIds);
1760
+
1761
+ // Clear object of all subscribed Ids and published Topics
1762
+ this.SubscribedTopics = {};
1763
+ this.PublishedIds = {};
1764
+ this.Notifications = {};
1765
+
1766
+ await this.discoverGeneralNotification();
1767
+ await this.discoverDataExchange();
1768
+
1769
+ const adapterObjects = await this.adapter.getAdapterObjectsAsync();
1770
+
1771
+ const CHUNK_SIZE = 8; // 5–10 ist für ioBroker sehr gut
1772
+ let chunk = [];
1773
+ this.adapter.log.error('Start');
1774
+ for (const adapterObject of Object.values(adapterObjects)) {
1775
+ if (adapterObject.type !== 'state') {
1776
+ continue;
1777
+ }
1778
+ if (
1779
+ !adapterObject._id.includes(
1780
+ `${this.adapter.messagehandler.directoryhandler.reachableSubfolders.uplinkDecoded}.`,
1781
+ ) &&
1782
+ !adapterObject._id.includes(
1783
+ `${this.adapter.messagehandler.directoryhandler.reachableSubfolders.downlinkControl}.`,
1784
+ )
1785
+ ) {
1786
+ continue;
1787
+ }
1788
+
1789
+ const localOptions = {
1790
+ ...(options || {}),
1791
+ common: adapterObject.common,
1792
+ };
1793
+
1794
+ chunk.push(this.work(adapterObject._id, undefined, localOptions));
1795
+
1796
+ // Wenn Chunk voll → warten
1797
+ if (chunk.length >= CHUNK_SIZE) {
1798
+ await Promise.all(chunk);
1799
+ chunk = [];
1800
+ }
1801
+ }
1802
+
1803
+ this.adapter.log.error('Ende');
1804
+ // Rest abarbeiten
1805
+ if (chunk.length > 0) {
1806
+ await Promise.all(chunk);
1807
+ }
1808
+
1809
+ // Ab hier ist ALLES aus work() fertig
1810
+ await this.discoverClimate();
1811
+ await this.getForeignStatesForStandardEntities();
1812
+ await this.getForeignClimateConfig();
1813
+ await this.getForeignHumidifierConfig();
1814
+ await this.getForeignLightConfig();
1815
+ await this.getForeignCoverConfig();
1816
+ await this.getForeignLockConfig();
1817
+ await this.checkDiscoveries();
1818
+ } catch (error) {
1819
+ this.adapter.log.error(`error at ${activeFunction}: ${error}`);
1820
+ }
1821
+ }
1822
+
1823
+ /* Alte Version
1752
1824
  async checkAllStatesForBridgeWork(options) {
1753
1825
  const activeFunction = 'bridge.js - checkAllStatesForBridgeWork';
1754
1826
  this.adapter.log.debug(`Function ${activeFunction} started.`);
@@ -1799,7 +1871,7 @@ class bridgeClass {
1799
1871
  this.adapter.log.error(`error at ${activeFunction}: ${error}`);
1800
1872
  }
1801
1873
  }
1802
-
1874
+ */
1803
1875
  /**
1804
1876
  * @param oldDiscoveredIds Ids wiche are discovered last time that Adapter runs
1805
1877
  */
package/main.js CHANGED
@@ -1361,78 +1361,84 @@ class Lorawan extends utils.Adapter {
1361
1361
  obj.command === 'getApplicationsForClimateModeConfig'
1362
1362
  ) {
1363
1363
  try {
1364
- let myCount = 0;
1365
- const applications = [];
1366
- if (obj.command === 'getApplicationsForConfig') {
1367
- applications[myCount] = { label: '* (Wildcard)', value: '*' };
1368
- myCount++;
1369
- } else if (obj.command === 'getApplicationsForClimateModeConfig') {
1370
- applications[myCount] = { label: '* Not Present (Virtual)', value: 'NotPresent' };
1371
- myCount++;
1372
- }
1373
- const currentApplications = {};
1374
- const adapterObjects = await this.getAdapterObjectsCached();
1375
- for (const adapterObject of Object.values(adapterObjects)) {
1376
- if (adapterObject.type === 'folder' && adapterObject._id.endsWith('uplink')) {
1377
- adapterObject._id = this.removeNamespace(adapterObject._id);
1378
- const changeInfo = await this.getChangeInfoCached(adapterObject._id);
1379
- const label = changeInfo?.usedApplicationName;
1380
- const value = changeInfo?.applicationId;
1381
- if (!currentApplications[value]) {
1382
- currentApplications[value] = value;
1383
- applications[myCount] = { label: label, value: value };
1384
- myCount++;
1364
+ await this.runSerializedMessages(async () => {
1365
+ let myCount = 0;
1366
+ const applications = [];
1367
+ if (obj.command === 'getApplicationsForConfig') {
1368
+ applications[myCount] = { label: '* (Wildcard)', value: '*' };
1369
+ myCount++;
1370
+ } else if (obj.command === 'getApplicationsForClimateModeConfig') {
1371
+ applications[myCount] = { label: '* Not Present (Virtual)', value: 'NotPresent' };
1372
+ myCount++;
1373
+ }
1374
+ const currentApplications = {};
1375
+ const adapterObjects = await this.getAdapterObjectsCached();
1376
+ for (const adapterObject of Object.values(adapterObjects)) {
1377
+ if (adapterObject.type === 'folder' && adapterObject._id.endsWith('uplink')) {
1378
+ adapterObject._id = this.removeNamespace(adapterObject._id);
1379
+ const changeInfo = await this.getChangeInfoCached(adapterObject._id);
1380
+ const label = changeInfo?.usedApplicationName;
1381
+ const value = changeInfo?.applicationId;
1382
+ if (!currentApplications[value]) {
1383
+ currentApplications[value] = value;
1384
+ applications[myCount] = { label: label, value: value };
1385
+ myCount++;
1386
+ }
1385
1387
  }
1386
1388
  }
1387
- }
1388
- applications.sort(this.sortByLabel);
1389
- this.sendTo(obj.from, obj.command, applications, obj.callback);
1389
+ applications.sort(this.sortByLabel);
1390
+ this.sendTo(obj.from, obj.command, applications, obj.callback);
1391
+ });
1390
1392
  } catch (error) {
1391
1393
  this.log.error(error);
1392
1394
  }
1393
1395
  } else if (obj.command === 'getDevicesForConfig' || obj.command === 'getDevicesForClimateConfig') {
1394
1396
  try {
1395
- let myCount = 0;
1396
- const devices = [];
1397
- if (obj.command === 'getDevicesForConfig') {
1398
- devices[myCount] = { label: '* (Wildcard)', value: '*' };
1399
- myCount++;
1400
- }
1401
- const adapterObjects = await this.getAdapterObjectsCached();
1402
- for (const adapterObject of Object.values(adapterObjects)) {
1403
- if (
1404
- adapterObject.type === 'folder' &&
1405
- (adapterObject._id.includes(obj.message.application) ||
1406
- obj.message.application === '*') &&
1407
- adapterObject._id.endsWith('uplink')
1408
- ) {
1409
- adapterObject._id = this.removeNamespace(adapterObject._id);
1410
- const changeInfo = await this.getChangeInfoCached(adapterObject._id);
1411
- const label = changeInfo?.usedDeviceId;
1412
- const value = changeInfo?.deviceEUI;
1413
- devices[myCount] = { label: label, value: value };
1397
+ await this.runSerializedMessages(async () => {
1398
+ let myCount = 0;
1399
+ const devices = [];
1400
+ if (obj.command === 'getDevicesForConfig') {
1401
+ devices[myCount] = { label: '* (Wildcard)', value: '*' };
1414
1402
  myCount++;
1415
1403
  }
1416
- }
1417
- devices.sort(this.sortByLabel);
1418
- this.sendTo(obj.from, obj.command, devices, obj.callback);
1404
+ const adapterObjects = await this.getAdapterObjectsCached();
1405
+ for (const adapterObject of Object.values(adapterObjects)) {
1406
+ if (
1407
+ adapterObject.type === 'folder' &&
1408
+ (adapterObject._id.includes(obj.message.application) ||
1409
+ obj.message.application === '*') &&
1410
+ adapterObject._id.endsWith('uplink')
1411
+ ) {
1412
+ adapterObject._id = this.removeNamespace(adapterObject._id);
1413
+ const changeInfo = await this.getChangeInfoCached(adapterObject._id);
1414
+ const label = changeInfo?.usedDeviceId;
1415
+ const value = changeInfo?.deviceEUI;
1416
+ devices[myCount] = { label: label, value: value };
1417
+ myCount++;
1418
+ }
1419
+ }
1420
+ devices.sort(this.sortByLabel);
1421
+ this.sendTo(obj.from, obj.command, devices, obj.callback);
1422
+ });
1419
1423
  } catch (error) {
1420
1424
  this.log.error(error);
1421
1425
  }
1422
1426
  } else if (obj.command === 'getFoldersForConfig') {
1423
1427
  try {
1424
- const devices = [
1425
- { label: '* (Wildcard)', value: '*' },
1426
- { label: 'uplink.decoded', value: 'uplink.decoded' },
1427
- { label: 'downlink.control', value: 'downlink.control' },
1428
- ];
1429
- this.sendTo(obj.from, obj.command, devices, obj.callback);
1428
+ await this.runSerializedMessages(async () => {
1429
+ const devices = [
1430
+ { label: '* (Wildcard)', value: '*' },
1431
+ { label: 'uplink.decoded', value: 'uplink.decoded' },
1432
+ { label: 'downlink.control', value: 'downlink.control' },
1433
+ ];
1434
+ this.sendTo(obj.from, obj.command, devices, obj.callback);
1435
+ });
1430
1436
  } catch (error) {
1431
1437
  this.log.error(error);
1432
1438
  }
1433
1439
  } else if (obj.command === 'getStatesForConfig' || obj.command === 'getStatesForClimateConfig') {
1434
1440
  try {
1435
- await this.runSerializedStateMessage(async () => {
1441
+ await this.runSerializedMessages(async () => {
1436
1442
  let myCount = 0;
1437
1443
  const states = [];
1438
1444
  const possibleTypes = { state: true };
@@ -1621,7 +1627,7 @@ class Lorawan extends utils.Adapter {
1621
1627
  return false;
1622
1628
  }
1623
1629
 
1624
- async runSerializedStateMessage(fn) {
1630
+ async runSerializedMessages(fn) {
1625
1631
  const run = async () => fn();
1626
1632
 
1627
1633
  // Queue verlängern
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.lorawan",
3
- "version": "1.18.57",
3
+ "version": "1.18.59",
4
4
  "description": "converts the desired lora gateway data to a ioBroker structure",
5
5
  "author": {
6
6
  "name": "BenAhrdt",