iobroker.lorawan 1.18.23 → 1.18.25

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,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.25 (2025-11-27)
27
+ * (BenAhrdt) remove logging for testing
28
+
29
+ ### 1.18.24 (2025-11-27)
30
+ * (BenAhrdt) add dataExchange between Adapter and Bridge-Partner (Complex JSON possible)
31
+
26
32
  ### 1.18.23 (2025-11-26)
27
33
  * (BenAhrdt) Notify Adapter Version to Bridge with connection
28
34
 
package/io-package.json CHANGED
@@ -1,8 +1,34 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "lorawan",
4
- "version": "1.18.23",
4
+ "version": "1.18.25",
5
5
  "news": {
6
+ "1.18.25": {
7
+ "en": "remove logging for testing",
8
+ "de": "entfernen von protokollen für tests",
9
+ "ru": "удаление бревен для тестирования",
10
+ "pt": "remover o registo para testes",
11
+ "nl": "verwijderen logging voor het testen",
12
+ "fr": "supprimer l'enregistrement pour les essais",
13
+ "it": "rimuovere logging per il test",
14
+ "es": "eliminar registro para pruebas",
15
+ "pl": "usunąć logowanie do testowania",
16
+ "uk": "видалення загартування для тестування",
17
+ "zh-cn": "删除用于测试的日志"
18
+ },
19
+ "1.18.24": {
20
+ "en": "add dataExchange between Adapter and Bridge-Partner (Complex JSON possible)",
21
+ "de": "daten hinzufügen Austausch zwischen Adapter und Bridge-Partner (Komplex JSON möglich)",
22
+ "ru": "добавить данные Обмен между адаптером и Bridge-Partner (комплекс JSON)",
23
+ "pt": "adicionar dados Troca entre adaptador e parceiro de ponte (complexo JSON possível)",
24
+ "nl": "gegevens toevoegen Uitwisseling tussen Adapter en Bridge-Partner (complex JSON mogelijk)",
25
+ "fr": "ajouter des données Échange entre Adaptateur et Bridge-Partner (Complex JSON possible)",
26
+ "it": "aggiungere i dati Scambio tra adattatore e Bridge-Partner (Complex JSON possibile)",
27
+ "es": "añadir datos Intercambio entre Adaptador y Bridge-Partner (Complejo JSON posible)",
28
+ "pl": "dodaj dane Wymiana między Adapterem a partnerem Bridge- (możliwy kompleks JSON)",
29
+ "uk": "додати дані Обмін між адаптером і Bridge-Partner (Комплексний JSON можливо)",
30
+ "zh-cn": "添加数据 适配器与Bridge-Partner之间的交换(可能复杂JSON)"
31
+ },
6
32
  "1.18.23": {
7
33
  "en": "Notify Adapter Version to Bridge with connection",
8
34
  "de": "Benachrichtigen Adapter Version auf Brücke mit Anschluss",
@@ -67,32 +93,6 @@
67
93
  "pl": "możliwość opublikowania jednego identyfikatora w jednostce spezialnej i normalnej",
68
94
  "uk": "можливість опублікувати одну ідентифікацію в спорідненому і нормальному суб’єкті",
69
95
  "zh-cn": "在普通实体中公布一个标识的可能性"
70
- },
71
- "1.18.18": {
72
- "en": "Bugfix limit sitch topic to state_topic",
73
- "de": "Bugfix limit sitch Thema zu state_topic",
74
- "ru": "Bugfix ограничивает тему ситча state_topic",
75
- "pt": "Assunto de configuração limite de Bugfix para state_topic",
76
- "nl": "Bugfix limit sitch topic to state_topic",
77
- "fr": "Bugfix limit sitch topic to state_topic",
78
- "it": "Bugfix limit sitch argomento a state_topic",
79
- "es": "Bugfix límite de sitch tema a state_topic",
80
- "pl": "Temat limit bugfix do stanu _ topic",
81
- "uk": "Виправлення ліміту висихання до стану_topic",
82
- "zh-cn": "错误fix 将 sitch 话题限制为状态_ title"
83
- },
84
- "1.18.17": {
85
- "en": "Bugfix limit switch closed",
86
- "de": "Bugfix Endschalter geschlossen",
87
- "ru": "Переключатель Bugfix Limit закрыт",
88
- "pt": "Interruptor de limite de correção de erros fechado",
89
- "nl": "Bugfix limietschakelaar gesloten",
90
- "fr": "Interrupteur limite de bogue fermé",
91
- "it": "Interruttore di limite Bugfix chiuso",
92
- "es": "Interruptor de límite de fallo cerrado",
93
- "pl": "Graniczny wyłącznik Bugfix zamknięty",
94
- "uk": "Перемикач ліміту попереку",
95
- "zh-cn": "关闭错误修正限制开关"
96
96
  }
97
97
  },
