iobroker.lorawan 1.20.49 → 1.20.50

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
@@ -24,6 +24,9 @@ For now there is documentation in English here: https://wiki.hafenmeister.de
24
24
  Placeholder for the next version (at the beginning of the line):
25
25
  ### **WORK IN PROGRESS**
26
26
  -->
27
+ ### 1.20.50 (2026-02-10)
28
+ * (BenAhrdt) implements light to ToIoB function
29
+
27
30
  ### 1.20.49 (2026-02-08)
28
31
  * (BenAhrdt) improve handling of remove Function fpr Bridge
29
32
 
@@ -55,127 +58,6 @@ For now there is documentation in English here: https://wiki.hafenmeister.de
55
58
  ### 1.20.40 (2026-02-02)
56
59
  * (BenAhrdt) update Form Width in Device Details
57
60
 
58
- ### 1.20.39 (2026-02-01)
59
- * (BenAhrdt) update DeviceProfile
60
-
61
- ### 1.20.38 (2026-02-01)
62
- * (BenAhrdt) add min / max to form
63
-
64
- ### 1.20.37 (2026-02-01)
65
- * (BenAhrdt) show Values (at bridge device) and Downlinks (at lorawan device) in Device Details flexible
66
-
67
- ### 1.20.36 (2026-01-31)
68
- * (BenAhrdt) add more details to lorawan and bridged devices
69
- * (BenAhrdt) change some logging
70
-
71
- ### 1.20.35 (2026-01-31)
72
- * (BenAhrdt) display actual device values for foreign devices
73
-
74
- ### 1.20.34 (2026-01-30)
75
- * (BenAhrdt) starup bridge device with battery value
76
-
77
- ### 1.20.33 (2026-01-30)
78
- * (BenAhrdt) first step of role detectiopn in bridged devices
79
-
80
- ### 1.20.32 (2026-01-30)
81
- * (BenAhrdt) change icon for default
82
-
83
- ### 1.20.31 (2026-01-30)
84
- * (BenAhrdt) Add colors to DeviceInfo and Details to Bridge Devices
85
-
86
- ### 1.20.30 (2026-01-30)
87
- * (BenAhrdt) Devices sorted alphabetically for Device Manager
88
-
89
- ### 1.20.29 (2026-01-30)
90
- * (BenAhrdt) bugfix entity type
91
-
92
- ### 1.20.28 (2026-01-30)
93
- * (BenAhrdt) showing experimental foreign devices
94
-
95
- ### 1.20.27 (2026-01-29)
96
- * (BenAhrdt) bugfix rolehandling
97
-
98
- ### 1.20.26 (2026-01-29)
99
- * (BenAhrdt) bring objectstore and deviceManager functions in new structure for future devices
100
-
101
- ### 1.20.25 (2026-01-28)
102
- * (BenAhrdt) improve number of role detection
103
-
104
- ### 1.20.24 (2026-01-28)
105
- * (BenAhrdt) change info Form to Detail button
106
-
107
- ### 1.20.23 (2026-01-28)
108
- * (BenAhrdt) change role display and icons
109
-
110
- ### 1.20.22 (2026-01-27)
111
- * (BenAhrdt) change preasure quere to pressure
112
-
113
- ### 1.20.21 (2026-01-27)
114
- * (BenAhrdt) set Details to informations and add icons for weateher station / humidity
115
-
116
- ### 1.20.20 (2026-01-27)
117
- * (BenAhrdt) icon assign changed
118
-
119
- ### 1.20.19 (2026-01-27)
120
- * (BenAhrdt) bugfix incon set
121
-
122
- ### 1.20.18 (2026-01-27)
123
- * (BenAhrdt) bugfix nameing incomingTopic
124
-
125
- ### 1.20.17 (2026-01-27)
126
- * (BenAhrdt) implement Device details
127
-
128
- ### 1.20.16 (2026-01-27)
129
- * (BenAhrdt) add informations to device Manager
130
-
131
- ### 1.20.15 (2026-01-26)
132
- * (BenAhrdt) sort output for informations
133
-
134
- ### 1.20.14 (2026-01-26)
135
- * (BenAhrdt) insert node
136
-
137
- ### 1.20.13 (2026-01-26)
138
- * (BenAhrdt) remove nod from crypto
139
-
140
- ### 1.20.12 (2026-01-26)
141
- * (BenAhrdt) check for update
142
-
143
- ### 1.20.11 (2026-01-26)
144
- * (BenAhrdt) improve device Manager icons and Buttons
145
-
146
- ### 1.20.10 (2026-01-26)
147
- * (BenAhrdt) return to root getCnageInfo
148
-
149
- ### 1.20.9 (2026-01-26)
150
- * (BenAhrdt) experimental for form
151
-
152
- ### 1.20.8 (2026-01-26)
153
- * (BenAhrdt) changes in objectStore
154
-
155
- ### 1.20.7 (2026-01-25)
156
- * (BenAhrdt) bugfix correct writing of indicators
157
-
158
- ### 1.20.6 (2026-01-25)
159
- * (BenAhrdt) updateing assignhandler und modifying indicators and informations
160
-
161
- ### 1.20.5 (2026-01-25)
162
- * (BenAhrdt) bugfixing updating object Store with not alowed id
163
-
164
- ### 1.20.4 (2026-01-25)
165
- * (BenAhrdt) experimental to debug in live system
166
-
167
- ### 1.20.3 (2026-01-25)
168
- * (BenAhrdt) bugfix device Manager
169
-
170
- ### 1.20.2 (2026-01-25)
171
- * (BenAhrdt) bugfix device Manager and objectStore device checks
172
-
173
- ### 1.20.1 (2026-01-25)
174
- * (BenAhrdt) bugfix device Manager
175
-
176
- ### 1.20.0 (2026-01-25)
177
- * (BenAhrdt) add first Steps of device Manager
178
-
179
61
  ### Older entries
