iobroker.device-watcher 2.15.13 → 2.15.14
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 -3
- package/io-package.json +14 -1
- package/main.js +41 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -191,6 +191,9 @@ This adapter would not have been possible without the great work of Christian Be
|
|
|
191
191
|
Placeholder for the next version (at the beginning of the line):
|
|
192
192
|
### **WORK IN PROGRESS**
|
|
193
193
|
-->
|
|
194
|
+
### 2.15.14 (2026-05-13)
|
|
195
|
+
* (arteck) fix high i/o
|
|
196
|
+
|
|
194
197
|
### 2.15.13 (2026-05-13)
|
|
195
198
|
* (arteck) fix new devices
|
|
196
199
|
|
|
@@ -204,9 +207,6 @@ This adapter would not have been possible without the great work of Christian Be
|
|
|
204
207
|
- (copilot) Adapter requires node.js >= 22 now
|
|
205
208
|
* (arteck) fix adapter crash after delete a device
|
|
206
209
|
|
|
207
|
-
### 2.15.9 (2026-04-22)
|
|
208
|
-
* (arteck) new xsense (v. 0.4.0) structure, plz update before
|
|
209
|
-
|
|
210
210
|
## License
|
|
211
211
|
|
|
212
212
|
MIT License
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "device-watcher",
|
|
4
|
-
"version": "2.15.
|
|
4
|
+
"version": "2.15.14",
|
|
5
5
|
"news": {
|
|
6
|
+
"2.15.14": {
|
|
7
|
+
"en": "fix high i/o",
|
|
8
|
+
"de": "hoch i/o",
|
|
9
|
+
"ru": "фиксировать высокий i/o",
|
|
10
|
+
"pt": "fixar i/o elevado",
|
|
11
|
+
"nl": "fix high i/o",
|
|
12
|
+
"fr": "fixer haut i/o",
|
|
13
|
+
"it": "correzione alta i/o",
|
|
14
|
+
"es": "fijar alto i/o",
|
|
15
|
+
"pl": "fix high i / o",
|
|
16
|
+
"uk": "фіксувати високий i/o",
|
|
17
|
+
"zh-cn": "固定高 i/o"
|
|
18
|
+
},
|
|
6
19
|
"2.15.13": {
|
|
7
20
|
"en": "fix new devices",
|
|
8
21
|
"de": "neue geräte installieren",
|
package/main.js
CHANGED
|
@@ -83,6 +83,10 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
83
83
|
// Interval timer
|
|
84
84
|
this.refreshDataTimeout = null;
|
|
85
85
|
|
|
86
|
+
// Debounce timer for list/datapoint updates triggered by stateChange
|
|
87
|
+
this.listUpdateDebounceTimer = null;
|
|
88
|
+
this.LIST_UPDATE_DEBOUNCE_MS = 5000; // 5 Sekunden Ruhezeit
|
|
89
|
+
|
|
86
90
|
// Check if main function is running
|
|
87
91
|
this.mainRunning = false;
|
|
88
92
|
|
|
@@ -366,6 +370,36 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
366
370
|
}
|
|
367
371
|
}
|
|
368
372
|
|
|
373
|
+
/**
|
|
374
|
+
* Debounced update of all lists and datapoints.
|
|
375
|
+
* Prevents excessive system load on rapid state changes.
|
|
376
|
+
* Waits LIST_UPDATE_DEBOUNCE_MS ms after the last call before executing.
|
|
377
|
+
*/
|
|
378
|
+
scheduleListUpdate() {
|
|
379
|
+
if (this.listUpdateDebounceTimer) {
|
|
380
|
+
this.clearTimeout(this.listUpdateDebounceTimer);
|
|
381
|
+
}
|
|
382
|
+
this.listUpdateDebounceTimer = this.setTimeout(async () => {
|
|
383
|
+
this.listUpdateDebounceTimer = null;
|
|
384
|
+
try {
|
|
385
|
+
await crud.createLists(this);
|
|
386
|
+
await crud.writeDatapoints(this);
|
|
387
|
+
|
|
388
|
+
if (this.configCreateOwnFolder) {
|
|
389
|
+
for (const [adId] of Object.entries(adapterArray)) {
|
|
390
|
+
const adapter = adapterArray[adId];
|
|
391
|
+
if (this.adapterSelected.includes(adapter.adapterKey)) {
|
|
392
|
+
await crud.createLists(this, adId);
|
|
393
|
+
await crud.writeDatapoints(this, adId);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
} catch (error) {
|
|
398
|
+
this.log.error(`[scheduleListUpdate] - ${error}`);
|
|
399
|
+
}
|
|
400
|
+
}, this.LIST_UPDATE_DEBOUNCE_MS);
|
|
401
|
+
}
|
|
402
|
+
|
|
369
403
|
async onStateChange(id, state) {
|
|
370
404
|
if (state) {
|
|
371
405
|
// this.log.debug(`State changed: ${id} changed ${state.val}`);
|
|
@@ -390,20 +424,8 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
390
424
|
if (Array.from(this.listAllDevicesRaw.values()).some((obj) => Object.values(obj).includes(id))) {
|
|
391
425
|
await this.renewDeviceData(id, state);
|
|
392
426
|
|
|
393
|
-
//
|
|
394
|
-
|
|
395
|
-
await crud.writeDatapoints(this);
|
|
396
|
-
|
|
397
|
-
// Also update per-adapter folder if configured
|
|
398
|
-
if (this.configCreateOwnFolder) {
|
|
399
|
-
for (const [adId] of Object.entries(adapterArray)) {
|
|
400
|
-
const adapter = adapterArray[adId];
|
|
401
|
-
if (this.adapterSelected.includes(adapter.adapterKey)) {
|
|
402
|
-
await crud.createLists(this, adId);
|
|
403
|
-
await crud.writeDatapoints(this, adId);
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
}
|
|
427
|
+
// Debounced update – verhindert Systemlast bei schnellen State-Änderungen
|
|
428
|
+
this.scheduleListUpdate();
|
|
407
429
|
}
|
|
408
430
|
} catch (error) {
|
|
409
431
|
this.log.error(`Issue at state change: ${id}`);
|
|
@@ -2460,6 +2482,11 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
2460
2482
|
this.refreshDataTimeout = null;
|
|
2461
2483
|
}
|
|
2462
2484
|
|
|
2485
|
+
if (this.listUpdateDebounceTimer) {
|
|
2486
|
+
this.clearTimeout(this.listUpdateDebounceTimer);
|
|
2487
|
+
this.listUpdateDebounceTimer = null;
|
|
2488
|
+
}
|
|
2489
|
+
|
|
2463
2490
|
this.log.info('cleaned everything up...');
|
|
2464
2491
|
|
|
2465
2492
|
callback();
|