iobroker.lorawan 0.5.2 → 0.5.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 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.5.4 (2024-03-01)
26
+ * (BenAhrdt) implement ther approvedFolder conzept for writecommands from message
27
+
28
+ ### 0.5.3 (2024-02-29)
29
+ * (BenAhrdt) change folder for writetriggers
30
+
25
31
  ### 0.5.2 (2024-02-29)
26
32
  * (BenAhrdt) make writetrigger more flexible
27
33
 
package/io-package.json CHANGED
@@ -1,8 +1,34 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "lorawan",
4
- "version": "0.5.2",
4
+ "version": "0.5.4",
5
5
  "news": {
6
+ "0.5.4": {
7
+ "en": "implement ther approvedFolder conzept for writecommands from message",
8
+ "de": "den genehmigten Ordner-Konzept für Schreibbefehle aus der Nachricht",
9
+ "ru": "реализовать Folder conzept for writecommands from message",
10
+ "pt": "implementar o aprovado Conzept de pasta para writecommands da mensagem",
11
+ "nl": "tenuitvoerlegging goedgekeurd Map conzept voor schrijfopdrachten uit bericht",
12
+ "fr": "mise en œuvre approuvée Dossier conzept pour les commandes d'écriture du message",
13
+ "it": "implementare il Cartella conzept per i comandi di scrittura dal messaggio",
14
+ "es": "de aplicación aprobado Folder conzept for writecommands from message",
15
+ "pl": "wdrożyć zatwierdzoną Folder conzept dla pisarek z wiadomości",
16
+ "uk": "реалізація затвердженого р. Складаний конверт для написаннякоманд з повідомлення",
17
+ "zh-cn": "执行批准的程序 从信件中写入命令的文件夹召集"
18
+ },
19
+ "0.5.3": {
20
+ "en": "change folder for writetriggers",
21
+ "de": "ordner für schreiber ändern",
22
+ "ru": "изменить папку для дикторов",
23
+ "pt": "mudar a pasta para writetriggers",
24
+ "nl": "map voor schrijftriggers wijzigen",
25
+ "fr": "modifier le dossier pour writetriggers",
26
+ "it": "modificare la cartella per writetriggers",
27
+ "es": "cambiar la carpeta para los escritores",
28
+ "pl": "zmień folder dla pisarzy",
29
+ "uk": "змінити папку для запису",
30
+ "zh-cn": "更改写入文件夹"
31
+ },
6
32
  "0.5.2": {
7
33
  "en": "make writetrigger more flexible",
8
34
  "de": "schreibtrigger flexibler gestalten",
@@ -67,32 +93,6 @@
67
93
  "pl": "searchogorythm improused, defaultvalues changed, remove query for \"all\"",
68
94
  "uk": "searchallgorythm improoved, типові значення змінені, видалення запиту для \"all\"",
69
95
  "zh-cn": "搜索所有未启动的理论, 默认值已更改, 删除“ 所有” 的查询"
70
- },
71
- "0.3.10": {
72
- "en": "change logging again if a device joined the network",
73
- "de": "erneute protokollierung ändern, wenn ein gerät dem netzwerk angeschlossen ist",
74
- "ru": "изменить журнализацию снова, если устройство вступило в сеть",
75
- "pt": "mudar o registro novamente se um dispositivo entrou na rede",
76
- "nl": "loggen opnieuw wijzigen als een apparaat zich aan het netwerk heeft aangesloten",
77
- "fr": "changer de journalisation si un périphérique a rejoint le réseau",
78
- "it": "modificare la registrazione di nuovo se un dispositivo è entrato nella rete",
79
- "es": "cambiar de registro de nuevo si un dispositivo se unió a la red",
80
- "pl": "zmiana logowania w przypadku połączenia urządzenia z siecią",
81
- "uk": "перезавантаження знову, якщо пристрій долучився до мережі",
82
- "zh-cn": "如果设备加入了网络, 将再次更改记录"
83
- },
84
- "0.3.9": {
85
- "en": "change logging if a device joined the network",
86
- "de": "änderung der protokollierung, wenn ein gerät im netzwerk angeschlossen ist",
87
- "ru": "изменение регистрации, если устройство вступило в сеть",
88
- "pt": "alterar o registro se um dispositivo entrou na rede",
89
- "nl": "loggen wijzigen als een apparaat zich aan het netwerk heeft aangesloten",
90
- "fr": "modifier l'enregistrement si un périphérique a rejoint le réseau",
91
- "it": "modificare la registrazione se un dispositivo è entrato nella rete",
92
- "es": "cambiar de registro si un dispositivo se unió a la red",
93
- "pl": "zmiana logowania, jeśli urządzenie dołączyło do sieci",
94
- "uk": "змінити логування, якщо пристрій долучився до мережі",
95
- "zh-cn": "如果设备加入网络, 更改日志"
96
96
  }
97
97
  },
