iobroker.lorawan 1.7.1 → 1.8.1

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,12 @@ 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.8.1 (2025-04-06)
27
+ * (BenAhrdt) chaned format time in device info
28
+
29
+ ### 1.8.0 (2025-04-06)
30
+ * (BenAhrdt) update dependencies and time / timestamp in deviceinfos
31
+
26
32
  ### 1.7.1 (2025-04-06)
27
33
  * (BenAhrdt) change timewriting in deviceinfos at chirpstack
28
34
 
package/io-package.json CHANGED
@@ -1,8 +1,34 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "lorawan",
4
- "version": "1.7.1",
4
+ "version": "1.8.1",
5
5
  "news": {
6
+ "1.8.1": {
7
+ "en": "chaned format time in device info",
8
+ "de": "chaned format time in device info",
9
+ "ru": "время в формате chaned in device info",
10
+ "pt": "tempo de formato chaned em informações do dispositivo",
11
+ "nl": "gechanteerde opmaaktijd in apparaatinformatie",
12
+ "fr": "temps de format channed dans l'information de l'appareil",
13
+ "it": "chaned format time in informazioni sul dispositivo",
14
+ "es": "tiempo de formato enmarcado en la información del dispositivo",
15
+ "pl": "chaned format time in device info",
16
+ "uk": "chaned формат часу в пристрої інформація",
17
+ "zh-cn": "设备信息中显示的格式时间"
18
+ },
19
+ "1.8.0": {
20
+ "en": "update dependencies and time / timestamp in deviceinfos",
21
+ "de": "aktualisierung von abhängigkeiten und zeit / zeitstempel in deviceinfos",
22
+ "ru": "зависимости обновления и время / временная метка в deviceinfos",
23
+ "pt": "dependências de atualização e tempo / timestamp no deviceinfos",
24
+ "nl": "afhankelijkheden en tijd / tijdstempel in apparaatinfo's bijwerken",
25
+ "fr": "mettre à jour les dépendances et l'heure / timestamp dans deviceinfos",
26
+ "it": "aggiornamento dipendenze e tempo / timestamp in deviceinfos",
27
+ "es": "actualizar las dependencias y el tiempo / timetamp en deviceinfos",
28
+ "pl": "aktualizacja zależności i czasu / znacznika czasu w deviceinfos",
29
+ "uk": "оновлення залежностей і часу / часовий апарат",
30
+ "zh-cn": "更新设备信息中的依赖性和时间/ 时间戳"
31
+ },
6
32
  "1.7.1": {
7
33
  "en": "change timewriting in deviceinfos at chirpstack",
8
34
  "de": "zeitschreiben in deviceinfos bei chirpstack ändern",
@@ -67,32 +93,6 @@
67
93
  "pl": "Ustaw dekodowaną strukturę w deviceInfos (z połączeniem)",
68
94
  "uk": "Настроювання декодованої структури в пристроїІнфос (з торговою маркою)",
69
95
  "zh-cn": "在设备Infos( 合并) 中设置解码结构"
70
- },
71
- "1.6.3": {
72
- "en": "Names of states changed (Downlink Raw)\nChange setObjectNotExistsAsync to extendObjectAsync for Raw Data",
73
- "de": "Namen der geänderten Zustände (Downlink Raw)\nÄnderungssatz ObjectNotExistsAsync erweitert ObjectAsync für Rohdaten",
74
- "ru": "Изменились названия государств (Downlink Raw)\nИзменение ObjectNotExistsAsync ObjectAsync для первичных данных",
75
- "pt": "Nomes de estados alterados (Downlink Raw)\nConjunto de alterações ObjectNotExistsAsync para estender ObjectAsync para dados brutos",
76
- "nl": "Namen van statuss veranderd (Downlink Raw)\nVerander set ObjectNotExistsAsync uit te breiden ObjectAsync voor ruwe gegevens",
77
- "fr": "Noms des états modifiés (Downlink Raw)\nModifier l'ensemble ObjetNotExistsAsync pour étendre ObjetAsync pour les données brutes",
78
- "it": "I nomi degli stati cambiati (Downlink Raw)\nModifica set ObjectNotExistsAsync per estendere ObjectAsync per dati raw",
79
- "es": "Los nombres de los estados cambiaron (Downlink Raw)\nCambio ObjectNotExistsAsync para extender ObjectAsync for Raw Data",
80
- "pl": "Zmienione nazwy państw (Downlink Raw)\nZmień zestaw ObjectNotExistsAsync do rozszerzenia ObjectAsync for raw Data",
81
- "uk": "Назви змінених держав (Downlink Raw)\nЗмінення Об'єктNotExistsAsync для розширення Об'єктАсинк для сирих даних",
82
- "zh-cn": "更改州名( 下link Raw)\n更改设置 要扩展的对象“非外来”Async 原始数据对象同步"
83
- },
84
- "1.6.2": {
85
- "en": "Bugfix creation of deviceinfo",
86
- "de": "Bugfix Erstellung von deviceinfo",
87
- "ru": "Bugfix создание deviceinfo",
88
- "pt": "Criação de Bugfix de deviceinfo",
89
- "nl": "Bugfix aanmaken van apparaatinfo",
90
- "fr": "Bugfix création de périphériqueinfo",
91
- "it": "Bugfix creazione di deviceinfo",
92
- "es": "Creación de bugfix del dispositivoinfo",
93
- "pl": "Bugfix tworzenie deviceinfo",
94
- "uk": "Створення пристроюinfo",
95
- "zh-cn": "设备信息的错误修正创建"
96
96
  }
97
97
  },
