iobroker.lorawan 1.19.7 → 1.19.9

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
@@ -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.19.9 (2026-01-05)
27
+ * (BenAhrdt) bugfix deleteing device
28
+
29
+ ### 1.19.8 (2026-01-05)
30
+ * (BenAhrdt) implement Link to device
31
+
26
32
  ### 1.19.7 (2026-01-04)
27
33
  * (BenAhrdt) improve available logic
28
34
 
package/io-package.json CHANGED
@@ -1,8 +1,34 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "lorawan",
4
- "version": "1.19.7",
4
+ "version": "1.19.9",
5
5
  "news": {
6
+ "1.19.9": {
7
+ "en": "bugfix deleteing device",
8
+ "de": "bugfix löschgerät",
9
+ "ru": "bugfix удаление устройства",
10
+ "pt": "dispositivo de remoção de correções de erros",
11
+ "nl": "bugfix verwijderapparaat",
12
+ "fr": "bugfix supprimer le périphérique",
13
+ "it": "bugfix dispositivo di cancellazione",
14
+ "es": "bugfix dispositivo de eliminación",
15
+ "pl": "urządzenie do usuwania błędów",
16
+ "uk": "пристрій видалення помилок",
17
+ "zh-cn": "错误修正删除设备"
18
+ },
19
+ "1.19.8": {
20
+ "en": "implement Link to device",
21
+ "de": "durchführung Link zum Gerät",
22
+ "ru": "осуществлять Ссылка на устройство",
23
+ "pt": "implementar Ligação ao dispositivo",
24
+ "nl": "implementeren Koppeling naar apparaat",
25
+ "fr": "mise en œuvre Lien vers le périphérique",
26
+ "it": "attuazione Link al dispositivo",
27
+ "es": "aplicación Enlace al dispositivo",
28
+ "pl": "wdrożenie Link do urządzenia",
29
+ "uk": "реалізація Посилання на пристрій",
30
+ "zh-cn": "执行 链接到设备"
31
+ },
6
32
  "1.19.7": {
7
33
  "en": "improve available logic",
8
34
  "de": "verbesserung der verfügbaren logik",
@@ -67,32 +93,6 @@
67
93
  "pl": "dodawanie wersji i domeny do automatyzacji",
68
94
  "uk": "додати версію та домен до автоматизації",
69
95
  "zh-cn": "在自动化中添加版本和域"
70
- },
71
- "1.19.2": {
72
- "en": "bugfix filldownlink",
73
- "de": "fehlerbehebungen",
74
- "ru": "bugfix filldownlink",
75
- "pt": "ligação de preenchimento de correções de erros",
76
- "nl": "bugfix filldownlink",
77
- "fr": "bugfix remplissagelien",
78
- "it": "bugfix filldownlink",
79
- "es": "bugfix rellenolink",
80
- "pl": "bugfix fishdownlink",
81
- "uk": "javascript licenses api веб-сайт",
82
- "zh-cn": "臭虫补全下行链路"
83
- },
84
- "1.19.1": {
85
- "en": "bugfix device and replace debug logs for silly",
86
- "de": "bugfix gerät und ersetzen debug protokolle für albern",
87
- "ru": "bugfix-устройство и замена отладочных журналов на глупые",
88
- "pt": "dispositivo de correção de bugs e registros de depuração de substituição para bobo",
89
- "nl": "bugfix-apparaat en debug-logs vervangen voor domheid",
90
- "fr": "bugfix périphérique et remplacer les journaux de débogage pour idiot",
91
- "it": "dispositivo bugfix e sostituire i log di debug per sciocco",
92
- "es": "dispositivo bugfix y reemplazar los registros de depuración para tontos",
93
- "pl": "bugfix urządzenia i zastąpić logi debug dla głupi",
94
- "uk": "пристрій для виправлення помилок і заміни журналів для silly",
95
- "zh-cn": "错误修正设备并替换愚昧的调试日志"
96
96
  }
97
97
  },
98
98
  "titleLang": {
@@ -25,6 +25,18 @@ class bridgeDeviceHandlerClass {
25
25
  },
26
26
  native: {},
27
27
  });
28
+ this.adapter.extendObject(`${this.basefolder}.bridgeBaseIp`, {
29
+ type: 'state',
30
+ common: {
31
+ name: 'Ip from Home Assistant',
32
+ type: 'string',
33
+ role: 'url.blank',
34
+ read: true,
35
+ write: true,
36
+ def: 'http://yourIP',
37
+ },
38
+ native: {},
39
+ });
28
40
  }
29
41
 
30
42
  // Generate Structure of incomming Data
