iobroker.lorawan 1.6.2 → 1.6.4
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 +7 -0
- package/io-package.json +27 -27
- package/lib/modules/deviceProfiles/Vicki.json +99 -7
- package/lib/modules/messagehandler.js +88 -38
- package/main.js +55 -7
- package/package.json +1 -1
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.6.4 (2025-01-21)
|
|
27
|
+
* (BenAhrdt) Set decoded Structure in deviceInfos (with Merge)
|
|
28
|
+
|
|
29
|
+
### 1.6.3 (2025-01-20)
|
|
30
|
+
* (BenAhrdt) Names of states changed (Downlink Raw)
|
|
31
|
+
* (BenAhrdt) Change setObjectNotExistsAsync to extendObjectAsync for Raw Data
|
|
32
|
+
|
|
26
33
|
### 1.6.2 (2025-01-15)
|
|
27
34
|
* (BenAhrdt) Bugfix creation of deviceinfo
|
|
28
35
|
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "lorawan",
|
|
4
|
-
"version": "1.6.
|
|
4
|
+
"version": "1.6.4",
|
|
5
5
|
"news": {
|
|
6
|
+
"1.6.4": {
|
|
7
|
+
"en": "Set decoded Structure in deviceInfos (with Merge)",
|
|
8
|
+
"de": "Set decodierte Struktur in deviceInfos (mit Verschmelzung)",
|
|
9
|
+
"ru": "Настройка декодированной структуры в deviceInfos (с Merge)",
|
|
10
|
+
"pt": "Definir estrutura decodificada no dispositivoInfos (com fusão)",
|
|
11
|
+
"nl": "Gedecodeerde structuur instellen in apparaatInfos (met samenvoegen)",
|
|
12
|
+
"fr": "Définir la structure décodée dans l'appareilInfos (avec Merge)",
|
|
13
|
+
"it": "Impostare la struttura decodificata in DeviceInfos (con fusione)",
|
|
14
|
+
"es": "Establecer estructura decodificada en el dispositivoInfos (con Merge)",
|
|
15
|
+
"pl": "Ustaw dekodowaną strukturę w deviceInfos (z połączeniem)",
|
|
16
|
+
"uk": "Настроювання декодованої структури в пристроїІнфос (з торговою маркою)",
|
|
17
|
+
"zh-cn": "在设备Infos( 合并) 中设置解码结构"
|
|
18
|
+
},
|
|
19
|
+
"1.6.3": {
|
|
20
|
+
"en": "Names of states changed (Downlink Raw)\nChange setObjectNotExistsAsync to extendObjectAsync for Raw Data",
|
|
21
|
+
"de": "Namen der geänderten Zustände (Downlink Raw)\nÄnderungssatz ObjectNotExistsAsync erweitert ObjectAsync für Rohdaten",
|
|
22
|
+
"ru": "Изменились названия государств (Downlink Raw)\nИзменение ObjectNotExistsAsync ObjectAsync для первичных данных",
|
|
23
|
+
"pt": "Nomes de estados alterados (Downlink Raw)\nConjunto de alterações ObjectNotExistsAsync para estender ObjectAsync para dados brutos",
|
|
24
|
+
"nl": "Namen van statuss veranderd (Downlink Raw)\nVerander set ObjectNotExistsAsync uit te breiden ObjectAsync voor ruwe gegevens",
|
|
25
|
+
"fr": "Noms des états modifiés (Downlink Raw)\nModifier l'ensemble ObjetNotExistsAsync pour étendre ObjetAsync pour les données brutes",
|
|
26
|
+
"it": "I nomi degli stati cambiati (Downlink Raw)\nModifica set ObjectNotExistsAsync per estendere ObjectAsync per dati raw",
|
|
27
|
+
"es": "Los nombres de los estados cambiaron (Downlink Raw)\nCambio ObjectNotExistsAsync para extender ObjectAsync for Raw Data",
|
|
28
|
+
"pl": "Zmienione nazwy państw (Downlink Raw)\nZmień zestaw ObjectNotExistsAsync do rozszerzenia ObjectAsync for raw Data",
|
|
29
|
+
"uk": "Назви змінених держав (Downlink Raw)\nЗмінення Об'єктNotExistsAsync для розширення Об'єктАсинк для сирих даних",
|
|
30
|
+
"zh-cn": "更改州名( 下link Raw)\n更改设置 要扩展的对象“非外来”Async 原始数据对象同步"
|
|
31
|
+
},
|
|
6
32
|
"1.6.2": {
|
|
7
33
|
"en": "Bugfix creation of deviceinfo",
|
|
8
34
|
"de": "Bugfix Erstellung von deviceinfo",
|
|
@@ -67,32 +93,6 @@
|
|
|
67
93
|
"pl": "dodaj folder \"uplink.revening.version _ ids\" do writecommands",
|
|
68
94
|
"uk": "додати папку \"uplink.remaining.version_ids\" для записукоманд",
|
|
69
95
|
"zh-cn": "添加文件夹“ uplink. remaining.version_ ids” 以写入命令"
|
|
70
|
-
},
|
|
71
|
-
"1.5.5": {
|
|
72
|
-
"en": "add CRC-8",
|
|
73
|
-
"de": "cRC-8 hinzufügen",
|
|
74
|
-
"ru": "добавить CRC-8",
|
|
75
|
-
"pt": "adicionar CRC-8",
|
|
76
|
-
"nl": "cRC-8 toevoegen",
|
|
77
|
-
"fr": "ajouter CRC-8",
|
|
78
|
-
"it": "aggiungere CRC-8",
|
|
79
|
-
"es": "añadir CRC-8",
|
|
80
|
-
"pl": "dodaj CRC- 8",
|
|
81
|
-
"uk": "додати CRC-8",
|
|
82
|
-
"zh-cn": "添加CRC-8"
|
|
83
|
-
},
|
|
84
|
-
"1.5.4": {
|
|
85
|
-
"en": "add roles and fix responsive issues",
|
|
86
|
-
"de": "rollen hinzufügen und reaktionsprobleme beheben",
|
|
87
|
-
"ru": "добавить роли и решить вопросы реагирования",
|
|
88
|
-
"pt": "adicionar funções e corrigir problemas responsivos",
|
|
89
|
-
"nl": "rolletjes toevoegen en responsieve problemen oplossen",
|
|
90
|
-
"fr": "ajouter des rôles et résoudre les problèmes sensibles",
|
|
91
|
-
"it": "aggiungere ruoli e risolvere problemi reattivi",
|
|
92
|
-
"es": "añadir funciones y fijar cuestiones sensibles",
|
|
93
|
-
"pl": "dodać role i naprawić problemy reagujące",
|
|
94
|
-
"uk": "додавання ролей і виправлення чуйних питань",
|
|
95
|
-
"zh-cn": "增加作用和解决应答问题"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"titleLang": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"onClick": "030111",
|
|
46
46
|
"multiplyfaktor": 10,
|
|
47
47
|
"decimalPlaces": 1,
|
|
48
|
-
"unit": "
|
|
48
|
+
"unit": "°C",
|
|
49
49
|
"crc": "noCrc",
|
|
50
50
|
"limitMin": true,
|
|
51
51
|
"limitMinValue": 6,
|
|
@@ -53,19 +53,19 @@
|
|
|
53
53
|
"limitMaxValue": 30
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
|
-
"name": "
|
|
56
|
+
"name": "ExternalTemperature",
|
|
57
57
|
"port": 1,
|
|
58
58
|
"priority": "NORMAL",
|
|
59
59
|
"type": "number",
|
|
60
60
|
"confirmed": false,
|
|
61
61
|
"front": "3C",
|
|
62
|
-
"end": "
|
|
62
|
+
"end": "0D021844",
|
|
63
63
|
"length": 12,
|
|
64
64
|
"on": "01",
|
|
65
65
|
"off": "11",
|
|
66
66
|
"onClick": "030111",
|
|
67
67
|
"multiplyfaktor": 10,
|
|
68
|
-
"unit": "
|
|
68
|
+
"unit": "°C",
|
|
69
69
|
"decimalPlaces": 1,
|
|
70
70
|
"lengthInByte": 2,
|
|
71
71
|
"crc": "noCrc",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"off": "11",
|
|
112
112
|
"onClick": "030111",
|
|
113
113
|
"multiplyfaktor": "1",
|
|
114
|
-
"unit": "
|
|
114
|
+
"unit": "°C",
|
|
115
115
|
"deviceType": "Vicki",
|
|
116
116
|
"lengthInByte": 1,
|
|
117
117
|
"decimalPlaces": 0,
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"length": 8,
|
|
134
134
|
"on": "01",
|
|
135
135
|
"off": "11",
|
|
136
|
-
"onClick": "
|
|
136
|
+
"onClick": "041215184634363D",
|
|
137
137
|
"multiplyfaktor": "1",
|
|
138
138
|
"unit": "",
|
|
139
139
|
"deviceType": "Vicki",
|
|
@@ -262,6 +262,98 @@
|
|
|
262
262
|
"limitMinValue": 0,
|
|
263
263
|
"limitMax": false,
|
|
264
264
|
"limitMaxValue": 0
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"name": "GetKp",
|
|
268
|
+
"port": 1,
|
|
269
|
+
"priority": "NORMAL",
|
|
270
|
+
"type": "button",
|
|
271
|
+
"swap": false,
|
|
272
|
+
"_statciText": null,
|
|
273
|
+
"confirmed": false,
|
|
274
|
+
"front": "03",
|
|
275
|
+
"end": "11",
|
|
276
|
+
"lengthInByte": 2,
|
|
277
|
+
"on": "01",
|
|
278
|
+
"off": "11",
|
|
279
|
+
"onClick": "36",
|
|
280
|
+
"multiplyfaktor": 1,
|
|
281
|
+
"decimalPlaces": 0,
|
|
282
|
+
"unit": "",
|
|
283
|
+
"crc": "noCrc",
|
|
284
|
+
"limitMin": false,
|
|
285
|
+
"limitMinValue": 0,
|
|
286
|
+
"limitMax": false,
|
|
287
|
+
"limitMaxValue": 0
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
"name": "GetKi",
|
|
291
|
+
"port": 1,
|
|
292
|
+
"priority": "NORMAL",
|
|
293
|
+
"type": "button",
|
|
294
|
+
"swap": false,
|
|
295
|
+
"_statciText": null,
|
|
296
|
+
"confirmed": false,
|
|
297
|
+
"front": "03",
|
|
298
|
+
"end": "11",
|
|
299
|
+
"lengthInByte": 2,
|
|
300
|
+
"on": "01",
|
|
301
|
+
"off": "11",
|
|
302
|
+
"onClick": "3D",
|
|
303
|
+
"multiplyfaktor": 1,
|
|
304
|
+
"decimalPlaces": 0,
|
|
305
|
+
"unit": "",
|
|
306
|
+
"crc": "noCrc",
|
|
307
|
+
"limitMin": false,
|
|
308
|
+
"limitMinValue": 0,
|
|
309
|
+
"limitMax": false,
|
|
310
|
+
"limitMaxValue": 0
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"name": "SetKp",
|
|
314
|
+
"port": 1,
|
|
315
|
+
"priority": "NORMAL",
|
|
316
|
+
"type": "number",
|
|
317
|
+
"swap": false,
|
|
318
|
+
"_statciText": null,
|
|
319
|
+
"confirmed": false,
|
|
320
|
+
"front": "37",
|
|
321
|
+
"end": "36",
|
|
322
|
+
"lengthInByte": 3,
|
|
323
|
+
"on": "01",
|
|
324
|
+
"off": "11",
|
|
325
|
+
"onClick": "030111",
|
|
326
|
+
"multiplyfaktor": 131072,
|
|
327
|
+
"decimalPlaces": 5,
|
|
328
|
+
"unit": "",
|
|
329
|
+
"crc": "noCrc",
|
|
330
|
+
"limitMin": false,
|
|
331
|
+
"limitMinValue": 0,
|
|
332
|
+
"limitMax": false,
|
|
333
|
+
"limitMaxValue": 0
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
"name": "SetKi",
|
|
337
|
+
"port": 1,
|
|
338
|
+
"priority": "NORMAL",
|
|
339
|
+
"type": "number",
|
|
340
|
+
"swap": false,
|
|
341
|
+
"_statciText": null,
|
|
342
|
+
"confirmed": false,
|
|
343
|
+
"front": "3E",
|
|
344
|
+
"end": "3D",
|
|
345
|
+
"lengthInByte": 3,
|
|
346
|
+
"on": "01",
|
|
347
|
+
"off": "11",
|
|
348
|
+
"onClick": "030111",
|
|
349
|
+
"multiplyfaktor": 131072,
|
|
350
|
+
"decimalPlaces": 5,
|
|
351
|
+
"unit": "",
|
|
352
|
+
"crc": "noCrc",
|
|
353
|
+
"limitMin": false,
|
|
354
|
+
"limitMinValue": 0,
|
|
355
|
+
"limitMax": false,
|
|
356
|
+
"limitMaxValue": 0
|
|
265
357
|
}
|
|
266
358
|
]
|
|
267
|
-
}
|
|
359
|
+
}
|
|
@@ -3,6 +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
7
|
/**
|
|
7
8
|
* handles the message, wich comes from LoRaWAN devices
|
|
8
9
|
*/
|
|
@@ -183,8 +184,26 @@ class messagehandlerClass {
|
|
|
183
184
|
decodedData[changeInfo.deviceEUI].decoded = {};
|
|
184
185
|
decodedData[changeInfo.deviceEUI].id = adapterObject._id;
|
|
185
186
|
}
|
|
186
|
-
|
|
187
|
-
|
|
187
|
+
const restId = adapterObject._id.substring(
|
|
188
|
+
adapterObject._id.indexOf(`${this.directoryhandler.reachableSubfolders.uplinkDecoded}.`) +
|
|
189
|
+
this.directoryhandler.reachableSubfolders.uplinkDecoded.length +
|
|
190
|
+
1,
|
|
191
|
+
adapterObject._id.length,
|
|
192
|
+
);
|
|
193
|
+
//Check for Structure or State
|
|
194
|
+
const index = restId.indexOf('.');
|
|
195
|
+
if (index !== -1) {
|
|
196
|
+
// => Structure
|
|
197
|
+
const generatedStructure = this.getIdStructure(restId, decodedState.val);
|
|
198
|
+
// merge the structures
|
|
199
|
+
decodedData[changeInfo.deviceEUI].decoded = _.merge(
|
|
200
|
+
decodedData[changeInfo.deviceEUI].decoded,
|
|
201
|
+
generatedStructure,
|
|
202
|
+
);
|
|
203
|
+
} else {
|
|
204
|
+
// direct state in decoded path
|
|
205
|
+
decodedData[changeInfo.deviceEUI].decoded[changeInfo.changedState] = decodedState.val;
|
|
206
|
+
}
|
|
188
207
|
}
|
|
189
208
|
if (
|
|
190
209
|
adapterObject._id.endsWith(`rx_metadata.0.time`) ||
|
|
@@ -227,6 +246,21 @@ class messagehandlerClass {
|
|
|
227
246
|
}
|
|
228
247
|
}
|
|
229
248
|
|
|
249
|
+
// get structure out of string (id)
|
|
250
|
+
/**
|
|
251
|
+
* @param id string toconvert to structure
|
|
252
|
+
* @param val value for last element
|
|
253
|
+
*/
|
|
254
|
+
getIdStructure(id, val) {
|
|
255
|
+
let idStructure = {};
|
|
256
|
+
const index = id.indexOf('.');
|
|
257
|
+
if (index !== -1) {
|
|
258
|
+
idStructure[id.substring(0, index)] = this.getIdStructure(id.substring(index + 1, id.length), val);
|
|
259
|
+
} else {
|
|
260
|
+
idStructure[id] = val;
|
|
261
|
+
}
|
|
262
|
+
return idStructure;
|
|
263
|
+
}
|
|
230
264
|
// Assign base information to presentDevices
|
|
231
265
|
/**
|
|
232
266
|
* @param id id of the state
|
|
@@ -234,6 +268,7 @@ class messagehandlerClass {
|
|
|
234
268
|
*/
|
|
235
269
|
async assignDeviceInformation(id, message) {
|
|
236
270
|
const activeFunction = 'assignDeviceInformation';
|
|
271
|
+
this.adapter.log.debug(`Function ${activeFunction} started.`);
|
|
237
272
|
try {
|
|
238
273
|
const changeInfo = await this.adapter.getChangeInfo(id);
|
|
239
274
|
// Create Attribute for application id
|
|
@@ -263,7 +298,22 @@ class messagehandlerClass {
|
|
|
263
298
|
case this.adapter.origin.chirpstack:
|
|
264
299
|
if (message.object && message.rxInfo[0].nsTime) {
|
|
265
300
|
for (const attr in message.object) {
|
|
266
|
-
|
|
301
|
+
// if there is allready an attribute check for object and assign all attributs of the object
|
|
302
|
+
if (this.deviceinformations[changeInfo.deviceEUI].uplink.decoded[attr]) {
|
|
303
|
+
if (typeof message.object[attr] === 'object') {
|
|
304
|
+
// merge the structures
|
|
305
|
+
this.deviceinformations[changeInfo.deviceEUI].uplink.decoded[attr] = _.merge(
|
|
306
|
+
this.deviceinformations[changeInfo.deviceEUI].uplink.decoded[attr],
|
|
307
|
+
message.object[attr],
|
|
308
|
+
);
|
|
309
|
+
} else {
|
|
310
|
+
this.deviceinformations[changeInfo.deviceEUI].uplink.decoded[attr] =
|
|
311
|
+
message.object[attr];
|
|
312
|
+
}
|
|
313
|
+
} else {
|
|
314
|
+
this.deviceinformations[changeInfo.deviceEUI].uplink.decoded[attr] =
|
|
315
|
+
message.object[attr];
|
|
316
|
+
}
|
|
267
317
|
}
|
|
268
318
|
this.deviceinformations[changeInfo.deviceEUI].uplink.time = message.rxInfo[0].nsTime;
|
|
269
319
|
}
|
|
@@ -552,10 +602,10 @@ class messagehandlerClass {
|
|
|
552
602
|
this.adapter.log.silly(`write rawdata`);
|
|
553
603
|
let startId = `${deviceStartdirectory}.${this.directoryhandler.reachableSubfolders.uplinkRaw}`;
|
|
554
604
|
// write json
|
|
555
|
-
await this.adapter.
|
|
605
|
+
await this.adapter.extendObjectAsync(`${startId}.json`, {
|
|
556
606
|
type: 'state',
|
|
557
607
|
common: {
|
|
558
|
-
name: 'last
|
|
608
|
+
name: 'last received message',
|
|
559
609
|
type: 'json',
|
|
560
610
|
role: 'json',
|
|
561
611
|
read: true,
|
|
@@ -572,10 +622,10 @@ class messagehandlerClass {
|
|
|
572
622
|
if (message.uplink_message.frm_payload) {
|
|
573
623
|
// wite base64 data
|
|
574
624
|
this.adapter.log.silly(`write base64`);
|
|
575
|
-
await this.adapter.
|
|
625
|
+
await this.adapter.extendObjectAsync(`${startId}.base64`, {
|
|
576
626
|
type: 'state',
|
|
577
627
|
common: {
|
|
578
|
-
name: 'last
|
|
628
|
+
name: 'last received data as base64',
|
|
579
629
|
type: 'string',
|
|
580
630
|
role: 'state',
|
|
581
631
|
read: true,
|
|
@@ -588,10 +638,10 @@ class messagehandlerClass {
|
|
|
588
638
|
|
|
589
639
|
// write base64 data in hex data
|
|
590
640
|
this.adapter.log.silly(`write hex`);
|
|
591
|
-
await this.adapter.
|
|
641
|
+
await this.adapter.extendObjectAsync(`${startId}.hex`, {
|
|
592
642
|
type: 'state',
|
|
593
643
|
common: {
|
|
594
|
-
name: 'last
|
|
644
|
+
name: 'last received data as hex',
|
|
595
645
|
type: 'string',
|
|
596
646
|
role: 'state',
|
|
597
647
|
read: true,
|
|
@@ -606,10 +656,10 @@ class messagehandlerClass {
|
|
|
606
656
|
|
|
607
657
|
// write base64 data in string data
|
|
608
658
|
this.adapter.log.silly(`write string`);
|
|
609
|
-
await this.adapter.
|
|
659
|
+
await this.adapter.extendObjectAsync(`${startId}.string`, {
|
|
610
660
|
type: 'state',
|
|
611
661
|
common: {
|
|
612
|
-
name: 'last
|
|
662
|
+
name: 'last received data as string',
|
|
613
663
|
type: 'string',
|
|
614
664
|
role: 'state',
|
|
615
665
|
read: true,
|
|
@@ -673,10 +723,10 @@ class messagehandlerClass {
|
|
|
673
723
|
let startId = `${deviceStartdirectory}.${this.directoryhandler.reachableSubfolders.downlinkRaw}`;
|
|
674
724
|
// write json
|
|
675
725
|
this.adapter.log.silly(`write rawdata`);
|
|
676
|
-
await this.adapter.
|
|
726
|
+
await this.adapter.extendObjectAsync(`${startId}.json`, {
|
|
677
727
|
type: 'state',
|
|
678
728
|
common: {
|
|
679
|
-
name: 'last
|
|
729
|
+
name: 'last send message',
|
|
680
730
|
type: 'json',
|
|
681
731
|
role: 'json',
|
|
682
732
|
read: true,
|
|
@@ -694,10 +744,10 @@ class messagehandlerClass {
|
|
|
694
744
|
this.adapter.log.silly(`write base64`);
|
|
695
745
|
if (message[downlinkType].frm_payload) {
|
|
696
746
|
// wite base64 data
|
|
697
|
-
await this.adapter.
|
|
747
|
+
await this.adapter.extendObjectAsync(`${startId}.base64`, {
|
|
698
748
|
type: 'state',
|
|
699
749
|
common: {
|
|
700
|
-
name: 'last
|
|
750
|
+
name: 'last send data as base64',
|
|
701
751
|
type: 'string',
|
|
702
752
|
role: 'state',
|
|
703
753
|
read: true,
|
|
@@ -710,10 +760,10 @@ class messagehandlerClass {
|
|
|
710
760
|
|
|
711
761
|
// write base64 data in hex data
|
|
712
762
|
this.adapter.log.silly(`write hex`);
|
|
713
|
-
await this.adapter.
|
|
763
|
+
await this.adapter.extendObjectAsync(`${startId}.hex`, {
|
|
714
764
|
type: 'state',
|
|
715
765
|
common: {
|
|
716
|
-
name: 'last
|
|
766
|
+
name: 'last send data as hex',
|
|
717
767
|
type: 'string',
|
|
718
768
|
role: 'state',
|
|
719
769
|
read: true,
|
|
@@ -728,10 +778,10 @@ class messagehandlerClass {
|
|
|
728
778
|
|
|
729
779
|
// write base64 data in string data
|
|
730
780
|
this.adapter.log.silly(`write string`);
|
|
731
|
-
await this.adapter.
|
|
781
|
+
await this.adapter.extendObjectAsync(`${startId}.string`, {
|
|
732
782
|
type: 'state',
|
|
733
783
|
common: {
|
|
734
|
-
name: 'last
|
|
784
|
+
name: 'last send data as string',
|
|
735
785
|
type: 'string',
|
|
736
786
|
role: 'state',
|
|
737
787
|
read: true,
|
|
@@ -773,7 +823,7 @@ class messagehandlerClass {
|
|
|
773
823
|
this.adapter.log.silly(`write rawdata`);
|
|
774
824
|
const startId = `${deviceStartdirectory}.${this.directoryhandler.reachableSubfolders.joinRaw}`;
|
|
775
825
|
// write json
|
|
776
|
-
await this.adapter.
|
|
826
|
+
await this.adapter.extendObjectAsync(`${startId}.json`, {
|
|
777
827
|
type: 'state',
|
|
778
828
|
common: {
|
|
779
829
|
name: 'last recieved message',
|
|
@@ -870,10 +920,10 @@ class messagehandlerClass {
|
|
|
870
920
|
let startId = `${deviceStartdirectory}.${this.directoryhandler.reachableSubfolders.uplinkRaw}`;
|
|
871
921
|
// write json
|
|
872
922
|
this.adapter.log.silly(`write rawdata`);
|
|
873
|
-
await this.adapter.
|
|
923
|
+
await this.adapter.extendObjectAsync(`${startId}.json`, {
|
|
874
924
|
type: 'state',
|
|
875
925
|
common: {
|
|
876
|
-
name: 'last
|
|
926
|
+
name: 'last received message',
|
|
877
927
|
type: 'json',
|
|
878
928
|
role: 'json',
|
|
879
929
|
read: true,
|
|
@@ -890,10 +940,10 @@ class messagehandlerClass {
|
|
|
890
940
|
if (message.data) {
|
|
891
941
|
// wite base64 data
|
|
892
942
|
this.adapter.log.silly(`write base64`);
|
|
893
|
-
await this.adapter.
|
|
943
|
+
await this.adapter.extendObjectAsync(`${startId}.base64`, {
|
|
894
944
|
type: 'state',
|
|
895
945
|
common: {
|
|
896
|
-
name: 'last
|
|
946
|
+
name: 'last received data as base64',
|
|
897
947
|
type: 'string',
|
|
898
948
|
role: 'state',
|
|
899
949
|
read: true,
|
|
@@ -906,10 +956,10 @@ class messagehandlerClass {
|
|
|
906
956
|
|
|
907
957
|
// write base64 data in hex data
|
|
908
958
|
this.adapter.log.silly(`write hex`);
|
|
909
|
-
await this.adapter.
|
|
959
|
+
await this.adapter.extendObjectAsync(`${startId}.hex`, {
|
|
910
960
|
type: 'state',
|
|
911
961
|
common: {
|
|
912
|
-
name: 'last
|
|
962
|
+
name: 'last received data as hex',
|
|
913
963
|
type: 'string',
|
|
914
964
|
role: 'state',
|
|
915
965
|
read: true,
|
|
@@ -922,10 +972,10 @@ class messagehandlerClass {
|
|
|
922
972
|
|
|
923
973
|
// write base64 data in string data
|
|
924
974
|
this.adapter.log.silly(`write string`);
|
|
925
|
-
await this.adapter.
|
|
975
|
+
await this.adapter.extendObjectAsync(`${startId}.string`, {
|
|
926
976
|
type: 'state',
|
|
927
977
|
common: {
|
|
928
|
-
name: 'last
|
|
978
|
+
name: 'last received data as string',
|
|
929
979
|
type: 'string',
|
|
930
980
|
role: 'state',
|
|
931
981
|
read: true,
|
|
@@ -978,10 +1028,10 @@ class messagehandlerClass {
|
|
|
978
1028
|
const startId = `${deviceStartdirectory}.${this.directoryhandler.reachableSubfolders.downlinkRaw}`;
|
|
979
1029
|
// write json
|
|
980
1030
|
this.adapter.log.silly(`write rawdata`);
|
|
981
|
-
await this.adapter.
|
|
1031
|
+
await this.adapter.extendObjectAsync(`${startId}.json`, {
|
|
982
1032
|
type: 'state',
|
|
983
1033
|
common: {
|
|
984
|
-
name: 'last
|
|
1034
|
+
name: 'last send message',
|
|
985
1035
|
type: 'json',
|
|
986
1036
|
role: 'json',
|
|
987
1037
|
read: true,
|
|
@@ -999,10 +1049,10 @@ class messagehandlerClass {
|
|
|
999
1049
|
if (message.data) {
|
|
1000
1050
|
// wite base64 data
|
|
1001
1051
|
this.adapter.log.silly(`write base64`);
|
|
1002
|
-
await this.adapter.
|
|
1052
|
+
await this.adapter.extendObjectAsync(`${startId}.base64`, {
|
|
1003
1053
|
type: 'state',
|
|
1004
1054
|
common: {
|
|
1005
|
-
name: 'last
|
|
1055
|
+
name: 'last send data as base64',
|
|
1006
1056
|
type: 'string',
|
|
1007
1057
|
role: 'state',
|
|
1008
1058
|
read: true,
|
|
@@ -1015,10 +1065,10 @@ class messagehandlerClass {
|
|
|
1015
1065
|
|
|
1016
1066
|
// write base64 data in hex data
|
|
1017
1067
|
this.adapter.log.silly(`write hex`);
|
|
1018
|
-
await this.adapter.
|
|
1068
|
+
await this.adapter.extendObjectAsync(`${startId}.hex`, {
|
|
1019
1069
|
type: 'state',
|
|
1020
1070
|
common: {
|
|
1021
|
-
name: 'last
|
|
1071
|
+
name: 'last send data as hex',
|
|
1022
1072
|
type: 'string',
|
|
1023
1073
|
role: 'state',
|
|
1024
1074
|
read: true,
|
|
@@ -1031,10 +1081,10 @@ class messagehandlerClass {
|
|
|
1031
1081
|
|
|
1032
1082
|
// write base64 data in string data
|
|
1033
1083
|
this.adapter.log.silly(`write string`);
|
|
1034
|
-
await this.adapter.
|
|
1084
|
+
await this.adapter.extendObjectAsync(`${startId}.string`, {
|
|
1035
1085
|
type: 'state',
|
|
1036
1086
|
common: {
|
|
1037
|
-
name: 'last
|
|
1087
|
+
name: 'last send data as string',
|
|
1038
1088
|
type: 'string',
|
|
1039
1089
|
role: 'state',
|
|
1040
1090
|
read: true,
|
|
@@ -1070,10 +1120,10 @@ class messagehandlerClass {
|
|
|
1070
1120
|
const startId = `${deviceStartdirectory}.${this.directoryhandler.reachableSubfolders.joinRaw}`;
|
|
1071
1121
|
// write json
|
|
1072
1122
|
this.adapter.log.silly(`write rawdata`);
|
|
1073
|
-
await this.adapter.
|
|
1123
|
+
await this.adapter.extendObjectAsync(`${startId}.json`, {
|
|
1074
1124
|
type: 'state',
|
|
1075
1125
|
common: {
|
|
1076
|
-
name: 'last
|
|
1126
|
+
name: 'last received message',
|
|
1077
1127
|
type: 'json',
|
|
1078
1128
|
role: 'json',
|
|
1079
1129
|
read: true,
|
package/main.js
CHANGED
|
@@ -69,9 +69,9 @@ class Lorawan extends utils.Adapter {
|
|
|
69
69
|
`the active downlinkconfigs are: ${JSON.stringify(this.downlinkConfighandler.activeDownlinkConfigs)}`,
|
|
70
70
|
);
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
setTimeout(async () => {
|
|
73
|
+
await this.startSimulation();
|
|
74
|
+
}, 5000);
|
|
75
75
|
/*this.simulation.timeout = setTimeout(async () => {
|
|
76
76
|
const topic = "application/d63c10b6-9263-4ab3-9299-4308fa19a2ad/device/f1c0ae0e-b4a2-4547-b360-7cfa15e85734/command/down";
|
|
77
77
|
const message = {devEui:"f1c0ae0e-b4a2-4547-b360-7cfa15e85734",confirmed:false,fPort:1,data:"AAA"};
|
|
@@ -86,7 +86,7 @@ class Lorawan extends utils.Adapter {
|
|
|
86
86
|
// TTN
|
|
87
87
|
//const topic ="v3/hafi-ttn-lorawan@ttn/devices/Meins/up";
|
|
88
88
|
//const message = {"end_device_ids":{"device_id":"eui-lobaro-modbus","application_ids":{"application_id":"hafi-ttn-lorawan"},"dev_eui":"70B3D5E050013950","join_eui":"D55B58C0DDC074DE","dev_addr":"260B5972"},"correlation_ids":["gs:uplink:01HMQZVSCX4D7JRDNFA7GJ9D4W"],"received_at":"2024-01-22T07:06:25.260676101Z","uplink_message":{"session_key_id":"AY0v/ZirzRkpNW0Cgjdhig==","f_port":20,"f_cnt":2,"frm_payload":"AA5BAf0AxwIAAQ==","decoded_payload":{"airhumidity":50.9,"airtemperature":19.9,"port":20,"relais1":0,"relais2":1,"relais3":null,"relais5":null,"volt":3.649,"zisternenpegel":2},"rx_metadata":[{"gateway_ids":{"gateway_id":"hafenmeister-port2ttn-ng","eui":"50313953530A4750"},"time":"2024-01-22T07:06:25.013878Z","timestamp":995696116,"rssi":-37,"channel_rssi":-37,"snr":8.5,"location":{"latitude":53.5548443059465,"longitude":9.92155426743724,"altitude":10,"source":"SOURCE_REGISTRY"},"uplink_token":"CiYKJAoYaGFmZW5tZWlzdGVyLXBvcnQydHRuLW5nEghQMTlTUwpHUBD0u+TaAxoLCPGnuK0GEM3uvhkgoIL0oP24Sg==","channel_index":5,"received_at":"2024-01-22T07:06:25.032492359Z"}],"settings":{"data_rate":{"lora":{"bandwidth":125000,"spreading_factor":9,"coding_rate":"4/5"}},"frequency":"867500000","timestamp":995696116,"time":"2024-01-22T07:06:25.013878Z"},"received_at":"2024-01-22T07:06:25.054442349Z","consumed_airtime":"0.205824s","network_ids":{"net_id":"000013","ns_id":"EC656E0000000181","tenant_id":"ttn","cluster_id":"eu1","cluster_address":"eu1.cloud.thethings.network"}}};
|
|
89
|
-
|
|
89
|
+
/*
|
|
90
90
|
const topic = 'v3/hafi-ttn-lorawan@ttn/devices/eui-00137A1000044DF5/up';
|
|
91
91
|
const message = {
|
|
92
92
|
end_device_ids: {
|
|
@@ -177,14 +177,62 @@ class Lorawan extends utils.Adapter {
|
|
|
177
177
|
},
|
|
178
178
|
},
|
|
179
179
|
};
|
|
180
|
-
|
|
180
|
+
*/
|
|
181
181
|
// ACK
|
|
182
182
|
//const topic = "v3/hafi-ttn-lorawan@ttn/devices/eui-a84041162183f8fb/down/ack";
|
|
183
183
|
//const message = {"end_device_ids":{"device_id":"eui-a84041162183f8fb","application_ids":{"application_id":"hafi-ttn-lorawan"},"dev_eui":"A84041162183F8FB","join_eui":"A840410000000101","dev_addr":"260B141A"},"correlation_ids":["as:downlink:01HP6D18MQXJN90J5B07DC11HY","gs:uplink:01HP6D1A9X4WAA3SFMXH4ESSMV"],"received_at":"2024-02-09T07:41:41.776887672Z","downlink_ack":{"session_key_id":"AY2MUrmnuovS8DCZAfYmsA==","f_port":1,"f_cnt":21,"frm_payload":"AQAAeA==","confirmed":true,"priority":"NORMAL","correlation_ids":["as:downlink:01HP6D18MQXJN90J5B07DC11HY"],"confirmed_retry":{"attempt":1}}};
|
|
184
184
|
|
|
185
185
|
// Chipstack
|
|
186
|
-
|
|
187
|
-
|
|
186
|
+
const topic = 'application/d63c10b6-9263-4ab3-9299-4308fa19a2ad/device/a84041f621857cd2/event/up';
|
|
187
|
+
const message = {
|
|
188
|
+
deduplicationId: '96e4a065-ad5e-402d-a997-7b261072a33c',
|
|
189
|
+
time: '2024-01-21T17:01:36.641008+00:00',
|
|
190
|
+
deviceInfo: {
|
|
191
|
+
tenantId: '52f14cd4-c6f1-4fbd-8f87-4025e1d49242',
|
|
192
|
+
tenantName: 'ChirpStack',
|
|
193
|
+
applicationId: 'd63c10b6-9263-4ab3-9299-4308fa19a2ad',
|
|
194
|
+
applicationName: 'Benjamin Schmidt',
|
|
195
|
+
deviceProfileId: '0b46400f-37ec-4f17-8005-168b06159347',
|
|
196
|
+
deviceProfileName: 'Dragino Feuchtesenor',
|
|
197
|
+
deviceName: 'Skimmer',
|
|
198
|
+
devEui: 'a84041f621857cd2',
|
|
199
|
+
deviceClassEnabled: 'CLASS_A',
|
|
200
|
+
tags: {},
|
|
201
|
+
},
|
|
202
|
+
devAddr: '01fd9738',
|
|
203
|
+
adr: true,
|
|
204
|
+
dr: 5,
|
|
205
|
+
fCnt: 2,
|
|
206
|
+
fPort: 2,
|
|
207
|
+
confirmed: false,
|
|
208
|
+
data: 'DPYBAAD//wAA',
|
|
209
|
+
object: {
|
|
210
|
+
Test: { zweite: { dritte: { a: 4 } } },
|
|
211
|
+
soilconductivity: 0.0,
|
|
212
|
+
soiltemperature: -0.1,
|
|
213
|
+
volt: 3.318,
|
|
214
|
+
soilmoisture: 0.0,
|
|
215
|
+
},
|
|
216
|
+
rxInfo: [
|
|
217
|
+
{
|
|
218
|
+
gatewayId: '50303541b0344750',
|
|
219
|
+
uplinkId: 39169,
|
|
220
|
+
gwTime: '2024-01-21T17:01:36.641008+00:00',
|
|
221
|
+
nsTime: '2024-01-21T17:01:37.695656999+00:00',
|
|
222
|
+
rssi: -89,
|
|
223
|
+
snr: 6.25,
|
|
224
|
+
rfChain: 1,
|
|
225
|
+
location: { latitude: 50.69344693065449, longitude: 8.476783633232118 },
|
|
226
|
+
context: 'qESemw==',
|
|
227
|
+
metadata: { region_config_id: 'eu868', region_common_name: 'EU868' },
|
|
228
|
+
crcStatus: 'CRC_OK',
|
|
229
|
+
},
|
|
230
|
+
],
|
|
231
|
+
txInfo: {
|
|
232
|
+
frequency: 868100000,
|
|
233
|
+
modulation: { lora: { bandwidth: 125000, spreadingFactor: 7, codeRate: 'CR_4_5' } },
|
|
234
|
+
},
|
|
235
|
+
};
|
|
188
236
|
//const topic = "application/d63c10b6-9263-4ab3-9299-4308fa19a2ad/device/a84041f621857cd2/command/down";
|
|
189
237
|
//const message = {"devEui":"a84041f621857cd2","confirmed":false,"fPort":1,"data":"AQAqMA=="};
|
|
190
238
|
|