iobroker.lorawan 0.4.1 → 0.5.0

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,9 @@ 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.0 (2024-02-28)
26
+ * (BenAhrdt) trigger for devicetype implemented
27
+
25
28
  ### 0.4.1 (2024-02-26)
26
29
  * (BenAhrdt) implement new deviceprofiles
27
30
 
package/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "lorawan",
4
- "version": "0.4.1",
4
+ "version": "0.5.0",
5
5
  "news": {
6
+ "0.5.0": {
7
+ "en": "trigger for devicetype implemented",
8
+ "de": "trigger für implementierte gerätetypen",
9
+ "ru": "триггер для реализованного устройства",
10
+ "pt": "gatilho para o tipo de dispositivo implementado",
11
+ "nl": "trigger voor apparaattype geïmplementeerd",
12
+ "fr": "déclencheur pour le type d'appareil implémenté",
13
+ "it": "trigger per il tipo di dispositivo implementato",
14
+ "es": "disparador para el tipo de dispositivo implementado",
15
+ "pl": "wyzwalacz dla wdrożonego typu devicetype",
16
+ "uk": "тригер для установки",
17
+ "zh-cn": "已执行设备类型的触发器"
18
+ },
6
19
  "0.4.1": {
7
20
  "en": "implement new deviceprofiles",
8
21
  "de": "neue geräteprofile implementieren",
@@ -80,19 +93,6 @@
80
93
  "pl": "improove zakazane znaki i narzędzia dołączyć surowe",
81
94
  "uk": "неприпустимий заборонений діаграма і реалізує приєднатися до сировини",
82
95
  "zh-cn": "将禁用字符和工具合并为原始字符"
83
- },
84
- "0.3.6": {
85
- "en": "set attributs if undefined",
86
- "de": "wenn nicht definiert",
87
- "ru": "набор атрибутов, если не определено",
88
- "pt": "definir atributos se indefinido",
89
- "nl": "attributes instellen indien niet gedefinieerd",
90
- "fr": "définir les attributs si non définis",
91
- "it": "attributi impostati se non definiti",
92
- "es": "conjunto atributos si no definido",
93
- "pl": "set attributs if undefined",
94
- "uk": "встановити attributs if undefined",
95
- "zh-cn": "如果未定义, 设置附件"
96
96
  }
97
97
  },
98
98
  "title": "LoRaWAN",
@@ -35,6 +35,12 @@ class directorieshandlerClass {
35
35
  // get roles
36
36
  this.uplinkRoles = this.getJsonFromDirectoryfile(`${this.adapter.adapterDir}${this.uplinkRolesPath}`);
37
37
 
38
+ //define path for devicetype difinitions
39
+ this.devicetypeDefinitionsPath = "/lib/modules/roles/devicetype.json";
40
+
41
+ // get devicetype definitions
42
+ this.devicetypeDefinitions = this.getJsonFromDirectoryfile(`${this.adapter.adapterDir}${this.devicetypeDefinitionsPath}`);
43
+
38
44
  // declare the directory structre
39
45
  this.directories = {
40
46
  application:{
@@ -255,9 +261,11 @@ class directorieshandlerClass {
255
261
  objectId = `${startDirectory}.${internalObjectId}`;
256
262
  }
257
263
  }
264
+ // Check for roles
258
265
  if(this.uplinkRoles[elementName]){
259
266
  stateCommonRole = this.uplinkRoles[elementName];
260
267
  }
268
+ // Check for id dont starts with "."
261
269
  if(objectId.indexOf(".") === 0){
262
270
  objectId.substring(1,objectId.length);
263
271
  }
@@ -279,6 +287,9 @@ class directorieshandlerClass {
279
287
  }
280
288
  if(stateVal !== undefined){
281
289
  await this.adapter.setStateAsync(`${objectId}`,stateVal,true);
290
+ if(this.devicetypeDefinitions[elementName]){
291
+ await this.setDevicetypeDefinition(objectId,stateVal);
292
+ }
282
293
  }
283
294
  }
284
295
  }
@@ -290,6 +301,18 @@ class directorieshandlerClass {
290
301
  }
291
302
  }
292
303
 
304
+ /*********************************************************************
305
+ * ******************** Devicetype definition ************************
306
+ * ******************************************************************/
307
+
308
+ async setDevicetypeDefinition(devicetypeId,stateVal){
309
+ const changeInfo = await this.adapter.getChangeInfo(devicetypeId);
310
+ if(changeInfo?.deviceType === ""){
311
+ const myId = `${changeInfo?.objectStartDirectory}.${this.adapter.messagehandler?.directoryhandler.reachableSubfolders.configuration}.devicetype`;
312
+ await this.adapter.setStateAsync(myId,stateVal);
313
+ }
314
+ }
315
+
293
316
  /*********************************************************************
294
317
  * ************************** Attribute ******************************
295
318
  * ******************************************************************/
@@ -0,0 +1,8 @@
1
+ {
2
+ "Devicetype": {},
3
+ "devicetype": {},
4
+ "Device": {},
5
+ "device": {},
6
+ "Hardware_mode": {},
7
+ "Hardware_Mode": {}
8
+ }
package/main.js CHANGED
@@ -322,7 +322,7 @@ class Lorawan extends utils.Adapter {
322
322
  try{
323
323
  this.log.silly(`changeinfo of id ${id}, will be generated.`);
324
324
  const changeInfo = this.getBaseDeviceInfo(id);
325
- const myId = `${changeInfo?.applicationId}.devices.${changeInfo?.deviceEUI}.${this.messagehandler?.directoryhandler.reachableSubfolders.configuration}.devicetype`;
325
+ const myId = `${changeInfo?.objectStartDirectory}.${this.messagehandler?.directoryhandler.reachableSubfolders.configuration}.devicetype`;
326
326
  // Check for changeInfo
327
327
  if(changeInfo){
328
328
  // Get Obect from startdirectory
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.lorawan",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "converts the desired lora gateway data to a ioBroker structure",
5
5
  "author": {
6
6
  "name": "BenAhrdt",