iobroker.lorawan 1.17.16 → 1.17.17

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.17.17 (2025-10-04)
27
+ * (BenAhrdt) serialize appending Data on NextSend
28
+ * (BenAhrdt) update assignhandler (SensorTemperature)
29
+
26
30
  ### 1.17.16 (2025-09-25)
27
31
  * (BenAhrdt) bring state_off topic to humidifier
28
32
 
@@ -666,7 +670,7 @@ For now there is documentation in English here: https://wiki.hafenmeister.de
666
670
  ## License
667
671
  MIT License
668
672
 
669
- Copyright (c) 2025 BenAhrdt <bsahrdt@gmail.com>
673
+ Copyright (c) 2025 BenAhrdt <bsahrdt@gmail.com>
670
674
  Copyright (c) 2025 Joerg Froehner <LoraWan@hafenmeister.com>
671
675
 
672
676
  Permission is hereby granted, free of charge, to any person obtaining a copy
package/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "lorawan",
4
- "version": "1.17.16",
4
+ "version": "1.17.17",
5
5
  "news": {
6
+ "1.17.17": {
7
+ "en": "serialize appending Data on NextSend\nupdate assignhandler (SensorTemperature)",
8
+ "de": "serialisieren Appending Data auf NextSend\nupdate assignhandler (SensorTemperatur)",
9
+ "ru": "сериализировать добавленные данные в NextSend\nраспределитель обновлений (SensorTemperature)",
10
+ "pt": "serialize anexando dados no NextSend\natualizar assignhandler (SensorTemperature)",
11
+ "nl": "serialiseren toevoegen van gegevens op NextSend\nupdate awardhandler (SensorTemperatuur)",
12
+ "fr": "sérialiser l'ajout de données sur NextSend\nmettre à jour le gestionnaire d'attribution (SensorTemperature)",
13
+ "it": "serializzare i dati di appending su NextSend\naggiornamento assegnatore (SensorTemperature)",
14
+ "es": "serializar los datos pendientes en NextSend\n(SensorTemperature)",
15
+ "pl": "serializuj przypisywanie danych na nextSend\naktualizuj urządzenie sterujące (SensorTemperatura)",
16
+ "uk": "сертифікувати дані додатків на NextSend\nоновлення assignhandler (SensorTemperature)",
17
+ "zh-cn": "序列化下一端的数据\n更新指派手( 传感器)"
18
+ },
6
19
  "1.17.16": {
7
20
  "en": "bring state_off topic to humidifier",
8
21
  "de": "state_off-thema zur befeuchtung bringen",
@@ -80,19 +93,6 @@
80
93
  "pl": "nie wypełniaj Downlinks w przypadku niewdrożonego rodzaju wiadomości\nrodzaj idów json zmienionych na ciąg",
81
94
  "uk": "не заповнити Попередження у разі невиконання типу повідомлення\nтип json ids змінився на рядок",
82
95
  "zh-cn": "不填满 未执行消息类型时的下行链接\n更改为字符串的 json id 类型"
83
- },
84
- "1.17.10": {
85
- "en": "Update topics und qnique ids",
86
- "de": "Update-Themen und qnique ids",
87
- "ru": "Обновление тем und qnique ids",
88
- "pt": "Atualizar tópicos e IDs do qnique",
89
- "nl": "Onderwerpen en qnique-id's bijwerken",
90
- "fr": "Mettre à jour les sujets et les ids qnique",
91
- "it": "Aggiornare gli argomenti und qnique ids",
92
- "es": "Actualizar temas und qnique ids",
93
- "pl": "Aktualizacja tematów i idów qnique",
94
- "uk": "Оновлення тем und qnique ids",
95
- "zh-cn": "更新主题 und qnique ids"
96
96
  }
97
97
  },
98
98
  "titleLang": {
@@ -197,6 +197,16 @@ class assignhandlerClass {
197
197
  },
198
198
  },
199
199
  },
