iobroker.lorawan 1.17.14 → 1.17.16

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,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.17.16 (2025-09-25)
27
+ * (BenAhrdt) bring state_off topic to humidifier
28
+
29
+ ### 1.17.15 (2025-09-25)
30
+ * (BenAhrdt) notifi new discover in case of oldDiscoveredDevices
31
+ * (BenAhrdt) bugfix debug logging
32
+
26
33
  ### 1.17.14 (2025-09-24)
27
34
  * (BenAhrdt) add humidifier to foreign States
28
35
 
package/io-package.json CHANGED
@@ -1,8 +1,34 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "lorawan",
4
- "version": "1.17.14",
4
+ "version": "1.17.16",
5
5
  "news": {
6
+ "1.17.16": {
7
+ "en": "bring state_off topic to humidifier",
8
+ "de": "state_off-thema zur befeuchtung bringen",
9
+ "ru": "скачать игру state_off для humidifier",
10
+ "pt": "trazer o tópico state_off para o umidificador",
11
+ "nl": "status_off onderwerp naar bevochtiger brengen",
12
+ "fr": "apporter le sujet état_off à l'humidificateur",
13
+ "it": "portare argomento state_off a umidificatore",
14
+ "es": "traer el tema state_off a humidificador",
15
+ "pl": "przynieść state _ off temat do nawilżacza",
16
+ "uk": "принести стан_вимкнути тему для зволоження",
17
+ "zh-cn": "将状态切换为潮湿器"
18
+ },
19
+ "1.17.15": {
20
+ "en": "notifi new discover in case of oldDiscoveredDevices\nbugfix debug logging",
21
+ "de": "notifi neu entdecken bei oldDiscoveredDevices\nbugfix debug protokollierung",
22
+ "ru": "уведомить новое открытие в случае старых обнаруженных устройств\nрегистрация отладчиков",
23
+ "pt": "notifi nova descoberta no caso de dispositivos antigosdescoberta\nregistro de depuração de bugfix",
24
+ "nl": "notifi nieuwe ontdekking in het geval van oudeDiscoverdDevices\nbugfix debug logging",
25
+ "fr": "notifi nouveau découverte en cas d'ancienDiscoveredDevices\nbugfix debug loging",
26
+ "it": "notifi nuova scoperta in caso di vecchiDiscoveredDevices\nbugfix debug logging",
27
+ "es": "notifi new discover in case of oldDiscoveredDevices\nbugfix debug logging",
28
+ "pl": "notifi nowe odkrycie w przypadku old DiscoveredDevices\nlogowanie debugfix",
29
+ "uk": "неідентифікувати нове відкриття у разі виникнення застарілих\nзареєструватися",
30
+ "zh-cn": "旧发现器的新发现\n调试日志"
31
+ },
6
32
  "1.17.14": {
7
33
  "en": "add humidifier to foreign States",
8
34
  "de": "fügen Sie Befeuchter für ausländische Staaten hinzu",
@@ -67,32 +93,6 @@
67
93
  "pl": "Aktualizacja tematów i idów qnique",
68
94
  "uk": "Оновлення тем und qnique ids",
69
95
  "zh-cn": "更新主题 und qnique ids"
70
- },
71
- "1.17.9": {
72
- "en": "setdefault defiveidentifier for lorawan bridge function to used Device Id",
73
- "de": "Setzen Sie den Standardgerätekennzeichner für die LoRaWAN-Bridge-Funktion auf die Verwendung der Geräte-ID.",
74
- "ru": "Установите идентификатор устройства по умолчанию для функции моста LoRaWAN, чтобы использовать идентификатор устройства.",
75
- "pt": "Defina o identificador padrão do dispositivo para a função de ponte LoRaWAN usando o ID do dispositivo.",
76
- "nl": "Stel standaard apparaatidentificatie in voor LoRaWAN Bridge-functie om het apparaat-ID te gebruiken",
77
- "fr": "Définir l'identifiant par défaut du périphérique pour la fonction de pont LoRaWAN pour utiliser l'identifiant du périphérique.",
78
- "it": "Impostare l'identificatore predefinito del dispositivo per la funzione del ponte LoRaWAN in modo da utilizzare l'ID del dispositivo.",
79
- "es": "Establecer el identificador predeterminado del dispositivo para la función de puente LoRaWAN para usar el ID del dispositivo",
80
- "pl": "Ustaw domyślny identyfikator urządzenia dla funkcji mostka LoRaWAN na użyty identyfikator urządzenia",
81
- "uk": "Встановлено значення за замовчуванням ідентифікатора пристрою для функції моста LoRaWAN на Device Id.",
82
- "zh-cn": "将LoRaWAN桥接功能的setdefault设备标识符设置为使用设备ID。"
83
- },
84
- "1.17.8": {
85
- "en": "normalize [] () & {} into _",
86
- "de": "normalize [] () & {} into _",
87
- "ru": "Нормализовать [] () & {} в _",
88
- "pt": "Normalizar [] () & {} para _",
89
- "nl": "normalize [] () & {} into _",
90
- "fr": "normaliser [] () & {} en _",
91
- "it": "normalizzare [] () & {} in _",
92
- "es": "Normalizar [] () & {} en _.",
93
- "pl": "zamień [] () & {} na _",
94
- "uk": "нормалізувати [] () & {} у _",
95
- "zh-cn": "将[]()和{}转换为_"
96
96
  }
97
97
  },
