iobroker.lorawan 1.16.6 → 1.16.8
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/admin/i18n/de/translations.json +3 -1
- package/admin/i18n/en/translations.json +3 -1
- package/admin/i18n/es/translations.json +3 -1
- package/admin/i18n/fr/translations.json +3 -1
- package/admin/i18n/it/translations.json +3 -1
- package/admin/i18n/nl/translations.json +3 -1
- package/admin/i18n/pl/translations.json +3 -1
- package/admin/i18n/pt/translations.json +3 -1
- package/admin/i18n/ru/translations.json +3 -1
- package/admin/i18n/uk/translations.json +3 -1
- package/admin/i18n/zh-cn/translations.json +3 -1
- package/admin/jsonConfig.json +15 -1
- package/io-package.json +28 -27
- package/lib/modules/bridge.js +62 -36
- package/main.js +48 -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.8 (2025-09-17)
|
|
27
|
+
* (BenAhrdt) Bring enum selection in config
|
|
28
|
+
|
|
29
|
+
### 1.16.7 (2025-09-17)
|
|
30
|
+
* (BenAhrdt) Bugfix deleting discovered devices
|
|
31
|
+
* (BenAhrdt) build in devug logging to find bug in devicename
|
|
32
|
+
|
|
26
33
|
### 1.16.6 (2025-09-17)
|
|
27
34
|
* (BenAhrdt) Change detection of new Discovery from LoRaWAN devices
|
|
28
35
|
|
|
@@ -159,5 +159,7 @@
|
|
|
159
159
|
"connection to bridge is activ": "Die Verbindung zur Bridge ist aktiv",
|
|
160
160
|
"connection to bridge is closed": "Die Verbindung zur Bridge ist geschlossen",
|
|
161
161
|
"new device discovered": "Neues Gerät discovered",
|
|
162
|
-
"Adapter will be stoped": "Der LoRaWAN Bridge Adapter wurde gestoppt"
|
|
162
|
+
"Adapter will be stoped": "Der LoRaWAN Bridge Adapter wurde gestoppt",
|
|
163
|
+
"BridgeEnum": "Bridge enum",
|
|
164
|
+
"BridgeEnumTooltip": "Wählen Sie eine enum (Kategorie) aus, die verwendet werden soll, um Adapter fremde States zur Bridge zu übertragen"
|
|
163
165
|
}
|
|
@@ -159,5 +159,7 @@
|
|
|
159
159
|
"connection to bridge is activ": "connection to bridge is activ",
|
|
160
160
|
"connection to bridge is closed": "connection to bridge will be closed",
|
|
161
161
|
"new device discovered": "new device discovered",
|
|
162
|
-
"Adapter will be stoped": "The LoRaWAN Bridge Adapter will be stoped"
|
|
162
|
+
"Adapter will be stoped": "The LoRaWAN Bridge Adapter will be stoped",
|
|
163
|
+
"BridgeEnum": "Bridge Enum",
|
|
164
|
+
"BridgeEnumTooltip": "Select an enum, that is used for bringing foreign states to the bridge"
|
|
163
165
|
}
|
|
@@ -159,5 +159,7 @@
|
|
|
159
159
|
"connection to bridge is activ": "La conexión al puente es activado",
|
|
160
160
|
"connection to bridge is closed": "La conexión al puente se cerrará",
|
|
161
161
|
"new device discovered": "nuevo dispositivo descubierto",
|
|
162
|
-
"Adapter will be stoped": "El adaptador del puente Lorawan se detendrá"
|
|
162
|
+
"Adapter will be stoped": "El adaptador del puente Lorawan se detendrá",
|
|
163
|
+
"BridgeEnum": "Enum de puente",
|
|
164
|
+
"BridgeEnumTooltip": "Seleccione una enumación, que se usa para llevar estados extranjeros al puente"
|
|
163
165
|
}
|
|
@@ -159,5 +159,7 @@
|
|
|
159
159
|
"connection to bridge is activ": "La connexion au pont est activ",
|
|
160
160
|
"connection to bridge is closed": "La connexion au pont sera fermée",
|
|
161
161
|
"new device discovered": "Nouvel appareil découvert",
|
|
162
|
-
"Adapter will be stoped": "L'adaptateur de pont Lorawan sera arrêté"
|
|
162
|
+
"Adapter will be stoped": "L'adaptateur de pont Lorawan sera arrêté",
|
|
163
|
+
"BridgeEnum": "Énumération du pont",
|
|
164
|
+
"BridgeEnumTooltip": "Sélectionnez une énumération, qui est utilisée pour amener des états étrangers au pont"
|
|
163
165
|
}
|
|
@@ -159,5 +159,7 @@
|
|
|
159
159
|
"connection to bridge is activ": "La connessione a bridge è attiva",
|
|
160
160
|
"connection to bridge is closed": "La connessione al ponte sarà chiusa",
|
|
161
161
|
"new device discovered": "Nuovo dispositivo scoperto",
|
|
162
|
-
"Adapter will be stoped": "L'adattatore del ponte Lorawan sarà fermato"
|
|
162
|
+
"Adapter will be stoped": "L'adattatore del ponte Lorawan sarà fermato",
|
|
163
|
+
"BridgeEnum": "Ponte enum",
|
|
164
|
+
"BridgeEnumTooltip": "Seleziona un enum, che viene utilizzato per portare stati stranieri sul ponte"
|
|
163
165
|
}
|
|
@@ -159,5 +159,7 @@
|
|
|
159
159
|
"connection to bridge is activ": "Verbinding met Bridge is activ",
|
|
160
160
|
"connection to bridge is closed": "Verbinding met Bridge wordt gesloten",
|
|
161
161
|
"new device discovered": "Nieuw apparaat ontdekt",
|
|
162
|
-
"Adapter will be stoped": "De Lorawan Bridge -adapter wordt gestopt"
|
|
162
|
+
"Adapter will be stoped": "De Lorawan Bridge -adapter wordt gestopt",
|
|
163
|
+
"BridgeEnum": "Brug -opsomming",
|
|
164
|
+
"BridgeEnumTooltip": "Selecteer een opsomming, dat wordt gebruikt om buitenlandse staten naar de brug te brengen"
|
|
163
165
|
}
|
|
@@ -159,5 +159,7 @@
|
|
|
159
159
|
"connection to bridge is activ": "Połączenie z mostem jest aktywne",
|
|
160
160
|
"connection to bridge is closed": "Połączenie z mostem zostanie zamknięte",
|
|
161
161
|
"new device discovered": "odkryte nowe urządzenie",
|
|
162
|
-
"Adapter will be stoped": "Adapter mostu Lorawan zostanie zatrzymany"
|
|
162
|
+
"Adapter will be stoped": "Adapter mostu Lorawan zostanie zatrzymany",
|
|
163
|
+
"BridgeEnum": "Most Enum",
|
|
164
|
+
"BridgeEnumTooltip": "Wybierz enum, które służy do przeniesienia obcego państw na most"
|
|
163
165
|
}
|
|
@@ -159,5 +159,7 @@
|
|
|
159
159
|
"connection to bridge is activ": "A conexão com a ponte é ativista",
|
|
160
160
|
"connection to bridge is closed": "A conexão com a ponte será fechada",
|
|
161
161
|
"new device discovered": "novo dispositivo descoberto",
|
|
162
|
-
"Adapter will be stoped": "O adaptador da ponte Lorawan será interrompido"
|
|
162
|
+
"Adapter will be stoped": "O adaptador da ponte Lorawan será interrompido",
|
|
163
|
+
"BridgeEnum": "Enumeração da ponte",
|
|
164
|
+
"BridgeEnumTooltip": "Selecione uma enumeração, usada para trazer estados estrangeiros para a ponte"
|
|
163
165
|
}
|
|
@@ -159,5 +159,7 @@
|
|
|
159
159
|
"connection to bridge is activ": "Соединение с мостом является активацией",
|
|
160
160
|
"connection to bridge is closed": "Соединение с мостом будет закрыто",
|
|
161
161
|
"new device discovered": "Новое устройство обнаружено",
|
|
162
|
-
"Adapter will be stoped": "Адаптер моста Лораван будет остановлен"
|
|
162
|
+
"Adapter will be stoped": "Адаптер моста Лораван будет остановлен",
|
|
163
|
+
"BridgeEnum": "Мост enum",
|
|
164
|
+
"BridgeEnumTooltip": "Выберите перечисление, которое используется для привлечения иностранных государств на мост"
|
|
163
165
|
}
|
|
@@ -159,5 +159,7 @@
|
|
|
159
159
|
"connection to bridge is activ": "Підключення до мосту активується",
|
|
160
160
|
"connection to bridge is closed": "Підключення до мосту буде закрито",
|
|
161
161
|
"new device discovered": "Виявлений новий пристрій",
|
|
162
|
-
"Adapter will be stoped": "Адаптер мосту Лоравана буде зупинено"
|
|
162
|
+
"Adapter will be stoped": "Адаптер мосту Лоравана буде зупинено",
|
|
163
|
+
"BridgeEnum": "Мост",
|
|
164
|
+
"BridgeEnumTooltip": "Виберіть Enum, який використовується для залучення іноземних держав до мосту"
|
|
163
165
|
}
|
|
@@ -159,5 +159,7 @@
|
|
|
159
159
|
"connection to bridge is activ": "连接到桥梁是激活",
|
|
160
160
|
"connection to bridge is closed": "连接到桥梁将关闭",
|
|
161
161
|
"new device discovered": "发现了新设备",
|
|
162
|
-
"Adapter will be stoped": "Lorawan桥适配器将停止"
|
|
162
|
+
"Adapter will be stoped": "Lorawan桥适配器将停止",
|
|
163
|
+
"BridgeEnum": "桥梁枚举",
|
|
164
|
+
"BridgeEnumTooltip": "选择一个枚举,用于将外国带到桥梁"
|
|
163
165
|
}
|
package/admin/jsonConfig.json
CHANGED
|
@@ -783,7 +783,21 @@
|
|
|
783
783
|
"md": 2,
|
|
784
784
|
"lg": 2,
|
|
785
785
|
"xl": 2
|
|
786
|
-
|
|
786
|
+
},
|
|
787
|
+
"BridgeEnum": {
|
|
788
|
+
"type": "selectSendTo",
|
|
789
|
+
"label": "BridgeEnum",
|
|
790
|
+
"tooltip": "BridgeEnumTooltip",
|
|
791
|
+
"default": "",
|
|
792
|
+
"jsonData": "{}",
|
|
793
|
+
"command": "getEnums",
|
|
794
|
+
"hidden": "data.BridgeType === 'off'",
|
|
795
|
+
"xs": 12,
|
|
796
|
+
"sm": 5,
|
|
797
|
+
"md": 5,
|
|
798
|
+
"lg": 5,
|
|
799
|
+
"xl": 5
|
|
800
|
+
},
|
|
787
801
|
"BridgenotificationActivation":{
|
|
788
802
|
"newLine": true,
|
|
789
803
|
"type": "select",
|
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.8",
|
|
5
5
|
"news": {
|
|
6
|
+
"1.16.8": {
|
|
7
|
+
"en": "Bring enum selection in config",
|
|
8
|
+
"de": "Fügen Sie die Auswahlmöglichkeit für Aufzählungen in der Konfiguration hinzu.",
|
|
9
|
+
"ru": "Добавлена возможность выбора значения из перечисления в настройках",
|
|
10
|
+
"pt": "Trazer seleção de enumeração na configuração",
|
|
11
|
+
"nl": "Breng de enum-selectie in de configuratie",
|
|
12
|
+
"fr": "Apporter la sélection d'énumération dans la configuration",
|
|
13
|
+
"it": "Porta la selezione dell'enum nella configurazione",
|
|
14
|
+
"es": "Traer selección de enum en la configuración",
|
|
15
|
+
"pl": "Przynieś wybór enum w konfiguracji",
|
|
16
|
+
"uk": "Додано вибір типу даних \"enum\" в налаштуваннях (config).",
|
|
17
|
+
"zh-cn": "在配置中添加枚举选择"
|
|
18
|
+
},
|
|
19
|
+
"1.16.7": {
|
|
20
|
+
"en": "Bugfix deleting discovered devices\nbuild in devug logging to find bug in devicename",
|
|
21
|
+
"de": "Fehlerbehebung beim Löschen entdeckter Geräte\nFüge Debug-Logging hinzu, um Fehler im Gerätenamen zu finden.",
|
|
22
|
+
"ru": "Исправлена ошибка удаления обнаруженных устройств.\nДобавлена отладочная запись для поиска ошибок в имени устройства.",
|
|
23
|
+
"pt": "Correção de bug ao excluir dispositivos descobertos\nAdicionar registro de depuração para encontrar bugs no nome do dispositivo",
|
|
24
|
+
"nl": "Bugfix voor het verwijderen van ontdekte apparaten\nBouw debug logging in om bugs in apparaatnaam te vinden",
|
|
25
|
+
"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",
|
|
26
|
+
"it": "Correzione bug eliminazione dispositivi scoperti\nImplementare il logging di debug per trovare bug nel nome del dispositivo",
|
|
27
|
+
"es": "Corrección de errores al eliminar dispositivos descubiertos.\nImplementación de registro de depuración para encontrar errores en el nombre del dispositivo",
|
|
28
|
+
"pl": "Naprawiono błąd usuwania odkrytych urządzeń.\nZaimplementowano logowanie debugowania w celu znalezienia błędu w nazwie urządzenia.",
|
|
29
|
+
"uk": "Виправлено помилку видалення виявлених пристроїв.\nВбудоване відлагодження для пошуку помилки в імені пристрою.",
|
|
30
|
+
"zh-cn": "修复删除已发现设备时出现的问题\n构建调试日志以查找设备名称中的错误"
|
|
31
|
+
},
|
|
6
32
|
"1.16.6": {
|
|
7
33
|
"en": "Change detection of new Discovery from LoRaWAN devices",
|
|
8
34
|
"de": "Änderung der Erkennung neuer Entdeckungen von LoRaWAN-Geräten",
|
|
@@ -67,32 +93,6 @@
|
|
|
67
93
|
"pl": "Poprawka błędu: przestrzeń nazw również wywoływana przez funkcję work z directoryhandler",
|
|
68
94
|
"uk": "виправлено помилку у просторі імен також шляхом виклику роботи з обробника директорій",
|
|
69
95
|
"zh-cn": "通过调用`directoryhandler`来修复了`namespace`问题。"
|
|
70
|
-
},
|
|
71
|
-
"1.16.1": {
|
|
72
|
-
"en": "bugfix namespace also by notifications",
|
|
73
|
-
"de": "Fehlerbehebung Namespace auch bei Benachrichtigungen",
|
|
74
|
-
"ru": "исправлена ошибка с пространством имён также для уведомлений",
|
|
75
|
-
"pt": "Correção de bug no namespace também por notificações.",
|
|
76
|
-
"nl": "bugfix namespace ook bij meldingen",
|
|
77
|
-
"fr": "Correction d'un bug concernant les notifications de namespace.",
|
|
78
|
-
"it": "Risolto bug anche per i namespace nelle notifiche",
|
|
79
|
-
"es": "Corrección de error en el espacio de nombres también por notificaciones.",
|
|
80
|
-
"pl": "naprawiono błąd z przestrzenią nazw również w powiadomieniach",
|
|
81
|
-
"uk": "виправлення помилки простору імен також за допомогою сповіщень",
|
|
82
|
-
"zh-cn": "修复命名空间通知问题"
|
|
83
|
-
},
|
|
84
|
-
"1.16.0": {
|
|
85
|
-
"en": "possibility to insert foreign states to bridge by using enum.functions.bridge",
|
|
86
|
-
"de": "Möglichkeit, externe Zustände über enum.functions.bridge in die Bridge einzufügen.",
|
|
87
|
-
"ru": "Возможность вставки внешних состояний в мост путем использования enum.functions.bridge",
|
|
88
|
-
"pt": "possibilidade de inserir estados estrangeiros na ponte usando enum.functions.bridge",
|
|
89
|
-
"nl": "Mogelijkheid om externe toestanden in de brug in te voegen door gebruik te maken van enum.functions.bridge.",
|
|
90
|
-
"fr": "possibilité d'insérer des états étrangers dans le pont en utilisant enum.functions.bridge",
|
|
91
|
-
"it": "Possibilità di inserire stati esterni al bridge utilizzando enum.functions.bridge",
|
|
92
|
-
"es": "Posibilidad de insertar estados extranjeros en el puente utilizando enum.functions.bridge",
|
|
93
|
-
"pl": "możliwość wstawienia stanów zewnętrznych do mostka za pomocą enum.functions.bridge",
|
|
94
|
-
"uk": "Можливість додавання зовнішніх станів до моста за допомогою enum.functions.bridge",
|
|
95
|
-
"zh-cn": "通过使用enum.functions.bridge功能,可以将外部状态插入到桥接器中。"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"titleLang": {
|
|
@@ -422,6 +422,7 @@
|
|
|
422
422
|
"BridgeType": "off",
|
|
423
423
|
"EnableRefresh": true,
|
|
424
424
|
"RefreshDiscoveryCronJob": "0 * * * *",
|
|
425
|
+
"BridgeEnum": "",
|
|
425
426
|
"BridgenotificationActivation": "allNotifications, brdigeConnection, newDiscover, deviceState",
|
|
426
427
|
"BridgeDevicenotificationActivation": "allNotifications, brdigeConnection, newDiscover, deviceState",
|
|
427
428
|
"DeviceIdentifiers": [
|
package/lib/modules/bridge.js
CHANGED
|
@@ -1571,12 +1571,14 @@ class bridgeClass {
|
|
|
1571
1571
|
const activeFunction = 'bridge.js - getForeignStatesForStandardEntities';
|
|
1572
1572
|
this.adapter.log.debug(`Function ${activeFunction} started.`);
|
|
1573
1573
|
try {
|
|
1574
|
-
const idBridgefunction =
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1574
|
+
const idBridgefunction = this.adapter.config.BridgeEnum;
|
|
1575
|
+
if (idBridgefunction !== '') {
|
|
1576
|
+
await this.adapter.subscribeForeignObjectsAsync(idBridgefunction);
|
|
1577
|
+
const bridgeElements = await this.adapter.getForeignObjectAsync(idBridgefunction);
|
|
1578
|
+
if (bridgeElements) {
|
|
1579
|
+
for (const member of bridgeElements.common.members) {
|
|
1580
|
+
await this.discoverForeignRange(member);
|
|
1581
|
+
}
|
|
1580
1582
|
}
|
|
1581
1583
|
}
|
|
1582
1584
|
} catch (error) {
|
|
@@ -1589,35 +1591,41 @@ class bridgeClass {
|
|
|
1589
1591
|
* @param clear clear the ids from internal memory
|
|
1590
1592
|
*/
|
|
1591
1593
|
async discoverForeignRange(id, clear = false) {
|
|
1592
|
-
const
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
delete this.ForeignBridgeMembers[id];
|
|
1600
|
-
}
|
|
1601
|
-
const states = await this.adapter.getObjectViewAsync('system', 'state', params);
|
|
1602
|
-
for (const state of states.rows) {
|
|
1594
|
+
const activeFunction = 'bridge.js - discoverForeignRange';
|
|
1595
|
+
this.adapter.log.debug(`Function ${activeFunction} started.`);
|
|
1596
|
+
try {
|
|
1597
|
+
const params = {
|
|
1598
|
+
startkey: id,
|
|
1599
|
+
endkey: `${id}.\u9999`,
|
|
1600
|
+
};
|
|
1603
1601
|
if (!clear) {
|
|
1604
|
-
|
|
1605
|
-
await this.discoverForeignStandardEntity(state.id, { common: common });
|
|
1602
|
+
this.ForeignBridgeMembers[id] = id;
|
|
1606
1603
|
} else {
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
) {
|
|
1612
|
-
|
|
1604
|
+
delete this.ForeignBridgeMembers[id];
|
|
1605
|
+
}
|
|
1606
|
+
const states = await this.adapter.getObjectViewAsync('system', 'state', params);
|
|
1607
|
+
for (const state of states.rows) {
|
|
1608
|
+
if (!clear) {
|
|
1609
|
+
const common = state.value.common;
|
|
1610
|
+
await this.discoverForeignStandardEntity(state.id, { common: common });
|
|
1611
|
+
} else {
|
|
1612
|
+
if (
|
|
1613
|
+
this.DiscoveredIds[state.id] &&
|
|
1614
|
+
this.DiscoveredIds[state.id].payload &&
|
|
1615
|
+
this.DiscoveredIds[state.id].payload.command_topic
|
|
1616
|
+
) {
|
|
1617
|
+
delete this.SubscribedTopics[this.DiscoveredIds[state.id].payload.command_topic];
|
|
1618
|
+
}
|
|
1619
|
+
delete this.PublishedIds[state.id];
|
|
1620
|
+
this.DiscoveredIds[state.id].payload = {};
|
|
1621
|
+
await this.adapter.unsubscribeForeignStatesAsync(state.id);
|
|
1622
|
+
await this.publishDiscovery(state.id, this.DiscoveredIds[state.id]);
|
|
1623
|
+
delete this.DiscoveredIds[state.id];
|
|
1624
|
+
await this.adapter.setState('info.discoveredIds', JSON.stringify(this.DiscoveredIds), true);
|
|
1613
1625
|
}
|
|
1614
|
-
delete this.PublishedIds[id];
|
|
1615
|
-
this.DiscoveredIds[id].payload = {};
|
|
1616
|
-
await this.adapter.unsubscribeForeignStatesAsync(id);
|
|
1617
|
-
await this.publishDiscovery(id, this.DiscoveredIds[id]);
|
|
1618
|
-
delete this.DiscoveredIds[id];
|
|
1619
|
-
await this.adapter.setState('info.discoveredIds', JSON.stringify(this.DiscoveredIds), true);
|
|
1620
1626
|
}
|
|
1627
|
+
} catch (error) {
|
|
1628
|
+
this.adapter.log.error(`error at ${activeFunction}: ${error} - id: ${id} - clear: ${clear}`);
|
|
1621
1629
|
}
|
|
1622
1630
|
}
|
|
1623
1631
|
|
|
@@ -1633,21 +1641,39 @@ class bridgeClass {
|
|
|
1633
1641
|
let partentId = '';
|
|
1634
1642
|
let parentName = '';
|
|
1635
1643
|
const parentDevice = await this.getParentDevice(id);
|
|
1636
|
-
if (typeof parentDevice
|
|
1644
|
+
if (typeof parentDevice !== 'object') {
|
|
1645
|
+
this.adapter.log.debug(`Parentdevice: ${parentDevice}`);
|
|
1637
1646
|
const parentChannel = await this.getParentChannel(id);
|
|
1638
|
-
if (typeof parentChannel
|
|
1639
|
-
|
|
1647
|
+
if (typeof parentChannel !== 'object') {
|
|
1648
|
+
if (parentChannel === undefined) {
|
|
1649
|
+
const indexOfFistDot = id.indexOf('.');
|
|
1650
|
+
const indexOfSecondDot = id.indexOf('.', indexOfFistDot);
|
|
1651
|
+
partentId = id.substring(0, indexOfSecondDot);
|
|
1652
|
+
} else {
|
|
1653
|
+
partentId = parentChannel;
|
|
1654
|
+
}
|
|
1640
1655
|
parentName = partentId;
|
|
1641
1656
|
} else {
|
|
1657
|
+
this.adapter.log.debug(`Parentchannel: ${JSON.stringify(parentChannel)}`);
|
|
1642
1658
|
partentId = parentChannel._id;
|
|
1643
|
-
|
|
1659
|
+
if (typeof parentChannel.common.name === 'string') {
|
|
1660
|
+
parentName = parentChannel.common.name;
|
|
1661
|
+
} else {
|
|
1662
|
+
parentName = parentChannel.common.name.de;
|
|
1663
|
+
}
|
|
1644
1664
|
}
|
|
1645
1665
|
} else {
|
|
1666
|
+
this.adapter.log.debug(`Parentdevice: ${JSON.stringify(parentDevice)}`);
|
|
1646
1667
|
partentId = parentDevice._id;
|
|
1647
|
-
|
|
1668
|
+
if (typeof parentDevice.common.name === 'string') {
|
|
1669
|
+
parentName = parentDevice.common.name;
|
|
1670
|
+
} else {
|
|
1671
|
+
parentName = parentDevice.common.name.de;
|
|
1672
|
+
}
|
|
1648
1673
|
}
|
|
1649
1674
|
const deviceIdentifier = parentName;
|
|
1650
1675
|
const statename = id.substring(partentId.length + 1, id.length);
|
|
1676
|
+
this.adapter.log.debug(`Assigned - deviceIdentifier: ${deviceIdentifier} - statename: ${statename}`);
|
|
1651
1677
|
options.Bridgestate = {
|
|
1652
1678
|
publish: options.common.read,
|
|
1653
1679
|
subscribe: options.common.write,
|
package/main.js
CHANGED
|
@@ -34,6 +34,8 @@ class Lorawan extends utils.Adapter {
|
|
|
34
34
|
|
|
35
35
|
// Simulation variables
|
|
36
36
|
this.simulation = {};
|
|
37
|
+
this.mySystemConfig;
|
|
38
|
+
this.language;
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
onFileChange(_id, _fileName, _size) {
|
|
@@ -50,6 +52,10 @@ class Lorawan extends utils.Adapter {
|
|
|
50
52
|
// read system translation out of i18n translation
|
|
51
53
|
this.i18nTranslation = await this.geti18nTranslation();
|
|
52
54
|
|
|
55
|
+
// get systemconfig and configued language
|
|
56
|
+
this.mySystemConfig = await this.getForeignObjectAsync('system.config');
|
|
57
|
+
this.language = this.mySystemConfig?.common.language || 'en';
|
|
58
|
+
|
|
53
59
|
// create downlinkConfigs
|
|
54
60
|
this.downlinkConfighandler = new downlinkConfighandlerClass(this);
|
|
55
61
|
|
|
@@ -422,26 +428,31 @@ class Lorawan extends utils.Adapter {
|
|
|
422
428
|
*/
|
|
423
429
|
async onObjectChange(id, obj) {
|
|
424
430
|
this.log.debug(`${id} is changed into ${JSON.stringify(obj.common)}`);
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
//
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
431
|
+
const activeFunction = 'main.js - onObjectChange';
|
|
432
|
+
this.log.debug(`Function ${activeFunction} started.`);
|
|
433
|
+
try {
|
|
434
|
+
// Only work, if bridge is activ
|
|
435
|
+
if (this.bridge) {
|
|
436
|
+
// Erzeugen der HA Bridged für Control
|
|
437
|
+
// check for new Entry
|
|
438
|
+
const members = obj.common.members;
|
|
439
|
+
for (const member of members) {
|
|
440
|
+
if (!this.bridge.ForeignBridgeMembers[member]) {
|
|
441
|
+
await this.bridge?.discoverForeignRange(member);
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
435
444
|
}
|
|
436
|
-
}
|
|
437
445
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
446
|
+
// check for Entry removed
|
|
447
|
+
for (const member of Object.values(this.bridge.ForeignBridgeMembers)) {
|
|
448
|
+
if (!members.includes(member)) {
|
|
449
|
+
await this.bridge.discoverForeignRange(member, true);
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
443
452
|
}
|
|
444
453
|
}
|
|
454
|
+
} catch (error) {
|
|
455
|
+
this.log.error(`error at ${activeFunction}: ${error}`);
|
|
445
456
|
}
|
|
446
457
|
}
|
|
447
458
|
|
|
@@ -1219,6 +1230,27 @@ class Lorawan extends utils.Adapter {
|
|
|
1219
1230
|
} catch (error) {
|
|
1220
1231
|
this.log.error(error);
|
|
1221
1232
|
}
|
|
1233
|
+
} else if (obj.command === 'getEnums') {
|
|
1234
|
+
try {
|
|
1235
|
+
const enums = [{ label: 'No Enum selected', value: '*' }];
|
|
1236
|
+
const enumList = await this.getEnumsAsync();
|
|
1237
|
+
for (const enumtyp of Object.values(enumList)) {
|
|
1238
|
+
for (const myEnum of Object.values(enumtyp)) {
|
|
1239
|
+
const value = myEnum._id;
|
|
1240
|
+
let label = myEnum.common.name;
|
|
1241
|
+
if (typeof label !== 'string') {
|
|
1242
|
+
if (this.language) {
|
|
1243
|
+
label = myEnum.common.name[this.language];
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
label += ` (${myEnum._id.substring(5, myEnum._id.length)})`;
|
|
1247
|
+
enums.push({ label: label.toString(), value: value });
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
this.sendTo(obj.from, obj.command, enums, obj.callback);
|
|
1251
|
+
} catch (error) {
|
|
1252
|
+
this.log.error(error);
|
|
1253
|
+
}
|
|
1222
1254
|
} else {
|
|
1223
1255
|
const result = { error: true, message: 'No message matched', received: obj.message };
|
|
1224
1256
|
if (obj.callback) {
|