iobroker.lorawan 1.17.11 → 1.17.13

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,14 @@ 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.13 (2025-09-24)
27
+ * (BenAhrdt) Bugfix discover new devices
28
+
29
+ ### 1.17.12 (2025-09-24)
30
+ * (BenAhrdt) Virtual Mode in default selected for Climate Entities
31
+ * (BenAhrdt) improve hidden attribute for climate entitie in LoRaWAN
32
+ * (BenAhrdt) change discovery delete {} => ''
33
+
26
34
  ### 1.17.11 (2025-09-23)
27
35
  * (BenAhrdt) dont fillDownlinks in case of not implemented messagetype
28
36
  * (BenAhrdt) type of json ids changed to string
@@ -1409,6 +1409,7 @@
1409
1409
  "label": "Device",
1410
1410
  "default": "*",
1411
1411
  "jsonData": "{\"application\":\"${data.ModeApplication}\"}",
1412
+ "hidden": "data.ModeApplication === 'NotPresent'",
1412
1413
  "command": "getDevicesForClimateConfig",
1413
1414
  "alsoDependsOn":[
1414
1415
  "ModeApplication"
@@ -1424,6 +1425,7 @@
1424
1425
  "attr": "ModeFolder",
1425
1426
  "label": "Folder",
1426
1427
  "default": "uplink.decoded",
1428
+ "hidden": "data.ModeApplication === 'NotPresent'",
1427
1429
  "options": [
1428
1430
  {"label":"uplink.decoded","value":"uplink.decoded"}
1429
1431
  ],
@@ -1440,6 +1442,7 @@
1440
1442
  "default": "No State selected",
1441
1443
  "jsonData": "{\"application\":\"${data.ModeApplication}\",\"device\":\"${data.ModeDevice}\",\"folder\":\"${data.ModeFolder}\"}",
1442
1444
  "command": "getStatesForClimateConfig",
1445
+ "hidden": "data.ModeApplication === 'NotPresent'",
1443
1446
  "noTranslation": true,
1444
1447
  "alsoDependsOn":[
1445
1448
  "ModeApplication",
@@ -1546,7 +1549,7 @@
1546
1549
  "attr": "VirtualMode",
1547
1550
  "label": "VirtualMode",
1548
1551
  "tooltip": "VirtualModeTooltip",
1549
- "default": false,
1552
+ "default": true,
1550
1553
  "xs": 12,
1551
1554
  "sm": 2,
1552
1555
  "md": 2,
package/io-package.json CHANGED
@@ -1,8 +1,34 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "lorawan",
4
- "version": "1.17.11",
4
+ "version": "1.17.13",
5
5
  "news": {
6
+ "1.17.13": {
7
+ "en": "Bugfix discover new devices",
8
+ "de": "Bugfix neue Geräte entdecken",
9
+ "ru": "Bugfix открывает новые устройства",
10
+ "pt": "Bugfix descobre novos dispositivos",
11
+ "nl": "Bugfix nieuwe apparaten ontdekken",
12
+ "fr": "Bugfix découvrez de nouveaux périphériques",
13
+ "it": "Bugfix scopri nuovi dispositivi",
14
+ "es": "Bugfix descubre nuevos dispositivos",
15
+ "pl": "Bugfix odkryj nowe urządzenia",
16
+ "uk": "Виправлення помилок",
17
+ "zh-cn": "错误fix 发现新设备"
18
+ },
19
+ "1.17.12": {
20
+ "en": "Virtual Mode in default selected for Climate Entities\nimprove hidden attribute for climate entitie in LoRaWAN\nchange discovery delete {} => ''",
21
+ "de": "Virtueller Modus in Standardeinstellung für Climate Entities\nverbessern Sie das versteckte Attribut für den Klimaschutz in LoRaWAN\nänderung der entdeckung löschen {} => ' '",
22
+ "ru": "Виртуальный режим по умолчанию выбран для климатических объектов\nулучшение скрытого атрибута для климатического объекта в LoRaWAN\nобнаружение изменений удалить {} => \"",
23
+ "pt": "Modo Virtual por omissão seleccionado para Entidades Climáticas\nmelhorar o atributo oculto para o clima em LoRaWAN\nalterar a descoberta apagar {} => ' '",
24
+ "nl": "Virtuele modus in standaard geselecteerd voor klimaatentiteiten\nverbeteren verborgen attribuut voor klimaat entitie in LoRaWAN\nde ontdekking wijzigen delete {} => ' '",
25
+ "fr": "Mode virtuel par défaut sélectionné pour les entités climatiques\naméliorer l'attribut caché pour entitie climatique dans LoRaWAN\nmodifier découverte supprimer {} => ' '",
26
+ "it": "Modalità virtuale in default selezionata per le Entità Climatiche\nmigliorare l'attributo nascosto per il clima in LoRaWAN\ncambiamento scoperta eliminare {} = > ' '",
27
+ "es": "Modo virtual por defecto seleccionado para Entidades climáticas\nmejorar el atributo oculto para el aislamiento climático en LoRaWAN\ncambio de descubrimiento eliminar {} = confianza ' '",
28
+ "pl": "Tryb wirtualny domyślnie wybrany dla podmiotów klimatycznych\npoprawić ukryte atrybuty dla klimatu w LoRaWAN\nzmień odkrycie usuń {} = > ''",
29
+ "uk": "Віртуальний режим за замовчуванням, вибраний для кліматичних обов'язків\nпокращуйте прихований атрибут для ентіту клімату в LoRaWAN\nвидалити зміни {} => ' р",
30
+ "zh-cn": "为气候实体选择默认的虚拟模式\n改善LoRaWAN中气候内涵的隐藏属性\n更改发现删除 {}} '"
31
+ },
6
32
  "1.17.11": {
7
33
  "en": "dont fillDownlinks in case of not implemented messagetype\ntype of json ids changed to string",
8
34
  "de": "nicht ausfüllen Downlinks bei nicht implementiertem Nachrichtentyp\nart der json ids geändert in string",
@@ -67,32 +93,6 @@
67
93
  "pl": "Dostępny tryb wirtualny dla zagranicznych jednostek klimatyzacyjnych.",
68
94
  "uk": "Доступний режим віртуальних сутностей для зовнішнього клімату",
69
95
  "zh-cn": "可用于外部气候实体的虚拟模式"
70
- },
71
- "1.17.6": {
72
- "en": "Check foreign state id in climate improved",
73
- "de": "Überprüfen von ausländischen Status-IDs in der verbesserten Klimasteuerung",
74
- "ru": "Проверка идентификатора иностранного состояния в улучшенном режиме климата",
75
- "pt": "Verificar id do estado estrangeiro na melhoria do clima.",
76
- "nl": "Controleer het buitenlandse statuselement in de verbeterde klimaat instellingen.",
77
- "fr": "Vérifier l'identifiant de l'état étranger amélioré dans le système de climatisation",
78
- "it": "Controllato l'ID dello stato estero in clima migliorato",
79
- "es": "Comprobación de la identificación del estado extranjero en clima mejorado",
80
- "pl": "Sprawdź poprawność identyfikatora stanu zagranicznego w ulepszonym module klimatyzacji",
81
- "uk": "Перевірено зовнішній ідентифікатор стану в кліматі покращений",
82
- "zh-cn": "改进了气候模块中检查外部状态id"
83
- },
84
- "1.17.5": {
85
- "en": "Improve quere for foreign states in discover foreign climate",
86
- "de": "Verbessern Sie die Abfrage für ausländische Staaten in der Entdecken-Fremdes-Klima-Funktion.",
87
- "ru": "Улучшена обработка запросов для иностранных стран при обнаружении климата в других странах.",
88
- "pt": "Melhorada a consulta para estados estrangeiros no descobrimento do clima estrangeiro.",
89
- "nl": "Verbeter query voor buitenlandse staten in het ontdekken van het buitenlandse klimaat",
90
- "fr": "Amélioration de la requête pour les états étrangers dans la découverte du climat étranger",
91
- "it": "Migliorata la richiesta per gli stati esteri nella scoperta del clima estero",
92
- "es": "Mejorar la consulta para estados extranjeros en descubrir clima extranjero",
93
- "pl": "Popraw zapytanie o stany zagraniczne w odkrywaniu zagranicznego klimatu",
94
- "uk": "Покращено запит для іноземних держав у відкритті зовнішнього клімату",
95
- "zh-cn": "改进了外国气候的查询。"
96
96
  }
97
97
  },
98
98
  "titleLang": {
@@ -235,24 +235,9 @@ class bridgeClass {
235
235
  this.adapter.log.debug(`Function ${activeFunction} started.`);
236
236
  try {
237
237
  if (this.bridgeMqttClient.internalConnectionstate) {
238
- const newDeviceDiscovered = await this.discovery(id, options);
239
- // notify new discovered Devices (new deviceidentifier)
240
- if (newDeviceDiscovered) {
241
- const device = this.DiscoveredIds[id].informations.usedDeviceId;
242
- const application = this.DiscoveredIds[id].informations.usedApplicationName;
243
- const message = `${this.adapter.i18nTranslation['new device discovered']}.\n${this.adapter.i18nTranslation['Device']}: ${device}\n${this.adapter.i18nTranslation['Application']}: ${application}`;
244
- const notificationId = `${this.adapter.namespace}.${this.adapter.bridge.Words.notification}${this.adapter.bridge.GeneralId}`;
245
- await this.adapter.bridge?.publishNotification(
246
- notificationId,
247
- message,
248
- this.adapter.bridge?.Notificationlevel.deviceState,
249
- false,
250
- );
251
- // Delay for publish new entitys
252
- setTimeout(async () => {
253
- await this.publishId(id, Stateval, {});
254
- }, 1000);
255
- } else {
238
+ const discovered = await this.discovery(id, options);
239
+ // only publish if no new id is discovered, because the newId will be published 1s later
240
+ if (!discovered || !discovered.newId) {
256
241
  await this.publishId(id, Stateval, {});
257
242
  }
258
243
  } else {
@@ -717,7 +702,8 @@ class bridgeClass {
717
702
  this.adapter.log.debug(`Function ${activeFunction} started.`);
718
703
  try {
719
704
  // Defaultvalue for discover
720
- let newDeviceDiscovered = false;
705
+ let returnValue = { newDevice: undefined, newId: undefined };
706
+
721
707
  // Query for decoded Folder
722
708
  if (id.includes(`${this.adapter.messagehandler.directoryhandler.reachableSubfolders.uplinkDecoded}.`)) {
723
709
  const changeInfo = await this.adapter.getChangeInfo(id);
@@ -767,7 +753,7 @@ class bridgeClass {
767
753
  DiscoveryObject?.payload.state_topic,
768
754
  );
769
755
  }
770
- await this.publishDiscovery(id, {
756
+ returnValue = await this.publishDiscovery(id, {
771
757
  topic: DiscoveryObject?.topic,
772
758
  payload: structuredClone(DiscoveryObject?.payload),
773
759
  informations: {
@@ -777,11 +763,10 @@ class bridgeClass {
777
763
  usedDeviceId: changeInfo.usedDeviceId,
778
764
  },
779
765
  });
780
- if (await this.checkNewDeviceDiscovered(DiscoveryObject?.payload.device.identifiers[0])) {
781
- newDeviceDiscovered = true;
782
- } else {
783
- newDeviceDiscovered = false;
784
- }
766
+ // Delay for publish new entity
767
+ setTimeout(async () => {
768
+ await this.publishId(id, undefined, {});
769
+ }, 1000);
785
770
  }
786
771
  }
787
772
 
@@ -845,7 +830,7 @@ class bridgeClass {
845
830
  id,
846
831
  );
847
832
  }
848
- await this.publishDiscovery(id, {
833
+ returnValue = await this.publishDiscovery(id, {
849
834
  topic: DiscoveryObject?.topic,
850
835
  payload: structuredClone(DiscoveryObject?.payload),
851
836
  informations: {
@@ -855,15 +840,14 @@ class bridgeClass {
855
840
  usedDeviceId: changeInfo.usedDeviceId,
856
841
  },
857
842
  });
858
- if (await this.checkNewDeviceDiscovered(DiscoveryObject?.payload.device.identifiers[0])) {
859
- newDeviceDiscovered = true;
860
- } else {
861
- newDeviceDiscovered = false;
862
- }
843
+ // Delay for publish new entity
844
+ setTimeout(async () => {
845
+ await this.publishId(id, undefined, {});
846
+ }, 1000);
863
847
  }
864
848
  }
865
849
  }
866
- return newDeviceDiscovered;
850
+ return returnValue;
867
851
  } catch (error) {
868
852
  this.adapter.log.error(`error at ${activeFunction}: ${error}`);
869
853
  }
@@ -986,6 +970,7 @@ class bridgeClass {
986
970
  async publishDiscovery(id, DiscoveryObject) {
987
971
  const activeFunction = 'bridge.js - publishDiscovery';
988
972
  this.adapter.log.debug(`Function ${activeFunction} started.`);
973
+ const returnValue = { newDevice: undefined, newId: undefined };
989
974
  try {
990
975
  if (!DiscoveryObject.lastDiscover) {
991
976
  DiscoveryObject.lastDiscover = {};
@@ -997,13 +982,56 @@ class bridgeClass {
997
982
  // @ts-expect-error
998
983
  this.Timeoutput.Format,
999
984
  );
985
+
986
+ /******************************************************
987
+ * ****************************************************
988
+ *************************************************** */
989
+ // check for new device discovered, or new Id discovered
990
+ if (typeof DiscoveryObject.payload !== 'string') {
991
+ // Payload is not empty => discover
992
+ const normalizedDeficeIdentifier = DiscoveryObject.payload.device.identifiers[0];
993
+ const notificationId = `${this.adapter.namespace}.${this.Words.notification}${this.GeneralId}`;
994
+ // New Device
995
+ if (!this.discoveredDevices[normalizedDeficeIdentifier] && id !== notificationId) {
996
+ this.discoveredDevices[normalizedDeficeIdentifier] = {};
997
+ returnValue.newDevice = DiscoveryObject;
998
+ const device = DiscoveryObject.informations.usedDeviceId;
999
+ let message = `${this.adapter.i18nTranslation['new device discovered']}.\n${this.adapter.i18nTranslation['Device']}: ${device}`;
1000
+ if (DiscoveryObject.informations.usedApplicationName) {
1001
+ const application = DiscoveryObject.informations.usedApplicationName;
1002
+ message += `\n${this.adapter.i18nTranslation['Application']}: ${application}`;
1003
+ }
1004
+ const notificationId = `${this.adapter.namespace}.${this.adapter.bridge.Words.notification}${this.adapter.bridge.GeneralId}`;
1005
+ await this.adapter.bridge?.publishNotification(
1006
+ notificationId,
1007
+ message,
1008
+ this.adapter.bridge?.Notificationlevel.deviceState,
1009
+ false,
1010
+ );
1011
+ }
1012
+ // New Id
1013
+ if (!this.DiscoveredIds[id]) {
1014
+ returnValue.newId = DiscoveryObject;
1015
+ }
1016
+ }
1017
+ /******************************************************
1018
+ * ****************************************************
1019
+ *************************************************** */
1020
+
1000
1021
  this.DiscoveredIds[id] = DiscoveryObject;
1001
- await this.bridgeMqttClient.publish(DiscoveryObject.topic, JSON.stringify(DiscoveryObject.payload), {
1022
+ let payload = JSON.stringify(DiscoveryObject.payload);
1023
+ if (typeof DiscoveryObject.payload === 'string') {
1024
+ payload = DiscoveryObject.payload;
1025
+ }
1026
+ await this.bridgeMqttClient.publish(DiscoveryObject.topic, payload, {
1002
1027
  retain: true,
1003
1028
  });
1029
+
1004
1030
  await this.adapter.setState('info.discoveredIds', JSON.stringify(this.DiscoveredIds), true);
1031
+ return returnValue;
1005
1032
  } catch (error) {
1006
1033
  this.adapter.log.error(`error at ${activeFunction}: ${error}`);
1034
+ return returnValue;
1007
1035
  }
1008
1036
  }
1009
1037
 
@@ -1396,9 +1424,9 @@ class bridgeClass {
1396
1424
  }
1397
1425
  }
1398
1426
  await this.discoverClimate();
1399
- await this.discoverGeneralNotification();
1400
1427
  await this.getForeignStatesForStandardEntities();
1401
1428
  await this.getForeignClimateConfig();
1429
+ await this.discoverGeneralNotification();
1402
1430
  await this.checkDiscoveries();
1403
1431
  } catch (error) {
1404
1432
  this.adapter.log.error(`error at ${activeFunction}: ${error}`);
@@ -1413,7 +1441,7 @@ class bridgeClass {
1413
1441
  if (!this.DiscoveredIds[id]) {
1414
1442
  this.adapter.log.debug(`The discovered id: ${id} will be removed`);
1415
1443
  this.DiscoveredIds[id] = this.OldDiscoveredIds[id];
1416
- this.DiscoveredIds[id].payload = {};
1444
+ this.DiscoveredIds[id].payload = '';
1417
1445
  await this.publishDiscovery(id, this.DiscoveredIds[id]);
1418
1446
  delete this.DiscoveredIds[id];
1419
1447
  await this.adapter.setState('info.discoveredIds', JSON.stringify(this.DiscoveredIds), true);
@@ -1422,7 +1450,7 @@ class bridgeClass {
1422
1450
  this.adapter.log.debug(`The discovered topic: ${this.OldDiscoveredIds[id].topic} will be removed`);
1423
1451
  const safeCurrent = this.DiscoveredIds[id];
1424
1452
  this.DiscoveredIds[id] = this.OldDiscoveredIds[id];
1425
- this.DiscoveredIds[id].payload = {};
1453
+ this.DiscoveredIds[id].payload = '';
1426
1454
  await this.publishDiscovery(id, this.DiscoveredIds[id]);
1427
1455
  this.DiscoveredIds[id] = safeCurrent;
1428
1456
  await this.publishDiscovery(id, this.DiscoveredIds[id]);
@@ -1767,7 +1795,7 @@ class bridgeClass {
1767
1795
  delete this.SubscribedTopics[this.DiscoveredIds[state.id].payload.command_topic];
1768
1796
  }
1769
1797
  delete this.PublishedIds[state.id];
1770
- this.DiscoveredIds[state.id].payload = {};
1798
+ this.DiscoveredIds[state.id].payload = '';
1771
1799
  await this.adapter.unsubscribeForeignStatesAsync(state.id);
1772
1800
  await this.publishDiscovery(state.id, this.DiscoveredIds[state.id]);
1773
1801
  delete this.DiscoveredIds[state.id];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.lorawan",
3
- "version": "1.17.11",
3
+ "version": "1.17.13",
4
4
  "description": "converts the desired lora gateway data to a ioBroker structure",
5
5
  "author": {
6
6
  "name": "BenAhrdt",