iobroker.lorawan 1.19.6 → 1.19.8

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.8 (2026-01-05)
27
+ * (BenAhrdt) implement Link to device
28
+
29
+ ### 1.19.7 (2026-01-04)
30
+ * (BenAhrdt) improve available logic
31
+
26
32
  ### 1.19.6 (2026-01-04)
27
33
  * (BenAhrdt) add available bit
28
34
 
package/io-package.json CHANGED
@@ -1,8 +1,34 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "lorawan",
4
- "version": "1.19.6",
4
+ "version": "1.19.8",
5
5
  "news": {
6
+ "1.19.8": {
7
+ "en": "implement Link to device",
8
+ "de": "durchführung Link zum Gerät",
9
+ "ru": "осуществлять Ссылка на устройство",
10
+ "pt": "implementar Ligação ao dispositivo",
11
+ "nl": "implementeren Koppeling naar apparaat",
12
+ "fr": "mise en œuvre Lien vers le périphérique",
13
+ "it": "attuazione Link al dispositivo",
14
+ "es": "aplicación Enlace al dispositivo",
15
+ "pl": "wdrożenie Link do urządzenia",
16
+ "uk": "реалізація Посилання на пристрій",
17
+ "zh-cn": "执行 链接到设备"
18
+ },
19
+ "1.19.7": {
20
+ "en": "improve available logic",
21
+ "de": "verbesserung der verfügbaren logik",
22
+ "ru": "улучшение доступной логики",
23
+ "pt": "melhorar a lógica disponível",
24
+ "nl": "de beschikbare logica verbeteren",
25
+ "fr": "améliorer la logique disponible",
26
+ "it": "migliorare la logica disponibile",
27
+ "es": "mejorar la lógica disponible",
28
+ "pl": "poprawić dostępną logikę",
29
+ "uk": "поліпшення логіки",
30
+ "zh-cn": "改进可用的逻辑"
31
+ },
6
32
  "1.19.6": {
7
33
  "en": "add available bit",
8
34
  "de": "hinzufügen von bit",
@@ -67,32 +93,6 @@
67
93
  "pl": "bugfix fishdownlink",
68
94
  "uk": "javascript licenses api веб-сайт",
69
95
  "zh-cn": "臭虫补全下行链路"
70
- },
71
- "1.19.1": {
72
- "en": "bugfix device and replace debug logs for silly",
73
- "de": "bugfix gerät und ersetzen debug protokolle für albern",
74
- "ru": "bugfix-устройство и замена отладочных журналов на глупые",
75
- "pt": "dispositivo de correção de bugs e registros de depuração de substituição para bobo",
76
- "nl": "bugfix-apparaat en debug-logs vervangen voor domheid",
77
- "fr": "bugfix périphérique et remplacer les journaux de débogage pour idiot",
78
- "it": "dispositivo bugfix e sostituire i log di debug per sciocco",
79
- "es": "dispositivo bugfix y reemplazar los registros de depuración para tontos",
80
- "pl": "bugfix urządzenia i zastąpić logi debug dla głupi",
81
- "uk": "пристрій для виправлення помилок і заміни журналів для silly",
82
- "zh-cn": "错误修正设备并替换愚昧的调试日志"
83
- },
84
- "1.19.0": {
85
- "en": "remove Bridgetype Smarthome\nadd firt possibility to generate devices from Bridge to Iob",
86
- "de": "bridgetype Smarthome entfernen\nfügen Sie firt Möglichkeit, Geräte von Bridge zu Iob zu generieren",
87
- "ru": "скачать Bridgetype Smarthome\nдобавьте возможность создания устройств от Bridge до Iob",
88
- "pt": "remover o tipo de ponte Smarthome\nadicionar a possibilidade inicial de gerar dispositivos de Bridge para Iob",
89
- "nl": "verwijderen Bridgetype Smarthome\nfirt mogelijkheid toevoegen om apparaten van brug aan Iob te genereren",
90
- "fr": "supprimer Bridgetype Smarthome\najouter la possibilité de firt pour générer des appareils de Bridge à Iob",
91
- "it": "rimuovere Bridgetype Smarthome\naggiungere firt possibilità di generare dispositivi da Bridge a Iob",
92
- "es": "eliminar Bridgetype Smarthome\nañadir firt posibilidad de generar dispositivos desde Bridge a Iob",
93
- "pl": "usuń Bridgetype Smarthome\ndodać firt możliwość generowania urządzeń z Bridge do Iob",
94
- "uk": "видалити Bridgetype Smarthome\nдо Iob",
95
- "zh-cn": "删除桥型 Smarthome\n从 Bridge 添加 firt 生成设备的可能性"
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
@@ -42,15 +54,24 @@ class bridgeDeviceHandlerClass {
42
54
  }
43
55
  // Query for Entity
44
56
  if (message.entities) {
57
+ const available = {};
45
58
  for (const entity of Object.values(message.entities)) {
59
+ // EntityInfo
46
60
  const entityInfo = this.generateStructure(entity);
47
- const availableId = `${entityInfo?.device.id}.available`;
48
- await this.adapter.extendObject(entityInfo?.device.id, {
61
+ if (!entityInfo) {
62
+ this.adapter.log.warn(`No EntityInfo found`);
63
+ return;
64
+ }
65
+
66
+ // Device
67
+ await this.adapter.extendObject(entityInfo.device.id, {
49
68
  type: 'device',
50
- common: { name: entity.device.name, statusStates: { onlineId: availableId } },
69
+ common: { name: entity.device.name, statusStates: { onlineId: entityInfo.device.availableId } },
51
70
  native: entity.device,
52
71
  });
53
- await this.adapter.extendObject(availableId, {
72
+
73
+ // Available
74
+ await this.adapter.extendObject(entityInfo.device.availableId, {
54
75
  type: 'state',
55
76
  common: {
56
77
  name: 'Device available',
@@ -62,10 +83,51 @@ class bridgeDeviceHandlerClass {
62
83
  },
63
84
  native: {},
64
85
  });
65
- const available = entity.available || entity.domain !== 'buton';
66
- await this.adapter.setState(availableId, available, true);
86
+ if (message.discovery) {
87
+ if (available[entityInfo.device.availableId] === undefined) {
88
+ if (entity.domain !== 'button' && entity.domain !== 'event' && entity.domain !== 'scene') {
89
+ available[entityInfo.device.availableId] = entity.available;
90
+ await this.adapter.setState(
91
+ entityInfo.device.availableId,
92
+ available[entityInfo.device.availableId],
93
+ true,
94
+ );
95
+ }
96
+ } else if (available[entityInfo.device.availableId] === true) {
97
+ if (
98
+ entity.domain !== 'button' &&
99
+ entity.domain !== 'event' &&
100
+ entity.domain !== 'scene' &&
101
+ entity.available === false
102
+ ) {
103
+ available[entityInfo.device.availableId] = false;
104
+ await this.adapter.setState(entityInfo.device.availableId, false, true);
105
+ }
106
+ }
107
+ } else {
108
+ await this.adapter.setState(entityInfo.device.availableId, true, true);
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
67
129
  const channel = entity.entity_id.substring(0, entity.entity_id.indexOf('.'));
68
- await this.adapter.extendObject(entityInfo?.channel.id, {
130
+ await this.adapter.extendObject(entityInfo.channel.id, {
69
131
  type: 'channel',
70
132
  common: { name: 'Channel of Entity' },
71
133
  native: {},
@@ -75,25 +137,25 @@ class bridgeDeviceHandlerClass {
75
137
  unique_id = unique_id.substring(channel.length + 1, unique_id.length);
76
138
  }
77
139
  unique_id.replace('.', '_');
78
- await this.adapter.extendObject(entityInfo?.state.id, {
140
+ await this.adapter.extendObject(entityInfo.state.id, {
79
141
  type: 'state',
80
142
  common: {
81
- name: entityInfo?.state.name,
82
- type: entityInfo?.state.type,
83
- role: entityInfo?.state.role,
84
- read: entityInfo?.state.read,
85
- write: entityInfo?.state.write,
86
- unit: entityInfo?.state.unit,
143
+ name: entityInfo.state.name,
144
+ type: entityInfo.state.type,
145
+ role: entityInfo.state.role,
146
+ read: entityInfo.state.read,
147
+ write: entityInfo.state.write,
148
+ unit: entityInfo.state.unit,
87
149
  },
88
150
  native: { entity: entity, entityInfo: entityInfo },
89
151
  });
90
152
  let state = entity.state;
91
- if (entityInfo?.state.type === 'boolean') {
153
+ if (entityInfo.state.type === 'boolean') {
92
154
  state = entity.state === 'on';
93
- } else if (entityInfo?.state.type === 'number') {
155
+ } else if (entityInfo.state.type === 'number') {
94
156
  state = Number(entity.state);
95
157
  }
96
- await this.adapter.setState(entityInfo?.state.id, state, true);
158
+ await this.adapter.setState(entityInfo.state.id, state, true);
97
159
  }
98
160
  }
99
161
  // Periodic discovery
@@ -150,9 +212,14 @@ class bridgeDeviceHandlerClass {
150
212
  endkey: `${deviceId}.\u9999`,
151
213
  };
152
214
 
153
- const deviceStates = await this.adapter.getObjectViewAsync('system', 'state', deviceParams);
215
+ const deviceChannels = await this.adapter.getObjectViewAsync(
216
+ 'system',
217
+ 'channel',
218
+ deviceParams,
219
+ );
154
220
 
155
- if (deviceStates.rows.length === 0) {
221
+ // No Channel found
222
+ if (deviceChannels.rows.length === 0) {
156
223
  await this.adapter.delObjectAsync(deviceId, { recursive: true });
157
224
  this.adapter.log.debug(`Deleted empty device: ${deviceId}`);
158
225
  }
@@ -190,6 +257,8 @@ class bridgeDeviceHandlerClass {
190
257
  manufacturer: entity.device?.manufacturer || '',
191
258
  model: entity.device?.model || '',
192
259
  };
260
+ device.availableId = `${device.id}.available`;
261
+ device.devicelinkId = `${device.id}.devicelink`;
193
262
 
194
263
  const channel = {
195
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.6",
3
+ "version": "1.19.8",
4
4
  "description": "converts the desired lora gateway data to a ioBroker structure",
5
5
  "author": {
6
6
  "name": "BenAhrdt",