iobroker.lorawan 1.16.2 → 1.16.3

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,9 @@ 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.3 (2025-09-16)
27
+ * (BenAhrdt) nameing of foreign Devices in Bridge
28
+
26
29
  ### 1.16.2 (2025-09-16)
27
30
  * (BenAhrdt) bugfix namespace also by calling work from directoryhandler
28
31
 
package/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "lorawan",
4
- "version": "1.16.2",
4
+ "version": "1.16.3",
5
5
  "news": {
6
+ "1.16.3": {
7
+ "en": "nameing of foreign Devices in Bridge",
8
+ "de": "Benennung von fremden Geräten in der Brücke",
9
+ "ru": "Наименование иностранных устройств в мосту",
10
+ "pt": "Nomenclatura de Dispositivos Estrangeiros na Ponte",
11
+ "nl": "Benaming van externe apparaten in de bridge",
12
+ "fr": "Renommage des appareils étrangers dans le pont",
13
+ "it": "Nominativo dei dispositivi stranieri nel Bridge",
14
+ "es": "Renombrar dispositivos extranjeros en el puente",
15
+ "pl": "Nadanie nazw obcym urządzeniom w mostku",
16
+ "uk": "Перейменування зовнішніх пристроїв у мосту",
17
+ "zh-cn": "在网桥中给外部设备命名"
18
+ },
6
19
  "1.16.2": {
7
20
  "en": "bugfix namespace also by calling work from directoryhandler",
8
21
  "de": "Bug behoben: Namensraum auch durch Aufruf von \"Arbeit\" von DirectoryHandler.",
@@ -80,19 +93,6 @@
80
93
  "pl": "Poprawiono obsługę urządzenia stanu w przypadku podfolderów.",
81
94
  "uk": "Поліпшено обробку пристрою стану у випадку підпапок.",
82
95
  "zh-cn": "改进对子文件夹中状态设备的处理"
83
- },
84
- "1.15.5": {
85
- "en": "Bugfix logging removed",
86
- "de": "Fehlerbehebung beim Protokollieren entfernt",
87
- "ru": "Исправлена ошибка с удалением журнала.",
88
- "pt": "Correção de bug: log removido",
89
- "nl": "Bugfix logging verwijderd",
90
- "fr": "Correctif de bug: suppression du journalisation",
91
- "it": "Rimossa la registrazione dei bugfix",
92
- "es": "Corregido el registro de errores.",
93
- "pl": "Usunięto logowanie błędów",
94
- "uk": "Виправлено запис журналів про помилки",
95
- "zh-cn": "修复了日志记录问题"
96
96
  }
97
97
  },
98
98
  "titleLang": {
@@ -1484,15 +1484,21 @@ class bridgeClass {
1484
1484
  this.adapter.log.debug(`Function ${activeFunction} started.`);
1485
1485
  try {
1486
1486
  const state = await this.adapter.getForeignStateAsync(id);
1487
- const parentObject = await this.getParentObject(id);
1488
1487
  let partentId = '';
1489
1488
  let parentName = '';
1490
- if (typeof parentObject === 'object') {
1491
- partentId = parentObject._id;
1492
- parentName = parentObject.common.name;
1489
+ const parentDevice = await this.getParentDevice(id);
1490
+ if (typeof parentDevice === 'string') {
1491
+ const parentChannel = await this.getParentChannel(id);
1492
+ if (typeof parentChannel === 'string') {
1493
+ partentId = parentChannel;
1494
+ parentName = partentId;
1495
+ } else {
1496
+ partentId = parentChannel._id;
1497
+ parentName = parentChannel.common.name;
1498
+ }
1493
1499
  } else {
1494
- partentId = parentObject;
1495
- parentName = partentId;
1500
+ partentId = parentDevice._id;
1501
+ parentName = parentDevice.common.name;
1496
1502
  }
1497
1503
  const deviceIdentifier = parentName;
1498
1504
  const statename = id.substring(partentId.length + 1, id.length);
@@ -1562,31 +1568,50 @@ class bridgeClass {
1562
1568
  }
1563
1569
 
1564
1570
  /**
1565
- * @param id id to get parent Object
1571
+ * @param id id to get parent Channel
1566
1572
  */
1567
- async getParentObject(id) {
1568
- const activeFunction = 'bridge.js - getParentObject';
1573
+ async getParentDevice(id) {
1574
+ const activeFunction = 'bridge.js - getParentDevice';
1569
1575
  this.adapter.log.debug(`Function ${activeFunction} started.`);
1570
1576
  try {
1571
1577
  const firstIdexOfDot = id.indexOf('.');
1572
1578
  const lastIdexOfDot = id.lastIndexOf('.');
1573
1579
  if (lastIdexOfDot > firstIdexOfDot + 3) {
1574
1580
  id = id.substring(0, lastIdexOfDot);
1575
- const firstObj = await this.adapter.getForeignObjectAsync(id);
1576
- if (!firstObj) {
1581
+ const obj = await this.adapter.getForeignObjectAsync(id);
1582
+ if (!obj) {
1577
1583
  return undefined;
1578
1584
  }
1579
- if (firstObj?.type === 'device') {
1580
- return firstObj;
1585
+ if (obj?.type === 'device') {
1586
+ return obj;
1581
1587
  }
1582
- if (firstObj.type === 'channel') {
1583
- const secondObj = await this.getParentObject(id);
1584
- if (secondObj !== undefined) {
1585
- return secondObj;
1586
- }
1587
- return firstObj;
1588
+ return await this.getParentDevice(id);
1589
+ }
1590
+ return id.substring(0, lastIdexOfDot);
1591
+ } catch (error) {
1592
+ this.adapter.log.error(`error at ${activeFunction}: ${error}`);
1593
+ }
1594
+ }
1595
+
1596
+ /**
1597
+ * @param id id to get parent Channel
1598
+ */
1599
+ async getParentChannel(id) {
1600
+ const activeFunction = 'bridge.js - getParentChannel';
1601
+ this.adapter.log.debug(`Function ${activeFunction} started.`);
1602
+ try {
1603
+ const firstIdexOfDot = id.indexOf('.');
1604
+ const lastIdexOfDot = id.lastIndexOf('.');
1605
+ if (lastIdexOfDot > firstIdexOfDot + 3) {
1606
+ id = id.substring(0, lastIdexOfDot);
1607
+ const obj = await this.adapter.getForeignObjectAsync(id);
1608
+ if (!obj) {
1609
+ return undefined;
1610
+ }
1611
+ if (obj?.type === 'channel') {
1612
+ return obj;
1588
1613
  }
1589
- return await this.getParentObject(id);
1614
+ return await this.getParentChannel(id);
1590
1615
  }
1591
1616
  return id.substring(0, lastIdexOfDot);
1592
1617
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.lorawan",
3
- "version": "1.16.2",
3
+ "version": "1.16.3",
4
4
  "description": "converts the desired lora gateway data to a ioBroker structure",
5
5
  "author": {
6
6
  "name": "BenAhrdt",