iobroker.lorawan 1.0.0 → 1.0.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 +3 -0
- package/io-package.json +14 -14
- package/lib/modules/directorieshandler.js +7 -7
- package/lib/modules/downlinkConfighandler.js +13 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,6 +22,9 @@ For now there is documentation in English here: https://wiki.hafenmeister.de
|
|
|
22
22
|
Placeholder for the next version (at the beginning of the line):
|
|
23
23
|
### **WORK IN PROGRESS**
|
|
24
24
|
-->
|
|
25
|
+
### 1.0.1 (2024-03-25)
|
|
26
|
+
* (BenAhrdt) support 2's complement
|
|
27
|
+
|
|
25
28
|
### 1.0.0 (2024-03-21)
|
|
26
29
|
* (BenAhrdt) implement wifi icons
|
|
27
30
|
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "lorawan",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"news": {
|
|
6
|
+
"1.0.1": {
|
|
7
|
+
"en": "support 2's complement",
|
|
8
|
+
"de": "support 2's ergänzung",
|
|
9
|
+
"ru": "поддержка 2",
|
|
10
|
+
"pt": "complemento do suporte 2",
|
|
11
|
+
"nl": "ondersteuning 2's complement",
|
|
12
|
+
"fr": "soutenir le complément 2",
|
|
13
|
+
"it": "supporto 2's complemento",
|
|
14
|
+
"es": "complemento de soporte 2",
|
|
15
|
+
"pl": "wsparcie dopełnienia 2",
|
|
16
|
+
"uk": "підтримка 2 доповнення",
|
|
17
|
+
"zh-cn": "支助2的补充"
|
|
18
|
+
},
|
|
6
19
|
"1.0.0": {
|
|
7
20
|
"en": "implement wifi icons",
|
|
8
21
|
"de": "wifi-symbole implementieren",
|
|
@@ -80,19 +93,6 @@
|
|
|
80
93
|
"pl": "seperate dp for deviceinformations",
|
|
81
94
|
"uk": "seperate dp для пристроюінформаційних систем",
|
|
82
95
|
"zh-cn": "设备信息的 seperate dp"
|
|
83
|
-
},
|
|
84
|
-
"0.6.1": {
|
|
85
|
-
"en": "better concept to write values and change setObjectNotExists to extendObject",
|
|
86
|
-
"de": "besseres Konzept zum Schreiben von Werten und Änderungsset ObjectNotExists to erweitern Gegenstand",
|
|
87
|
-
"ru": "лучшее понятие для написания ценностей и изменения набора ObjectNotExists Объект",
|
|
88
|
-
"pt": "melhor conceito para escrever valores e alterar o conjunto ObjectNotExists para estender Objeto",
|
|
89
|
-
"nl": "beter concept om waarden en verandering set te schrijven ObjectNotBestaat om uit te breiden Doel",
|
|
90
|
-
"fr": "meilleur concept pour écrire des valeurs et changer ensemble ObjectNotExiste à étendre Objet",
|
|
91
|
-
"it": "migliore concetto per scrivere valori e cambiare set ObjectNotEsiste per estendere Oggetto",
|
|
92
|
-
"es": "mejor concepto para escribir valores y cambiar conjunto ObjectNotExists to extend Objeto",
|
|
93
|
-
"pl": "lepsza koncepcja zapisu wartości i zestaw zmian ObjectNotExists rozszerzyć Obiekt",
|
|
94
|
-
"uk": "краща концепція для написання значень та змін Об'єктNotExists для розширення Об'єкт",
|
|
95
|
-
"zh-cn": "更好的写值和更改集的概念 要扩展的对象不包含 对象"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"titleLang": {
|
|
@@ -372,7 +372,7 @@ class directorieshandlerClass {
|
|
|
372
372
|
* ******************************************************************/
|
|
373
373
|
|
|
374
374
|
getIconPath(topic,message,icontype){
|
|
375
|
-
const activeFunction = "
|
|
375
|
+
const activeFunction = "getIconPath";
|
|
376
376
|
try{
|
|
377
377
|
// Select search in case of origin
|
|
378
378
|
switch(this.adapter.config.origin){
|
|
@@ -501,13 +501,13 @@ class directorieshandlerClass {
|
|
|
501
501
|
* ******************************************************************/
|
|
502
502
|
|
|
503
503
|
getTtnIconPath(topic,message,icontype){
|
|
504
|
-
const activeFunction = "
|
|
504
|
+
const activeFunction = "getTtnIconPath";
|
|
505
505
|
try{
|
|
506
506
|
this.adapter.log.silly(`icontype ${icontype} is requested for ttn`);
|
|
507
507
|
switch(icontype){
|
|
508
508
|
case this.icons.wifi:
|
|
509
|
-
if(message.uplink_message
|
|
510
|
-
message.uplink_message
|
|
509
|
+
if(message.uplink_message?.settings.data_rate.lora.spreading_factor &&
|
|
510
|
+
message.uplink_message?.rx_metadata[0].rssi){
|
|
511
511
|
return this.analyseConnection(message.uplink_message.settings.data_rate.lora.spreading_factor,message.uplink_message.rx_metadata[0].rssi);
|
|
512
512
|
}
|
|
513
513
|
return "";
|
|
@@ -594,13 +594,13 @@ class directorieshandlerClass {
|
|
|
594
594
|
* ******************************************************************/
|
|
595
595
|
|
|
596
596
|
getChirpstackIconPath(topic,message,icontype){
|
|
597
|
-
const activeFunction = "
|
|
597
|
+
const activeFunction = "getChirpstackIconPath";
|
|
598
598
|
try{
|
|
599
599
|
this.adapter.log.silly(`icontype ${icontype} is requested for ttn`);
|
|
600
600
|
switch(icontype){
|
|
601
601
|
case this.icons.wifi:
|
|
602
|
-
if(message.txInfo
|
|
603
|
-
message.rxInfo[0]
|
|
602
|
+
if(message.txInfo?.modulation.lora.spreadingFactor &&
|
|
603
|
+
message.rxInfo[0]?.rssi){
|
|
604
604
|
return this.analyseConnection(message.txInfo.modulation.lora.spreadingFactor,message.rxInfo[0].rssi);
|
|
605
605
|
}
|
|
606
606
|
else{
|
|
@@ -293,14 +293,17 @@ class downlinkConfighandlerClass {
|
|
|
293
293
|
case "number":
|
|
294
294
|
if(downlinkParameter.decimalPlaces){
|
|
295
295
|
const expotentialFactor = Math.pow(10,downlinkParameter.decimalPlaces);
|
|
296
|
-
const StateWithExotetialFactor = Math.
|
|
296
|
+
const StateWithExotetialFactor = Math.round(state.val * expotentialFactor);
|
|
297
|
+
this.adapter.log.warn(StateWithExotetialFactor);
|
|
297
298
|
resultAfterdecimalPlaces = StateWithExotetialFactor / expotentialFactor;
|
|
298
299
|
}
|
|
299
300
|
else{
|
|
300
301
|
resultAfterdecimalPlaces = Math.trunc(state.val);
|
|
301
302
|
}
|
|
302
303
|
multipliedVal = resultAfterdecimalPlaces * downlinkParameter.multiplyfaktor;
|
|
303
|
-
|
|
304
|
+
// Assign absolute value
|
|
305
|
+
payloadInHex = Math.abs(multipliedVal).toString(16);
|
|
306
|
+
// create the zero diggits
|
|
304
307
|
numberOfDiggits = downlinkParameter.lengthInByte * 2;
|
|
305
308
|
for(let index = 1; index <= numberOfDiggits; index++){
|
|
306
309
|
zeroDiggits += "0";
|
|
@@ -309,6 +312,14 @@ class downlinkConfighandlerClass {
|
|
|
309
312
|
if(downlinkParameter.swap){
|
|
310
313
|
payloadInHex = Buffer.from(payloadInHex,"hex").reverse().toString("hex");
|
|
311
314
|
}
|
|
315
|
+
|
|
316
|
+
// Create negative 2´s complement
|
|
317
|
+
if(multipliedVal < 0){
|
|
318
|
+
const compareFactor = Math.pow(2,(downlinkParameter.lengthInByte * 8))-1;
|
|
319
|
+
payloadInHex = (~parseInt(payloadInHex,16)+1 & compareFactor).toString(16);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// Assign the front and end
|
|
312
323
|
payloadInHex = downlinkParameter.front + payloadInHex + downlinkParameter.end;
|
|
313
324
|
break;
|
|
314
325
|
|