iobroker.lorawan 1.16.5 → 1.16.7
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 +7 -0
- package/io-package.json +27 -27
- package/lib/modules/bridge.js +75 -41
- package/main.js +21 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,6 +23,13 @@ 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.16.7 (2025-09-17)
|
|
27
|
+
* (BenAhrdt) Bugfix deleting discovered devices
|
|
28
|
+
* (BenAhrdt) build in devug logging to find bug in devicename
|
|
29
|
+
|
|
30
|
+
### 1.16.6 (2025-09-17)
|
|
31
|
+
* (BenAhrdt) Change detection of new Discovery from LoRaWAN devices
|
|
32
|
+
|
|
26
33
|
### 1.16.5 (2025-09-17)
|
|
27
34
|
* (BenAhrdt) Bugfix in notifications to Bridge (new device dicovered) => namespace not set
|
|
28
35
|
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "lorawan",
|
|
4
|
-
"version": "1.16.
|
|
4
|
+
"version": "1.16.7",
|
|
5
5
|
"news": {
|
|
6
|
+
"1.16.7": {
|
|
7
|
+
"en": "Bugfix deleting discovered devices\nbuild in devug logging to find bug in devicename",
|
|
8
|
+
"de": "Fehlerbehebung beim Löschen entdeckter Geräte\nFüge Debug-Logging hinzu, um Fehler im Gerätenamen zu finden.",
|
|
9
|
+
"ru": "Исправлена ошибка удаления обнаруженных устройств.\nДобавлена отладочная запись для поиска ошибок в имени устройства.",
|
|
10
|
+
"pt": "Correção de bug ao excluir dispositivos descobertos\nAdicionar registro de depuração para encontrar bugs no nome do dispositivo",
|
|
11
|
+
"nl": "Bugfix voor het verwijderen van ontdekte apparaten\nBouw debug logging in om bugs in apparaatnaam te vinden",
|
|
12
|
+
"fr": "Correction de bug suppression des périphériques découverts\nIntégration du journal de débogage pour trouver des bugs dans le nom du périphérique",
|
|
13
|
+
"it": "Correzione bug eliminazione dispositivi scoperti\nImplementare il logging di debug per trovare bug nel nome del dispositivo",
|
|
14
|
+
"es": "Corrección de errores al eliminar dispositivos descubiertos.\nImplementación de registro de depuración para encontrar errores en el nombre del dispositivo",
|
|
15
|
+
"pl": "Naprawiono błąd usuwania odkrytych urządzeń.\nZaimplementowano logowanie debugowania w celu znalezienia błędu w nazwie urządzenia.",
|
|
16
|
+
"uk": "Виправлено помилку видалення виявлених пристроїв.\nВбудоване відлагодження для пошуку помилки в імені пристрою.",
|
|
17
|
+
"zh-cn": "修复删除已发现设备时出现的问题\n构建调试日志以查找设备名称中的错误"
|
|
18
|
+
},
|
|
19
|
+
"1.16.6": {
|
|
20
|
+
"en": "Change detection of new Discovery from LoRaWAN devices",
|
|
21
|
+
"de": "Änderung der Erkennung neuer Entdeckungen von LoRaWAN-Geräten",
|
|
22
|
+
"ru": "Обнаружение изменений новых устройств LoRaWAN",
|
|
23
|
+
"pt": "Detecção de novos dispositivos LoRaWAN na Descoberta",
|
|
24
|
+
"nl": "Wijziging in detectie van nieuwe Discovery van LoRaWAN apparaten",
|
|
25
|
+
"fr": "Détection des nouvelles découvertes des dispositifs LoRaWAN",
|
|
26
|
+
"it": "Rilevamento delle nuove scoperte dei dispositivi LoRaWAN",
|
|
27
|
+
"es": "Detección de cambios de nuevos dispositivos de descubrimiento de LoRaWAN",
|
|
28
|
+
"pl": "Wykrywanie zmian w nowym Discovery urządzeń LoRaWAN",
|
|
29
|
+
"uk": "Виявлення нових пристроїв Discovery з LoRaWAN",
|
|
30
|
+
"zh-cn": "更改LoRaWAN设备的新发现检测"
|
|
31
|
+
},
|
|
6
32
|
"1.16.5": {
|
|
7
33
|
"en": "Bugfix in notifications to Bridge (new device dicovered) => namespace not set",
|
|
8
34
|
"de": "Fehlerbehebung bei Benachrichtigungen an Bridge (neues Gerät erkannt) => Namespace nicht festgelegt",
|
|
@@ -67,32 +93,6 @@
|
|
|
67
93
|
"pl": "naprawiono błąd z przestrzenią nazw również w powiadomieniach",
|
|
68
94
|
"uk": "виправлення помилки простору імен також за допомогою сповіщень",
|
|
69
95
|
"zh-cn": "修复命名空间通知问题"
|
|
70
|
-
},
|
|
71
|
-
"1.16.0": {
|
|
72
|
-
"en": "possibility to insert foreign states to bridge by using enum.functions.bridge",
|
|
73
|
-
"de": "Möglichkeit, externe Zustände über enum.functions.bridge in die Bridge einzufügen.",
|
|
74
|
-
"ru": "Возможность вставки внешних состояний в мост путем использования enum.functions.bridge",
|
|
75
|
-
"pt": "possibilidade de inserir estados estrangeiros na ponte usando enum.functions.bridge",
|
|
76
|
-
"nl": "Mogelijkheid om externe toestanden in de brug in te voegen door gebruik te maken van enum.functions.bridge.",
|
|
77
|
-
"fr": "possibilité d'insérer des états étrangers dans le pont en utilisant enum.functions.bridge",
|
|
78
|
-
"it": "Possibilità di inserire stati esterni al bridge utilizzando enum.functions.bridge",
|
|
79
|
-
"es": "Posibilidad de insertar estados extranjeros en el puente utilizando enum.functions.bridge",
|
|
80
|
-
"pl": "możliwość wstawienia stanów zewnętrznych do mostka za pomocą enum.functions.bridge",
|
|
81
|
-
"uk": "Можливість додавання зовнішніх станів до моста за допомогою enum.functions.bridge",
|
|
82
|
-
"zh-cn": "通过使用enum.functions.bridge功能,可以将外部状态插入到桥接器中。"
|
|
83
|
-
},
|
|
84
|
-
"1.15.8": {
|
|
85
|
-
"en": "remove await from some callings",
|
|
86
|
-
"de": "Entferne das „await“ aus einigen Aufrufen.",
|
|
87
|
-
"ru": "Удалите ожидание (await) из некоторых вызовов",
|
|
88
|
-
"pt": "remover await de algumas chamadas",
|
|
89
|
-
"nl": "Verwijder 'await' uit enkele aanroepen.",
|
|
90
|
-
"fr": "supprimer l'attente de certains appels",
|
|
91
|
-
"it": "Rimuovere l'attesa da alcune chiamate.",
|
|
92
|
-
"es": "eliminar await de algunas llamadas",
|
|
93
|
-
"pl": "Usuń oczekiwanie (await) z niektórych wywołań.",
|
|
94
|
-
"uk": "видаліть await із деяких викликів",
|
|
95
|
-
"zh-cn": "从部分调用中删除 await"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"titleLang": {
|
package/lib/modules/bridge.js
CHANGED
|
@@ -234,12 +234,9 @@ class bridgeClass {
|
|
|
234
234
|
this.adapter.log.debug(`Function ${activeFunction} started.`);
|
|
235
235
|
try {
|
|
236
236
|
if (this.bridgeMqttClient.internalConnectionstate) {
|
|
237
|
-
const
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
// On startup this ist mostly true, but the genereal notification id will set later.
|
|
241
|
-
// So there is no notificaton published to Bridge
|
|
242
|
-
if (countBefore !== Object.keys(this.Notifications).length) {
|
|
237
|
+
const newNotification = await this.discovery(id, options);
|
|
238
|
+
// notify new discovered Devices (new notification)
|
|
239
|
+
if (newNotification) {
|
|
243
240
|
const device = this.DiscoveredIds[id].informations.usedDeviceId;
|
|
244
241
|
const application = this.DiscoveredIds[id].informations.usedApplicationName;
|
|
245
242
|
const message = `${this.adapter.i18nTranslation['new device discovered']}.\n${this.adapter.i18nTranslation['Device']}: ${device}\n${this.adapter.i18nTranslation['Application']}: ${application}`;
|
|
@@ -280,10 +277,10 @@ class bridgeClass {
|
|
|
280
277
|
if (!this.CheckedIds[id] || (options && options.forceDiscovery)) {
|
|
281
278
|
this.CheckedIds[id] = {};
|
|
282
279
|
this.adapter.log.debug(`discover the id ${id}`);
|
|
283
|
-
await this.buildDiscovery(id, options);
|
|
284
|
-
} else {
|
|
285
|
-
this.adapter.log.debug(`${id} allready checked for discovery`);
|
|
280
|
+
return await this.buildDiscovery(id, options);
|
|
286
281
|
}
|
|
282
|
+
this.adapter.log.debug(`${id} allready checked for discovery`);
|
|
283
|
+
return false;
|
|
287
284
|
} catch (error) {
|
|
288
285
|
this.adapter.log.error(`error at ${activeFunction}: ${error}`);
|
|
289
286
|
}
|
|
@@ -398,7 +395,9 @@ class bridgeClass {
|
|
|
398
395
|
usedDeviceId: changeInfo.usedDeviceId,
|
|
399
396
|
},
|
|
400
397
|
});
|
|
398
|
+
return true;
|
|
401
399
|
}
|
|
400
|
+
return false;
|
|
402
401
|
} catch (error) {
|
|
403
402
|
this.adapter.log.error(`error at ${activeFunction}: ${error}`);
|
|
404
403
|
}
|
|
@@ -817,6 +816,8 @@ class bridgeClass {
|
|
|
817
816
|
const activeFunction = 'bridge.js - buildDiscovery';
|
|
818
817
|
this.adapter.log.debug(`Function ${activeFunction} started.`);
|
|
819
818
|
try {
|
|
819
|
+
// Defaultvalue for discover
|
|
820
|
+
let newNotification = false;
|
|
820
821
|
// Query for decoded Folder
|
|
821
822
|
if (id.includes(`${this.adapter.messagehandler.directoryhandler.reachableSubfolders.uplinkDecoded}.`)) {
|
|
822
823
|
const changeInfo = await this.adapter.getChangeInfo(id);
|
|
@@ -876,7 +877,11 @@ class bridgeClass {
|
|
|
876
877
|
usedDeviceId: changeInfo.usedDeviceId,
|
|
877
878
|
},
|
|
878
879
|
});
|
|
879
|
-
await this.discoverDeviceNotifications(changeInfo)
|
|
880
|
+
if (await this.discoverDeviceNotifications(changeInfo)) {
|
|
881
|
+
newNotification = true;
|
|
882
|
+
} else {
|
|
883
|
+
newNotification = false;
|
|
884
|
+
}
|
|
880
885
|
}
|
|
881
886
|
}
|
|
882
887
|
|
|
@@ -950,10 +955,15 @@ class bridgeClass {
|
|
|
950
955
|
usedDeviceId: changeInfo.usedDeviceId,
|
|
951
956
|
},
|
|
952
957
|
});
|
|
953
|
-
await this.discoverDeviceNotifications(changeInfo)
|
|
958
|
+
if (await this.discoverDeviceNotifications(changeInfo)) {
|
|
959
|
+
newNotification = true;
|
|
960
|
+
} else {
|
|
961
|
+
newNotification = false;
|
|
962
|
+
}
|
|
954
963
|
}
|
|
955
964
|
}
|
|
956
965
|
}
|
|
966
|
+
return newNotification;
|
|
957
967
|
} catch (error) {
|
|
958
968
|
this.adapter.log.error(`error at ${activeFunction}: ${error}`);
|
|
959
969
|
}
|
|
@@ -1579,35 +1589,41 @@ class bridgeClass {
|
|
|
1579
1589
|
* @param clear clear the ids from internal memory
|
|
1580
1590
|
*/
|
|
1581
1591
|
async discoverForeignRange(id, clear = false) {
|
|
1582
|
-
const
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
delete this.ForeignBridgeMembers[id];
|
|
1590
|
-
}
|
|
1591
|
-
const states = await this.adapter.getObjectViewAsync('system', 'state', params);
|
|
1592
|
-
for (const state of states.rows) {
|
|
1592
|
+
const activeFunction = 'bridge.js - discoverForeignRange';
|
|
1593
|
+
this.adapter.log.debug(`Function ${activeFunction} started.`);
|
|
1594
|
+
try {
|
|
1595
|
+
const params = {
|
|
1596
|
+
startkey: id,
|
|
1597
|
+
endkey: `${id}.\u9999`,
|
|
1598
|
+
};
|
|
1593
1599
|
if (!clear) {
|
|
1594
|
-
|
|
1595
|
-
await this.discoverForeignStandardEntity(state.id, { common: common });
|
|
1600
|
+
this.ForeignBridgeMembers[id] = id;
|
|
1596
1601
|
} else {
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
) {
|
|
1602
|
-
|
|
1602
|
+
delete this.ForeignBridgeMembers[id];
|
|
1603
|
+
}
|
|
1604
|
+
const states = await this.adapter.getObjectViewAsync('system', 'state', params);
|
|
1605
|
+
for (const state of states.rows) {
|
|
1606
|
+
if (!clear) {
|
|
1607
|
+
const common = state.value.common;
|
|
1608
|
+
await this.discoverForeignStandardEntity(state.id, { common: common });
|
|
1609
|
+
} else {
|
|
1610
|
+
if (
|
|
1611
|
+
this.DiscoveredIds[state.id] &&
|
|
1612
|
+
this.DiscoveredIds[state.id].payload &&
|
|
1613
|
+
this.DiscoveredIds[state.id].payload.command_topic
|
|
1614
|
+
) {
|
|
1615
|
+
delete this.SubscribedTopics[this.DiscoveredIds[state.id].payload.command_topic];
|
|
1616
|
+
}
|
|
1617
|
+
delete this.PublishedIds[state.id];
|
|
1618
|
+
this.DiscoveredIds[state.id].payload = {};
|
|
1619
|
+
await this.adapter.unsubscribeForeignStatesAsync(state.id);
|
|
1620
|
+
await this.publishDiscovery(state.id, this.DiscoveredIds[state.id]);
|
|
1621
|
+
delete this.DiscoveredIds[state.id];
|
|
1622
|
+
await this.adapter.setState('info.discoveredIds', JSON.stringify(this.DiscoveredIds), true);
|
|
1603
1623
|
}
|
|
1604
|
-
delete this.PublishedIds[id];
|
|
1605
|
-
this.DiscoveredIds[id].payload = {};
|
|
1606
|
-
await this.adapter.unsubscribeForeignStatesAsync(id);
|
|
1607
|
-
await this.publishDiscovery(id, this.DiscoveredIds[id]);
|
|
1608
|
-
delete this.DiscoveredIds[id];
|
|
1609
|
-
await this.adapter.setState('info.discoveredIds', JSON.stringify(this.DiscoveredIds), true);
|
|
1610
1624
|
}
|
|
1625
|
+
} catch (error) {
|
|
1626
|
+
this.adapter.log.error(`error at ${activeFunction}: ${error} - id: ${id} - clear: ${clear}`);
|
|
1611
1627
|
}
|
|
1612
1628
|
}
|
|
1613
1629
|
|
|
@@ -1623,21 +1639,39 @@ class bridgeClass {
|
|
|
1623
1639
|
let partentId = '';
|
|
1624
1640
|
let parentName = '';
|
|
1625
1641
|
const parentDevice = await this.getParentDevice(id);
|
|
1626
|
-
if (typeof parentDevice
|
|
1642
|
+
if (typeof parentDevice !== 'object') {
|
|
1643
|
+
this.adapter.log.debug(`Parentdevice: ${parentDevice}`);
|
|
1627
1644
|
const parentChannel = await this.getParentChannel(id);
|
|
1628
|
-
if (typeof parentChannel
|
|
1629
|
-
|
|
1645
|
+
if (typeof parentChannel !== 'object') {
|
|
1646
|
+
if (parentChannel === undefined) {
|
|
1647
|
+
const indexOfFistDot = id.indexOf('.');
|
|
1648
|
+
const indexOfSecondDot = id.indexOf('.', indexOfFistDot);
|
|
1649
|
+
partentId = id.substring(0, indexOfSecondDot);
|
|
1650
|
+
} else {
|
|
1651
|
+
partentId = parentChannel;
|
|
1652
|
+
}
|
|
1630
1653
|
parentName = partentId;
|
|
1631
1654
|
} else {
|
|
1655
|
+
this.adapter.log.debug(`Parentchannel: ${JSON.stringify(parentChannel)}`);
|
|
1632
1656
|
partentId = parentChannel._id;
|
|
1633
|
-
|
|
1657
|
+
if (typeof parentChannel.common.name === 'string') {
|
|
1658
|
+
parentName = parentChannel.common.name;
|
|
1659
|
+
} else {
|
|
1660
|
+
parentName = parentChannel.common.name.de;
|
|
1661
|
+
}
|
|
1634
1662
|
}
|
|
1635
1663
|
} else {
|
|
1664
|
+
this.adapter.log.debug(`Parentdevice: ${JSON.stringify(parentDevice)}`);
|
|
1636
1665
|
partentId = parentDevice._id;
|
|
1637
|
-
|
|
1666
|
+
if (typeof parentDevice.common.name === 'string') {
|
|
1667
|
+
parentName = parentDevice.common.name;
|
|
1668
|
+
} else {
|
|
1669
|
+
parentName = parentDevice.common.name.de;
|
|
1670
|
+
}
|
|
1638
1671
|
}
|
|
1639
1672
|
const deviceIdentifier = parentName;
|
|
1640
1673
|
const statename = id.substring(partentId.length + 1, id.length);
|
|
1674
|
+
this.adapter.log.debug(`Assigned - deviceIdentifier: ${deviceIdentifier} - statename: ${statename}`);
|
|
1641
1675
|
options.Bridgestate = {
|
|
1642
1676
|
publish: options.common.read,
|
|
1643
1677
|
subscribe: options.common.write,
|
package/main.js
CHANGED
|
@@ -422,26 +422,31 @@ class Lorawan extends utils.Adapter {
|
|
|
422
422
|
*/
|
|
423
423
|
async onObjectChange(id, obj) {
|
|
424
424
|
this.log.debug(`${id} is changed into ${JSON.stringify(obj.common)}`);
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
//
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
425
|
+
const activeFunction = 'main.js - onObjectChange';
|
|
426
|
+
this.log.debug(`Function ${activeFunction} started.`);
|
|
427
|
+
try {
|
|
428
|
+
// Only work, if bridge is activ
|
|
429
|
+
if (this.bridge) {
|
|
430
|
+
// Erzeugen der HA Bridged für Control
|
|
431
|
+
// check for new Entry
|
|
432
|
+
const members = obj.common.members;
|
|
433
|
+
for (const member of members) {
|
|
434
|
+
if (!this.bridge.ForeignBridgeMembers[member]) {
|
|
435
|
+
await this.bridge?.discoverForeignRange(member);
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
435
438
|
}
|
|
436
|
-
}
|
|
437
439
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
440
|
+
// check for Entry removed
|
|
441
|
+
for (const member of Object.values(this.bridge.ForeignBridgeMembers)) {
|
|
442
|
+
if (!members.includes(member)) {
|
|
443
|
+
await this.bridge.discoverForeignRange(member, true);
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
443
446
|
}
|
|
444
447
|
}
|
|
448
|
+
} catch (error) {
|
|
449
|
+
this.log.error(`error at ${activeFunction}: ${error}`);
|
|
445
450
|
}
|
|
446
451
|
}
|
|
447
452
|
|