98
98
  "titleLang": {
@@ -579,6 +579,19 @@
579
579
  "def": ""
580
580
  },
581
581
  "native": {}
582
+ },
583
+ {
584
+ "_id": "bridge.dataExchange",
585
+ "type": "state",
586
+ "common": {
587
+ "type": "string",
588
+ "role": "json",
589
+ "name": "dataexchange with bridge",
590
+ "read": true,
591
+ "write": true,
592
+ "def": ""
593
+ },
594
+ "native": {}
582
595
  }
583
596
  ]
584
597
  }
@@ -260,9 +260,16 @@ class bridgeClass {
260
260
 
261
261
  // Check for namespace and write own, oder foreign state
262
262
  if (this.SubscribedTopics[topic].id.startsWith(this.adapter.namespace)) {
263
- await this.adapter.setState(this.SubscribedTopics[topic].id, message);
263
+ if (this.SubscribedTopics[topic].dataExchange) {
264
+ if (typeof message === 'object') {
265
+ message = JSON.stringify(message);
266
+ }
267
+ await this.adapter.setState(this.SubscribedTopics[topic].id, message);
268
+ } else {
269
+ await this.adapter.setState(this.SubscribedTopics[topic].id, message);
270
+ }
264
271
  } else {
265
- if (message.id && message.val) {
272
+ if (this.SubscribedTopics[topic].message) {
266
273
  await this.adapter.setForeignStateAsync(message.id, message.val);
267
274
  } else {
268
275
  await this.adapter.setForeignStateAsync(this.SubscribedTopics[topic].id, message);
@@ -1158,22 +1165,34 @@ class bridgeClass {
1158
1165
  const activeFunction = 'bridge.js - getDiscoveryObject';
1159
1166
  this.adapter.log.debug(`Function ${activeFunction} started.`);
1160
1167
  try {
1161
- let indexOfStatebegin = changeInfo.id.indexOf(
1162
- this.adapter.messagehandler.directoryhandler.reachableSubfolders.uplinkDecoded,
1163
- );
1164
- if (indexOfStatebegin === -1) {
1168
+ let indexOfStatebegin = -1;
1169
+ // Check for state discover outsid the applications
1170
+ if (options && options.internal) {
1171
+ indexOfStatebegin = changeInfo.id.indexOf(options.internal.folder);
1172
+ indexOfStatebegin = options.internal.folder.length + 1;
1173
+ } else {
1165
1174
  indexOfStatebegin = changeInfo.id.indexOf(
1166
- this.adapter.messagehandler.directoryhandler.reachableSubfolders.downlinkControl,
1175
+ this.adapter.messagehandler.directoryhandler.reachableSubfolders.uplinkDecoded,
1167
1176
  );
1168
- indexOfStatebegin +=
1169
- this.adapter.messagehandler.directoryhandler.reachableSubfolders.downlinkControl.length + 1;
1170
- } else {
1171
- indexOfStatebegin +=
1172
- this.adapter.messagehandler.directoryhandler.reachableSubfolders.uplinkDecoded.length + 1;
1177
+ if (indexOfStatebegin === -1) {
1178
+ indexOfStatebegin = changeInfo.id.indexOf(
1179
+ this.adapter.messagehandler.directoryhandler.reachableSubfolders.downlinkControl,
1180
+ );
1181
+ indexOfStatebegin +=
1182
+ this.adapter.messagehandler.directoryhandler.reachableSubfolders.downlinkControl.length + 1;
1183
+ } else {
1184
+ indexOfStatebegin +=
1185
+ this.adapter.messagehandler.directoryhandler.reachableSubfolders.uplinkDecoded.length + 1;
1186
+ }
1173
1187
  }
1174
1188
  const StateName = changeInfo.id.substring(indexOfStatebegin, changeInfo.id.length);
1175
1189
  //const normalizedStateName = this.normalizeString(StateName); 08.11.2025 BeSc dont needed anymore with chenge below
1176
- const DeviceIdentifier = this.getDeviceIdentifier(changeInfo, this.adapter.config.DeviceIdentifiers);
1190
+ let DeviceIdentifier;
1191
+ if (options && options.internal) {
1192
+ DeviceIdentifier = options.internal.deviceidentifier;
1193
+ } else {
1194
+ DeviceIdentifier = this.getDeviceIdentifier(changeInfo, this.adapter.config.DeviceIdentifiers);
1195
+ }
1177
1196
  const normalizedDeviceIdentifier = this.normalizeString(DeviceIdentifier);
1178
1197
  const uniqueString = await this.getUniqueString(
1179
1198
  `${this.adapter.namespace}.${changeInfo.id}`,
@@ -1668,6 +1687,8 @@ class bridgeClass {
1668
1687
  //this.adapter.log.error(JSON.stringify(this.oldDiscoveredDevices));
1669
1688
  await this.discoverGeneralNotification();
1670
1689
 
1690
+ await this.discoverDataExchange();
1691
+
1671
1692
  // Get all ids in adapterfolder
1672
1693
  // Generate Infos of all devices and decoded folders
1673
1694
  const adapterObjects = await this.adapter.getAdapterObjectsAsync();
@@ -1722,6 +1743,59 @@ class bridgeClass {
1722
1743
  }
1723
1744
  }
1724
1745
 
1746
+ /**
1747
+ * Discovery of DataExchange state
1748
+ */
1749
+ async discoverDataExchange() {
1750
+ const options = {};
1751
+ const id = `${this.adapter.namespace}.bridge.dataExchange`;
1752
+ const deviceObject = await this.adapter.getForeignObjectAsync(id);
1753
+ options.common = deviceObject.common;
1754
+ this.adapter.log.warn(JSON.stringify(options));
1755
+ const changeInfo = await this.adapter.getChangeInfo(id);
1756
+ options.Bridgestate = {
1757
+ discover: true,
1758
+ publish: true,
1759
+ subscribe: true,
1760
+ };
1761
+ options.internal = { folder: `bridge`, deviceidentifier: this.adapter.namespace };
1762
+ const DiscoveryObject = await this.getDiscoveryObject(changeInfo, options);
1763
+ this.assignIdStructure(
1764
+ this.PublishedIds,
1765
+ id,
1766
+ {
1767
+ usedDeviceId: this.adapter.namespace,
1768
+ },
1769
+ DiscoveryObject?.topic,
1770
+ DiscoveryObject?.payload,
1771
+ DiscoveryObject?.payload.state_topic,
1772
+ { dataExchange: true },
1773
+ );
1774
+
1775
+ this.assignTopicStructure(
1776
+ this.SubscribedTopics,
1777
+ DiscoveryObject?.payload.command_topic,
1778
+ {
1779
+ usedDeviceId: this.adapter.namespace,
1780
+ },
1781
+ DiscoveryObject?.topic,
1782
+ DiscoveryObject?.payload,
1783
+ id,
1784
+ { dataExchange: true },
1785
+ );
1786
+ await this.publishDiscovery(id, {
1787
+ topic: DiscoveryObject?.topic,
1788
+ payload: structuredClone(DiscoveryObject?.payload),
1789
+ informations: {
1790
+ usedDeviceId: this.adapter.namespace,
1791
+ },
1792
+ });
1793
+ // Delay for publish new entity
1794
+ setTimeout(async () => {
1795
+ await this.publishId(id, undefined, {});
1796
+ }, 1000);
1797
+ }
1798
+
1725
1799
  /**
1726
1800
  * check discovery for old entries
1727
1801
  */
package/main.js CHANGED
@@ -714,6 +714,9 @@ class Lorawan extends utils.Adapter {
714
714
  await this.setState('bridge.debug.payload', payload.val, true);
715
715
  }
716
716
  await this.setState(id, false, true);
717
+ } else if (id.endsWith('.bridge.dataExchange')) {
718
+ await this.bridge?.publishId(id, state.val, {});
719
+ await this.setState(id, state.val, true);
717
720
  }
718
721
  } else {
719
722
  // Query for 0_userdata or alias => states also publish with ack = false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.lorawan",
3
- "version": "1.18.23",
3
+ "version": "1.18.25",
4
4
  "description": "converts the desired lora gateway data to a ioBroker structure",
5
5
  "author": {
6
6
  "name": "BenAhrdt",