iobroker.lorawan 1.20.5 → 1.20.6
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 +15 -15
- package/lib/modules/assignhandler.js +2 -2
- package/lib/modules/deviceManager.js +15 -15
- package/lib/modules/downlinkConfighandler.js +2 -2
- package/lib/modules/messagehandler.js +14 -5
- package/lib/modules/objectStore.js +38 -40
- package/main.js +5 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,6 +23,9 @@ 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.20.6 (2026-01-25)
|
|
27
|
+
* (BenAhrdt) updateing assignhandler und modifying indicators and informations
|
|
28
|
+
|
|
26
29
|
### 1.20.5 (2026-01-25)
|
|
27
30
|
* (BenAhrdt) bugfixing updating object Store with not alowed id
|
|
28
31
|
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "lorawan",
|
|
4
|
-
"version": "1.20.
|
|
4
|
+
"version": "1.20.6",
|
|
5
5
|
"news": {
|
|
6
|
+
"1.20.6": {
|
|
7
|
+
"en": "updateing assignhandler und modifying indicators and informations",
|
|
8
|
+
"de": "aktualisierung von assignhandler und änderung von indikatoren und informationen",
|
|
9
|
+
"ru": "обновление цессионера и изменение показателей и информации",
|
|
10
|
+
"pt": "atualização de indicadores e informações de atribuição e modificação",
|
|
11
|
+
"nl": "actualisering van indicatoren en informatie",
|
|
12
|
+
"fr": "mettre à jour les indicateurs et les informations d'attribution et de modification",
|
|
13
|
+
"it": "aggiornamento assegnatore und modifica degli indicatori e delle informazioni",
|
|
14
|
+
"es": "actualización del cedente nod modificando indicadores e informaciones",
|
|
15
|
+
"pl": "aktualizowanie identyfikatorów i modyfikowanie wskaźników i informacji",
|
|
16
|
+
"uk": "оновлення вивіски унд модифікації індикаторів та інформації",
|
|
17
|
+
"zh-cn": "更新指定手控器未修改指标和信息"
|
|
18
|
+
},
|
|
6
19
|
"1.20.5": {
|
|
7
20
|
"en": "bugfixing updating object Store with not alowed id",
|
|
8
21
|
"de": "bugfixing update object Store with not alowed id",
|
|
@@ -80,19 +93,6 @@
|
|
|
80
93
|
"pl": "dodaj pierwsze kroki menedżera urządzeń",
|
|
81
94
|
"uk": "додати перші кроки диспетчера пристроїв",
|
|
82
95
|
"zh-cn": "添加设备管理器的第一个步骤"
|
|
83
|
-
},
|
|
84
|
-
"1.19.34": {
|
|
85
|
-
"en": "assign Percent & Liter in assignhandler",
|
|
86
|
-
"de": "percent & Liter in assignhandler zuweisen",
|
|
87
|
-
"ru": "производитель Percent & Liter",
|
|
88
|
-
"pt": "atribuir a percentagem & Liter no atribuidor",
|
|
89
|
-
"nl": "procent & Liter toewijzen aan attributen",
|
|
90
|
-
"fr": "assigner Pourcentage & Liter dans l'attributhandler",
|
|
91
|
-
"it": "assegnare Percent & Liter in assegnatore",
|
|
92
|
-
"es": "asignar Percent \" Liter in assignhandler",
|
|
93
|
-
"pl": "przypisz Procent i Liter w assignhandler",
|
|
94
|
-
"uk": "призначте відсоток & Література в assignhandler",
|
|
95
|
-
"zh-cn": "在指定手牌中指定百分数( L)"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"titleLang": {
|
|
@@ -589,7 +589,7 @@
|
|
|
589
589
|
"name": "internal logging types",
|
|
590
590
|
"read": true,
|
|
591
591
|
"write": true,
|
|
592
|
-
"def": "{\"discovery\":false, \"assign\": false, \"messageTo\": false, \"listDevices\": false, \"getStatus\": false}"
|
|
592
|
+
"def": "{\"discovery\":false, \"assign\": false, \"messageTo\": false, \"listDevices\": false, \"getStatus\": false, \"deviceinformation\": false, \"downlinkconfig\": false,}"
|
|
593
593
|
},
|
|
594
594
|
"native": {}
|
|
595
595
|
},
|
|
@@ -311,7 +311,7 @@ class assignhandlerClass {
|
|
|
311
311
|
'uplink.decoded': {
|
|
312
312
|
assignfunction: this.commonAssign,
|
|
313
313
|
common: {
|
|
314
|
-
role: 'sensor',
|
|
314
|
+
role: 'sensor.contact',
|
|
315
315
|
},
|
|
316
316
|
},
|
|
317
317
|
},
|
|
@@ -321,7 +321,7 @@ class assignhandlerClass {
|
|
|
321
321
|
'uplink.decoded': {
|
|
322
322
|
assignfunction: this.commonAssign,
|
|
323
323
|
common: {
|
|
324
|
-
role: 'sensor.
|
|
324
|
+
role: 'sensor.contact',
|
|
325
325
|
},
|
|
326
326
|
},
|
|
327
327
|
},
|
|
@@ -29,9 +29,9 @@ class LoRaWANDeviceManagement extends DeviceManagement {
|
|
|
29
29
|
id: key,
|
|
30
30
|
name: value.object.common.name,
|
|
31
31
|
icon: await this.getIcon(value),
|
|
32
|
-
manufacturer: value.
|
|
33
|
-
? value.
|
|
34
|
-
? new Date(value.
|
|
32
|
+
manufacturer: value.informations
|
|
33
|
+
? value.informations.lastUplink
|
|
34
|
+
? new Date(value.informations.lastUplink.state.ts).toLocaleString('de-DE', {
|
|
35
35
|
weekday: 'short', // Mo
|
|
36
36
|
year: 'numeric', // 2026
|
|
37
37
|
month: '2-digit', // 01
|
|
@@ -42,9 +42,9 @@ class LoRaWANDeviceManagement extends DeviceManagement {
|
|
|
42
42
|
})
|
|
43
43
|
: undefined
|
|
44
44
|
: undefined,
|
|
45
|
-
model: value.
|
|
45
|
+
model: value.informations ? value.informations.devicetype.state.val : undefined, // - ${value.uplink.remaining.rxInfo[0].rssi.ts}`,
|
|
46
46
|
status: await this.getStatus(value),
|
|
47
|
-
hasDetails:
|
|
47
|
+
hasDetails: false,
|
|
48
48
|
actions: [
|
|
49
49
|
{
|
|
50
50
|
id: 'rename',
|
|
@@ -87,11 +87,11 @@ class LoRaWANDeviceManagement extends DeviceManagement {
|
|
|
87
87
|
status.connection = 'disconnected';
|
|
88
88
|
} else {
|
|
89
89
|
status.connection = 'connected';
|
|
90
|
-
if (devicevalue.
|
|
91
|
-
status.rssi = devicevalue.
|
|
90
|
+
if (devicevalue.informations.rssi) {
|
|
91
|
+
status.rssi = devicevalue.informations.rssi.state.val;
|
|
92
92
|
}
|
|
93
|
-
if (devicevalue.
|
|
94
|
-
status.battery = devicevalue.
|
|
93
|
+
if (devicevalue.informations.batteryPercent) {
|
|
94
|
+
status.battery = devicevalue.informations.batteryPercent.state.val ?? undefined;
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
return status;
|
|
@@ -102,16 +102,16 @@ class LoRaWANDeviceManagement extends DeviceManagement {
|
|
|
102
102
|
* @param devicevalue values of device
|
|
103
103
|
*/
|
|
104
104
|
async getIcon(devicevalue) {
|
|
105
|
-
if (devicevalue.
|
|
106
|
-
if (devicevalue.
|
|
105
|
+
if (devicevalue.indicators) {
|
|
106
|
+
if (devicevalue.indicators.isThermostat) {
|
|
107
107
|
return 'thermostat';
|
|
108
|
-
} else if (devicevalue.
|
|
109
|
-
return 'window';
|
|
110
|
-
} else if (devicevalue.checks.isDoor) {
|
|
108
|
+
} else if (devicevalue.indicators.isDoor) {
|
|
111
109
|
return 'door';
|
|
110
|
+
} else if (devicevalue.indicators.isWindow) {
|
|
111
|
+
return 'window';
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
return
|
|
114
|
+
return 'node'; //`/adapter/${this.adapter.name}/icons/Node.png`; //${value.object.common.icon}`,
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
/**
|
|
@@ -155,7 +155,7 @@ class downlinkConfighandlerClass {
|
|
|
155
155
|
);
|
|
156
156
|
for (const element of Object.values(metadataOfFiles)) {
|
|
157
157
|
const filepath = `${this.metafolders.downlink.knownProfiles}${element.file}`;
|
|
158
|
-
//delete file from
|
|
158
|
+
//delete file from downloadfolder
|
|
159
159
|
this.adapter.delFileAsync(this.adapter.namespace, filepath);
|
|
160
160
|
}
|
|
161
161
|
|
|
@@ -193,7 +193,7 @@ class downlinkConfighandlerClass {
|
|
|
193
193
|
);
|
|
194
194
|
for (const element of Object.values(metadataOfFiles)) {
|
|
195
195
|
const filepath = `${this.metafolders.downlink.current}${element.file}`;
|
|
196
|
-
//delete file from
|
|
196
|
+
//delete file from downloadfolder
|
|
197
197
|
this.adapter.delFileAsync(this.adapter.namespace, filepath);
|
|
198
198
|
}
|
|
199
199
|
|
|
@@ -185,17 +185,24 @@ class messagehandlerClass {
|
|
|
185
185
|
this.adapter.log.silly(`Function ${activeFunction} started.`);
|
|
186
186
|
try {
|
|
187
187
|
const adapterObjectsAtStart = await this.adapter.getAdapterObjectsAsync();
|
|
188
|
-
|
|
188
|
+
// Check for logging
|
|
189
|
+
this.adapter.log[this.adapter.logtypes.deviceinformation]?.(
|
|
190
|
+
`Adapter objects at start: ${JSON.stringify(adapterObjectsAtStart)}`,
|
|
191
|
+
);
|
|
189
192
|
// Generate Infos of all devices and decoded folders
|
|
190
193
|
const decodedData = {};
|
|
191
194
|
for (const adapterObject of Object.values(adapterObjectsAtStart)) {
|
|
192
|
-
|
|
195
|
+
// Check for logging
|
|
196
|
+
this.adapter.log[this.adapter.logtypes.deviceinformation]?.(`Check ${adapterObject._id} for state.`);
|
|
193
197
|
if (adapterObject.type === 'state') {
|
|
194
198
|
// To became just states no folders
|
|
195
199
|
if (
|
|
196
200
|
adapterObject._id.indexOf(`${this.directoryhandler.reachableSubfolders.uplinkDecoded}.`) !== -1
|
|
197
201
|
) {
|
|
198
|
-
|
|
202
|
+
// Check for logging
|
|
203
|
+
this.adapter.log[this.adapter.logtypes.deviceinformation]?.(
|
|
204
|
+
`${adapterObject._id} will be added to deviceinformation.`,
|
|
205
|
+
);
|
|
199
206
|
|
|
200
207
|
const decodedState = await this.adapter.getStateAsync(adapterObject._id);
|
|
201
208
|
const changeInfo = await this.adapter.getChangeInfo(adapterObject._id);
|
|
@@ -430,7 +437,8 @@ class messagehandlerClass {
|
|
|
430
437
|
for (const downlinkParameter of Object.values(
|
|
431
438
|
this.adapter.downlinkConfighandler.activeDownlinkConfigs[downlinkDevice].downlinkState,
|
|
432
439
|
)) {
|
|
433
|
-
|
|
440
|
+
// Check for logging
|
|
441
|
+
this.adapter.log[this.adapter.logtypes.fillWithDownlink]?.(
|
|
434
442
|
`the downlinkparameter ${JSON.stringify(downlinkParameter)}, will be checked.`,
|
|
435
443
|
);
|
|
436
444
|
// check for forbidden states
|
|
@@ -511,7 +519,8 @@ class messagehandlerClass {
|
|
|
511
519
|
*/
|
|
512
520
|
// Check for assign (new implemented function)
|
|
513
521
|
if (this.assignhandler.assign[downlinkParameter.name] && !options?.dontAssign) {
|
|
514
|
-
|
|
522
|
+
// Check for logging
|
|
523
|
+
this.adapter.log[this.adapter.logtypes.fillWithDownlink]?.(
|
|
515
524
|
`the state with the id ${stateId} will be assigned by internal assign function`,
|
|
516
525
|
);
|
|
517
526
|
this.assignhandler.executeAssign(
|
|
@@ -19,20 +19,20 @@ class objectStoreClass {
|
|
|
19
19
|
|
|
20
20
|
this.rolesToCheck = {
|
|
21
21
|
'value.battery': {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
indicator: { name: 'isBatteryDevice', subfolder: '.uplink.decoded' },
|
|
23
|
+
assignToDeviceInformations: { name: 'batteryPercent', subfolder: '.uplink.decoded' },
|
|
24
24
|
},
|
|
25
25
|
'level.temperature': {
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
'sensor.window': {
|
|
29
|
-
checkIndicator: { name: 'isWindow', subfolder: '.uplink.decoded' },
|
|
26
|
+
indicator: { name: 'isThermostat', subfolder: '.downlink.control' },
|
|
30
27
|
},
|
|
31
28
|
'sensor.door': {
|
|
32
|
-
|
|
29
|
+
indicator: { name: 'isDoor', subfolder: '.uplink.decoded' },
|
|
30
|
+
},
|
|
31
|
+
'sensor.window': {
|
|
32
|
+
indicator: { name: 'isWindow', subfolder: '.uplink.decoded' },
|
|
33
33
|
},
|
|
34
34
|
};
|
|
35
|
-
this.
|
|
35
|
+
this.assignToDeviceInformations = {
|
|
36
36
|
rssi: true,
|
|
37
37
|
devicetype: { name: 'devicetype', subfolder: '.configuration' },
|
|
38
38
|
json: { name: 'lastUplink', subfolder: '.uplink.raw' },
|
|
@@ -105,39 +105,37 @@ class objectStoreClass {
|
|
|
105
105
|
let assign = undefined;
|
|
106
106
|
if (payload.object) {
|
|
107
107
|
if (Object.hasOwn(this.rolesToCheck, payload.object.common.role)) {
|
|
108
|
-
if (!deviceObject[deviceId].
|
|
109
|
-
deviceObject[deviceId].
|
|
108
|
+
if (!deviceObject[deviceId].incators) {
|
|
109
|
+
deviceObject[deviceId].incators = {};
|
|
110
110
|
}
|
|
111
|
-
if (this.rolesToCheck[payload.object.common.role].
|
|
112
|
-
if (
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
deviceObject[deviceId].checks[
|
|
116
|
-
this.rolesToCheck[payload.object.common.role].checkIndicator
|
|
111
|
+
if (this.rolesToCheck[payload.object.common.role].indicator) {
|
|
112
|
+
if (typeof this.rolesToCheck[payload.object.common.role].indicator === 'string') {
|
|
113
|
+
deviceObject[deviceId].incators[
|
|
114
|
+
this.rolesToCheck[payload.object.common.role].indicator
|
|
117
115
|
] = true;
|
|
118
116
|
} else if (
|
|
119
|
-
typeof this.rolesToCheck[payload.object.common.role].
|
|
117
|
+
typeof this.rolesToCheck[payload.object.common.role].indicator === 'object'
|
|
120
118
|
) {
|
|
121
119
|
let name = key;
|
|
122
120
|
if (
|
|
123
|
-
this.rolesToCheck[payload.object.common.role].
|
|
121
|
+
this.rolesToCheck[payload.object.common.role].indicator.subfolder &&
|
|
124
122
|
!idWithoutLast.endsWith(
|
|
125
|
-
this.rolesToCheck[payload.object.common.role].
|
|
123
|
+
this.rolesToCheck[payload.object.common.role].indicator.subfolder,
|
|
126
124
|
)
|
|
127
125
|
) {
|
|
128
126
|
continue;
|
|
129
127
|
}
|
|
130
|
-
if (this.rolesToCheck[payload.object.common.role].
|
|
131
|
-
name = this.rolesToCheck[payload.object.common.role].
|
|
128
|
+
if (this.rolesToCheck[payload.object.common.role].indicator.name) {
|
|
129
|
+
name = this.rolesToCheck[payload.object.common.role].indicator.name;
|
|
132
130
|
}
|
|
133
|
-
deviceObject[deviceId].
|
|
131
|
+
deviceObject[deviceId].incators[name] = true;
|
|
134
132
|
}
|
|
135
|
-
deviceObject[deviceId].
|
|
136
|
-
this.rolesToCheck[payload.object.common.role].
|
|
133
|
+
deviceObject[deviceId].incators[
|
|
134
|
+
this.rolesToCheck[payload.object.common.role].indicator
|
|
137
135
|
] = true;
|
|
138
136
|
}
|
|
139
|
-
if (this.rolesToCheck[payload.object.common.role].
|
|
140
|
-
assign = this.rolesToCheck[payload.object.common.role].
|
|
137
|
+
if (this.rolesToCheck[payload.object.common.role].assignToDeviceInformations) {
|
|
138
|
+
assign = this.rolesToCheck[payload.object.common.role].assignToDeviceInformations;
|
|
141
139
|
}
|
|
142
140
|
}
|
|
143
141
|
}
|
|
@@ -151,9 +149,9 @@ class objectStoreClass {
|
|
|
151
149
|
}
|
|
152
150
|
}
|
|
153
151
|
// Assign to device
|
|
154
|
-
if (Object.hasOwn(this.
|
|
155
|
-
if (!deviceObject[deviceId].
|
|
156
|
-
deviceObject[deviceId].
|
|
152
|
+
if (Object.hasOwn(this.assignToDeviceInformations, key) || assign) {
|
|
153
|
+
if (!deviceObject[deviceId].incators) {
|
|
154
|
+
deviceObject[deviceId].incators = {};
|
|
157
155
|
}
|
|
158
156
|
let name = key;
|
|
159
157
|
if (assign) {
|
|
@@ -167,24 +165,24 @@ class objectStoreClass {
|
|
|
167
165
|
name = assign.name;
|
|
168
166
|
}
|
|
169
167
|
}
|
|
170
|
-
} else if (typeof this.
|
|
171
|
-
name = this.
|
|
172
|
-
} else if (typeof this.
|
|
168
|
+
} else if (typeof this.assignToDeviceInformations[key] === 'string') {
|
|
169
|
+
name = this.assignToDeviceInformations[key];
|
|
170
|
+
} else if (typeof this.assignToDeviceInformations[key] === 'object') {
|
|
173
171
|
if (
|
|
174
|
-
this.
|
|
175
|
-
!idWithoutLast.endsWith(this.
|
|
172
|
+
this.assignToDeviceInformations[key].subfolder &&
|
|
173
|
+
!idWithoutLast.endsWith(this.assignToDeviceInformations[key].subfolder)
|
|
176
174
|
) {
|
|
177
175
|
continue;
|
|
178
176
|
}
|
|
179
|
-
if (this.
|
|
180
|
-
name = this.
|
|
177
|
+
if (this.assignToDeviceInformations[key].name) {
|
|
178
|
+
name = this.assignToDeviceInformations[key].name;
|
|
181
179
|
}
|
|
182
180
|
}
|
|
183
|
-
if (!deviceObject[deviceId].
|
|
184
|
-
deviceObject[deviceId].
|
|
181
|
+
if (!deviceObject[deviceId].informations) {
|
|
182
|
+
deviceObject[deviceId].informations = {};
|
|
185
183
|
}
|
|
186
|
-
if (!deviceObject[deviceId].
|
|
187
|
-
deviceObject[deviceId].
|
|
184
|
+
if (!deviceObject[deviceId].informations[name]) {
|
|
185
|
+
deviceObject[deviceId].informations[name] = node[key];
|
|
188
186
|
}
|
|
189
187
|
}
|
|
190
188
|
}
|
package/main.js
CHANGED
|
@@ -127,8 +127,11 @@ class Lorawan extends utils.Adapter {
|
|
|
127
127
|
await this.subscribeStatesAsync('*');
|
|
128
128
|
await this.subscribeObjectsAsync('*');
|
|
129
129
|
//this.subscribeObjectsAsync('*.downlink.control.*');
|
|
130
|
-
|
|
131
|
-
this.log.
|
|
130
|
+
// Check for logging
|
|
131
|
+
this.log[this.logtypes.downlinkconfig]?.(
|
|
132
|
+
`the adapter starts with downlinkconfigs: ${JSON.stringify(this.config.downlinkConfig)}.`,
|
|
133
|
+
);
|
|
134
|
+
this.log[this.logtypes.downlinkconfig]?.(
|
|
132
135
|
`the active downlinkconfigs are: ${JSON.stringify(this.downlinkConfighandler.activeDownlinkConfigs)}`,
|
|
133
136
|
);
|
|
134
137
|
/*
|