iobroker.lorawan 1.16.6 → 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 CHANGED
@@ -23,6 +23,10 @@ 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
+
26
30
  ### 1.16.6 (2025-09-17)
27
31
  * (BenAhrdt) Change detection of new Discovery from LoRaWAN devices
28
32
 
package/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "lorawan",
4
- "version": "1.16.6",
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
+ },
6
19
  "1.16.6": {
7
20
  "en": "Change detection of new Discovery from LoRaWAN devices",
8
21
  "de": "Änderung der Erkennung neuer Entdeckungen von LoRaWAN-Geräten",
@@ -80,19 +93,6 @@
80
93
  "pl": "naprawiono błąd z przestrzenią nazw również w powiadomieniach",
81
94
  "uk": "виправлення помилки простору імен також за допомогою сповіщень",
82
95
  "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": {
@@ -1589,35 +1589,41 @@ class bridgeClass {
1589
1589
  * @param clear clear the ids from internal memory
1590
1590
  */
1591
1591
  async discoverForeignRange(id, clear = false) {
1592
- const params = {
1593
- startkey: id,
1594
- endkey: `${id}.\u9999`,
1595
- };
1596
- if (!clear) {
1597
- this.ForeignBridgeMembers[id] = id;
1598
- } else {
1599
- delete this.ForeignBridgeMembers[id];
1600
- }
1601
- const states = await this.adapter.getObjectViewAsync('system', 'state', params);
1602
- 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
+ };
1603
1599
  if (!clear) {
1604
- const common = state.value.common;
1605
- await this.discoverForeignStandardEntity(state.id, { common: common });
1600
+ this.ForeignBridgeMembers[id] = id;
1606
1601
  } else {
1607
- if (
1608
- this.DiscoveredIds[id] &&
1609
- this.DiscoveredIds[id].payload &&
1610
- this.DiscoveredIds[id].payload.command_topic
1611
- ) {
1612
- delete this.SubscribedTopics[this.DiscoveredIds[id].payload.command_topic];
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);
1613
1623
  }
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
1624
  }
1625
+ } catch (error) {
1626
+ this.adapter.log.error(`error at ${activeFunction}: ${error} - id: ${id} - clear: ${clear}`);
1621
1627
  }
1622
1628
  }
1623
1629
 
@@ -1633,21 +1639,39 @@ class bridgeClass {
1633
1639
  let partentId = '';
1634
1640
  let parentName = '';
1635
1641
  const parentDevice = await this.getParentDevice(id);
1636
- if (typeof parentDevice === 'string') {
1642
+ if (typeof parentDevice !== 'object') {
1643
+ this.adapter.log.debug(`Parentdevice: ${parentDevice}`);
1637
1644
  const parentChannel = await this.getParentChannel(id);
1638
- if (typeof parentChannel === 'string') {
1639
- partentId = parentChannel;
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
+ }
1640
1653
  parentName = partentId;
1641
1654
  } else {
1655
+ this.adapter.log.debug(`Parentchannel: ${JSON.stringify(parentChannel)}`);
1642
1656
  partentId = parentChannel._id;
1643
- parentName = parentChannel.common.name;
1657
+ if (typeof parentChannel.common.name === 'string') {
1658
+ parentName = parentChannel.common.name;
1659
+ } else {
1660
+ parentName = parentChannel.common.name.de;
1661
+ }
1644
1662
  }
1645
1663
  } else {
1664
+ this.adapter.log.debug(`Parentdevice: ${JSON.stringify(parentDevice)}`);
1646
1665
  partentId = parentDevice._id;
1647
- parentName = parentDevice.common.name;
1666
+ if (typeof parentDevice.common.name === 'string') {
1667
+ parentName = parentDevice.common.name;
1668
+ } else {
1669
+ parentName = parentDevice.common.name.de;
1670
+ }
1648
1671
  }
1649
1672
  const deviceIdentifier = parentName;
1650
1673
  const statename = id.substring(partentId.length + 1, id.length);
1674
+ this.adapter.log.debug(`Assigned - deviceIdentifier: ${deviceIdentifier} - statename: ${statename}`);
1651
1675
  options.Bridgestate = {
1652
1676
  publish: options.common.read,
1653
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
- // Only work, if bridge is activ
427
- if (this.bridge) {
428
- // Erzeugen der HA Bridged für Control
429
- // check for new Entry
430
- const members = obj.common.members;
431
- for (const member of members) {
432
- if (!this.bridge.ForeignBridgeMembers[member]) {
433
- await this.bridge?.discoverForeignRange(member);
434
- return;
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
- // check for Entry removed
439
- for (const member of Object.values(this.bridge.ForeignBridgeMembers)) {
440
- if (!members.includes(member)) {
441
- await this.bridge.discoverForeignRange(member, true);
442
- return;
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.lorawan",
3
- "version": "1.16.6",
3
+ "version": "1.16.7",
4
4
  "description": "converts the desired lora gateway data to a ioBroker structure",
5
5
  "author": {
6
6
  "name": "BenAhrdt",