180
62
  [here](OLD_CHANGELOG.md)
181
63
 
package/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "lorawan",
4
- "version": "1.20.49",
4
+ "version": "1.20.50",
5
5
  "news": {
6
+ "1.20.50": {
7
+ "en": "implements light to ToIoB function",
8
+ "de": "implementiert Licht zur ToIoB-Funktion",
9
+ "ru": "функция Light to ToIoB",
10
+ "pt": "implementa luz para a função ToIoB",
11
+ "nl": "implementeert licht naar ToIoB functie",
12
+ "fr": "implémente la lumière à la fonction ToIoB",
13
+ "it": "implementa la luce alla funzione ToIoB",
14
+ "es": "implementa luz a la función ToIoB",
15
+ "pl": "implementuje światło do funkcji ToIoB",
16
+ "uk": "реалізує світло для функції ToIoB",
17
+ "zh-cn": "执行光线到 ToIOB 函数"
18
+ },
6
19
  "1.20.49": {
7
20
  "en": "improve handling of remove Function fpr Bridge",
8
21
  "de": "verbesserung der Handhabung von Entfernen Function fpr Bridge",
@@ -80,19 +93,6 @@
80
93
  "pl": "dodać możliwość zobaczyć urządzenia wiche są sendet Tolob",
81
94
  "uk": "додати можливість побачити пристрої Wiche відправник ToIob",
82
95
  "zh-cn": "添加可看到设备 wiche 是 sendet ToIob"
83
- },
84
- "1.20.43": {
85
- "en": "add value.power.active and value.power.reactive ...",
86
- "de": "add value.power.active und value.power.reactive ...",
87
- "ru": "добавить value.power.active и value.power.reactive.",
88
- "pt": "adicionar valor.power.active e valor.power.reative ...",
89
- "nl": "toegevoegde waarde.power.active en waarde.power.reactive ...",
90
- "fr": "ajouter value.power.active et value.power.réactive ...",
91
- "it": "aggiungere valore.power.active e value.power.reactive ...",
92
- "es": "añadir valor.power.active y valor.power.reactive ...",
93
- "pl": "dodaj value.power.active i value.power.reaktywne...",
94
- "uk": "add value.power.active and value.power.reactive ...",
95
- "zh-cn": "增加值 能量 活性 能量 反应..."
96
96
  }
97
97
  },