200
+ KeepAliveTime: {
201
+ approvedFolders: {
202
+ 'uplink.decoded': {
203
+ assignfunction: this.commonAssign,
204
+ common: {
205
+ unit: 'min',
206
+ },
207
+ },
208
+ },
209
+ },
200
210
  Light: {
201
211
  approvedFolders: {
202
212
  'uplink.decoded': {
@@ -374,6 +384,7 @@ class assignhandlerClass {
374
384
  assignfunction: this.commonAssign,
375
385
  common: {
376
386
  role: 'value.temperature',
387
+ unit: '°C',
377
388
  },
378
389
  },
379
390
  },
package/main.js CHANGED
@@ -34,6 +34,8 @@ class Lorawan extends utils.Adapter {
34
34
  chirpstack: 'chirpstack',
35
35
  };
36
36
 
37
+ this.NextSendLocks = new Map(); // key -> Promise-chain
38
+
37
39
  // Simulation variables
38
40
  this.simulation = {};
39
41
  this.mySystemConfig;
@@ -765,22 +767,55 @@ class Lorawan extends utils.Adapter {
765
767
  this.log.debug(`Function ${activeFunction} started.`);
766
768
  try {
767
769
  const idFolderNextSend = `${changeInfo.objectStartDirectory}.${this.messagehandler?.directoryhandler.reachableSubfolders.downlinkNextSend}`;
768
- if (
769
- changeInfo.bestMatchForDeviceType &&
770
- this.downlinkConfighandler?.activeDownlinkConfigs[changeInfo.bestMatchForDeviceType].sendWithUplink ===
771
- 'enabled & collect'
772
- ) {
773
- const nextSend = await this.getStateAsync(`${idFolderNextSend}.hex`);
774
- if (nextSend?.val !== '0') {
775
- payloadInHex = nextSend?.val + payloadInHex;
770
+ const stateId = `${idFolderNextSend}.hex`;
771
+
772
+ // Serialize (also simple write without append)
773
+ await this.withLock(this.NextSendLocks, stateId, async () => {
774
+ let toWrite = payloadInHex;
775
+ if (
776
+ changeInfo.bestMatchForDeviceType &&
777
+ this.downlinkConfighandler?.activeDownlinkConfigs?.[changeInfo.bestMatchForDeviceType]
778
+ .sendWithUplink === 'enabled & collect'
779
+ ) {
780
+ const nextSend = await this.getStateAsync(stateId);
781
+ if (nextSend?.val !== '0') {
782
+ toWrite = nextSend?.val + toWrite;
783
+ }
776
784
  }
777
- }
778
- await this.setState(`${idFolderNextSend}.hex`, payloadInHex, true);
785
+ await this.setState(stateId, toWrite, true);
786
+ });
779
787
  } catch (error) {
780
788
  this.log.error(`error at ${activeFunction}: ${error}`);
781
789
  }
782
790
  }
783
791
 
792
+ // Serialize functions
793
+ async withLock(locksMap, key, fn) {
794
+ const activeFunction = 'main.js - withLock';
795
+ this.log.debug(`Function ${activeFunction} started.`);
796
+ const prev = locksMap.get(key) || Promise.resolve();
797
+
798
+ // fn erst starten, wenn prev fertig ist (egal ob ok oder Fehler)
799
+ const next = prev.then(
800
+ () => Promise.resolve().then(fn),
801
+ () => Promise.resolve().then(fn),
802
+ );
803
+
804
+ // stored wartet auf next, fängt aber Fehler intern ab (Kette reißt nicht)
805
+ const stored = next.catch(() => {});
806
+ locksMap.set(key, stored);
807
+
808
+ try {
809
+ // Ergebnis/Fehler an Aufrufer weitergeben
810
+ return await next;
811
+ } finally {
812
+ // vorsichtig aufräumen: nur löschen, wenn kein neuer Job dazwischenkam
813
+ if (locksMap.get(key) === stored) {
814
+ locksMap.delete(key);
815
+ }
816
+ }
817
+ }
818
+
784
819
  async sendDownlink(topic, message, changeInfo) {
785
820
  const activeFunction = 'main.js - sendDownlink';
786
821
  this.log.debug(`Function ${activeFunction} started.`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.lorawan",
3
- "version": "1.17.16",
3
+ "version": "1.17.17",
4
4
  "description": "converts the desired lora gateway data to a ioBroker structure",
5
5
  "author": {
6
6
  "name": "BenAhrdt",
@@ -28,7 +28,7 @@
28
28
  "@iobroker/adapter-core": "^3.3.2",
29
29
  "easy-crc": "^1.1.0",
30
30
  "lodash": "^4.17.21",
31
- "mqtt": "^5.14.0",
31
+ "mqtt": "^5.14.1",
32
32
  "node-schedule": "^2.1.1"
33
33
  },
34
34
  "devDependencies": {
@@ -36,13 +36,13 @@
36
36
  "@alcalzone/release-script-plugin-iobroker": "^3.7.2",
37
37
  "@alcalzone/release-script-plugin-license": "^3.7.0",
38
38
  "@alcalzone/release-script-plugin-manual-review": "^3.7.0",
39
- "@iobroker/adapter-dev": "^1.4.0",
40
- "@iobroker/eslint-config": "^2.1.0",
39
+ "@iobroker/adapter-dev": "^1.5.0",
40
+ "@iobroker/eslint-config": "^2.2.0",
41
41
  "@iobroker/testing": "^5.1.1",
42
42
  "@tsconfig/node20": "^20.1.6",
43
43
  "@types/lodash": "^4.17.20",
44
- "@types/node": "^24.3.0",
45
- "typescript": "~5.9.2"
44
+ "@types/node": "^24.6.1",
45
+ "typescript": "~5.9.3"
46
46
  },
47
47
  "main": "main.js",
48
48
  "files": [