iobroker.lorawan 1.2.0 → 1.2.2
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 +6 -0
- package/io-package.json +27 -27
- package/lib/modules/messagehandler.js +20 -19
- package/lib/modules/mqttclient.js +7 -7
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -23,6 +23,12 @@ 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.2.2 (2024-06-25)
|
|
27
|
+
* (BenAhrdt) Bugfix inf generate Deviceinfo at startup for chirpstack
|
|
28
|
+
|
|
29
|
+
### 1.2.1 (2024-06-24)
|
|
30
|
+
* (BenAhrdt) improof building of offlinenotification >= 25 hours
|
|
31
|
+
|
|
26
32
|
### 1.2.0 (2024-05-28)
|
|
27
33
|
* (BenAhrdt) change deviceInformations (keep old values in structure)
|
|
28
34
|
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "lorawan",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.2",
|
|
5
5
|
"news": {
|
|
6
|
+
"1.2.2": {
|
|
7
|
+
"en": "Bugfix inf generate Deviceinfo at startup for chirpstack",
|
|
8
|
+
"de": "Bugfix inf erzeugen Deviceinfo beim Start für chirpstack",
|
|
9
|
+
"ru": "Bugfix вf генерирует Deviceinfo при запуске chirpstack",
|
|
10
|
+
"pt": "Bugfix inf gerar Deviceinfo na inicialização para chirpstack",
|
|
11
|
+
"nl": "Bugfix inf genereren Apparaatinfo bij opstarten voor tjirpstack",
|
|
12
|
+
"fr": "Bugfix inf génère Deviceinfo au démarrage pour chirpstack",
|
|
13
|
+
"it": "Bugfix inf genera Deviceinfo all'avvio per chirpstack",
|
|
14
|
+
"es": "Bugfix inf genera Deviceinfo al inicio para chirpstack",
|
|
15
|
+
"pl": "Bugfix inf generuje Deviceinfo przy starcie dla chirpstock",
|
|
16
|
+
"uk": "Bugfix inf генерувати Deviceinfo на запуску для chirpstack",
|
|
17
|
+
"zh-cn": "启动时 bugfix inf 生成设备信息"
|
|
18
|
+
},
|
|
19
|
+
"1.2.1": {
|
|
20
|
+
"en": "improof building of offlinenotification >= 25 hours",
|
|
21
|
+
"de": "unsicherer aufbau der offlinenotifizierung >= 25 stunden",
|
|
22
|
+
"ru": " im 25 часов",
|
|
23
|
+
"pt": "construção à prova de notificações off-line >= 25 horas",
|
|
24
|
+
"nl": "voor de toepassing van deze onderverdeling wordt verstaan onder:",
|
|
25
|
+
"fr": "improof construction de la notification hors ligne >= 25 heures",
|
|
26
|
+
"it": ">= 25 ore",
|
|
27
|
+
"es": "construcción infalible de la notificación sin conexión >= 25 horas",
|
|
28
|
+
"pl": "nieodporna budowa offlinenotyfikacji > = 25 godzin",
|
|
29
|
+
"uk": "небезпечна будівля офлайнеризації >= 25 годин",
|
|
30
|
+
"zh-cn": "防线外通知楼 25小时"
|
|
31
|
+
},
|
|
6
32
|
"1.2.0": {
|
|
7
33
|
"en": "change deviceInformations (keep old values in structure)",
|
|
8
34
|
"de": "ändern deviceInformationen (erhalten alte Werte in der Struktur)",
|
|
@@ -67,32 +93,6 @@
|
|
|
67
93
|
"pl": "ustawić wartość keeplive na 0 = > dezaktywować automatyczne ponowne połączenie",
|
|
68
94
|
"uk": "встановити безпечне значення 0 => деактивувати автоматичне відключення",
|
|
69
95
|
"zh-cn": "将保存值设置为 0 qq 自动重联"
|
|
70
|
-
},
|
|
71
|
-
"1.0.7": {
|
|
72
|
-
"en": "setObjectAsynch bug after offline solved",
|
|
73
|
-
"de": "menge ObjectAsynch Bug nach Offline gelöst",
|
|
74
|
-
"ru": "set ObjectAsynch bug after offline resolved",
|
|
75
|
-
"pt": "conjunto Bug ObjectAsynch após offline resolvido",
|
|
76
|
-
"nl": "ingesteld ObjectAsynch bug na offline opgelost",
|
|
77
|
-
"fr": "ensemble ObjectAsynch bug après hors ligne résolu",
|
|
78
|
-
"it": "set bug ObjectAsynch dopo risolto offline",
|
|
79
|
-
"es": "set ObjectAsynch bug después de la resolución offline",
|
|
80
|
-
"pl": "zestaw Błąd obiektu Asynch po rozwiązaniu offline",
|
|
81
|
-
"uk": "комплекти Об'єктАсинхронний помилка після офлайну",
|
|
82
|
-
"zh-cn": "设定 离线后解析 ObjectAsynch 错误"
|
|
83
|
-
},
|
|
84
|
-
"1.0.6": {
|
|
85
|
-
"en": "icons changed\ndevice offline notofication placed in messagehandler.js",
|
|
86
|
-
"de": "icons geändert\ngerät offline-noofication platziert in messagehandler.js",
|
|
87
|
-
"ru": "значки изменились\nустройство в автономном режиме, помещенное в messagehandler.js",
|
|
88
|
-
"pt": "ícones alterados\ndispositivo off-line notofication colocado em messagehandler.js",
|
|
89
|
-
"nl": "pictogrammen gewijzigd\napparaat offline notificatie geplaatst in messagehandler.js",
|
|
90
|
-
"fr": "icônes changées\npériphérique hors ligne notofication placé dans messagehandler.js",
|
|
91
|
-
"it": "icone cambiate\ndispositivo notorietà offline posto in messagehandler.js",
|
|
92
|
-
"es": "iconos cambiados\ndispositivo offline notofication placed in messagehandler.js",
|
|
93
|
-
"pl": "ikony zmienione\nnotyfikacja urządzenia umieszczona w messagehandler.js",
|
|
94
|
-
"uk": "іконки змінені\nпристрій offline notofication, розміщений в повідомленняhandler.js",
|
|
95
|
-
"zh-cn": "图标已更改\n设备离线通知放置在 messagehandler.js"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"titleLang": {
|
|
@@ -31,6 +31,8 @@ class messagehandlerClass {
|
|
|
31
31
|
};
|
|
32
32
|
// Create cronjob to check timestamps (for device offline notification)
|
|
33
33
|
this.cronJobs[this.cronJobIds.checkTimestamp] = schedule.scheduleJob(this.cronJosValues.checkTimestamp,this.checkTimestamps.bind(this));
|
|
34
|
+
this.offlineiconString = "icons/offline.png";
|
|
35
|
+
this.offlinetimeMax = 25 * 60 * 60 * 1000; // Time in ms
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
/*********************************************************************
|
|
@@ -47,22 +49,21 @@ class messagehandlerClass {
|
|
|
47
49
|
if(adapterObject._id.endsWith(`${this.directoryhandler.reachableSubfolders.uplinkRaw}.json`)){
|
|
48
50
|
const uplinkState = await this.adapter.getStateAsync(adapterObject._id);
|
|
49
51
|
if(uplinkState){
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
await this.adapter.setObjectAsync(deviceId,deviceObject);
|
|
52
|
+
const difference = Date.now(); - uplinkState.ts;
|
|
53
|
+
// Check for timedifference
|
|
54
|
+
if(difference >= this.offlinetimeMax){
|
|
55
|
+
const deviceobjectId = adapterObject._id.substring(0,adapterObject._id.indexOf(".uplink"));
|
|
56
|
+
const deviceObject = await this.adapter.getObjectAsync(deviceobjectId);
|
|
57
|
+
// Check deviceObject and present iconpath
|
|
58
|
+
if(deviceObject){
|
|
59
|
+
if(deviceObject.common.icon !== this.offlineiconString){
|
|
60
|
+
deviceObject.common.icon = this.offlineiconString;
|
|
61
|
+
await this.adapter.setObjectAsync(deviceobjectId,deviceObject);
|
|
62
|
+
// create changeinfo and register notification
|
|
63
|
+
const changeInfo = await this.adapter.getChangeInfo(adapterObject._id);
|
|
64
|
+
if(changeInfo){
|
|
65
|
+
this.adapter.registerNotification("lorawan", "LoRaWAN device offline", `The LoRaWAN device ${changeInfo.usedDeviceId} in the application ${changeInfo.usedApplicationName} is offline`);
|
|
66
|
+
}
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
69
|
}
|
|
@@ -170,9 +171,9 @@ class messagehandlerClass {
|
|
|
170
171
|
break;
|
|
171
172
|
case this.adapter.origin.chirpstack:
|
|
172
173
|
decodedData[devEUI].object = decodedData[devEUI].decoded;
|
|
173
|
-
decodedData[devEUI].
|
|
174
|
-
decodedData[devEUI].
|
|
175
|
-
decodedData[devEUI].
|
|
174
|
+
decodedData[devEUI].rxInfo = [];
|
|
175
|
+
decodedData[devEUI].rxInfo[0] = {};
|
|
176
|
+
decodedData[devEUI].rxInfo[0].nsTime = decodedData[devEUI].time;
|
|
176
177
|
break;
|
|
177
178
|
}
|
|
178
179
|
this.assignDeviceInformation(decodedData[devEUI].id,decodedData[devEUI]);
|
|
@@ -12,17 +12,17 @@ class mqttClientClass {
|
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
// Variables for correct connection (disconnection) notification / logging
|
|
15
|
-
this.
|
|
15
|
+
this.internalConnectionstate = false;
|
|
16
16
|
this.errorCountdown = 0;
|
|
17
17
|
this.numberOfErrorsToLog = 10;
|
|
18
18
|
|
|
19
19
|
this.client.on("connect", () => {
|
|
20
|
-
if(!this.
|
|
20
|
+
if(!this.internalConnectionstate){
|
|
21
21
|
this.adapter.log.info(`Connection is active.`);
|
|
22
22
|
this.adapter.registerNotification("lorawan", "LoRaWAN Network Service connected", `The LoRaWAN Network Service ${settings.ipUrl} was connected`);
|
|
23
23
|
}
|
|
24
24
|
this.adapter.setState("info.connection", true, true);
|
|
25
|
-
this.
|
|
25
|
+
this.internalConnectionstate = true;
|
|
26
26
|
this.errorCountdown = this.numberOfErrorsToLog;
|
|
27
27
|
// @ts-ignore
|
|
28
28
|
this.client.subscribe(this.getSubscribtionArray(), (err) => {
|
|
@@ -32,9 +32,9 @@ class mqttClientClass {
|
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
34
|
this.client.on("disconnect", () => {
|
|
35
|
-
if(this.
|
|
35
|
+
if(this.internalConnectionstate){
|
|
36
36
|
this.adapter.setState("info.connection", false, true);
|
|
37
|
-
this.
|
|
37
|
+
this.internalConnectionstate = false;
|
|
38
38
|
this.adapter.log.info(`disconnected`);
|
|
39
39
|
}
|
|
40
40
|
});
|
|
@@ -49,12 +49,12 @@ class mqttClientClass {
|
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
this.client.on("close", () => {
|
|
52
|
-
if(this.
|
|
52
|
+
if(this.internalConnectionstate){
|
|
53
53
|
this.adapter.log.info(`Connection is closed.`);
|
|
54
54
|
this.adapter.registerNotification("lorawan", "LoRaWAN Network Service disconnected", `The LoRaWAN Network Service ${settings.ipUrl} was disconnected`);
|
|
55
55
|
}
|
|
56
56
|
this.adapter.setState("info.connection", false, true);
|
|
57
|
-
this.
|
|
57
|
+
this.internalConnectionstate = false;
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
this.client.on("message", async (topic, message) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.lorawan",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "converts the desired lora gateway data to a ioBroker structure",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "BenAhrdt",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@iobroker/adapter-core": "^3.1.4",
|
|
28
28
|
"easy-crc": "^1.1.0",
|
|
29
|
-
"mqtt": "^5.
|
|
29
|
+
"mqtt": "^5.7.0",
|
|
30
30
|
"node-schedule": "^2.1.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
@@ -40,16 +40,16 @@
|
|
|
40
40
|
"@types/chai": "^4.3.11",
|
|
41
41
|
"@types/chai-as-promised": "^7.1.8",
|
|
42
42
|
"@types/mocha": "^10.0.6",
|
|
43
|
-
"@types/node": "^20.
|
|
43
|
+
"@types/node": "^20.13.0",
|
|
44
44
|
"@types/proxyquire": "^1.3.31",
|
|
45
45
|
"@types/sinon": "^17.0.3",
|
|
46
46
|
"@types/sinon-chai": "^3.2.12",
|
|
47
47
|
"chai": "^4.4.1",
|
|
48
|
-
"chai-as-promised": "^7.1.
|
|
48
|
+
"chai-as-promised": "^7.1.2",
|
|
49
49
|
"eslint": "^8.57.0",
|
|
50
50
|
"mocha": "^10.4.0",
|
|
51
51
|
"proxyquire": "^2.1.3",
|
|
52
|
-
"sinon": "^
|
|
52
|
+
"sinon": "^18.0.0",
|
|
53
53
|
"sinon-chai": "^3.7.0",
|
|
54
54
|
"typescript": "~5.4.5"
|
|
55
55
|
},
|