iobroker.device-watcher 2.15.0 → 2.15.1

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
@@ -191,6 +191,10 @@ 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.1 (2026-01-10)
195
+ * (arteck) fix instance check
196
+ * (arteck) fix admin json
197
+
194
198
  ### 2.15.0 (2026-01-07)
195
199
  * (arteck) fixed device array
196
200
  * (arteck) deleted zwave2mqtt Adapter
@@ -216,10 +220,6 @@ This adapter would not have been possible without the great work of Christian Be
216
220
  * (arteck) add homee battery devices (only)
217
221
  * (arteck) fix battery list
218
222
 
219
- ### 2.14.4 (2025-11-13)
220
- * (arteck) fix silent telegram notification
221
- * (arteck) fix offline list
222
-
223
223
  ## License
224
224
 
225
225
  MIT License
@@ -41,7 +41,7 @@
41
41
  type: 'checkbox',
42
42
  attr: 'enabled',
43
43
  width: '3%',
44
- default: false,
44
+ default: 'false',
45
45
  },
46
46
  {
47
47
  type: 'text',
@@ -51,7 +51,7 @@
51
51
  width: '47%',
52
52
  filter: true,
53
53
  sort: true,
54
- disabled: true,
54
+ disabled: 'true',
55
55
  },
56
56
  {
57
57
  type: 'number',
@@ -69,7 +69,7 @@
69
69
  title: 'Telegram Silent Mode',
70
70
  attr: 'telegramSilent',
71
71
  width: '20%',
72
- default: false,
72
+ default: 'false',
73
73
  disabled: '!data.enabled',
74
74
  },
75
75
  {
@@ -77,7 +77,7 @@
77
77
  title: '',
78
78
  attr: 'adapterKey',
79
79
  width: '1%',
80
- disabled: true,
80
+ disabled: 'true',
81
81
  hidden: true,
82
82
  },
83
83
  ],
