iobroker.lorawan 1.22.20 → 1.22.22

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,12 @@ 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.22.22 (2026-06-16)
28
+ - (BenAhrdt) Remove writing of the last 10 values at receive and public message
29
+
30
+ ### 1.22.21 (2026-06-16)
31
+ - (BenAhrdt) Changed setTimeout to this.adapter.setTimeout
32
+
27
33
  ### 1.22.20 (2026-06-16)
28
34
  - (BenAhrdt) Write publishIds and subscribedTopics delayed
29
35
 
@@ -33,12 +39,6 @@ For now there is documentation in English here: https://wiki.hafenmeister.de
33
39
  ### 1.22.18 (2026-06-16)
34
40
  - (BenAhrdt) Testversion, ohne info. schreiben
35
41
 
36
- ### 1.22.17 (2026-06-07)
37
- - (BenAhrdt) Fixed writing valid zero values from bridged Home Assistant entities to ioBroker states.
38
-
39
- ### 1.22.16 (2026-06-06)
40
- - (BenAhrdt) Bugfix COver in ToIob
41
-
42
42
  [Older changes can be found there](CHANGELOG_OLD.md)
43
43
 
44
44
  ## License
@@ -790,7 +790,7 @@
790
790
  "label": "EnableRefresh",
791
791
  "tooltip": "EnableRefreshTooltip",
792
792
  "hidden": "data.BridgeType === 'off'",
793
- "default": true,
793
+ "default": false,
794
794
  "xs": 12,
795
795
  "sm": 2,
796
796
  "md": 2,
package/io-package.json CHANGED
@@ -1,8 +1,34 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "lorawan",
4
- "version": "1.22.20",
4
+ "version": "1.22.22",
5
5
  "news": {
6
+ "1.22.22": {
7
+ "en": "Remove writing of the last 10 values at receive and public message",
8
+ "de": "Entfernen Sie das Schreiben der letzten 10 Werte bei Empfang und öffentliche Nachricht",
9
+ "ru": "Удалить написание последних 10 ценностей при получении и публичном сообщении",
10
+ "pt": "Remover a escrita dos últimos 10 valores na mensagem recebida e pública",
11
+ "nl": "Verwijder het schrijven van de laatste 10 waarden op ontvangen en openbaar bericht",
12
+ "fr": "Supprimer l'écriture des 10 dernières valeurs à réception et message public",
13
+ "it": "Rimuovere la scrittura degli ultimi 10 valori a ricezione e messaggio pubblico",
14
+ "es": "Eliminar la escritura de los últimos 10 valores al recibir y el mensaje público",
15
+ "pl": "Usuń zapis ostatnich 10 wartości przy odbieraniu i wiadomości publicznej",
16
+ "uk": "Видалити письмове повідомлення про останні 10",
17
+ "zh-cn": "删除最后 10 个值在接收时的写入和公开消息"
18
+ },
19
+ "1.22.21": {
20
+ "en": "Changed setTimeout to this.adapter.setTimeout",
21
+ "de": "Geändert setTimeout zu this.adapter.setTimeout",
22
+ "ru": "Изменить setTimeout на this.adapter.setTimeout",
23
+ "pt": "SetTimeout alterado para este.adapter.setTimeout",
24
+ "nl": "Veranderde setTimeout naar deze.adapter.setTimeout",
25
+ "fr": "Changed setTimeout to this.adapter.setTimeout",
26
+ "it": "Modificato il timeout a questo.adapter.setTimeout",
27
+ "es": "Cambio de configuraciónTiempo a este.adapter.setTimeout",
28
+ "pl": "Zmieniono timeout do tego. Adapter. setTimeout",
29
+ "uk": "Змінено setTimeout в this.adapter.setTimeout",
30
+ "zh-cn": "更改了设置 Timeout 到此. adapter. set Timeout"
31
+ },
6
32
  "1.22.20": {
7
33
  "en": "Write publishIds and subscribedTopics delayed",
8
34
  "de": "Write publishIds und abonnierteTopics verzögert",
@@ -67,32 +93,6 @@
67
93
  "pl": "Bugfix Cover w Tołobie",
68
94
  "uk": "Бугфікс Ковер в Тойоб",
69
95
  "zh-cn": "在 ToIob 中错误修正 Cover"
70
- },
71
- "1.22.15": {
72
- "en": "Add roles for some new devices",
73
- "de": "Rollen für einige neue Geräte hinzufügen",
74
- "ru": "Добавить роли для некоторых новых устройств",
75
- "pt": "Adicionar funções para alguns dispositivos novos",
76
- "nl": "Rolletjes toevoegen voor sommige nieuwe apparaten",
77
- "fr": "Ajouter des rôles pour certains nouveaux appareils",
78
- "it": "Aggiungi ruoli per alcuni nuovi dispositivi",
79
- "es": "Agregar roles para algunos nuevos dispositivos",
80
- "pl": "Dodaj role dla niektórych nowych urządzeń",
81
- "uk": "Додати ролі для деяких нових пристроїв",
82
- "zh-cn": "为一些新设备添加角色"
83
- },
84
- "1.22.14": {
85
- "en": "ToIob suports hs mode for color (light)\nissues from depandabot",
86
- "de": "ToIob suports hs mode für color (light)\nfragen von depandabot",
87
- "ru": "ToIob suports hs режим для цвета (свет)\nотзывы о depandabot",
88
- "pt": "Modo de suporte do ToIob hs para cores (luz)\nquestões do depandabot",
89
- "nl": "ToIob suports hs-modus voor kleur (licht)\nproblemen van depandabot",
90
- "fr": "Mode TOIobs hs pour la couleur (lumière)\ndepandabot",
91
- "it": "ToIob suports hs modalità per colore (luce)\nproblemi da depandabot",
92
- "es": "ToIob suports hs modo para el color (light)\ncuestiones de depandabot",
93
- "pl": "Tolob suports tryb hs dla koloru (światła)\nkwestie związane z depandabot",
94
- "uk": "ToIob suports hs режим для кольору (світло)\nпитання від depandabot",
95
- "zh-cn": "颜色的 ToIob suports hs 模式( 浅色)\n发件人的问题"
96
96
  }
97
97
  },