98
98
  "titleLang": {
@@ -3,7 +3,7 @@ const { isDeepStrictEqual } = require('util');
3
3
  const directorieshandlerClass = require('./directorieshandler');
4
4
  const schedule = require('node-schedule');
5
5
  const assignhandlerClass = require('./assignhandler');
6
- const _ = require('lodash');
6
+ const lodash = require('lodash');
7
7
  /**
8
8
  * handles the message, wich comes from LoRaWAN devices
9
9
  */
@@ -196,7 +196,7 @@ class messagehandlerClass {
196
196
  // => Structure
197
197
  const generatedStructure = this.getIdStructure(restId, decodedState.val);
198
198
  // merge the structures
199
- decodedData[changeInfo.deviceEUI].decoded = _.merge(
199
+ decodedData[changeInfo.deviceEUI].decoded = lodash.merge(
200
200
  decodedData[changeInfo.deviceEUI].decoded,
201
201
  generatedStructure,
202
202
  );
@@ -287,13 +287,30 @@ class messagehandlerClass {
287
287
  case this.adapter.origin.ttn:
288
288
  if (message.uplink_message && message.uplink_message.rx_metadata[0]) {
289
289
  for (const attr in message.uplink_message.decoded_payload) {
290
- this.deviceinformations[changeInfo.deviceEUI].uplink.decoded[attr] =
291
- message.uplink_message.decoded_payload[attr];
290
+ if (typeof message.uplink_message.decoded_payload[attr] === 'object') {
291
+ // merge the structures
292
+ this.deviceinformations[changeInfo.deviceEUI].uplink.decoded[attr] = lodash.merge(
293
+ this.deviceinformations[changeInfo.deviceEUI].uplink.decoded[attr],
294
+ message.uplink_message.decoded_payload[attr],
295
+ );
296
+ } else {
297
+ this.deviceinformations[changeInfo.deviceEUI].uplink.decoded[attr] =
298
+ message.uplink_message.decoded_payload[attr];
299
+ }
292
300
  }
293
- this.deviceinformations[changeInfo.deviceEUI].uplink.time =
301
+
302
+ // Generate Timestamp
303
+ const Timestamp =
294
304
  typeof message.uplink_message.rx_metadata[0].time === 'number'
295
305
  ? message.uplink_message.rx_metadata[0].time
296
306
  : new Date(message.uplink_message.rx_metadata[0].time).valueOf();
307
+
308
+ // time
309
+ this.deviceinformations[changeInfo.deviceEUI].uplink.time =
310
+ this.generateTimestringFromTimestamp(Timestamp);
311
+
312
+ // timestamp
313
+ this.deviceinformations[changeInfo.deviceEUI].uplink.timestamp = Timestamp;
297
314
  }
298
315
  break;
299
316
  case this.adapter.origin.chirpstack:
@@ -303,7 +320,7 @@ class messagehandlerClass {
303
320
  if (this.deviceinformations[changeInfo.deviceEUI].uplink.decoded[attr]) {
304
321
  if (typeof message.object[attr] === 'object') {
305
322
  // merge the structures
306
- this.deviceinformations[changeInfo.deviceEUI].uplink.decoded[attr] = _.merge(
323
+ this.deviceinformations[changeInfo.deviceEUI].uplink.decoded[attr] = lodash.merge(
307
324
  this.deviceinformations[changeInfo.deviceEUI].uplink.decoded[attr],
308
325
  message.object[attr],
309
326
  );
@@ -316,8 +333,16 @@ class messagehandlerClass {
316
333
  message.object[attr];
317
334
  }
318
335
  }
319
- this.deviceinformations[changeInfo.deviceEUI].uplink.time =
336
+ // Generate Timestamp
337
+ const Timestamp =
320
338
  typeof message.time === 'number' ? message.time : new Date(message.time).valueOf();
339
+
340
+ // time
341
+ this.deviceinformations[changeInfo.deviceEUI].uplink.time =
342
+ this.generateTimestringFromTimestamp(Timestamp);
343
+
344
+ // timestamp
345
+ this.deviceinformations[changeInfo.deviceEUI].uplink.timestamp = Timestamp;
321
346
  }
322
347
  break;
323
348
  }
@@ -327,6 +352,14 @@ class messagehandlerClass {
327
352
  }
328
353
  }
329
354
 
355
+ // Generate Timestring for deviceInformations
356
+ /**
357
+ * @param Timestamp Timestamp, from wich the Timestring has to generated
358
+ */
359
+ generateTimestringFromTimestamp(Timestamp) {
360
+ return `${new Date(Timestamp).toDateString()} ${new Date(Timestamp).toTimeString().substring(0, 8)}`;
361
+ }
362
+
330
363
  //Add directories at startup (so they are present before next upload)
331
364
  /**
332
365
  * @param startDirectory directorypath (id)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.lorawan",
3
- "version": "1.7.1",
3
+ "version": "1.8.1",
4
4
  "description": "converts the desired lora gateway data to a ioBroker structure",
5
5
  "author": {
6
6
  "name": "BenAhrdt",
@@ -27,6 +27,7 @@
27
27
  "dependencies": {
28
28
  "@iobroker/adapter-core": "^3.2.3",
29
29
  "easy-crc": "^1.1.0",
30
+ "lodash": "^4.17.21",
30
31
  "mqtt": "^5.10.4",
31
32
  "node-schedule": "^2.1.1"
32
33
  },
@@ -41,6 +42,7 @@
41
42
  "@tsconfig/node18": "^18.2.2",
42
43
  "@types/chai": "^4.3.11",
43
44
  "@types/chai-as-promised": "^8.0.2",
45
+ "@types/lodash": "^4.17.16",
44
46
  "@types/mocha": "^10.0.10",
45
47
  "@types/node": "^22.13.14",
46
48
  "@types/proxyquire": "^1.3.31",