iobroker.device-watcher 2.15.12 → 2.15.13
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 +15 -2
- package/main.js +40 -2
- 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.13 (2026-05-13)
|
|
195
|
+
* (arteck) fix new devices
|
|
196
|
+
|
|
194
197
|
### 2.15.12 (2026-05-06)
|
|
195
198
|
* (arteck) fix hueExtended battery check
|
|
196
199
|
|
|
@@ -204,9 +207,6 @@ This adapter would not have been possible without the great work of Christian Be
|
|
|
204
207
|
### 2.15.9 (2026-04-22)
|
|
205
208
|
* (arteck) new xsense (v. 0.4.0) structure, plz update before
|
|
206
209
|
|
|
207
|
-
### 2.15.8 (2026-04-18)
|
|
208
|
-
* (arteck) fix cronParserLib.parseExpression message
|
|
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.13",
|
|
5
5
|
"news": {
|
|
6
|
+
"2.15.13": {
|
|
7
|
+
"en": "fix new devices",
|
|
8
|
+
"de": "neue geräte installieren",
|
|
9
|
+
"ru": "ремонт новых устройств",
|
|
10
|
+
"pt": "corrigir novos dispositivos",
|
|
11
|
+
"nl": "nieuwe apparaten herstellen",
|
|
12
|
+
"fr": "correction de nouveaux dispositifs",
|
|
13
|
+
"it": "fissare nuovi dispositivi",
|
|
14
|
+
"es": "nuevos dispositivos",
|
|
15
|
+
"pl": "naprawić nowe urządzenia",
|
|
16
|
+
"uk": "фіксувати нові пристрої",
|
|
17
|
+
"zh-cn": "修复新设备"
|
|
18
|
+
},
|
|
6
19
|
"2.15.12": {
|
|
7
20
|
"en": "fix hueExtended battery check",
|
|
8
21
|
"de": "hueExtended Akku Check",
|
|
@@ -28,7 +41,7 @@
|
|
|
28
41
|
"pl": "fix",
|
|
29
42
|
"uk": "fix",
|
|
30
43
|
"zh-cn": "fix"
|
|
31
|
-
},
|
|
44
|
+
},
|
|
32
45
|
"2.15.5": {
|
|
33
46
|
"en": "fix admin",
|
|
34
47
|
"de": "admin",
|
package/main.js
CHANGED
|
@@ -86,6 +86,9 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
86
86
|
// Check if main function is running
|
|
87
87
|
this.mainRunning = false;
|
|
88
88
|
|
|
89
|
+
// Pending rescan flag (set if a new device was detected while main() was running)
|
|
90
|
+
this.pendingRescan = false;
|
|
91
|
+
|
|
89
92
|
this.on('ready', this.onReady.bind(this));
|
|
90
93
|
this.on('stateChange', this.onStateChange.bind(this));
|
|
91
94
|
this.on('objectChange', this.onObjectChange.bind(this));
|
|
@@ -280,6 +283,13 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
280
283
|
}
|
|
281
284
|
this.mainRunning = false;
|
|
282
285
|
this.log.debug(`Function finished: ${this.main.name}`);
|
|
286
|
+
|
|
287
|
+
// If a new device was detected while main() was running, trigger a rescan now
|
|
288
|
+
if (this.pendingRescan) {
|
|
289
|
+
this.pendingRescan = false;
|
|
290
|
+
this.log.info(`[main] Pending rescan detected – restarting main() for new device`);
|
|
291
|
+
await this.main();
|
|
292
|
+
}
|
|
283
293
|
} //<--End of main function
|
|
284
294
|
|
|
285
295
|
// If you need to react to object changes, uncomment the following block and the corresponding line in the constructor.
|
|
@@ -302,10 +312,23 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
302
312
|
if (!this.mainRunning) {
|
|
303
313
|
await this.main();
|
|
304
314
|
} else {
|
|
305
|
-
|
|
315
|
+
this.pendingRescan = true;
|
|
306
316
|
}
|
|
307
317
|
} else {
|
|
308
|
-
|
|
318
|
+
// Check if the changed object belongs to a monitored adapter (new device)
|
|
319
|
+
const belongsToMonitoredAdapter = this.adapterSelected.some((adapterKey) =>
|
|
320
|
+
id.toLowerCase().startsWith(`${adapterKey.toLowerCase() }.`)
|
|
321
|
+
);
|
|
322
|
+
|
|
323
|
+
if (belongsToMonitoredAdapter) {
|
|
324
|
+
if (!this.mainRunning) {
|
|
325
|
+
this.log.info(`[onObjectChange] New device detected: ${id} – triggering rescan`);
|
|
326
|
+
await this.main();
|
|
327
|
+
} else {
|
|
328
|
+
this.log.debug(`[onObjectChange] main() is running – rescan for ${id} queued`);
|
|
329
|
+
this.pendingRescan = true;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
309
332
|
}
|
|
310
333
|
}
|
|
311
334
|
} catch (error) {
|
|
@@ -366,6 +389,21 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
366
389
|
=============================================*/
|
|
367
390
|
if (Array.from(this.listAllDevicesRaw.values()).some((obj) => Object.values(obj).includes(id))) {
|
|
368
391
|
await this.renewDeviceData(id, state);
|
|
392
|
+
|
|
393
|
+
// Update lists and datapoints immediately after device data change
|
|
394
|
+
await crud.createLists(this);
|
|
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
|
+
}
|
|
369
407
|
}
|
|
370
408
|
} catch (error) {
|
|
371
409
|
this.log.error(`Issue at state change: ${id}`);
|