98
98
  "titleLang": {
@@ -76,6 +76,7 @@ class bridgeClass {
76
76
  },
77
77
  };
78
78
  this.discoveredDevices = {};
79
+ this.oldDiscoveredDevices = {};
79
80
 
80
81
  // Unitmapping zur Zuweisung der passenden Unit, wenn diese falsch geschrieben ist
81
82
  this.unitMap = {
@@ -275,27 +276,6 @@ class bridgeClass {
275
276
  }
276
277
  }
277
278
 
278
- /*********************************************************************
279
- * *************** Discover Device Notifications *********************
280
- * ******************************************************************/
281
-
282
- /**
283
- * @param normalizedDeficeIdentifier identifier od device
284
- */
285
- async checkNewDeviceDiscovered(normalizedDeficeIdentifier) {
286
- const activeFunction = 'bridge.js checkNewDeviceDiscovered';
287
- this.adapter.log.debug(`Function ${activeFunction} started.`);
288
- try {
289
- if (!this.discoveredDevices[normalizedDeficeIdentifier]) {
290
- this.discoveredDevices[normalizedDeficeIdentifier] = {};
291
- return true;
292
- }
293
- return false;
294
- } catch (error) {
295
- this.adapter.log.error(`error at ${activeFunction}: ${error}`);
296
- }
297
- }
298
-
299
279
  /*********************************************************************
300
280
  * ******************** Discover Notification ************************
301
281
  * ******************************************************************/
