iobroker.lorawan 1.19.2 → 1.19.3
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/bridgeDeviceHandler.js +28 -26
- package/main.js +10 -10
- 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.19.3 (2026-01-04)
|
|
27
|
+
* (BenAhrdt) add version and domain to automation
|
|
28
|
+
|
|
26
29
|
### 1.19.2 (2026-01-03)
|
|
27
30
|
* (BenAhrdt) bugfix filldownlink
|
|
28
31
|
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "lorawan",
|
|
4
|
-
"version": "1.19.
|
|
4
|
+
"version": "1.19.3",
|
|
5
5
|
"news": {
|
|
6
|
+
"1.19.3": {
|
|
7
|
+
"en": "add version and domain to automation",
|
|
8
|
+
"de": "version und domäne zur automatisierung hinzufügen",
|
|
9
|
+
"ru": "добавить версию и домен в автоматизацию",
|
|
10
|
+
"pt": "adicionar versão e domínio à automação",
|
|
11
|
+
"nl": "versie en domein toevoegen aan automatisering",
|
|
12
|
+
"fr": "ajouter version et domaine à l'automatisation",
|
|
13
|
+
"it": "aggiungere la versione e il dominio all'automazione",
|
|
14
|
+
"es": "añadir versión y dominio a automatización",
|
|
15
|
+
"pl": "dodawanie wersji i domeny do automatyzacji",
|
|
16
|
+
"uk": "додати версію та домен до автоматизації",
|
|
17
|
+
"zh-cn": "在自动化中添加版本和域"
|
|
18
|
+
},
|
|
6
19
|
"1.19.2": {
|
|
7
20
|
"en": "bugfix filldownlink",
|
|
8
21
|
"de": "fehlerbehebungen",
|
|
@@ -80,19 +93,6 @@
|
|
|
80
93
|
"pl": "ustawiony rozmiar chunksize do 32",
|
|
81
94
|
"uk": "встановити chunksize до 32",
|
|
82
95
|
"zh-cn": "设置为32块"
|
|
83
|
-
},
|
|
84
|
-
"1.18.60": {
|
|
85
|
-
"en": "bugfix errorlogging",
|
|
86
|
-
"de": "fehlerbehebung von fehlern",
|
|
87
|
-
"ru": "bugfix ошибка",
|
|
88
|
-
"pt": "erro de correção",
|
|
89
|
-
"nl": "bugfix foutloggen",
|
|
90
|
-
"fr": "bugfix errorlogging",
|
|
91
|
-
"it": "bugfix errorelogging",
|
|
92
|
-
"es": "error bugfixlogging",
|
|
93
|
-
"pl": "błąd bugfix",
|
|
94
|
-
"uk": "повідомлень про помилку",
|
|
95
|
-
"zh-cn": "错误修正错误日志"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"titleLang": {
|
|
@@ -13,6 +13,18 @@ class bridgeDeviceHandlerClass {
|
|
|
13
13
|
common: { name: 'Devices recieved from Bridge' },
|
|
14
14
|
native: {},
|
|
15
15
|
});
|
|
16
|
+
this.adapter.extendObject(`${this.basefolder}.discoveredEntities`, {
|
|
17
|
+
type: 'state',
|
|
18
|
+
common: {
|
|
19
|
+
name: 'Discovered Entities',
|
|
20
|
+
type: 'string',
|
|
21
|
+
role: 'json',
|
|
22
|
+
read: true,
|
|
23
|
+
write: false,
|
|
24
|
+
def: '',
|
|
25
|
+
},
|
|
26
|
+
native: {},
|
|
27
|
+
});
|
|
16
28
|
}
|
|
17
29
|
|
|
18
30
|
// Generate Structure of incomming Data
|
|
@@ -23,6 +35,11 @@ class bridgeDeviceHandlerClass {
|
|
|
23
35
|
const activeFunction = 'bridgeDeviceHandler.js - generateDeviceStructure';
|
|
24
36
|
this.adapter.log.silly(`Function ${activeFunction} started.`);
|
|
25
37
|
try {
|
|
38
|
+
const version = '1.0.0';
|
|
39
|
+
if (!message.version || message.version !== version) {
|
|
40
|
+
this.adapter.log.warn(`You need to use version ${version} of the Home Assistant automation.`);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
26
43
|
// Query for Entity
|
|
27
44
|
if (message.entities) {
|
|
28
45
|
for (const entity of Object.values(message.entities)) {
|
|
@@ -67,18 +84,6 @@ class bridgeDeviceHandlerClass {
|
|
|
67
84
|
// Periodic discovery
|
|
68
85
|
if (message.discovery) {
|
|
69
86
|
const id = `${this.basefolder}.discoveredEntities`;
|
|
70
|
-
await this.adapter.extendObject(id, {
|
|
71
|
-
type: 'state',
|
|
72
|
-
common: {
|
|
73
|
-
name: 'Discovered Entities',
|
|
74
|
-
type: 'string',
|
|
75
|
-
role: 'json',
|
|
76
|
-
read: true,
|
|
77
|
-
write: false,
|
|
78
|
-
def: '',
|
|
79
|
-
},
|
|
80
|
-
native: {},
|
|
81
|
-
});
|
|
82
87
|
|
|
83
88
|
// Read current data
|
|
84
89
|
const discoveredEntities = await this.adapter.getStateAsync(id);
|
|
@@ -95,7 +100,6 @@ class bridgeDeviceHandlerClass {
|
|
|
95
100
|
}
|
|
96
101
|
}
|
|
97
102
|
}
|
|
98
|
-
|
|
99
103
|
// Check for delete channels and devices
|
|
100
104
|
for (const deviceId of Object.keys(checkDevices)) {
|
|
101
105
|
let foundStateInAnyChannel = false;
|
|
@@ -158,8 +162,6 @@ class bridgeDeviceHandlerClass {
|
|
|
158
162
|
return null;
|
|
159
163
|
}
|
|
160
164
|
|
|
161
|
-
const [domain] = entity.entity_id.split('.');
|
|
162
|
-
|
|
163
165
|
const stateId = this.buildSafeStateId(entity);
|
|
164
166
|
if (!stateId) {
|
|
165
167
|
return null;
|
|
@@ -168,25 +170,25 @@ class bridgeDeviceHandlerClass {
|
|
|
168
170
|
const assign = this.detectAssign(entity);
|
|
169
171
|
|
|
170
172
|
const device = {
|
|
171
|
-
id: `${this.basefolder}.${entity.device?.id ?? 'unknown_device'}`,
|
|
173
|
+
id: `${this.adapter.namespace}.${this.basefolder}.${entity.device?.id ?? 'unknown_device'}`,
|
|
172
174
|
name: entity.device?.name || 'Unknown Device',
|
|
173
175
|
manufacturer: entity.device?.manufacturer || '',
|
|
174
176
|
model: entity.device?.model || '',
|
|
175
177
|
};
|
|
176
178
|
|
|
177
179
|
const channel = {
|
|
178
|
-
id: `${
|
|
179
|
-
name: domain,
|
|
180
|
+
id: `${device.id}.${entity.domain}`,
|
|
181
|
+
name: entity.domain,
|
|
180
182
|
};
|
|
181
183
|
|
|
182
184
|
const state = {
|
|
183
|
-
id: `${
|
|
185
|
+
id: `${channel.id}.${stateId}`,
|
|
184
186
|
name: entity.friendly_name || stateId,
|
|
185
187
|
type: type,
|
|
186
|
-
role: this.detectRole(entity,
|
|
188
|
+
role: this.detectRole(entity, type),
|
|
187
189
|
unit: entity.unit_of_measurement || undefined,
|
|
188
190
|
read: true,
|
|
189
|
-
write: this.isWritable(domain),
|
|
191
|
+
write: this.isWritable(entity.domain),
|
|
190
192
|
};
|
|
191
193
|
if (assign) {
|
|
192
194
|
state.assign = assign;
|
|
@@ -266,6 +268,7 @@ class bridgeDeviceHandlerClass {
|
|
|
266
268
|
'climate',
|
|
267
269
|
'cover',
|
|
268
270
|
'lock',
|
|
271
|
+
'text',
|
|
269
272
|
].includes(domain);
|
|
270
273
|
} catch (error) {
|
|
271
274
|
this.adapter.log.error(`error at ${activeFunction}: ${error}`);
|
|
@@ -274,20 +277,19 @@ class bridgeDeviceHandlerClass {
|
|
|
274
277
|
|
|
275
278
|
/**
|
|
276
279
|
* @param entity entity wich contains the desired informations
|
|
277
|
-
* @param domain domain wich contains the type of the entity
|
|
278
280
|
* @param type type wich contains the type of ioBroker state
|
|
279
281
|
*/
|
|
280
|
-
detectRole(entity,
|
|
282
|
+
detectRole(entity, type) {
|
|
281
283
|
const activeFunction = 'bridgeDeviceHandler.js - detectRole';
|
|
282
284
|
this.adapter.log.silly(`Function ${activeFunction} started.`);
|
|
283
285
|
try {
|
|
284
|
-
if (domain === 'switch') {
|
|
286
|
+
if (entity.domain === 'switch') {
|
|
285
287
|
return 'switch';
|
|
286
288
|
}
|
|
287
|
-
if (domain === 'light') {
|
|
289
|
+
if (entity.domain === 'light') {
|
|
288
290
|
return 'light';
|
|
289
291
|
}
|
|
290
|
-
if (domain === 'binary_sensor') {
|
|
292
|
+
if (entity.domain === 'binary_sensor') {
|
|
291
293
|
return 'indicator';
|
|
292
294
|
}
|
|
293
295
|
|
package/main.js
CHANGED
|
@@ -510,7 +510,7 @@ class Lorawan extends utils.Adapter {
|
|
|
510
510
|
`the state ${id} has changed to ${state.val !== '' ? state.val : '""'} with ack = ${state.ack}.`,
|
|
511
511
|
);
|
|
512
512
|
} else {
|
|
513
|
-
this.log.
|
|
513
|
+
this.log.silly(
|
|
514
514
|
`the state ${id} has changed to ${state.val !== '' ? state.val : '""'} with ack = ${state.ack}.`,
|
|
515
515
|
);
|
|
516
516
|
}
|
|
@@ -612,11 +612,11 @@ class Lorawan extends utils.Adapter {
|
|
|
612
612
|
}
|
|
613
613
|
|
|
614
614
|
// Query about th correct type
|
|
615
|
-
this.log.
|
|
615
|
+
this.log.silly(
|
|
616
616
|
'The following values are detected / used at input of custom send state',
|
|
617
617
|
);
|
|
618
618
|
for (const element in StateElements) {
|
|
619
|
-
this.log.
|
|
619
|
+
this.log.silly(
|
|
620
620
|
`${element}: Type: ${typeof StateElements[element]} - Value: ${StateElements[element]}`,
|
|
621
621
|
);
|
|
622
622
|
}
|
|
@@ -905,7 +905,7 @@ class Lorawan extends utils.Adapter {
|
|
|
905
905
|
const activeFunction = 'main.js - checkSendDownlinkWithUplink';
|
|
906
906
|
this.log.silly(`Function ${activeFunction} started.`);
|
|
907
907
|
try {
|
|
908
|
-
this.log.
|
|
908
|
+
this.log.silly(`Check for send downlink with uplink.`);
|
|
909
909
|
const changeInfo = await this.getChangeInfo(id, { withBestMatch: true });
|
|
910
910
|
if (
|
|
911
911
|
changeInfo &&
|
|
@@ -1064,7 +1064,7 @@ class Lorawan extends utils.Adapter {
|
|
|
1064
1064
|
async getChangeInfo(id, options) {
|
|
1065
1065
|
const activeFunction = 'getChangeInfo';
|
|
1066
1066
|
try {
|
|
1067
|
-
this.log.
|
|
1067
|
+
this.log.silly(`changeinfo of id ${id}, will be generated.`);
|
|
1068
1068
|
const changeInfo = this.getBaseDeviceInfo(id);
|
|
1069
1069
|
const myId = `${changeInfo?.objectStartDirectory}.${this.messagehandler?.directoryhandler.reachableSubfolders.configuration}.devicetype`;
|
|
1070
1070
|
// Check for changeInfo
|
|
@@ -1088,18 +1088,18 @@ class Lorawan extends utils.Adapter {
|
|
|
1088
1088
|
this.downlinkConfighandler?.getBestMatchForDeviceType(changeInfo);
|
|
1089
1089
|
if (bestMatchForDeviceType) {
|
|
1090
1090
|
changeInfo.bestMatchForDeviceType = bestMatchForDeviceType;
|
|
1091
|
-
this.log.
|
|
1091
|
+
this.log.silly(
|
|
1092
1092
|
`best match for expertconfig of device: ${changeInfo.deviceType ? changeInfo.deviceType : 'empty devicetype'} is: ${bestMatchForDeviceType}`,
|
|
1093
1093
|
);
|
|
1094
1094
|
} else {
|
|
1095
|
-
this.log.
|
|
1095
|
+
this.log.silly(
|
|
1096
1096
|
`no match for expert downlinkconfig found: ${changeInfo.deviceType ? changeInfo.deviceType : 'empty devicetype'}`,
|
|
1097
1097
|
);
|
|
1098
1098
|
}
|
|
1099
1099
|
}
|
|
1100
1100
|
}
|
|
1101
1101
|
}
|
|
1102
|
-
this.log.
|
|
1102
|
+
this.log.silly(`changeinfo is ${JSON.stringify(changeInfo)}.`);
|
|
1103
1103
|
return changeInfo;
|
|
1104
1104
|
} catch (error) {
|
|
1105
1105
|
this.log.error(`error at ${activeFunction}: ${error}`);
|
|
@@ -1108,7 +1108,7 @@ class Lorawan extends utils.Adapter {
|
|
|
1108
1108
|
|
|
1109
1109
|
removeNamespace(id) {
|
|
1110
1110
|
if (id.indexOf(this.namespace) !== -1) {
|
|
1111
|
-
this.log.
|
|
1111
|
+
this.log.silly(`namespace will be removed from id ${id}.`);
|
|
1112
1112
|
id = id.substring(this.namespace.length + 1, id.length);
|
|
1113
1113
|
}
|
|
1114
1114
|
return id;
|
|
@@ -1138,7 +1138,7 @@ class Lorawan extends utils.Adapter {
|
|
|
1138
1138
|
|
|
1139
1139
|
async onMessage(obj) {
|
|
1140
1140
|
const activeFunction = 'onMessage';
|
|
1141
|
-
this.log.
|
|
1141
|
+
this.log.silly(`message received: command = ${obj.command} - message = ${JSON.stringify(obj.message)}`);
|
|
1142
1142
|
try {
|
|
1143
1143
|
if (typeof obj === 'object' && obj.message) {
|
|
1144
1144
|
let result = {};
|