98
98
  "titleLang": {
@@ -425,7 +425,7 @@
425
425
  "Bridgepassword": "",
426
426
  "Bridgessl": false,
427
427
  "BridgeType": "off",
428
- "EnableRefresh": true,
428
+ "EnableRefresh": false,
429
429
  "RefreshDiscoveryCronJob": "0 * * * *",
430
430
  "BridgeEnum": "*",
431
431
  "BridgenotificationActivation": "allNotifications, bridgeConnection, newDiscover, deviceState",
@@ -191,6 +191,7 @@ class bridgeClass extends EventEmiter {
191
191
  // Timerwerte für verzögertes Schreiben
192
192
  this.publishedIdsWriteTimer = undefined;
193
193
  this.subscribedTopicsWriteTimer = undefined;
194
+ this.discoveredIdsWriteTimer = undefined;
194
195
  }
195
196
 
196
197
  /*********************************************************************
@@ -208,29 +209,6 @@ class bridgeClass extends EventEmiter {
208
209
  if (this.SubscribedTopics[topic]) {
209
210
  // First emit the Handle
210
211
  this.emit('handleMessage', { device: this.SubscribedTopics[topic].discovery[0].payload.device });
211
- // safe old values (10 last values)
212
- if (this.SubscribedTopics[topic].values) {
213
- if (!this.SubscribedTopics[topic].oldValues) {
214
- this.SubscribedTopics[topic].oldValues = [];
215
- }
216
- if (this.SubscribedTopics[topic].oldValues.length >= this.MaxValueCount) {
217
- this.SubscribedTopics[topic].oldValues.pop();
218
- }
219
- this.SubscribedTopics[topic].oldValues.unshift(
220
- structuredClone(this.SubscribedTopics[topic].values),
221
- );
222
- }
223
- if (!this.SubscribedTopics[topic].values) {
224
- this.SubscribedTopics[topic].values = {};
225
- }
226
- this.SubscribedTopics[topic].values.val = message;
227
- this.SubscribedTopics[topic].values.ts = Date.now();
228
- this.SubscribedTopics[topic].values.time = new Date(Date.now()).toLocaleString(
229
- this.Timeoutput.Argument,
230
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
231
- // @ts-expect-error
232
- this.Timeoutput.Format,
233
- );
234
212
  if (this.SubscribedTopics[topic].id.endsWith(this.EndingVirtualMode)) {
235
213
  this.adapter.log.debug(
236
214
  `The value ${message} is assigned to virtual id: ${this.SubscribedTopics[topic].id}`,
@@ -238,7 +216,6 @@ class bridgeClass extends EventEmiter {
238
216
  this.VitualIds[this.SubscribedTopics[topic].id] = message;
239
217
  // Return the virtual mode
240
218
  await this.publishId(this.SubscribedTopics[topic].id, message, {});
241
- this.scheduleSubscribedTopicsWrite();
242
219
  return;
243
220
  }
244
221
 
@@ -282,7 +259,6 @@ class bridgeClass extends EventEmiter {
282
259
  c: 'from bridge',
283
260
  });
284
261
  }
285
- this.scheduleSubscribedTopicsWrite();
286
262
  return;
287
263
  }
288
264
 
@@ -371,7 +347,6 @@ class bridgeClass extends EventEmiter {
371
347
  });
372
348
  }
373
349
  }
374
- this.scheduleSubscribedTopicsWrite();
375
350
  } else {
376
351
  this.adapter.log.debug(`The received Topic ${topic} is not subscribed`);
377
352
  }
@@ -388,7 +363,7 @@ class bridgeClass extends EventEmiter {
388
363
  return;
389
364
  }
390
365
 
391
- this.subscribedTopicsWriteTimer = setTimeout(async () => {
366
+ this.subscribedTopicsWriteTimer = this.adapter.setTimeout(async () => {
392
367
  this.subscribedTopicsWriteTimer = undefined;
393
368
 
394
369
  await this.adapter.setState(
@@ -1083,27 +1058,6 @@ class bridgeClass extends EventEmiter {
1083
1058
  }
1084
1059
  }
1085
1060
 
1086
- // safe old values (5 last values)
1087
- if (publish.values) {
1088
- if (!publish.oldValues) {
1089
- publish.oldValues = [];
1090
- }
1091
- if (publish.oldValues.length >= this.MaxValueCount) {
1092
- publish.oldValues.pop();
1093
- }
1094
- publish.oldValues.unshift(structuredClone(publish.values));
1095
- }
1096
- if (!publish.values) {
1097
- publish.values = {};
1098
- }
1099
- publish.values.val = value;
1100
- publish.values.ts = Date.now();
1101
- publish.values.time = new Date(Date.now()).toLocaleString(
1102
- this.Timeoutput.Argument,
1103
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1104
- // @ts-expect-error
1105
- this.Timeoutput.Format,
1106
- );
1107
1061
  if (typeof value !== 'string') {
1108
1062
  value = JSON.stringify(value);
1109
1063
  }
@@ -1113,77 +1067,7 @@ class bridgeClass extends EventEmiter {
1113
1067
  options.retain = true;
1114
1068
  }
1115
1069
  await this.bridgeMqttClient.publish(topic, value, options);
1116
- this.schedulePublishedIdsWrite();
1117
1070
  }
1118
-
1119
- /* alt 26.11.2025
1120
- if (this.PublishedIds[id].light) {
1121
- val = {};
1122
- val.state = (await this.adapter.getForeignStateAsync(this.PublishedIds[id].LightIds.onOff)).val;
1123
- val.state = val.state === true ? 'ON' : 'OFF';
1124
- if (this.PublishedIds[id].LightIds.brightness) {
1125
- val.brightness = (
1126
- await this.adapter.getForeignStateAsync(this.PublishedIds[id].LightIds.brightness)
1127
- ).val;
1128
- }
1129
- if (this.PublishedIds[id].LightIds.color) {
1130
- val.color_mode = 'rgb';
1131
- val.color = this.hexToRgb(
1132
- (await this.adapter.getForeignStateAsync(this.PublishedIds[id].LightIds.color)).val,
1133
- );
1134
- }
1135
- if (this.PublishedIds[id].LightIds.effects) {
1136
- const effect = (await this.adapter.getForeignStateAsync(this.PublishedIds[id].LightIds.effects))
1137
- .val;
1138
- val.effect = '';
1139
- if (this.PublishedIds[id].effects[effect]) {
1140
- val.effect = this.PublishedIds[id].effects[effect];
1141
- }
1142
- }
1143
- }
1144
-
1145
- if (this.PublishedIds[id].cover) {
1146
- if (this.PublishedIds[id].message) {
1147
- if (this.PublishedIds[id].message[val]) {
1148
- val = this.PublishedIds[id].message[val];
1149
- } else {
1150
- val = '';
1151
- }
1152
- }
1153
- }
1154
-
1155
- // safe old values (5 last values)
1156
- if (this.PublishedIds[id].values) {
1157
- if (!this.PublishedIds[id].oldValues) {
1158
- this.PublishedIds[id].oldValues = [];
1159
- }
1160
- if (this.PublishedIds[id].oldValues.length >= this.MaxValueCount) {
1161
- this.PublishedIds[id].oldValues.pop();
1162
- }
1163
- this.PublishedIds[id].oldValues.unshift(structuredClone(this.PublishedIds[id].values));
1164
- }
1165
- if (!this.PublishedIds[id].values) {
1166
- this.PublishedIds[id].values = {};
1167
- }
1168
- this.PublishedIds[id].values.val = val;
1169
- this.PublishedIds[id].values.ts = Date.now();
1170
- this.PublishedIds[id].values.time = new Date(Date.now()).toLocaleString(
1171
- this.Timeoutput.Argument,
1172
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1173
- // @ts-expect-error
1174
- this.Timeoutput.Format,
1175
- );
1176
- if (typeof val !== 'string') {
1177
- val = JSON.stringify(val);
1178
- }
1179
- if (!options) {
1180
- options = { retain: true };
1181
- } else if (options.retain === undefined) {
1182
- options.retain = true;
1183
- }
1184
- await this.bridgeMqttClient.publish(this.PublishedIds[id].state_topic, val, options);
1185
- await this.adapter.setState('info.publishedIds', JSON.stringify(this.PublishedIds), true);
1186
- */
1187
1071
  } else {
1188
1072
  // Check for logging
1189
1073
  this.adapter.log[this.adapter.logtypes.bridgePublish]?.(`Id ${id} is not set for publish.`);
@@ -1379,6 +1263,25 @@ class bridgeClass extends EventEmiter {
1379
1263
  }
1380
1264
  }
