iobroker.lorawan 0.3.1 → 0.3.3

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
@@ -22,6 +22,12 @@ For now there is documentation in English here: http://www.hafenmeister.com/Lora
22
22
  Placeholder for the next version (at the beginning of the line):
23
23
  ### **WORK IN PROGRESS**
24
24
  -->
25
+ ### 0.3.3 (2024-02-19)
26
+ * (BenAhrdt) set infos into native
27
+
28
+ ### 0.3.2 (2024-02-16)
29
+ * (BenAhrdt) wording recieved => received in messageing
30
+
25
31
  ### 0.3.1 (2024-02-15)
26
32
  * (BenAhrdt) rebuild with better messageing
27
33
 
package/io-package.json CHANGED
@@ -1,8 +1,34 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "lorawan",
4
- "version": "0.3.1",
4
+ "version": "0.3.3",
5
5
  "news": {
6
+ "0.3.3": {
7
+ "en": "set infos into native",
8
+ "de": "informationen in die heimat",
9
+ "ru": "установить информацию на родной",
10
+ "pt": "definir informações em nativo",
11
+ "nl": "info's instellen in native",
12
+ "fr": "définir les infos dans native",
13
+ "it": "impostare le informazioni in nativo",
14
+ "es": "set infos into native",
15
+ "pl": "zestaw infos do rodzimej",
16
+ "uk": "встановити інформацію на рідні",
17
+ "zh-cn": "设置为本地信息"
18
+ },
19
+ "0.3.2": {
20
+ "en": "wording recieved => received in messageing",
21
+ "de": "zurückgegeben => in der mitteilung empfangen",
22
+ "ru": "=> в сообщении",
23
+ "pt": "redação recieved => recebido em mensagens",
24
+ "nl": "tekst ontvangen => ontvangen in berichtgeving",
25
+ "fr": "texte reçu => reçu en message",
26
+ "it": "> ricevuto nel messaggio",
27
+ "es": "wording recieved = recibidos en mensajes",
28
+ "pl": "sformułowanie otrzymane = > otrzymywane w procesie messaging",
29
+ "uk": "javascript licenses api веб-сайт go1.13.8 отримувати повідомлення",
30
+ "zh-cn": "重述的语句 发送信件时收到"
31
+ },
6
32
  "0.3.1": {
7
33
  "en": "rebuild with better messageing",
8
34
  "de": "neuaufbau mit besserer botschaft",
@@ -67,32 +93,6 @@
67
93
  "pl": "budowa zmienionych katalogów i wdrożona wiadomość",
68
94
  "uk": "створення каталогу змінено та повідомлення",
69
95
  "zh-cn": "更改目录构建并执行消息"
70
- },
71
- "0.1.12": {
72
- "en": "default value crc config bug fixed",
73
- "de": "standardwert crc config bug behoben",
74
- "ru": "по умолчанию",
75
- "pt": "valor padrão crc config bug corrigido",
76
- "nl": "standaard waarde crc config bug vast",
77
- "fr": "valeur par défaut crc config bug corrigé",
78
- "it": "valore predefinito crc config bug fisso",
79
- "es": "valor predeterminado crc config error fijo",
80
- "pl": "wartość domyślna błąd konfiguracyjny crc",
81
- "uk": "за замовчуванням значення crc config fix",
82
- "zh-cn": "默认值 crc 配置错误已修正"
83
- },
84
- "0.1.11": {
85
- "en": "min / max values for downlink-configs (number)",
86
- "de": "min / max werte für downlink-konfigs (anzahl)",
87
- "ru": "min / max значения для конфигураций нисходящей ссылки (число)",
88
- "pt": "min / valores máximos para downlink-configs (número)",
89
- "nl": "min / max waarden voor downlink-configs (aantal)",
90
- "fr": "valeurs min / max pour les configurations de liaison descendante (nombre)",
91
- "it": "min / max valori per downlink-configs (numero)",
92
- "es": "valores min / máx para los inconvenientes (número)",
93
- "pl": "min / max wartości dla downlink- configs (liczba)",
94
- "uk": "min / максимальні значення для налаштувань посилань (номер)",
95
- "zh-cn": "下行链路配置最小值( 数)"
96
96
  }
97
97
  },
