iobroker.lorawan 1.18.22 → 1.18.24
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 +6 -0
- package/io-package.json +40 -27
- package/lib/modules/bridge.js +88 -13
- package/lib/modules/bridgeMqttclient.js +1 -1
- package/main.js +10 -0
- package/package.json +1 -1
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.24 (2025-11-27)
|
|
27
|
+
* (BenAhrdt) add dataExchange between Adapter and Bridge-Partner (Complex JSON possible)
|
|
28
|
+
|
|
29
|
+
### 1.18.23 (2025-11-26)
|
|
30
|
+
* (BenAhrdt) Notify Adapter Version to Bridge with connection
|
|
31
|
+
|
|
26
32
|
### 1.18.22 (2025-11-26)
|
|
27
33
|
* (BenAhrdt) Bugfix message to brige with discovered device
|
|
28
34
|
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "lorawan",
|
|
4
|
-
"version": "1.18.
|
|
4
|
+
"version": "1.18.24",
|
|
5
5
|
"news": {
|
|
6
|
+
"1.18.24": {
|
|
7
|
+
"en": "add dataExchange between Adapter and Bridge-Partner (Complex JSON possible)",
|
|
8
|
+
"de": "daten hinzufügen Austausch zwischen Adapter und Bridge-Partner (Komplex JSON möglich)",
|
|
9
|
+
"ru": "добавить данные Обмен между адаптером и Bridge-Partner (комплекс JSON)",
|
|
10
|
+
"pt": "adicionar dados Troca entre adaptador e parceiro de ponte (complexo JSON possível)",
|
|
11
|
+
"nl": "gegevens toevoegen Uitwisseling tussen Adapter en Bridge-Partner (complex JSON mogelijk)",
|
|
12
|
+
"fr": "ajouter des données Échange entre Adaptateur et Bridge-Partner (Complex JSON possible)",
|
|
13
|
+
"it": "aggiungere i dati Scambio tra adattatore e Bridge-Partner (Complex JSON possibile)",
|
|
14
|
+
"es": "añadir datos Intercambio entre Adaptador y Bridge-Partner (Complejo JSON posible)",
|
|
15
|
+
"pl": "dodaj dane Wymiana między Adapterem a partnerem Bridge- (możliwy kompleks JSON)",
|
|
16
|
+
"uk": "додати дані Обмін між адаптером і Bridge-Partner (Комплексний JSON можливо)",
|
|
17
|
+
"zh-cn": "添加数据 适配器与Bridge-Partner之间的交换(可能复杂JSON)"
|
|
18
|
+
},
|
|
19
|
+
"1.18.23": {
|
|
20
|
+
"en": "Notify Adapter Version to Bridge with connection",
|
|
21
|
+
"de": "Benachrichtigen Adapter Version auf Brücke mit Anschluss",
|
|
22
|
+
"ru": "Уведомить версию адаптера о подключении к Bridge",
|
|
23
|
+
"pt": "Notificar versão do adaptador para Ponte com conexão",
|
|
24
|
+
"nl": "Aanmelden Adapter versie naar Brug met verbinding",
|
|
25
|
+
"fr": "Avertissez la version adaptateur de Bridge avec connexion",
|
|
26
|
+
"it": "Notifica versione adattatore a ponte con connessione",
|
|
27
|
+
"es": "Notify Adapter Version to Bridge with connection",
|
|
28
|
+
"pl": "Informuj wersję adaptera do mostka z połączeniem",
|
|
29
|
+
"uk": "Повідомити версію адаптера до мосту з підключенням",
|
|
30
|
+
"zh-cn": "将适配器版本通知连接桥"
|
|
31
|
+
},
|
|
6
32
|
"1.18.22": {
|
|
7
33
|
"en": "Bugfix message to brige with discovered device",
|
|
8
34
|
"de": "Bugfix-Nachricht zu brige mit entdecktem Gerät",
|
|
@@ -67,32 +93,6 @@
|
|
|
67
93
|
"pl": "Temat limit bugfix do stanu _ topic",
|
|
68
94
|
"uk": "Виправлення ліміту висихання до стану_topic",
|
|
69
95
|
"zh-cn": "错误fix 将 sitch 话题限制为状态_ title"
|
|
70
|
-
},
|
|
71
|
-
"1.18.17": {
|
|
72
|
-
"en": "Bugfix limit switch closed",
|
|
73
|
-
"de": "Bugfix Endschalter geschlossen",
|
|
74
|
-
"ru": "Переключатель Bugfix Limit закрыт",
|
|
75
|
-
"pt": "Interruptor de limite de correção de erros fechado",
|
|
76
|
-
"nl": "Bugfix limietschakelaar gesloten",
|
|
77
|
-
"fr": "Interrupteur limite de bogue fermé",
|
|
78
|
-
"it": "Interruttore di limite Bugfix chiuso",
|
|
79
|
-
"es": "Interruptor de límite de fallo cerrado",
|
|
80
|
-
"pl": "Graniczny wyłącznik Bugfix zamknięty",
|
|
81
|
-
"uk": "Перемикач ліміту попереку",
|
|
82
|
-
"zh-cn": "关闭错误修正限制开关"
|
|
83
|
-
},
|
|
84
|
-
"1.18.16": {
|
|
85
|
-
"en": "change cover states into lower case",
|
|
86
|
-
"de": "änderung der deckelzustände in den unteren fall",
|
|
87
|
-
"ru": "изменение состояния покрытия в нижнем регистре",
|
|
88
|
-
"pt": "mudar os estados de cobertura em minúsculas",
|
|
89
|
-
"nl": "wijzigen dekking staten in kleine geval",
|
|
90
|
-
"fr": "changement des états de couverture en minuscules",
|
|
91
|
-
"it": "cambiare gli stati di copertura in caso più basso",
|
|
92
|
-
"es": "cambiar los estados de cobertura en caso inferior",
|
|
93
|
-
"pl": "zmiana stanu pokrycia na niższy przypadek",
|
|
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
|
}
|
package/lib/modules/bridge.js
CHANGED
|
@@ -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
|
-
|
|
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 (
|
|
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,35 @@ class bridgeClass {
|
|
|
1158
1165
|
const activeFunction = 'bridge.js - getDiscoveryObject';
|
|
1159
1166
|
this.adapter.log.debug(`Function ${activeFunction} started.`);
|
|
1160
1167
|
try {
|
|
1161
|
-
let indexOfStatebegin =
|
|
1162
|
-
|
|
1163
|
-
)
|
|
1164
|
-
|
|
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.
|
|
1175
|
+
this.adapter.messagehandler.directoryhandler.reachableSubfolders.uplinkDecoded,
|
|
1167
1176
|
);
|
|
1168
|
-
indexOfStatebegin
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
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);
|
|
1189
|
+
this.adapter.log.warn(StateName);
|
|
1175
1190
|
//const normalizedStateName = this.normalizeString(StateName); 08.11.2025 BeSc dont needed anymore with chenge below
|
|
1176
|
-
|
|
1191
|
+
let DeviceIdentifier;
|
|
1192
|
+
if (options && options.internal) {
|
|
1193
|
+
DeviceIdentifier = options.internal.deviceidentifier;
|
|
1194
|
+
} else {
|
|
1195
|
+
DeviceIdentifier = this.getDeviceIdentifier(changeInfo, this.adapter.config.DeviceIdentifiers);
|
|
1196
|
+
}
|
|
1177
1197
|
const normalizedDeviceIdentifier = this.normalizeString(DeviceIdentifier);
|
|
1178
1198
|
const uniqueString = await this.getUniqueString(
|
|
1179
1199
|
`${this.adapter.namespace}.${changeInfo.id}`,
|
|
@@ -1668,6 +1688,8 @@ class bridgeClass {
|
|
|
1668
1688
|
//this.adapter.log.error(JSON.stringify(this.oldDiscoveredDevices));
|
|
1669
1689
|
await this.discoverGeneralNotification();
|
|
1670
1690
|
|
|
1691
|
+
await this.discoverDataExchange();
|
|
1692
|
+
|
|
1671
1693
|
// Get all ids in adapterfolder
|
|
1672
1694
|
// Generate Infos of all devices and decoded folders
|
|
1673
1695
|
const adapterObjects = await this.adapter.getAdapterObjectsAsync();
|
|
@@ -1722,6 +1744,59 @@ class bridgeClass {
|
|
|
1722
1744
|
}
|
|
1723
1745
|
}
|
|
1724
1746
|
|
|
1747
|
+
/**
|
|
1748
|
+
* Discovery of DataExchange state
|
|
1749
|
+
*/
|
|
1750
|
+
async discoverDataExchange() {
|
|
1751
|
+
const options = {};
|
|
1752
|
+
const id = `${this.adapter.namespace}.bridge.dataExchange`;
|
|
1753
|
+
const deviceObject = await this.adapter.getForeignObjectAsync(id);
|
|
1754
|
+
options.common = deviceObject.common;
|
|
1755
|
+
this.adapter.log.warn(JSON.stringify(options));
|
|
1756
|
+
const changeInfo = await this.adapter.getChangeInfo(id);
|
|
1757
|
+
options.Bridgestate = {
|
|
1758
|
+
discover: true,
|
|
1759
|
+
publish: true,
|
|
1760
|
+
subscribe: true,
|
|
1761
|
+
};
|
|
1762
|
+
options.internal = { folder: `bridge`, deviceidentifier: this.adapter.namespace };
|
|
1763
|
+
const DiscoveryObject = await this.getDiscoveryObject(changeInfo, options);
|
|
1764
|
+
this.assignIdStructure(
|
|
1765
|
+
this.PublishedIds,
|
|
1766
|
+
id,
|
|
1767
|
+
{
|
|
1768
|
+
usedDeviceId: this.adapter.namespace,
|
|
1769
|
+
},
|
|
1770
|
+
DiscoveryObject?.topic,
|
|
1771
|
+
DiscoveryObject?.payload,
|
|
1772
|
+
DiscoveryObject?.payload.state_topic,
|
|
1773
|
+
{ dataExchange: true },
|
|
1774
|
+
);
|
|
1775
|
+
|
|
1776
|
+
this.assignTopicStructure(
|
|
1777
|
+
this.SubscribedTopics,
|
|
1778
|
+
DiscoveryObject?.payload.command_topic,
|
|
1779
|
+
{
|
|
1780
|
+
usedDeviceId: this.adapter.namespace,
|
|
1781
|
+
},
|
|
1782
|
+
DiscoveryObject?.topic,
|
|
1783
|
+
DiscoveryObject?.payload,
|
|
1784
|
+
id,
|
|
1785
|
+
{ dataExchange: true },
|
|
1786
|
+
);
|
|
1787
|
+
await this.publishDiscovery(id, {
|
|
1788
|
+
topic: DiscoveryObject?.topic,
|
|
1789
|
+
payload: structuredClone(DiscoveryObject?.payload),
|
|
1790
|
+
informations: {
|
|
1791
|
+
usedDeviceId: this.adapter.namespace,
|
|
1792
|
+
},
|
|
1793
|
+
});
|
|
1794
|
+
// Delay for publish new entity
|
|
1795
|
+
setTimeout(async () => {
|
|
1796
|
+
await this.publishId(id, undefined, {});
|
|
1797
|
+
}, 1000);
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1725
1800
|
/**
|
|
1726
1801
|
* check discovery for old entries
|
|
1727
1802
|
*/
|
|
@@ -54,7 +54,7 @@ class bridgeMqttClientClass {
|
|
|
54
54
|
const notificationId = `${this.adapter.namespace}.${this.adapter.bridge.Words.notification}${this.adapter.bridge.GeneralId}`;
|
|
55
55
|
await this.adapter.bridge?.publishNotification(
|
|
56
56
|
notificationId,
|
|
57
|
-
this.adapter.i18nTranslation['connection to bridge is activ']
|
|
57
|
+
`${this.adapter.i18nTranslation['connection to bridge is activ']}. Adapterversion: ${this.adapter.version}`,
|
|
58
58
|
this.adapter.bridge?.Notificationlevel.bridgeConnection,
|
|
59
59
|
false,
|
|
60
60
|
);
|
package/main.js
CHANGED
|
@@ -41,6 +41,9 @@ class Lorawan extends utils.Adapter {
|
|
|
41
41
|
this.mySystemConfig;
|
|
42
42
|
this.language;
|
|
43
43
|
|
|
44
|
+
// Adapter Version
|
|
45
|
+
this.version;
|
|
46
|
+
|
|
44
47
|
this.secret = {
|
|
45
48
|
hash: 'feda26376e3d3b38eae8efa48d055754eb0c388d6dbc7ced2ddb5f2f8166f417',
|
|
46
49
|
salt: 'LoRaWANBeScJoFr',
|
|
@@ -65,6 +68,10 @@ class Lorawan extends utils.Adapter {
|
|
|
65
68
|
this.mySystemConfig = await this.getForeignObjectAsync('system.config');
|
|
66
69
|
this.language = this.mySystemConfig?.common.language || 'en';
|
|
67
70
|
|
|
71
|
+
// Read aktual Adapterversion
|
|
72
|
+
const adapterinfos = await this.getForeignObjectAsync(`system.adapter.${this.namespace}`);
|
|
73
|
+
this.version = adapterinfos?.common.version;
|
|
74
|
+
|
|
68
75
|
// create downlinkConfigs
|
|
69
76
|
this.downlinkConfighandler = new downlinkConfighandlerClass(this);
|
|
70
77
|
|
|
@@ -707,6 +714,9 @@ class Lorawan extends utils.Adapter {
|
|
|
707
714
|
await this.setState('bridge.debug.payload', payload.val, true);
|
|
708
715
|
}
|
|
709
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);
|
|
710
720
|
}
|
|
711
721
|
} else {
|
|
712
722
|
// Query for 0_userdata or alias => states also publish with ack = false
|