@@ -44,18 +56,22 @@ class bridgeDeviceHandlerClass {
44
56
  if (message.entities) {
45
57
  const available = {};
46
58
  for (const entity of Object.values(message.entities)) {
59
+ // EntityInfo
47
60
  const entityInfo = this.generateStructure(entity);
48
61
  if (!entityInfo) {
49
62
  this.adapter.log.warn(`No EntityInfo found`);
50
63
  return;
51
64
  }
52
- const availableId = `${entityInfo.device.id}.available`;
65
+
66
+ // Device
53
67
  await this.adapter.extendObject(entityInfo.device.id, {
54
68
  type: 'device',
55
- common: { name: entity.device.name, statusStates: { onlineId: availableId } },
69
+ common: { name: entity.device.name, statusStates: { onlineId: entityInfo.device.availableId } },
56
70
  native: entity.device,
57
71
  });
58
- await this.adapter.extendObject(availableId, {
72
+
73
+ // Available
74
+ await this.adapter.extendObject(entityInfo.device.availableId, {
59
75
  type: 'state',
60
76
  common: {
61
77
  name: 'Device available',
@@ -68,25 +84,48 @@ class bridgeDeviceHandlerClass {
68
84
  native: {},
69
85
  });
70
86
  if (message.discovery) {
71
- if (available[availableId] === undefined) {
87
+ if (available[entityInfo.device.availableId] === undefined) {
72
88
  if (entity.domain !== 'button' && entity.domain !== 'event' && entity.domain !== 'scene') {
73
- available[availableId] = entity.available;
74
- await this.adapter.setState(availableId, available[availableId], true);
89
+ available[entityInfo.device.availableId] = entity.available;
90
+ await this.adapter.setState(
91
+ entityInfo.device.availableId,
92
+ available[entityInfo.device.availableId],
93
+ true,
94
+ );
75
95
  }
76
- } else if (available[availableId] === true) {
96
+ } else if (available[entityInfo.device.availableId] === true) {
77
97
  if (
78
98
  entity.domain !== 'button' &&
79
99
  entity.domain !== 'event' &&
80
100
  entity.domain !== 'scene' &&
81
101
  entity.available === false
82
102
  ) {
83
- available[availableId] = false;
84
- await this.adapter.setState(availableId, false, true);
103
+ available[entityInfo.device.availableId] = false;
104
+ await this.adapter.setState(entityInfo.device.availableId, false, true);
85
105
  }
86
106
  }
87
107
  } else {
88
- await this.adapter.setState(availableId, true, true);
108
+ await this.adapter.setState(entityInfo.device.availableId, true, true);
89
109
  }
110
+
111
+ // DeviceLink
112
+ const baseUrl = await this.adapter.getStateAsync(`${this.basefolder}.bridgeBaseIp`);
113
+ const url = `${baseUrl.val}:8123/config/devices/device/${entity.device.id}`;
114
+ await this.adapter.extendObject(entityInfo.device.devicelinkId, {
115
+ type: 'state',
116
+ common: {
117
+ name: 'Link to devicepage',
118
+ type: 'string',
119
+ role: 'url.blank',
120
+ read: true,
121
+ write: false,
122
+ def: url,
123
+ },
124
+ native: {},
125
+ });
126
+ await this.adapter.setState(entityInfo.device.devicelinkId, url, true);
127
+
128
+ // Channel
90
129
  const channel = entity.entity_id.substring(0, entity.entity_id.indexOf('.'));
91
130
  await this.adapter.extendObject(entityInfo.channel.id, {
92
131
  type: 'channel',
@@ -132,7 +171,9 @@ class bridgeDeviceHandlerClass {
132
171
  if (!Object.keys(message.entities).includes(entityId)) {
133
172
  const entityInfo = this.generateStructure(entities[entityId]);
134
173
  await this.adapter.delObjectAsync(entityInfo?.state.id);
135
- checkDevices[entityInfo?.device.id] = {};
174
+ if (!checkDevices[entityInfo?.device.id]) {
175
+ checkDevices[entityInfo?.device.id] = {};
176
+ }
136
177
  if (entityInfo?.channel.id) {
137
178
  checkDevices[entityInfo?.device.id][entityInfo?.channel.id] = {};
138
179
  }
@@ -141,7 +182,6 @@ class bridgeDeviceHandlerClass {
141
182
  // Check for delete channels and devices
142
183
  for (const deviceId of Object.keys(checkDevices)) {
143
184
  let foundStateInAnyChannel = false;
144
-
145
185
  // Check channel
146
186
  for (const channelId of Object.keys(checkDevices[deviceId])) {
147
187
  const channelParams = {
@@ -160,7 +200,6 @@ class bridgeDeviceHandlerClass {
160
200
  foundStateInAnyChannel = true;
161
201
  continue;
162
202
  }
163
-
164
203
  // No state
165
204
  await this.adapter.delObjectAsync(channelId, { recursive: true });
166
205
  this.adapter.log.debug(`Deleted empty channel: ${channelId}`);
@@ -173,9 +212,14 @@ class bridgeDeviceHandlerClass {
173
212
  endkey: `${deviceId}.\u9999`,
174
213
  };
175
214
 
176
- const deviceStates = await this.adapter.getObjectViewAsync('system', 'state', deviceParams);
215
+ const deviceChannels = await this.adapter.getObjectViewAsync(
216
+ 'system',
217
+ 'channel',
218
+ deviceParams,
219
+ );
177
220
 
178
- if (deviceStates.rows.length === 0) {
221
+ // No Channel found
222
+ if (deviceChannels.rows.length === 0) {
179
223
  await this.adapter.delObjectAsync(deviceId, { recursive: true });
180
224
  this.adapter.log.debug(`Deleted empty device: ${deviceId}`);
181
225
  }
@@ -213,6 +257,8 @@ class bridgeDeviceHandlerClass {
213
257
  manufacturer: entity.device?.manufacturer || '',
214
258
  model: entity.device?.model || '',
215
259
  };
260
+ device.availableId = `${device.id}.available`;
261
+ device.devicelinkId = `${device.id}.devicelink`;
216
262
 
217
263
  const channel = {
218
264
  id: `${device.id}.${entity.domain}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.lorawan",
3
- "version": "1.19.7",
3
+ "version": "1.19.9",
4
4
  "description": "converts the desired lora gateway data to a ioBroker structure",
5
5
  "author": {
6
6
  "name": "BenAhrdt",