1381
1265
 
1266
+ /**
1267
+ * schedule the Discovered Ids
1268
+ */
1269
+ scheduleDiscoveredIdsWrite() {
1270
+ if (this.discoveredIdsWriteTimer) {
1271
+ return;
1272
+ }
1273
+
1274
+ this.discoveredIdsWriteTimer = setTimeout(async () => {
1275
+ this.discoveredIdsWriteTimer = undefined;
1276
+
1277
+ try {
1278
+ await this.adapter.setState('info.discoveredIds', JSON.stringify(this.DiscoveredIds), true);
1279
+ } catch (error) {
1280
+ this.adapter.log.error(`scheduleDiscoveredIdsWrite: ${error}`);
1281
+ }
1282
+ }, 1000);
1283
+ }
1284
+
1382
1285
  /**
1383
1286
  * schedule the Published Ids
1384
1287
  */
@@ -1387,7 +1290,7 @@ class bridgeClass extends EventEmiter {
1387
1290
  return;
1388
1291
  }
1389
1292
 
1390
- this.publishedIdsWriteTimer = setTimeout(async () => {
1293
+ this.publishedIdsWriteTimer = this.adapter.setTimeout(async () => {
1391
1294
  this.publishedIdsWriteTimer = undefined;
1392
1295
 
1393
1296
  try {
@@ -1420,15 +1323,6 @@ class bridgeClass extends EventEmiter {
1420
1323
  payload: structuredClone(payload),
1421
1324
  });
1422
1325
  }
1423
- /* alt 26.11.2025
1424
- assignObject[indexId].state_topic = state_topic;
1425
- assignObject[indexId].informations = structuredClone(informations);
1426
- if (options) {
1427
- for (const option in options) {
1428
- assignObject[indexId][option] = options[option];
1429
- }
1430
- }
1431
- */
1432
1326
  if (!assignObject[indexId].publish[state_topic]) {
1433
1327
  assignObject[indexId].publish[state_topic] = {};
1434
1328
  assignObject[indexId].publish[state_topic].informations = structuredClone(informations);
@@ -1644,7 +1538,9 @@ class bridgeClass extends EventEmiter {
1644
1538
  retain: true,
1645
1539
  });
1646
1540
 
1647
- await this.adapter.setState('info.discoveredIds', JSON.stringify(this.DiscoveredIds), true);
1541
+ this.scheduleDiscoveredIdsWrite();
1542
+ this.schedulePublishedIdsWrite();
1543
+ this.scheduleSubscribedTopicsWrite();
1648
1544
  if (this.adapter.config.BridgeDevicesToGenerate.includes(DiscoveryObject.from)) {
1649
1545
  this.emit('publishDiscovery', { id, DiscoveryObject });
1650
1546
  }
@@ -2082,79 +1978,6 @@ class bridgeClass extends EventEmiter {
2082
1978
  }
2083
1979
  }
2084
1980
 
2085
- /*
2086
- async checkAllStatesForBridgeWork(options) {
2087
- const activeFunction = 'bridge.js - checkAllStatesForBridgeWork';
2088
- this.adapter.log.silly(`Function ${activeFunction} started.`);
2089
-
2090
- try {
2091
- // get old Discovered ids
2092
- this.OldDiscoveredIds = JSON.parse((await this.adapter.getStateAsync('info.discoveredIds')).val);
2093
- this.oldDiscoveredDevices = this.generateOldDevices(this.OldDiscoveredIds);
2094
-
2095
- // Clear object of all subscribed Ids and published Topics
2096
- this.SubscribedTopics = {};
2097
- this.PublishedIds = {};
2098
- this.Notifications = {};
2099
-
2100
- await this.discoverGeneralNotification();
2101
- await this.discoverDataExchange();
2102
-
2103
- const adapterObjects = await this.adapter.getAdapterObjectsAsync();
2104
-
2105
- const CHUNK_SIZE = (await this.adapter.getStateAsync('bridge.debug.chunk'))?.val || 32;
2106
- let chunk = [];
2107
- for (const adapterObject of Object.values(adapterObjects)) {
2108
- if (adapterObject.type !== 'state') {
2109
- continue;
2110
- }
2111
- if (
2112
- !adapterObject._id.includes(
2113
- `${this.adapter.messagehandler.directoryhandler.reachableSubfolders.uplinkDecoded}.`,
2114
- ) &&
2115
- !adapterObject._id.includes(
2116
- `${this.adapter.messagehandler.directoryhandler.reachableSubfolders.downlinkControl}.`,
2117
- )
2118
- ) {
2119
- continue;
2120
- }
2121
-
2122
- const localOptions = {
2123
- ...(options || {}),
2124
- common: adapterObject.common,
2125
- };
2126
-
2127
- chunk.push(this.work(adapterObject._id, undefined, localOptions));
2128
-
2129
- // if chunk full => do
2130
- if (chunk.length >= CHUNK_SIZE) {
2131
- await Promise.all(chunk);
2132
- chunk = [];
2133
- }
2134
- }
2135
-
2136
- // Do until chunk is 0
2137
- if (chunk.length > 0) {
2138
- await Promise.all(chunk);
2139
- }
2140
-
2141
- // Promise all functions
2142
- await Promise.all([
2143
- this.discoverClimate(),
2144
- this.getForeignStatesForStandardEntities(),
2145
- this.getForeignClimateConfig(),
2146
- this.getForeignHumidifierConfig(),
2147
- this.getForeignLightConfig(),
2148
- this.getForeignCoverConfig(),
2149
- this.getForeignLockConfig(),
2150
- ]);
2151
- await this.checkDiscoveries();
2152
- } catch (error) {
2153
- this.adapter.log.error(`error at ${activeFunction}: ${error}`);
2154
- }
2155
- }
2156
- */
2157
-
2158
1981
  /**
2159
1982
  * @param oldDiscoveredIds Ids wiche are discovered last time that Adapter runs
2160
1983
  */
@@ -2273,7 +2096,7 @@ class bridgeClass extends EventEmiter {
2273
2096
  await this.publishDiscovery(id, this.DiscoveredIds[id]);
2274
2097
  delete this.DiscoveredIds[id];
2275
2098
  delete this.OldDiscoveredIds[id];
2276
- await this.adapter.setState('info.discoveredIds', JSON.stringify(this.DiscoveredIds), true);
2099
+ this.scheduleDiscoveredIdsWrite();
2277
2100
  }
2278
2101
  } else {
2279
2102
  if (this.DiscoveredIds[id].topic !== this.OldDiscoveredIds[id].topic) {
@@ -4228,7 +4051,7 @@ class bridgeClass extends EventEmiter {
4228
4051
  //await this.adapter.unsubscribeForeignObjectsAsync(state.id);
4229
4052
  await this.publishDiscovery(state.id, this.DiscoveredIds[state.id]);
4230
4053
  delete this.DiscoveredIds[state.id];
4231
- await this.adapter.setState('info.discoveredIds', JSON.stringify(this.DiscoveredIds), true);
4054
+ this.scheduleDiscoveredIdsWrite();
4232
4055
  }
4233
4056
  }
4234
4057
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.lorawan",
3
- "version": "1.22.20",
3
+ "version": "1.22.22",
4
4
  "description": "converts the desired lora gateway data to a ioBroker structure",
5
5
  "author": {
6
6
  "name": "BenAhrdt",