98
98
  "titleLang": {
@@ -47,7 +47,7 @@ class bridgeDeviceHandlerClass {
47
47
  const activeFunction = 'bridgeDeviceHandler.js - generateDeviceStructure';
48
48
  this.adapter.log.silly(`Function ${activeFunction} started.`);
49
49
  try {
50
- const version = '1.0.2';
50
+ const version = '1.1.0';
51
51
  if (!message.version || message.version !== version) {
52
52
  this.adapter.log.warn(`You need to use version ${version} of the Home Assistant automation.`);
53
53
  return;
@@ -137,25 +137,28 @@ class bridgeDeviceHandlerClass {
137
137
  unique_id = unique_id.substring(channel.length + 1, unique_id.length);
138
138
  }
139
139
  unique_id.replace('.', '_');
140
- await this.adapter.extendObject(entityInfo.state.id, {
141
- type: 'state',
142
- common: {
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,
149
- },
150
- native: { entity: entity, entityInfo: entityInfo },
151
- });
152
- let state = entity.state;
153
- if (entityInfo.state.type === 'boolean') {
154
- state = entity.state === 'on';
155
- } else if (entityInfo.state.type === 'number') {
156
- state = Number(entity.state);
140
+ for (const state of entityInfo.state) {
141
+ await this.adapter.extendObject(state.id, {
142
+ type: 'state',
143
+ common: {
144
+ name: state.name,
145
+ type: state.type,
146
+ role: state.role,
147
+ read: state.read,
148
+ write: state.write,
149
+ unit: state.unit,
150
+ states: state.states ? state.states : undefined,
151
+ },
152
+ native: { entity: entity, entityInfo: entityInfo, state: state },
153
+ });
154
+ let stateValue = state.val;
155
+ if (state.type === 'boolean') {
156
+ stateValue = state.val === 'on';
157
+ } else if (state.type === 'number') {
158
+ stateValue = Number(state.val);
159
+ }
160
+ await this.adapter.setState(state.id, stateValue, true);
157
161
  }
158
- await this.adapter.setState(entityInfo.state.id, state, true);
159
162
  }
160
163
  }
161
164
  // Periodic discovery
@@ -170,7 +173,11 @@ class bridgeDeviceHandlerClass {
170
173
  for (const entityId of Object.keys(entities)) {
171
174
  if (!Object.keys(message.entities).includes(entityId)) {
172
175
  const entityInfo = this.generateStructure(entities[entityId]);
173
- await this.adapter.delObjectAsync(entityInfo?.state.id);
176
+ if (entityInfo?.state) {
177
+ for (const state of entityInfo.state) {
178
+ await this.adapter.delObjectAsync(state.id);
179
+ }
180
+ }
174
181
  if (!checkDevices[entityInfo?.device.id]) {
175
182
  checkDevices[entityInfo?.device.id] = {};
176
183
  }
@@ -278,17 +285,86 @@ class bridgeDeviceHandlerClass {
278
285
  if (clearStatename.startsWith(`${device.name} `)) {
279
286
  clearStatename = clearStatename.substring(device.name.length + 1, clearStatename.length);
280
287
  }
281
- const state = {
282
- id: `${channel.id}.${stateId}`,
283
- name: clearStatename || stateId,
284
- type: type,
285
- role: this.detectRole(entity, type),
286
- unit: entity.unit_of_measurement || undefined,
287
- read: entity.domain !== 'button',
288
- write: this.isWritable(entity.domain),
289
- };
290
- if (assign) {
291
- state.assign = assign;
288
+ let state = [];
289
+ if (entity.domain === 'light') {
290
+ state.push({
291
+ id: `${channel.id}.on`,
292
+ name: clearStatename || stateId,
293
+ type: 'boolean',
294
+ role: this.detectRole(entity, type),
295
+ unit: entity.unit_of_measurement || undefined,
296
+ read: entity.domain !== 'button',
297
+ write: this.isWritable(entity.domain),
298
+ val: entity.state,
299
+ });
300
+ if (entity.attributes.brightness !== undefined) {
301
+ state.push({
302
+ id: `${channel.id}.brightness`,
303
+ name: clearStatename || stateId,
304
+ type: 'number',
305
+ role: this.detectRole(entity, type),
306
+ read: true,
307
+ write: true,
308
+ val: entity.attributes.brightness,
309
+ isAttribute: true,
310
+ });
311
+ }
312
+ if (entity.attributes.rgb_color !== undefined) {
313
+ const colorObject = {
314
+ r: 0,
315
+ g: 0,
316
+ b: 0,
317
+ };
318
+ if (entity.attributes.rgb_color) {
319
+ colorObject.r = entity.attributes.rgb_color[0];
320
+ colorObject.g = entity.attributes.rgb_color[1];
321
+ colorObject.b = entity.attributes.rgb_color[2];
322
+ }
323
+ state.push({
324
+ id: `${channel.id}.color`,
325
+ name: clearStatename || stateId,
326
+ type: 'string',
327
+ role: this.detectRole(entity, type),
328
+ read: true,
329
+ write: true,
330
+ val: this.adapter.bridge?.rgbToHex(colorObject),
331
+ isAttribute: true,
332
+ });
333
+ }
334
+ if (entity.attributes.effect !== undefined) {
335
+ let effectnumber = null;
336
+ const states = entity.capabilities.effects.states;
337
+ const currentEffect = entity.attributes.effect;
338
+ for (const [key, value] of Object.entries(states)) {
339
+ if (value === currentEffect) {
340
+ effectnumber = Number(key);
341
+ break;
342
+ }
343
+ }
344
+ state.push({
345
+ id: `${channel.id}.effect`,
346
+ name: clearStatename || stateId,
347
+ type: 'number',
348
+ role: this.detectRole(entity, type),
349
+ read: true,
350
+ write: true,
351
+ states: entity.capabilities.effects.states ? entity.capabilities.effects.states : undefined,
352
+ val: effectnumber,
353
+ isAttribute: true,
354
+ });
355
+ }
356
+ } else {
357
+ state.push({
358
+ id: `${channel.id}.${stateId}`,
359
+ name: clearStatename || stateId,
360
+ type: type,
361
+ role: this.detectRole(entity, type),
362
+ unit: entity.unit_of_measurement || undefined,
363
+ read: entity.domain !== 'button',
364
+ write: this.isWritable(entity.domain),
365
+ assign: assign ? assign : undefined,
366
+ val: entity.state,
367
+ });
292
368
  }
293
369
 
294
370
  const meta = {
@@ -460,10 +536,33 @@ class bridgeDeviceHandlerClass {
460
536
  try {
461
537
  const idObject = await this.adapter.getObjectAsync(id);
462
538
  const sendInfo = {};
463
- if (idObject.native.entityInfo.state.assign) {
464
- sendInfo[idObject.native.entity.entity_id] = idObject.native.entityInfo.state.assign[state.val];
539
+ if (idObject.native.state.isAttribute) {
540
+ sendInfo.entity_id = idObject.native.entity.entity_id;
541
+ if (idObject.native.entity.domain === 'light') {
542
+ // Brightness
543
+ if (id.endsWith('brightness')) {
544
+ sendInfo.attribute = 'brightness';
545
+ sendInfo.value = state.val;
546
+
547
+ // color
548
+ } else if (id.endsWith('color')) {
549
+ sendInfo.attribute = 'rgb_color';
550
+ const colorObject = this.adapter.bridge?.hexToRgb(state.val);
551
+ sendInfo.value = [colorObject.r, colorObject.g, colorObject.b];
552
+
553
+ // effect
554
+ } else if (id.endsWith('effect')) {
555
+ sendInfo.attribute = 'effect';
556
+ const effects = idObject.native.entity.capabilities.effects.states;
557
+ sendInfo.value = effects[state.val];
558
+ }
559
+ }
465
560
  } else {
466
- sendInfo[idObject.native.entity.entity_id] = state.val;
561
+ if (idObject.native.entityInfo.state.assign) {
562
+ sendInfo[idObject.native.entity.entity_id] = idObject.native.entityInfo.state.assign[state.val];
563
+ } else {
564
+ sendInfo[idObject.native.entity.entity_id] = state.val;
565
+ }
467
566
  }
468
567
  await this.adapter.bridge.publishId(`${this.adapter.namespace}.bridge.dataFromIob`, sendInfo, {});
469
568
  await this.adapter.setState(`${this.adapter.namespace}.bridge.dataFromIob`, JSON.stringify(sendInfo), true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.lorawan",
3
- "version": "1.20.49",
3
+ "version": "1.20.50",
4
4
  "description": "converts the desired lora gateway data to a ioBroker structure",
5
5
  "author": {
6
6
  "name": "BenAhrdt",