98
98
  "title": "LoRaWAN",
@@ -0,0 +1,8 @@
1
+ {
2
+ "Devicetype": {"destination":"configuration.devicetype","releaseValue":"","approvedFolders":{"uplink.decoded":true}},
3
+ "devicetype": {"destination":"configuration.devicetype","releaseValue":"","approvedFolders":{"uplink.decoded":true}},
4
+ "Device": {"destination":"configuration.devicetype","releaseValue":"","approvedFolders":{"uplink.decoded":true}},
5
+ "device": {"destination":"configuration.devicetype","releaseValue":"","approvedFolders":{"uplink.decoded":true}},
6
+ "Hardware_mode": {"destination":"configuration.devicetype","releaseValue":"","approvedFolders":{"uplink.decoded":true}},
7
+ "Hardware_Mode": {"destination":"configuration.devicetype","releaseValue":"","approvedFolders":{"uplink.decoded":true}}
8
+ }
@@ -36,10 +36,10 @@ class directorieshandlerClass {
36
36
  this.uplinkRoles = this.getJsonFromDirectoryfile(`${this.adapter.adapterDir}${this.uplinkRolesPath}`);
37
37
 
38
38
  //define path for devicetype difinitions
39
- this.writeTriggerPath = "/lib/modules/roles/writeTrigger.json";
39
+ this.writeCommandPath = "/lib/modules/commands/write.json";
40
40
 
41
41
  // get devicetype definitions
42
- this.writeTrigger = this.getJsonFromDirectoryfile(`${this.adapter.adapterDir}${this.writeTriggerPath}`);
42
+ this.writeCommand = this.getJsonFromDirectoryfile(`${this.adapter.adapterDir}${this.writeCommandPath}`);
43
43
 
44
44
  // declare the directory structre
45
45
  this.directories = {
@@ -288,16 +288,7 @@ class directorieshandlerClass {
288
288
  if(stateVal !== undefined){
289
289
  // Set State from Objectpath
290
290
  await this.adapter.setStateAsync(`${objectId}`,stateVal,true);
291
- // Check, if there is a writetrigger and the stateval is not euqal its releaseVal(still present)
292
- if(this.writeTrigger[elementName] && this.writeTrigger[elementName].releaseValue !== stateVal){
293
- const baseInfo = this.adapter.getBaseDeviceInfo(objectId);
294
- const destinationId = `${baseInfo.objectStartDirectory}.${this.writeTrigger[elementName].destination}`;
295
- const destinationState = await this.adapter.getStateAsync(destinationId);
296
- if(destinationState?.val === this.writeTrigger[elementName].releaseValue){
297
- this.adapter.log.debug(`writetrigger ${elementName} recogniced. value ${stateVal} will be written into ${this.writeTrigger[elementName].destination}`);
298
- await this.adapter.setStateAsync(destinationId,stateVal);
299
- }
300
- }
291
+ await this.executeWritecommand(elementName,objectId,stateVal);
301
292
  }
302
293
  }
303
294
  }
@@ -309,6 +300,26 @@ class directorieshandlerClass {
309
300
  }
310
301
  }
311
302
 