package/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "device-watcher",
4
- "version": "2.15.0",
4
+ "version": "2.15.1",
5
5
  "news": {
6
+ "2.15.1": {
7
+ "en": "fix instance check\nfix admin json",
8
+ "de": "fehlerbehebung\nadmin json",
9
+ "ru": "установить проверку\nисполнитель: admin json",
10
+ "pt": "corrigir verificação de instância\ncorrigir o administrador json",
11
+ "nl": "fix instantiecontrole\nfix admin json",
12
+ "fr": "correction de la vérification de l'instance\nréparer admin json",
13
+ "it": "verifica dell'istanza di correzione\ncorrezione admin json",
14
+ "es": "control de instancia de fijación\nadmin json",
15
+ "pl": "fix instance check\nfix admin json",
16
+ "uk": "перевірка екземпляра\nвиправлено admin json",
17
+ "zh-cn": "修补实例检查\n固定管理员json"
18
+ },
6
19
  "2.15.0": {
7
20
  "en": "fixed device array\ndeleted zwave2mqtt Adapter\nadded zwavews Adapter\nDependencies have been updated\nadded zwave2mqtt Adapter\nfixed all count devices\ncorrected finder",
8
21
  "de": "Geräteanordnung bereinigt\nzwave2mqt Adapter gelöscht\nzwavews Adapter hinzugefügt\nAbhängigkeiten wurden aktualisiert\nzwave2mqtt Adapter hinzugefügt\nalle Zählgeräte überarbeitet\nfinder korrigiert",
package/main.js CHANGED
@@ -294,7 +294,9 @@ class DeviceWatcher extends utils.Adapter {
294
294
 
295
295
  if (this.config.checkAdapterInstances && id.startsWith('system.adapter.')) {
296
296
  //read new instance data and add it to the lists
297
- await this.getInstanceData(id);
297
+ if (typeof id === 'string' && /\d$/.test(id)) {
298
+ await this.getInstanceData(id);
299
+ }
298
300
  } else {
299
301
  if (Array.from(this.listAllDevicesRaw.values()).some((obj) => obj.mainSelector === id)) {
300
302
  if (!this.mainRunning) {
@@ -1299,7 +1301,8 @@ class DeviceWatcher extends utils.Adapter {
1299
1301
  */
1300
1302
  async getInstanceData(instanceObject) {
1301
1303
  try {
1302
- const instanceAliveDP = await this.getForeignStatesAsync(`${instanceObject}.alive`);
1304
+ const idDP = `${instanceObject}.alive`;
1305
+ const instanceAliveDP = await this.getForeignStatesAsync(idDP);
1303
1306
 
1304
1307
  this.adapterUpdatesJsonRaw = await this.getAdapterUpdateData(adapterUpdateListDP);
1305
1308
 
@@ -1317,8 +1320,10 @@ class DeviceWatcher extends utils.Adapter {
1317
1320
 
1318
1321
  // get instance connected to device data
1319
1322
  const instanceConnectedDeviceDP = `${instanceID}.info.connection`;
1323
+ const devicesState = await this.getForeignStateAsync(instanceConnectedDeviceDP);
1324
+
1320
1325
  let instanceConnectedDeviceVal;
1321
- if (instanceConnectedDeviceDP !== undefined && typeof instanceConnectedDeviceDP === 'boolean') {
1326
+ if (instanceConnectedDeviceDP !== undefined && devicesState !== null && typeof devicesState.val === 'boolean') {
1322
1327
  instanceConnectedDeviceVal = await tools.getInitValue(this, instanceConnectedDeviceDP);
1323
1328
  } else {
1324
1329
  instanceConnectedDeviceVal = 'N/A';
@@ -1331,7 +1336,9 @@ class DeviceWatcher extends utils.Adapter {
1331
1336
  let adapterAvailableUpdate = '';
1332
1337
  let instanceMode;
1333
1338
  let scheduleTime = 'N/A';
1339
+
1334
1340
  const instanceObjectData = await this.getForeignObjectAsync(instanceObjectPath);
1341
+
1335
1342
  if (instanceObjectData) {
1336
1343
  adapterName = tools.capitalize(instanceObjectData.common.name);
1337
1344
  adapterVersion = instanceObjectData.common.version;
@@ -2284,19 +2291,21 @@ class DeviceWatcher extends utils.Adapter {
2284
2291
  }
2285
2292
  }
2286
2293
  async getPreviousCronRun(lastCronRun) {
2287
- try {
2288
- const cronParser = cronParserLib.parseExpression
2289
- ? cronParserLib // klassischer Import
2290
- : cronParserLib.default; // ESM-Fallback
2291
-
2292
- const interval = cronParser.parseExpression(lastCronRun);
2293
- const previous = interval.prev();
2294
- return Math.floor(Date.now() - previous.getTime()); // in ms
2295
- } catch (error) {
2296
- this.log.error(`[getPreviousCronRun] - ${error}`);
2297
- }
2294
+ try {
2295
+ const cronParser = cronParserLib.parseExpression ? cronParserLib : cronParserLib.default;
2296
+
2297
+ const interval = cronParser.parseExpression(lastCronRun);
2298
+ const previous = interval.prev();
2299
+
2300
+ // Differenz in ms seit dem vorherigen Cron-Zeitpunkt
2301
+ return Date.now() - previous.getTime();
2302
+ } catch (error) {
2303
+ this.log.error(`[getPreviousCronRun] - ${error}`);
2304
+ return null;
2305
+ }
2298
2306
  }
2299
2307
 
2308
+
2300
2309
  /**
2301
2310
  * @param {() => void} callback
2302
2311
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.device-watcher",
3
- "version": "2.15.0",
3
+ "version": "2.15.1",
4
4
  "description": "Watchdog for devices",
5
5
  "author": "Christian Behrends <mail@christian-behrends.de>",
6
6
  "contributors": [
@@ -27,7 +27,8 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@iobroker/adapter-core": "^3.3.2",
30
- "node-schedule": "^2.1.1"
30
+ "node-schedule": "^2.1.1",
31
+ "cron-parser": "^4.9.0"
31
32
  },
32
33
  "devDependencies": {
33
34
  "@alcalzone/release-script": "^5.0.0",