@@ -993,24 +973,34 @@ class bridgeClass {
993
973
  if (typeof DiscoveryObject.payload !== 'string') {
994
974
  // Payload is not empty => discover
995
975
  const normalizedDeficeIdentifier = DiscoveryObject.payload.device.identifiers[0];
996
- const notificationId = `${this.adapter.namespace}.${this.Words.notification}${this.GeneralId}`;
997
976
  // New Device
998
- if (!this.discoveredDevices[normalizedDeficeIdentifier] && id !== notificationId) {
977
+ if (!this.discoveredDevices[normalizedDeficeIdentifier]) {
999
978
  this.discoveredDevices[normalizedDeficeIdentifier] = {};
1000
- returnValue.newDevice = DiscoveryObject;
1001
- const device = DiscoveryObject.informations.usedDeviceId;
1002
- let message = `${this.adapter.i18nTranslation['new device discovered']}.\n${this.adapter.i18nTranslation['Device']}: ${device}`;
1003
- if (DiscoveryObject.informations.usedApplicationName) {
1004
- const application = DiscoveryObject.informations.usedApplicationName;
1005
- message += `\n${this.adapter.i18nTranslation['Application']}: ${application}`;
979
+ if (!this.oldDiscoveredDevices[normalizedDeficeIdentifier]) {
980
+ // Only messegae with ne fiscovered dewvice, if not in old discovered devices
981
+ returnValue.newDevice = DiscoveryObject;
982
+ let device = 'unknown';
983
+ if (DiscoveryObject.informations.usedDeviceId) {
984
+ device = DiscoveryObject.informations.usedDeviceId;
985
+ } else if (
986
+ DiscoveryObject.informations.target &&
987
+ DiscoveryObject.informations.target.usedDeviceId
988
+ ) {
989
+ device = DiscoveryObject.informations.target.usedDeviceId;
990
+ }
991
+ let message = `${this.adapter.i18nTranslation['new device discovered']}.\n${this.adapter.i18nTranslation['Device']}: ${device}`;
992
+ if (DiscoveryObject.informations.usedApplicationName) {
993
+ const application = DiscoveryObject.informations.usedApplicationName;
994
+ message += `\n${this.adapter.i18nTranslation['Application']}: ${application}`;
995
+ }
996
+ const notificationId = `${this.adapter.namespace}.${this.adapter.bridge.Words.notification}${this.adapter.bridge.GeneralId}`;
997
+ await this.adapter.bridge?.publishNotification(
998
+ notificationId,
999
+ message,
1000
+ this.adapter.bridge?.Notificationlevel.deviceState,
1001
+ false,
1002
+ );
1006
1003
  }
1007
- const notificationId = `${this.adapter.namespace}.${this.adapter.bridge.Words.notification}${this.adapter.bridge.GeneralId}`;
1008
- await this.adapter.bridge?.publishNotification(
1009
- notificationId,
1010
- message,
1011
- this.adapter.bridge?.Notificationlevel.deviceState,
1012
- false,
1013
- );
1014
1004
  }
1015
1005
  // New Id
1016
1006
  if (!this.DiscoveredIds[id]) {
@@ -1404,6 +1394,9 @@ class bridgeClass {
1404
1394
  try {
1405
1395
  // get old Discovered ids
1406
1396
  this.OldDiscoveredIds = JSON.parse((await this.adapter.getStateAsync('info.discoveredIds')).val);
1397
+ this.oldDiscoveredDevices = this.generateOldDevices(this.OldDiscoveredIds);
1398
+ //this.adapter.log.error(JSON.stringify(this.oldDiscoveredDevices));
1399
+ await this.discoverGeneralNotification();
1407
1400
 
1408
1401
  // Get all ids in adapterfolder
1409
1402
  // Generate Infos of all devices and decoded folders
@@ -1430,38 +1423,67 @@ class bridgeClass {
1430
1423
  await this.getForeignStatesForStandardEntities();
1431
1424
  await this.getForeignClimateConfig();
1432
1425
  await this.getForeignHumidifierConfig();
1433
- await this.discoverGeneralNotification();
1434
1426
  await this.checkDiscoveries();
1435
1427
  } catch (error) {
1436
1428
  this.adapter.log.error(`error at ${activeFunction}: ${error}`);
1437
1429
  }
1438
1430
  }
1439
1431
 
1432
+ /**
1433
+ * @param oldDiscoveredIds Ids wiche are discovered last time that Adapter runs
1434
+ */
1435
+ generateOldDevices(oldDiscoveredIds) {
1436
+ const activeFunction = 'bridge.js - generateOldDevices';
1437
+ this.adapter.log.debug(`Function ${activeFunction} started.`);
1438
+ try {
1439
+ const oldDevices = {};
1440
+ for (const id of Object.values(oldDiscoveredIds)) {
1441
+ const normalizedDeviceidentifier = id.payload.device.identifiers[0];
1442
+ if (!oldDevices[normalizedDeviceidentifier]) {
1443
+ oldDevices[normalizedDeviceidentifier] = {};
1444
+ }
1445
+ }
1446
+ return oldDevices;
1447
+ } catch (error) {
1448
+ this.adapter.log.error(`error at ${activeFunction}: ${error}`);
1449
+ return {};
1450
+ }
1451
+ }
1452
+
1440
1453
  /**
1441
1454
  * check discovery for old entries
1442
1455
  */
1443
1456
  async checkDiscoveries() {
1444
- for (const id in this.OldDiscoveredIds) {
1445
- if (!this.DiscoveredIds[id]) {
1446
- this.adapter.log.debug(`The discovered id: ${id} will be removed`);
1447
- this.DiscoveredIds[id] = this.OldDiscoveredIds[id];
1448
- this.DiscoveredIds[id].payload = '';
1449
- await this.publishDiscovery(id, this.DiscoveredIds[id]);
1450
- this.adapter.log.error('Löschen 1');
1451
- delete this.DiscoveredIds[id];
1452
- await this.adapter.setState('info.discoveredIds', JSON.stringify(this.DiscoveredIds), true);
1453
- } else {
1454
- if (this.DiscoveredIds[id].topic !== this.OldDiscoveredIds[id].topic) {
1455
- this.adapter.log.debug(`The discovered topic: ${this.OldDiscoveredIds[id].topic} will be removed`);
1456
- const safeCurrent = this.DiscoveredIds[id];
1457
+ const activeFunction = 'bridge.js - checkDiscoveries';
1458
+ this.adapter.log.debug(`Function ${activeFunction} started.`);
1459
+ try {
1460
+ for (const id in this.OldDiscoveredIds) {
1461
+ if (!this.DiscoveredIds[id]) {
1462
+ this.adapter.log.debug(`The discovered id: ${id} will be removed`);
1457
1463
  this.DiscoveredIds[id] = this.OldDiscoveredIds[id];
1458
1464
  this.DiscoveredIds[id].payload = '';
1459
1465
  await this.publishDiscovery(id, this.DiscoveredIds[id]);
1460
- this.adapter.log.error('Löschen 2');
1461
- this.DiscoveredIds[id] = safeCurrent;
1462
- await this.publishDiscovery(id, this.DiscoveredIds[id]);
1466
+ delete this.DiscoveredIds[id];
1467
+ delete this.OldDiscoveredIds[id];
1468
+ await this.adapter.setState('info.discoveredIds', JSON.stringify(this.DiscoveredIds), true);
1469
+ } else {
1470
+ if (this.DiscoveredIds[id].topic !== this.OldDiscoveredIds[id].topic) {
1471
+ this.adapter.log.debug(
1472
+ `The discovered topic: ${this.OldDiscoveredIds[id].topic} will be removed`,
1473
+ );
1474
+ const safeCurrent = this.DiscoveredIds[id];
1475
+ this.DiscoveredIds[id] = this.OldDiscoveredIds[id];
1476
+ this.DiscoveredIds[id].payload = '';
1477
+ await this.publishDiscovery(id, this.DiscoveredIds[id]);
1478
+ this.DiscoveredIds[id] = safeCurrent;
1479
+ await this.publishDiscovery(id, this.DiscoveredIds[id]);
1480
+ }
1463
1481
  }
1464
1482
  }
1483
+ //Assign new Discoverd Devices to Old
1484
+ this.oldDiscoveredDevices = structuredClone(this.discoveredDevices);
1485
+ } catch (error) {
1486
+ this.adapter.log.error(`error at ${activeFunction}: ${error}`);
1465
1487
  }
1466
1488
  }
1467
1489
  // create schedule Jobs for online and historic values
@@ -1607,7 +1629,7 @@ class bridgeClass {
1607
1629
  this.SubscribedTopics,
1608
1630
  `${target.Topic}${this.EndingSet}`,
1609
1631
  {
1610
- deviceId: target.DeviceIdentifier,
1632
+ usedDeviceId: target.DeviceIdentifier,
1611
1633
  },
1612
1634
  DiscoveryTopic,
1613
1635
  DiscoveryPayload,
@@ -1619,7 +1641,7 @@ class bridgeClass {
1619
1641
  this.SubscribedTopics,
1620
1642
  `${mode.Topic}${this.EndingSet}`,
1621
1643
  {
1622
- deviceId: mode.DeviceIdentifier,
1644
+ usedDeviceId: mode.DeviceIdentifier,
1623
1645
  },
1624
1646
  DiscoveryTopic,
1625
1647
  DiscoveryPayload,
@@ -1632,7 +1654,7 @@ class bridgeClass {
1632
1654
  this.PublishedIds,
1633
1655
  config.climateIds.target,
1634
1656
  {
1635
- deviceId: target.DeviceIdentifier,
1657
+ usedDeviceId: target.DeviceIdentifier,
1636
1658
  },
1637
1659
  DiscoveryTopic,
1638
1660
  DiscoveryPayload,
@@ -1644,7 +1666,7 @@ class bridgeClass {
1644
1666
  this.PublishedIds,
1645
1667
  config.climateIds.act,
1646
1668
  {
1647
- deviceId: act.DeviceIdentifier,
1669
+ usedDeviceId: act.DeviceIdentifier,
1648
1670
  },
1649
1671
  DiscoveryTopic,
1650
1672
  DiscoveryPayload,
@@ -1656,7 +1678,7 @@ class bridgeClass {
1656
1678
  this.PublishedIds,
1657
1679
  config.climateIds.mode,
1658
1680
  {
1659
- deviceId: mode.DeviceIdentifier,
1681
+ usedDeviceId: mode.DeviceIdentifier,
1660
1682
  },
1661
1683
  DiscoveryTopic,
1662
1684
  DiscoveryPayload,
@@ -1674,13 +1696,13 @@ class bridgeClass {
1674
1696
  payload: structuredClone(DiscoveryPayload),
1675
1697
  informations: {
1676
1698
  target: {
1677
- deviceId: target.DeviceIdentifier,
1699
+ usedDeviceId: target.DeviceIdentifier,
1678
1700
  },
1679
1701
  act: {
1680
- deviceId: act.DeviceIdentifier,
1702
+ usedDeviceId: act.DeviceIdentifier,
1681
1703
  },
1682
1704
  mode: {
1683
- deviceId: mode.DeviceIdentifier,
1705
+ usedDeviceId: mode.DeviceIdentifier,
1684
1706
  },
1685
1707
  },
1686
1708
  });
@@ -1821,6 +1843,8 @@ class bridgeClass {
1821
1843
  device_class: `${entityType}`,
1822
1844
  state_topic: `${onOff.Topic}${this.EndingState}`,
1823
1845
  command_topic: `${onOff.Topic}${this.EndingSet}`,
1846
+ state_on: 'true',
1847
+ state_off: 'false',
1824
1848
  payload_on: 'true',
1825
1849
  payload_off: 'false',
1826
1850
  min_humidity: target.min ? target.min : 0,
@@ -1837,7 +1861,7 @@ class bridgeClass {
1837
1861
  this.SubscribedTopics,
1838
1862
  `${onOff.Topic}${this.EndingSet}`,
1839
1863
  {
1840
- deviceId: onOff.DeviceIdentifier,
1864
+ usedDeviceId: onOff.DeviceIdentifier,
1841
1865
  },
1842
1866
  DiscoveryTopic,
1843
1867
  DiscoveryPayload,
@@ -1849,7 +1873,7 @@ class bridgeClass {
1849
1873
  this.SubscribedTopics,
1850
1874
  `${target.Topic}${this.EndingSet}`,
1851
1875
  {
1852
- deviceId: target.DeviceIdentifier,
1876
+ usedDeviceId: target.DeviceIdentifier,
1853
1877
  },
1854
1878
  DiscoveryTopic,
1855
1879
  DiscoveryPayload,
@@ -1862,7 +1886,7 @@ class bridgeClass {
1862
1886
  this.PublishedIds,
1863
1887
  config.HumidifierIds.onOff,
1864
1888
  {
1865
- deviceId: onOff.DeviceIdentifier,
1889
+ usedDeviceId: onOff.DeviceIdentifier,
1866
1890
  },
1867
1891
  DiscoveryTopic,
1868
1892
  DiscoveryPayload,
@@ -1874,7 +1898,7 @@ class bridgeClass {
1874
1898
  this.PublishedIds,
1875
1899
  config.HumidifierIds.target,
1876
1900
  {
1877
- deviceId: target.DeviceIdentifier,
1901
+ usedDeviceId: target.DeviceIdentifier,
1878
1902
  },
1879
1903
  DiscoveryTopic,
1880
1904
  DiscoveryPayload,
@@ -1886,7 +1910,7 @@ class bridgeClass {
1886
1910
  this.PublishedIds,
1887
1911
  config.HumidifierIds.act,
1888
1912
  {
1889
- deviceId: act.DeviceIdentifier,
1913
+ usedDeviceId: act.DeviceIdentifier,
1890
1914
  },
1891
1915
  DiscoveryTopic,
1892
1916
  DiscoveryPayload,
@@ -1894,14 +1918,14 @@ class bridgeClass {
1894
1918
  );
1895
1919
  const informations = {
1896
1920
  onOff: {
1897
- deviceId: onOff.DeviceIdentifier,
1921
+ usedDeviceId: onOff.DeviceIdentifier,
1898
1922
  },
1899
1923
  target: {
1900
- deviceId: target.DeviceIdentifier,
1924
+ usedDeviceId: target.DeviceIdentifier,
1901
1925
  },
1902
1926
  };
1903
1927
  if (config.WithAct) {
1904
- informations.act = { deviceId: act.DeviceIdentifier };
1928
+ informations.act = { usedDeviceId: act.DeviceIdentifier };
1905
1929
  }
1906
1930
  // Publishing the discover message
1907
1931
  await this.publishDiscovery(Id, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.lorawan",
3
- "version": "1.17.14",
3
+ "version": "1.17.16",
4
4
  "description": "converts the desired lora gateway data to a ioBroker structure",
5
5
  "author": {
6
6
  "name": "BenAhrdt",