303
+ /*********************************************************************
304
+ * ************************* writecommand ****************************
305
+ * ******************************************************************/
306
+
307
+ async executeWritecommand(writecommand,sourceId,value){
308
+ // Check, if there is a writetrigger and the stateval is not euqal its releaseVal(still present)
309
+ if(this.writeCommand[writecommand] && this.writeCommand[writecommand].releaseValue !== value){
310
+ const baseInfo = this.adapter.getBaseDeviceInfo(sourceId);
311
+ const subfolder = sourceId.slice(baseInfo.objectStartDirectory.length + 1,sourceId.length - baseInfo.changedState.length - 1);
312
+ if(!this.writeCommand[writecommand].approvedFolders || this.writeCommand[writecommand].approvedFolders[subfolder]){
313
+ const destinationId = `${baseInfo.objectStartDirectory}.${this.writeCommand[writecommand].destination}`;
314
+ const destinationState = await this.adapter.getStateAsync(destinationId);
315
+ if(destinationState?.val === this.writeCommand[writecommand].releaseValue){
316
+ this.adapter.log.debug(`writetrigger ${writecommand} recogniced. value ${value} will be written into ${this.writeCommand[writecommand].destination}`);
317
+ await this.adapter.setStateAsync(destinationId,value);
318
+ }
319
+ }
320
+ }
321
+ }
322
+
312
323
  /*********************************************************************
313
324
  * ************************** Attribute ******************************
314
325
  * ******************************************************************/
@@ -583,7 +583,6 @@ class messagehandlerClass {
583
583
  startId = `${deviceStartdirectory}.${this.directoryhandler.reachableSubfolders.uplinkDecoded}`;
584
584
  this.adapter.log.silly(`write decoded payload (Object)`);
585
585
  await this.directoryhandler.generateRekursivObjects(message.object,startId,topic,message);
586
-
587
586
  /*********************************************************************
588
587
  * ************************* remaining *******************************
589
588
  * ******************************************************************/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.lorawan",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "description": "converts the desired lora gateway data to a ioBroker structure",
5
5
  "author": {
6
6
  "name": "BenAhrdt",
@@ -26,27 +26,27 @@
26
26
  "dependencies": {
27
27
  "@iobroker/adapter-core": "^3.0.4",
28
28
  "easy-crc": "^1.1.0",
29
- "mqtt": "^5.3.5"
29
+ "mqtt": "^5.3.6"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@alcalzone/release-script": "^3.7.0",
33
33
  "@alcalzone/release-script-plugin-iobroker": "^3.7.0",
34
34
  "@alcalzone/release-script-plugin-license": "^3.7.0",
35
35
  "@alcalzone/release-script-plugin-manual-review": "^3.7.0",
36
- "@iobroker/adapter-dev": "^1.2.0",
36
+ "@iobroker/adapter-dev": "^1.3.0",
37
37
  "@iobroker/testing": "^4.1.0",
38
38
  "@tsconfig/node18": "^18.2.2",
39
39
  "@types/chai": "^4.3.11",
40
40
  "@types/chai-as-promised": "^7.1.8",
41
41
  "@types/mocha": "^10.0.6",
42
- "@types/node": "^20.11.14",
42
+ "@types/node": "^20.11.24",
43
43
  "@types/proxyquire": "^1.3.31",
44
44
  "@types/sinon": "^17.0.3",
45
45
  "@types/sinon-chai": "^3.2.12",
46
46
  "chai": "^4.4.1",
47
47
  "chai-as-promised": "^7.1.1",
48
- "eslint": "^8.56.0",
49
- "mocha": "^10.2.0",
48
+ "eslint": "^8.57.0",
49
+ "mocha": "^10.3.0",
50
50
  "proxyquire": "^2.1.3",
51
51
  "sinon": "^17.0.1",
52
52
  "sinon-chai": "^3.7.0",
@@ -1,8 +0,0 @@
1
- {
2
- "Devicetype": {"destination":{"destination":"configuration.devicetype","releaseValue":""},"releaseValue":""},
3
- "devicetype": {"destination":"configuration.devicetype","releaseValue":""},
4
- "Device": {"destination":"configuration.devicetype","releaseValue":""},
5
- "device": {"destination":"configuration.devicetype","releaseValue":""},
6
- "Hardware_mode": {"destination":"configuration.devicetype","releaseValue":""},
7
- "Hardware_Mode": {"destination":"configuration.devicetype","releaseValue":""}
8
- }