98
98
  "title": "LoRaWAN",
@@ -195,19 +195,6 @@
195
195
  "def": false
196
196
  },
197
197
  "native": {}
198
- },
199
- {
200
- "_id": "info.logAvailableConfignames",
201
- "type": "state",
202
- "common": {
203
- "role": "button",
204
- "name": "logs the names of available device configurations",
205
- "type": "boolean",
206
- "read": true,
207
- "write": true,
208
- "def": false
209
- },
210
- "native": {}
211
198
  }
212
199
  ]
213
200
  }
@@ -1,3 +1,4 @@
1
+ const { isDeepStrictEqual } = require("util");
1
2
  const fs = require("fs");
2
3
 
3
4
  class directorieshandlerClass {
@@ -6,8 +7,9 @@ class directorieshandlerClass {
6
7
 
7
8
  // used dataentries in directory structurt
8
9
  this.searchableAttributeNames = {
9
- apllicationId: "applicationId",
10
- deviceEUI: "devEui",
10
+ applicationId: "applicationId",
11
+ applicationName: "applicationName",
12
+ deviceEUI: "deviceEui",
11
13
  deviceId: "deviceId"
12
14
  };
13
15
 
@@ -34,17 +36,26 @@ class directorieshandlerClass {
34
36
  // declare the directory structre
35
37
  this.directories = {
36
38
  application:{
37
- objectStateId : async (topic,message) =>{
38
- return await this.getAttributValue(topic,message,this.searchableAttributeNames.apllicationId);
39
+ objectId : (topic,message) =>{
40
+ return this.getAttributValue(topic,message,this.searchableAttributeNames.applicationId);
41
+ },
42
+ objectCommonFromNative: {name:"applicationName"},
43
+ objectNative : (topic,message) =>{
44
+ return {
45
+ applicationName : this.getAttributValue(topic,message,this.searchableAttributeNames.applicationName)
46
+ };
39
47
  },
40
- objectCommonName: "application",
41
48
  devices:{
42
49
  deviceEUI:{
43
- objectStateId : async (topic,message) =>{
44
- return await this.getAttributValue(topic,message,this.searchableAttributeNames.deviceEUI);
50
+ objectId : (topic,message) =>{
51
+ return this.getAttributValue(topic,message,this.searchableAttributeNames.deviceEUI);
45
52
  },
46
- objectCommonName: async (topic,message) =>{
47
- return await this.getAttributValue(topic,message,this.searchableAttributeNames.deviceId);
53
+ objectCommonFromNative: {name:"deviceId"},
54
+ objectNative : (topic,message) =>{
55
+ return {
56
+ applicationName : this.getAttributValue(topic,message,this.searchableAttributeNames.applicationName),
57
+ deviceId : this.getAttributValue(topic,message,this.searchableAttributeNames.deviceId)
58
+ };
48
59
  },
49
60
  objectType: "device",
50
61
  configuration:{
@@ -90,9 +101,11 @@ class directorieshandlerClass {
90
101
  }
91
102
  };
92
103
  this.ignoredElementNames ={
93
- objectStateId: "objectStateId",
104
+ objectId: "objectId",
94
105
  objectCommonName: "objectCommonName",
95
- objectType: "objectType"
106
+ objectCommonFromNative: "objectCommonFromNative",
107
+ objectType: "objectType",
108
+ objectNative : "objectNative"
96
109
  };
97
110
  }
98
111
 
@@ -131,38 +144,79 @@ class directorieshandlerClass {
131
144
  if(!this.ignoredElementNames[elementName] && !options?.ignoredElementNames[elementName]){
132
145
  // Check if the element is an object
133
146
  if(typeof obj[elementName] === "object" && obj[elementName] && !obj[elementName].isState){
134
- // if there is an declared ObjectStateName (must be a function)=> take it
147
+ // Generate the desired id
135
148
  let objectId = `${startDirectory}.${elementName}`;
136
149
  let internalObjectId = elementName;
137
- if(obj[elementName].objectStateId){
138
- internalObjectId = `${await obj[elementName].objectStateId(topic,message)}`;
150
+ if(obj[elementName].objectId){
151
+ internalObjectId = `${obj[elementName].objectId(topic,message)}`;
139
152
  objectId = `${startDirectory}.${internalObjectId}`;
140
153
  }
141
154
  if(objectId.indexOf(".") === 0){
142
155
  objectId = objectId.substring(1,objectId.length);
143
156
  }
144
- let objectCommonName = "";
157
+ let myObject = {};
158
+ // check object exists
159
+ if(await this.adapter.objectExists(objectId)){
160
+ myObject = await this.adapter.getObjectAsync(objectId);
161
+ }
162
+ const myObjectBefore = structuredClone(myObject);
163
+
164
+ //Set type of object
165
+ if(!myObject.type){
166
+ myObject.type = obj[elementName].objectType? obj[elementName].objectType : "folder";
167
+ }
168
+
169
+ //check for common
170
+ if(!myObject.common){
171
+ myObject.common = {};
172
+ }
173
+
174
+ // check whether a common name was specified
145
175
  if(obj[elementName].objectCommonName && typeof obj[elementName].objectCommonName === "function"){
146
- objectCommonName = await obj[elementName].objectCommonName(topic,message);
147
- await this.adapter.extendObject(objectId,{
148
- type: obj[elementName].objectType? obj[elementName].objectType : "folder",
149
- common: {
150
- name: objectCommonName
151
- },
152
- native : {},
153
- });
176
+ if(typeof obj[elementName].objectCommonName === "function"){
177
+ myObject.common.name = obj[elementName].objectCommonName(topic,message);
178
+ }
179
+ else{
180
+ myObject.common.name = obj[elementName].objectCommonName;
181
+ }
182
+ }
183
+
184
+ // Check wheter a native content was specified
185
+ if(!myObject.native){
186
+ myObject.native = {};
154
187
  }
155
- else{
156
- if(obj[elementName].objectCommonName){
157
- objectCommonName = obj[elementName].objectCommonName;
188
+ if(obj[elementName].objectNative){
189
+ const objectNative = obj[elementName].objectNative(topic,message);
190
+ for(const attribute in objectNative){
191
+ myObject.native[attribute] = objectNative[attribute];
158
192
  }
159
- await this.adapter.setObjectNotExistsAsync(objectId,{
160
- type: obj[elementName].objectType? obj[elementName].objectType : "folder",
161
- common: {
162
- name: objectCommonName
163
- },
164
- native : {},
165
- });
193
+
194
+ // Assigne to common, if there are values specified
195
+ if(obj[elementName].objectCommonFromNative){
196
+ for(const attribute in obj[elementName].objectCommonFromNative){
197
+ // Check, whether the actual native is present
198
+ if(myObject.native[obj[elementName].objectCommonFromNative[attribute]]){
199
+ // check for old common => existing object
200
+ if(myObjectBefore.common){
201
+ //check for content
202
+ if(myObjectBefore.common[attribute] === myObjectBefore.native[obj[elementName].objectCommonFromNative[attribute]] ||
203
+ myObjectBefore.common[attribute] === ""){
204
+ myObject.common[attribute] = myObject.native[obj[elementName].objectCommonFromNative[attribute]];
205
+ }
206
+ }
207
+ else{
208
+ myObject.common[attribute] = myObject.native[obj[elementName].objectCommonFromNative[attribute]];
209
+ }
210
+ }
211
+ }
212
+ }
213
+ }
214
+ // Check for name
215
+ if(!myObject.common.name){
216
+ myObject.common.name = "";
217
+ }
218
+ if(!isDeepStrictEqual(myObject,myObjectBefore)){
219
+ await this.adapter.setObject(objectId,myObject);
166
220
  }
167
221
  // Jump into next step (next directory / attribute)
168
222
  await this.generateRekursivObjects(obj[elementName],objectId,topic,message);
@@ -183,8 +237,8 @@ class directorieshandlerClass {
183
237
  stateCommonWrite = obj[elementName].stateCommonWrite ? obj[elementName].stateCommonWrite : stateCommonWrite;
184
238
  stateCommonRole = obj[elementName].stateCommonRole ? obj[elementName].stateCommonRole : stateCommonRole;
185
239
  }
186
- if(obj[elementName].objectStateId){
187
- internalObjectId = `${await obj[elementName].objectStateId(topic,message)}`;
240
+ if(obj[elementName].objectId){
241
+ internalObjectId = `${obj[elementName].objectId(topic,message)}`;
188
242
  objectId = `${startDirectory}.${internalObjectId}`;
189
243
  }
190
244
  }
@@ -227,15 +281,15 @@ class directorieshandlerClass {
227
281
  * ************************** Attribute ******************************
228
282
  * ******************************************************************/
229
283
 
230
- async getAttributValue(topic,message,resolvetype){
284
+ getAttributValue(topic,message,resolvetype){
231
285
  const activeFunction = "getAttributValue";
232
286
  try{
233
287
  // Select search in case of origin
234
288
  switch(this.adapter.config.origin){
235
289
  case this.adapter.origin.ttn:
236
- return await this.getTtnAttributValue(topic,message,resolvetype);
290
+ return this.getTtnAttributValue(topic,message,resolvetype);
237
291
  case this.adapter.origin.chirpstack:
238
- return await this.getChirpstackAttributValue(topic,message,resolvetype);
292
+ return this.getChirpstackAttributValue(topic,message,resolvetype);
239
293
  }
240
294
  }
241
295
  catch(error){
@@ -244,19 +298,15 @@ class directorieshandlerClass {
244
298
  }
245
299
 
246
300
  /*********************************************************************
247
- * ************************ Object Directory *************************
301
+ * ******************** Object Start Directory ***********************
248
302
  * ******************************************************************/
249
303
 
250
- async getObjectDirectory(topic,message,resolvetype){
251
- const activeFunction = "getObjectDirectory";
304
+ getDeviceStartDirectory(topic,message){
305
+ const activeFunction = "getDeviceStartDirectory";
252
306
  try{
253
- // Select search in case of origin
254
- switch(this.adapter.config.origin){
255
- case this.adapter.origin.ttn:
256
- return await this.getTtnObjectDirectory(topic,message,resolvetype);
257
- case this.adapter.origin.chirpstack:
258
- return await this.getChirpstackObjectDirectory(topic,message,resolvetype);
259
- }
307
+ const applicationId = `${this.getAttributValue(topic,message,this.searchableAttributeNames.applicationId)}`;
308
+ const deviceEUI = `${this.getAttributValue(topic,message,this.searchableAttributeNames.deviceEUI)}`;
309
+ return `${applicationId}.devices.${deviceEUI}`;
260
310
  }
261
311
  catch(error){
262
312
  this.adapter.log.error(`error at ${activeFunction}: ${error} - - - Message: ${JSON.stringify(message)}`);
@@ -291,15 +341,18 @@ class directorieshandlerClass {
291
341
  * ************************** Attribute ******************************
292
342
  * ******************************************************************/
293
343
 
294
- async getTtnAttributValue(topic,message,resolvetype){
344
+ getTtnAttributValue(topic,message,resolvetype){
295
345
  const activeFunction = "getTtnAttributValue";
296
346
  try{
297
347
  this.adapter.log.silly(`attribute ${resolvetype} is requested for ttn`);
298
348
  const topicResolved = this.getTopicResolved(topic);
299
349
  switch(resolvetype){
300
- case this.searchableAttributeNames.apllicationId:
350
+ case this.searchableAttributeNames.applicationId:
301
351
  return topicResolved?.applicationId;
302
352
 
353
+ case this.searchableAttributeNames.applicationName:
354
+ return topicResolved?.applicationName;
355
+
303
356
  case this.searchableAttributeNames.deviceEUI:
304
357
  return message.end_device_ids.dev_eui;
305
358
 
@@ -316,33 +369,6 @@ class directorieshandlerClass {
316
369
  }
317
370
  }
318
371
 
319
- /*********************************************************************
320
- * ************************ Object Directory *************************
321
- * ******************************************************************/
322
-
323
- async getTtnObjectDirectory(topic,message,resolvetype){
324
- const activeFunction = "getTtnObjectDirectory";
325
- try{
326
- this.adapter.log.silly(`directory ${resolvetype} is requested for ttn`);
327
- const topicResolved = this.getTopicResolved(topic);
328
- if(typeof message !== "string"){
329
- switch(resolvetype){
330
- case this.searchableAttributeNames.deviceEUI:
331
- return `${topicResolved?.applicationId}.devices.${message.end_device_ids.dev_eui}`;
332
-
333
- default:
334
- return message;
335
- }
336
- }
337
- else{
338
- return message;
339
- }
340
- }
341
- catch(error){
342
- this.adapter.log.error(`error at ${activeFunction}: ${error} - - - Message: ${JSON.stringify(message)}`);
343
- }
344
- }
345
-
346
372
  /*********************************************************************
347
373
  * ************************ Object Directory *************************
348
374
  * ******************************************************************/
@@ -352,6 +378,7 @@ class directorieshandlerClass {
352
378
  try{
353
379
  const topicElements = topic.split("/");
354
380
  const topicResolved = {
381
+ applicationName: "",
355
382
  applicationId: topicElements[1],
356
383
  deviceId: topicElements[3],
357
384
  messageType: topicElements[topicElements.length - 1]
@@ -359,6 +386,7 @@ class directorieshandlerClass {
359
386
  // clean up application id
360
387
  const indexOfOrigin = topicResolved.applicationId.indexOf("@");
361
388
  if(indexOfOrigin !== -1){
389
+ topicResolved.applicationName = topicResolved.applicationId;
362
390
  topicResolved.applicationId = topicResolved.applicationId.substring(0,indexOfOrigin);
363
391
  }
364
392
  return topicResolved;
@@ -379,15 +407,19 @@ class directorieshandlerClass {
379
407
  * ******************************************************************/
380
408
 
381
409
 
382
- async getChirpstackAttributValue(topic,message,resolvetype){
410
+ // !!! Dont use resoletypes with message.deviceInfo in down => No deviceInfo in down message present
411
+ getChirpstackAttributValue(topic,message,resolvetype){
383
412
  const activeFunction = "getChirpstackAttributValue";
384
413
  try{
385
414
  this.adapter.log.silly(`attribute ${resolvetype} is requested for chirpstack`);
386
415
  const topicResolved = this.getTopicResolved(topic);
387
416
  switch(resolvetype){
388
- case this.searchableAttributeNames.apllicationId:
417
+ case this.searchableAttributeNames.applicationId:
389
418
  return topicResolved?.applicationId;
390
419
 
420
+ case this.searchableAttributeNames.applicationName:
421
+ return message.deviceInfo.applicationName;
422
+
391
423
  case this.searchableAttributeNames.deviceEUI:
392
424
  return topicResolved?.deviceEUI;
393
425
 
@@ -404,35 +436,6 @@ class directorieshandlerClass {
404
436
  }
405
437
  }
406
438
 
407
- /*********************************************************************
408
- * ************************ Object Directory *************************
409
- * ******************************************************************/
410
-
411
- async getChirpstackObjectDirectory(topic,message,resolvetype){
412
- const activeFunction = "getChirpstackObjectDirectory";
413
- try{
414
- this.adapter.log.silly(`directory ${resolvetype} is requested for chirpstack`);
415
- const topicResolved = this.getTopicResolved(topic);
416
- let devUid = undefined;
417
- if(topicResolved?.messageType !== "down"){
418
- devUid = message.deviceInfo.devEui;
419
- }
420
- else{
421
- devUid = message.devEui;
422
- }
423
- switch(resolvetype){
424
- case this.searchableAttributeNames.deviceEUI:
425
- return `${topicResolved?.applicationId}.devices.${devUid}`;
426
-
427
- default:
428
- return message;
429
- }
430
- }
431
- catch(error){
432
- this.adapter.log.error(`error at ${activeFunction}: ${error} - - - Message: ${JSON.stringify(message)}`);
433
- }
434
- }
435
-
436
439
  /*********************************************************************
437
440
  * ************************ Resolved Topic ***************************
438
441
  * ******************************************************************/
@@ -38,7 +38,7 @@ class downlinkConfighandlerClass {
38
38
  // generate the Config without own objects
39
39
  const ownConfig = [];
40
40
  for(const downlinkConfig of Object.values(this.activeDownlinkConfigs)){
41
- ownConfig.push(JSON.parse(JSON.stringify(downlinkConfig)));
41
+ ownConfig.push(structuredClone(downlinkConfig));//JSON.parse(JSON.stringify(downlinkConfig)));
42
42
  delete ownConfig[ownConfig.length - 1].downlinkState;
43
43
  }
44
44
  // Add internal base downlinks
@@ -169,7 +169,7 @@ class messagehandlerClass {
169
169
  const messageType = topic.substring(topic.lastIndexOf("/") + 1 ,topic.length);
170
170
  this.adapter.log.silly(`the messagetype ${messageType} was determined`);
171
171
  // generate startdirectory of device
172
- const deviceStartdirectory = await this.directoryhandler.getObjectDirectory(topic,message,this.directoryhandler.searchableAttributeNames.deviceEUI);
172
+ const deviceStartdirectory = this.directoryhandler.getDeviceStartDirectory(topic,message);
173
173
  this.adapter.log.silly(`the startdirectory ${deviceStartdirectory} was determined`);
174
174
 
175
175
  /*********************************************************************
@@ -418,7 +418,7 @@ class messagehandlerClass {
418
418
  const messageType = topic.substring(topic.lastIndexOf("/") + 1 ,topic.length);
419
419
  this.adapter.log.silly(`the messagetype ${messageType} was determined`);
420
420
  // generate startdirectory of device
421
- const deviceStartdirectory = await this.directoryhandler.getObjectDirectory(topic,message,this.directoryhandler.searchableAttributeNames.deviceEUI);
421
+ const deviceStartdirectory = this.directoryhandler.getDeviceStartDirectory(topic,message);
422
422
  this.adapter.log.silly(`the startdirectory ${deviceStartdirectory} was determined`);
423
423
 
424
424
  /*********************************************************************
package/main.js CHANGED
@@ -214,18 +214,6 @@ class Lorawan extends utils.Adapter {
214
214
  }
215
215
  this.setStateAsync(id,state.val,true);
216
216
  }
217
- // logging of the actual available configs
218
- else if(id.indexOf(".logAvailableConfignames") !== -1){
219
- this.log.info(`The following devicenames has an existing downlink-config`);
220
- let index = 0;
221
- for(const devicename in this.downlinkConfighandler?.activeDownlinkConfigs){
222
- index++;
223
- if(devicename !== this.downlinkConfighandler.internalDevices.baseDevice){
224
- this.log.info(`Device ${index}: ${devicename}`);
225
- }
226
- }
227
- this.setStateAsync(id,state.val,true);
228
- }
229
217
  }
230
218
  } else {
231
219
  // The state was deleted
@@ -340,7 +328,8 @@ class Lorawan extends utils.Adapter {
340
328
  // Get Obect from startdirectory
341
329
  const startDirectoryObject = await this.getObjectAsync(changeInfo.objectStartDirectory);
342
330
  if(startDirectoryObject){
343
- changeInfo.deviceId = startDirectoryObject.common.name;
331
+ changeInfo.applicationName = startDirectoryObject.native.applicationName;
332
+ changeInfo.deviceId = startDirectoryObject.native.deviceId;
344
333
  }
345
334
  // Get deviceType
346
335
  const deviceTypeIdState = await this.getStateAsync(myId);
@@ -399,7 +388,7 @@ class Lorawan extends utils.Adapter {
399
388
 
400
389
  async onMessage(obj){
401
390
  const activeFunction = "onMessage";
402
- this.log.debug(`message recieved: command = ${obj.command} - message = ${JSON.stringify(obj.message)}`);
391
+ this.log.debug(`message received: command = ${obj.command} - message = ${JSON.stringify(obj.message)}`);
403
392
  try{
404
393
  if (typeof obj === "object" && obj.message){
405
394
  let result = {};
@@ -407,14 +396,14 @@ class Lorawan extends utils.Adapter {
407
396
  if(obj.message.deviceEUI){
408
397
  const changeInfo = await this.getChangeInfoFromDeviceEUI(obj.message.deviceEUI,`${this.messagehandler?.directoryhandler.reachableSubfolders.configuration}.devicetype`);
409
398
  if(changeInfo){
410
- result = {applicationId: changeInfo.applicationId, deviceEUI: changeInfo.deviceEUI, deviceId: changeInfo.deviceId, deviceType: changeInfo.deviceType, recieved:obj.message};
399
+ result = {applicationId: changeInfo.applicationId, applicationName: changeInfo.applicationName, deviceEUI: changeInfo.deviceEUI, deviceId: changeInfo.deviceId, deviceType: changeInfo.deviceType, received:obj.message};
411
400
  }
412
401
  else{
413
- result = {error:true, message:"No device found", recieved:obj.message};
402
+ result = {error:true, message:"No device found", received:obj.message};
414
403
  }
415
404
  }
416
405
  else{
417
- result = {error:true, message:"No deviceEUI found", recieved:obj.message};
406
+ result = {error:true, message:"No deviceEUI found", received:obj.message};
418
407
  }
419
408
  // Send response
420
409
  if (obj.callback) this.sendTo(obj.from, obj.command, result, obj.callback);
@@ -428,19 +417,19 @@ class Lorawan extends utils.Adapter {
428
417
  if(await this.objectExists(uplinkId)){
429
418
  const stateResult = await this.getStateAsync(changeInfo.id);
430
419
  if(stateResult){
431
- result = {applicationId: changeInfo.applicationId, deviceEUI: changeInfo.deviceEUI, deviceId: changeInfo.deviceId, deviceType: changeInfo.deviceType, value: stateResult.val, recieved:obj.message};
420
+ result = {applicationId: changeInfo.applicationId, applicationName: changeInfo.applicationName, deviceEUI: changeInfo.deviceEUI, deviceId: changeInfo.deviceId, deviceType: changeInfo.deviceType, value: stateResult.val, received:obj.message};
432
421
  }
433
422
  }
434
423
  else{
435
- result = {error:true, message:"No uplink matches", recieved:obj.message};
424
+ result = {error:true, message:"No uplink matches", received:obj.message};
436
425
  }
437
426
  }
438
427
  else{
439
- result = {error:true, message:"No device found", recieved:obj.message};
428
+ result = {error:true, message:"No device found", received:obj.message};
440
429
  }
441
430
  }
442
431
  else{
443
- result = {error:true, message:"No deviceEUI & uplink found", recieved:obj.message};
432
+ result = {error:true, message:"No deviceEUI & uplink found", received:obj.message};
444
433
  }
445
434
  // Send response
446
435
  if (obj.callback) this.sendTo(obj.from, obj.command, result, obj.callback);
@@ -460,45 +449,45 @@ class Lorawan extends utils.Adapter {
460
449
  // Check limit
461
450
  if((!downlinkObject.common.min || obj.message.value >= downlinkObject.common.min) && (!downlinkObject.common.max || obj.message.value <= downlinkObject.common.max)){
462
451
  await this.setStateAsync(downlinkId,obj.message.value);
463
- result = {applicationId: changeInfo.applicationId, deviceEUI: changeInfo.deviceEUI, deviceId: changeInfo.deviceId, deviceType: changeInfo.deviceType, downlink: obj.message.downlink, value: obj.message.value, recieved:obj.message};
452
+ result = {applicationId: changeInfo.applicationId, applicationName: changeInfo.applicationName, deviceEUI: changeInfo.deviceEUI, deviceId: changeInfo.deviceId, deviceType: changeInfo.deviceType, downlink: obj.message.downlink, value: obj.message.value, received:obj.message};
464
453
  }
465
454
  else{
466
- result = {error:true, message:"value is not in valid range", recieved:obj.message};
455
+ result = {error:true, message:"value is not in valid range", received:obj.message};
467
456
  }
468
457
  }
469
458
  else{
470
- result = {error:true, message: `downlink is type number, but recieved ${typeof obj.message.value}`, recieved:obj.message};
459
+ result = {error:true, message: `downlink is type number, but received ${typeof obj.message.value}`, received:obj.message};
471
460
  }
472
461
  }
473
462
  // downlinkobject is not a number
474
463
  else{
475
464
  if(downlinkObject.common.type !== typeof obj.message.value){
476
- result = {error:true, message: `downlink is type ${downlinkObject.common.type}, but recieved ${typeof obj.message.value}`, recieved:obj.message};
465
+ result = {error:true, message: `downlink is type ${downlinkObject.common.type}, but received ${typeof obj.message.value}`, received:obj.message};
477
466
  }
478
467
  else{
479
468
  await this.setStateAsync(downlinkId,obj.message.value);
480
- result = {applicationId: changeInfo.applicationId, deviceEUI: changeInfo.deviceEUI, deviceId: changeInfo.deviceId, deviceType: changeInfo.deviceType, downlink: obj.message.downlink, value: obj.message.value, recieved:obj.message};
469
+ result = {applicationId: changeInfo.applicationId, applicationName: changeInfo.applicationName, deviceEUI: changeInfo.deviceEUI, deviceId: changeInfo.deviceId, deviceType: changeInfo.deviceType, downlink: obj.message.downlink, value: obj.message.value, received:obj.message};
481
470
  }
482
471
  }
483
472
  }
484
473
  }
485
474
  else{
486
- result = {error:true, message:"No downlink matches", recieved:obj.message};
475
+ result = {error:true, message:"No downlink matches", received:obj.message};
487
476
  }
488
477
  }
489
478
  else{
490
- result = {error:true, message:"No device found", recieved:obj.message};
479
+ result = {error:true, message:"No device found", received:obj.message};
491
480
  }
492
481
  }
493
482
  else{
494
- result = {error:true, message:"No deviceEUI, downlink & value found", recieved:obj.message};
483
+ result = {error:true, message:"No deviceEUI, downlink & value found", received:obj.message};
495
484
  }
496
485
  // Send response
497
486
  if (obj.callback) this.sendTo(obj.from, obj.command, result, obj.callback);
498
487
  }
499
488
  else
500
489
  {
501
- const result = {error:true, message: "No message matched", recieved:obj.message};
490
+ const result = {error:true, message: "No message matched", received:obj.message};
502
491
  if (obj.callback) this.sendTo(obj.from, obj.command, result, obj.callback);
503
492
  }
504
493
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.lorawan",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "converts the desired lora gateway data to a ioBroker structure",
5
5
  "author": {
6
6
  "name": "BenAhrdt",