iobroker.device-watcher 0.2.1 → 0.2.2

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/main.js CHANGED
@@ -126,7 +126,7 @@ class DeviceWatcher extends utils.Adapter {
126
126
  },
127
127
  hueExt: {
128
128
  'Selektor':'hue-extended.*.reachable',
129
- 'adapter':'hue extended',
129
+ 'adapter':'hue-extended',
130
130
  'battery':'.config.battery',
131
131
  'reach':'.reachable',
132
132
  'isLowBat':'none'
@@ -169,8 +169,8 @@ class DeviceWatcher extends utils.Adapter {
169
169
  },
170
170
  nukiExt: {
171
171
  'Selektor':'nuki-extended.*.batteryCritical',
172
- 'adapter':'nuki_extended',
173
- 'battery':'none',
172
+ 'adapter':'nuki-extended',
173
+ 'battery':'.batteryCharge',
174
174
  'reach':'none',
175
175
  'isLowBat':'.batteryCritical'
176
176
  }
@@ -257,111 +257,210 @@ class DeviceWatcher extends utils.Adapter {
257
257
 
258
258
  //create datapoints for each adapter
259
259
  async createDPsForEachAdapter(adptName) {
260
+
261
+ await this.setObjectNotExistsAsync(`${adptName}`, {
262
+ type: 'channel',
263
+ common: {
264
+ name: adptName,
265
+ },
266
+ native: {},
267
+ });
268
+
260
269
  await this.setObjectNotExistsAsync(`${adptName}.offlineCount`, {
261
270
  'type': 'state',
262
271
  'common': {
263
- 'name': 'Quantity devices offline',
272
+ 'name': {
273
+ 'en': 'Number of devices offline',
274
+ 'de': 'Anzahl der Geräte offline',
275
+ 'ru': 'Количество устройств offline',
276
+ 'pt': 'Número de dispositivos offline',
277
+ 'nl': 'Nummer van apparatuur offline',
278
+ 'fr': 'Nombre de dispositifs hors ligne',
279
+ 'it': 'Numero di dispositivi offline',
280
+ 'es': 'Número de dispositivos sin conexión',
281
+ 'pl': 'Ilość urządzeń offline',
282
+ 'zh-cn': '线内装置数量'
283
+ },
264
284
  'type': 'number',
265
285
  'role': 'value',
266
286
  'read': true,
267
287
  'write': false,
268
- 'def': 0
269
288
  },
270
289
  'native': {}
271
290
  });
272
291
  await this.setObjectNotExistsAsync(`${adptName}.offlineList`, {
273
292
  'type': 'state',
274
293
  'common': {
275
- 'name': 'List devices offline',
294
+ 'name': {
295
+ 'en': 'List of offline devices',
296
+ 'de': 'Liste der Offline-Geräte',
297
+ 'ru': 'Список оффлайн устройств',
298
+ 'pt': 'Lista de dispositivos off-line',
299
+ 'nl': 'List van offline apparatuur',
300
+ 'fr': 'Liste des dispositifs hors ligne',
301
+ 'it': 'Elenco dei dispositivi offline',
302
+ 'es': 'Lista de dispositivos sin conexión',
303
+ 'pl': 'Lista urządzeń offline',
304
+ 'zh-cn': '线装置清单'
305
+ },
276
306
  'type': 'array',
277
307
  'role': 'json',
278
308
  'read': true,
279
309
  'write': false,
280
- 'def': JSON.stringify([{Device: '--keine--', Adapter: '', Last_contact: ''}])
281
310
  },
282
311
  'native': {}
283
312
  });
284
313
  await this.setObjectNotExistsAsync(`${adptName}.listAll`, {
285
314
  'type': 'state',
286
315
  'common': {
287
- 'name': 'List all devices',
316
+ 'name': {
317
+ 'en': 'List of all devices',
318
+ 'de': 'Liste aller Geräte',
319
+ 'ru': 'Список всех устройств',
320
+ 'pt': 'Lista de todos os dispositivos',
321
+ 'nl': 'List van alle apparaten',
322
+ 'fr': 'Liste de tous les dispositifs',
323
+ 'it': 'Elenco di tutti i dispositivi',
324
+ 'es': 'Lista de todos los dispositivos',
325
+ 'pl': 'Lista wszystkich urządzeń',
326
+ 'zh-cn': '所有装置清单'
327
+ },
288
328
  'type': 'array',
289
329
  'role': 'json',
290
330
  'read': true,
291
331
  'write': false,
292
- 'def': JSON.stringify([{Device: '--keine--', Adapter: '', Battery: '', Last_contact: '', Link_quality: ''}])
293
332
  },
294
333
  'native': {}
295
334
  });
296
335
  await this.setObjectNotExistsAsync(`${adptName}.linkQualityList`, {
297
336
  'type': 'state',
298
337
  'common': {
299
- 'name': 'List devices with qualitiy strength',
338
+ 'name': {
339
+ 'en': 'List of devices with signal strength',
340
+ 'de': 'Liste der Geräte mit Signalstärke',
341
+ 'ru': 'Список устройств с силой сигнала',
342
+ 'pt': 'Lista de dispositivos com força de sinal',
343
+ 'nl': 'List van apparaten met signaalkracht',
344
+ 'fr': 'Liste des dispositifs avec force de signal',
345
+ 'it': 'Elenco dei dispositivi con forza del segnale',
346
+ 'es': 'Lista de dispositivos con fuerza de señal',
347
+ 'pl': 'Lista urządzeń z siłą sygnałową',
348
+ 'zh-cn': '具有信号实力的装置清单'
349
+ },
300
350
  'type': 'array',
301
351
  'role': 'json',
302
352
  'read': true,
303
353
  'write': false,
304
- 'def': JSON.stringify([{Device: '--keine--', Adapter: '', Link_quality: ''}])
305
354
  },
306
355
  'native': {}
307
356
  });
308
357
  await this.setObjectNotExistsAsync(`${adptName}.countAll`, {
309
358
  'type': 'state',
310
359
  'common': {
311
- 'name': 'Quantity devices all',
360
+ 'name': {
361
+ 'en': 'Number of all devices',
362
+ 'de': 'Anzahl aller Geräte',
363
+ 'ru': 'Количество всех устройств',
364
+ 'pt': 'Número de todos os dispositivos',
365
+ 'nl': 'Nummer van alle apparaten',
366
+ 'fr': 'Nombre de tous les appareils',
367
+ 'it': 'Numero di tutti i dispositivi',
368
+ 'es': 'Número de todos los dispositivos',
369
+ 'pl': 'Ilość wszystkich urządzeń',
370
+ 'zh-cn': '所有装置的数目'
371
+ },
312
372
  'type': 'number',
313
373
  'role': 'value',
314
374
  'read': true,
315
375
  'write': false,
316
- 'def': 0
317
376
  },
318
377
  'native': {}
319
378
  });
320
379
  await this.setObjectNotExistsAsync(`${adptName}.batteryList`, {
321
380
  'type': 'state',
322
381
  'common': {
323
- 'name': 'List devices with battery state',
382
+ 'name': {
383
+ 'en': 'List of devices with battery state',
384
+ 'de': 'Liste der Geräte mit Batteriezustand',
385
+ 'ru': 'Список устройств с состоянием батареи',
386
+ 'pt': 'Lista de dispositivos com estado da bateria',
387
+ 'nl': 'List van apparaten met batterij staat',
388
+ 'fr': 'Liste des appareils avec état de batterie',
389
+ 'it': 'Elenco dei dispositivi con stato della batteria',
390
+ 'es': 'Lista de dispositivos con estado de batería',
391
+ 'pl': 'Lista urządzeń z baterią stanową',
392
+ 'zh-cn': '电池国装置清单'
393
+ },
324
394
  'type': 'array',
325
395
  'role': 'json',
326
396
  'read': true,
327
397
  'write': false,
328
- 'def': JSON.stringify([{Device: '--keine--', Adapter: '', Battery: ''}])
329
398
  },
330
399
  'native': {}
331
400
  });
332
401
  await this.setObjectNotExistsAsync(`${adptName}.lowBatteryList`, {
333
402
  'type': 'state',
334
403
  'common': {
335
- 'name': 'List devices with low battery state',
404
+ 'name': {
405
+ 'en': 'List of devices with low battery state',
406
+ 'de': 'Liste der Geräte mit niedrigem Batteriezustand',
407
+ 'ru': 'Список устройств с низким состоянием батареи',
408
+ 'pt': 'Lista de dispositivos com baixo estado da bateria',
409
+ 'nl': 'List van apparaten met lage batterij staat',
410
+ 'fr': 'Liste des appareils à faible état de batterie',
411
+ 'it': 'Elenco di dispositivi con stato di batteria basso',
412
+ 'es': 'Lista de dispositivos con estado de batería bajo',
413
+ 'pl': 'Lista urządzeń o niskim stanie baterii',
414
+ 'zh-cn': '低电池国家装置清单'
415
+ },
336
416
  'type': 'array',
337
417
  'role': 'json',
338
418
  'read': true,
339
419
  'write': false,
340
- 'def': JSON.stringify([{Device: '--keine--', Adapter: '', Battery: ''}])
341
420
  },
342
421
  'native': {}
343
422
  });
344
423
  await this.setObjectNotExistsAsync(`${adptName}.lowBatteryCount`, {
345
424
  'type': 'state',
346
425
  'common': {
347
- 'name': 'Quantity devices with low battery',
426
+ 'name': {
427
+ 'en': 'Number of devices with low battery',
428
+ 'de': 'Anzahl der Geräte mit niedriger Batterie',
429
+ 'ru': 'Количество устройств c низкой батареей',
430
+ 'pt': 'Número de dispositivos com bateria baixa',
431
+ 'nl': 'Nummer van apparaten met lage batterij',
432
+ 'fr': 'Nombre de dispositifs avec batterie basse',
433
+ 'it': 'Numero di dispositivi con batteria bassa',
434
+ 'es': 'Número de dispositivos con batería baja',
435
+ 'pl': 'Liczba urządzeń z niską baterią',
436
+ 'zh-cn': '低电池的装置数量'
437
+ },
348
438
  'type': 'number',
349
439
  'role': 'value',
350
440
  'read': true,
351
441
  'write': false,
352
- 'def': 0
353
442
  },
354
443
  'native': {}
355
444
  });
356
445
  await this.setObjectNotExistsAsync(`${adptName}.batteryCount`, {
357
446
  'type': 'state',
358
447
  'common': {
359
- 'name': 'Quantity devices with battery',
448
+ 'name': {
449
+ 'en': 'Number of devices with battery',
450
+ 'de': 'Anzahl der Geräte mit Batterie',
451
+ 'ru': 'Количество устройств c батареей',
452
+ 'pt': 'Número de dispositivos com bateria',
453
+ 'nl': 'Nummer van apparaten met batterij',
454
+ 'fr': 'Nombre de dispositifs avec batterie',
455
+ 'it': 'Numero di dispositivi con batteria',
456
+ 'es': 'Número de dispositivos con batería',
457
+ 'pl': 'Liczba urządzeń z baterią',
458
+ 'zh-cn': '电池的装置数量'
459
+ },
360
460
  'type': 'number',
361
461
  'role': 'value',
362
462
  'read': true,
363
463
  'write': false,
364
- 'def': 0
365
464
  },
366
465
  'native': {}
367
466
  });
@@ -390,22 +489,23 @@ class DeviceWatcher extends utils.Adapter {
390
489
  const shortDeviceObject = await this.getForeignObjectAsync(shortCurrDeviceString);
391
490
  let deviceName;
392
491
 
393
- if (deviceObject && typeof deviceObject === 'object') {
394
- deviceName = deviceObject.common.name;
395
- }
396
-
397
- if (shortDeviceObject && typeof shortDeviceObject === 'object') {
398
- if (this.arrDev[i].adapter === 'hue extended') {
399
- deviceName = shortDeviceObject.common.name;
400
- }
401
- }
402
-
403
- //Get ID for Switchbot and ESPHome Devices
404
492
  switch (this.arrDev[i].adapter) {
405
- case 'switchbotBle':
493
+ case 'switchbotBle': //Get ID for Switchbot and ESPHome Devices
406
494
  case 'esphome':
407
495
  deviceName = await this.getInitValue(currDeviceString + this.arrDev[i].id);
408
496
  break;
497
+
498
+ case 'hue-extended':
499
+ if (shortDeviceObject && typeof shortDeviceObject === 'object') {
500
+ deviceName = shortDeviceObject.common.name;
501
+ }
502
+ break;
503
+
504
+ default:
505
+ if (deviceObject && typeof deviceObject === 'object') {
506
+ deviceName = deviceObject.common.name;
507
+ }
508
+ break;
409
509
  }
410
510
 
411
511
  // 1. Get link quality
@@ -433,9 +533,9 @@ class DeviceWatcher extends utils.Adapter {
433
533
  }
434
534
  this.linkQualityDevices.push(
435
535
  {
436
- Device: deviceName,
437
- Adapter: deviceAdapterName,
438
- Link_quality: linkQuality
536
+ 'Device': deviceName,
537
+ 'Adapter': deviceAdapterName,
538
+ 'Signal strength': linkQuality
439
539
  }
440
540
  );
441
541
  } else {
@@ -506,9 +606,9 @@ class DeviceWatcher extends utils.Adapter {
506
606
  deviceState = 'Offline'; //set online state to offline
507
607
  this.offlineDevices.push(
508
608
  {
509
- Device: deviceName,
510
- Adapter: deviceAdapterName,
511
- Last_contact: lastContactString
609
+ 'Device': deviceName,
610
+ 'Adapter': deviceAdapterName,
611
+ 'Last contact': lastContactString
512
612
  }
513
613
  );
514
614
  }
@@ -516,9 +616,9 @@ class DeviceWatcher extends utils.Adapter {
516
616
  deviceState = 'Offline'; //set online state to offline
517
617
  this.offlineDevices.push(
518
618
  {
519
- Device: deviceName,
520
- Adapter: deviceAdapterName,
521
- Last_contact: lastContactString
619
+ 'Device': deviceName,
620
+ 'Adapter': deviceAdapterName,
621
+ 'Last contact': lastContactString
522
622
  }
523
623
  );
524
624
  }
@@ -529,9 +629,9 @@ class DeviceWatcher extends utils.Adapter {
529
629
  deviceState = 'Offline'; //set online state to offline
530
630
  this.offlineDevices.push(
531
631
  {
532
- Device: deviceName,
533
- Adapter: deviceAdapterName,
534
- Last_contact: lastContactString
632
+ 'Device': deviceName,
633
+ 'Adapter': deviceAdapterName,
634
+ 'Last contact': lastContactString
535
635
  }
536
636
  );
537
637
  }
@@ -539,9 +639,9 @@ class DeviceWatcher extends utils.Adapter {
539
639
  deviceState = 'Offline'; //set online state to offline
540
640
  this.offlineDevices.push(
541
641
  {
542
- Device: deviceName,
543
- Adapter: deviceAdapterName,
544
- Last_contact: lastContactString
642
+ 'Device': deviceName,
643
+ 'Adapter': deviceAdapterName,
644
+ 'Last contact': lastContactString
545
645
  }
546
646
  );
547
647
  }
@@ -552,9 +652,9 @@ class DeviceWatcher extends utils.Adapter {
552
652
  deviceState = 'Offline'; //set online state to offline
553
653
  this.offlineDevices.push(
554
654
  {
555
- Device: deviceName,
556
- Adapter: deviceAdapterName,
557
- Last_contact: lastContactString
655
+ 'Device': deviceName,
656
+ 'Adapter': deviceAdapterName,
657
+ 'Last contact': lastContactString
558
658
  }
559
659
  );
560
660
  }
@@ -562,9 +662,9 @@ class DeviceWatcher extends utils.Adapter {
562
662
  deviceState = 'Offline'; //set online state to offline
563
663
  this.offlineDevices.push(
564
664
  {
565
- Device: deviceName,
566
- Adapter: deviceAdapterName,
567
- Last_contact: lastContactString
665
+ 'Device': deviceName,
666
+ 'Adapter': deviceAdapterName,
667
+ 'Last contact': lastContactString
568
668
  }
569
669
  );
570
670
  }
@@ -575,9 +675,9 @@ class DeviceWatcher extends utils.Adapter {
575
675
  deviceState = 'Offline'; //set online state to offline
576
676
  this.offlineDevices.push(
577
677
  {
578
- Device: deviceName,
579
- Adapter: deviceAdapterName,
580
- Last_contact: lastContactString
678
+ 'Device': deviceName,
679
+ 'Adapter': deviceAdapterName,
680
+ 'Last contact': lastContactString
581
681
  }
582
682
  );
583
683
  }
@@ -585,9 +685,9 @@ class DeviceWatcher extends utils.Adapter {
585
685
  deviceState = 'Offline'; //set online state to offline
586
686
  this.offlineDevices.push(
587
687
  {
588
- Device: deviceName,
589
- Adapter: deviceAdapterName,
590
- Last_contact: lastContactString
688
+ 'Device': deviceName,
689
+ 'Adapter': deviceAdapterName,
690
+ 'Last contact': lastContactString
591
691
  }
592
692
  );
593
693
  }
@@ -598,9 +698,9 @@ class DeviceWatcher extends utils.Adapter {
598
698
  deviceState = 'Offline'; //set online state to offline
599
699
  this.offlineDevices.push(
600
700
  {
601
- Device: deviceName,
602
- Adapter: deviceAdapterName,
603
- Last_contact: lastContactString
701
+ 'Device': deviceName,
702
+ 'Adapter': deviceAdapterName,
703
+ 'Last contact': lastContactString
604
704
  }
605
705
  );
606
706
  }
@@ -608,9 +708,9 @@ class DeviceWatcher extends utils.Adapter {
608
708
  deviceState = 'Offline'; //set online state to offline
609
709
  this.offlineDevices.push(
610
710
  {
611
- Device: deviceName,
612
- Adapter: deviceAdapterName,
613
- Last_contact: lastContactString
711
+ 'Device': deviceName,
712
+ 'Adapter': deviceAdapterName,
713
+ 'Last contact': lastContactString
614
714
  }
615
715
  );
616
716
  }
@@ -621,9 +721,9 @@ class DeviceWatcher extends utils.Adapter {
621
721
  deviceState = 'Offline'; //set online state to offline
622
722
  this.offlineDevices.push(
623
723
  {
624
- Device: deviceName,
625
- Adapter: deviceAdapterName,
626
- Last_contact: lastContactString
724
+ 'Device': deviceName,
725
+ 'Adapter': deviceAdapterName,
726
+ 'Last contact': lastContactString
627
727
  }
628
728
  );
629
729
  }
@@ -631,9 +731,9 @@ class DeviceWatcher extends utils.Adapter {
631
731
  deviceState = 'Offline'; //set online state to offline
632
732
  this.offlineDevices.push(
633
733
  {
634
- Device: deviceName,
635
- Adapter: deviceAdapterName,
636
- Last_contact: lastContactString
734
+ 'Device': deviceName,
735
+ 'Adapter': deviceAdapterName,
736
+ 'Last contact': lastContactString
637
737
  }
638
738
  );
639
739
  }
@@ -644,9 +744,9 @@ class DeviceWatcher extends utils.Adapter {
644
744
  deviceState = 'Offline'; //set online state to offline
645
745
  this.offlineDevices.push(
646
746
  {
647
- Device: deviceName,
648
- Adapter: deviceAdapterName,
649
- Last_contact: lastContactString
747
+ 'Device': deviceName,
748
+ 'Adapter': deviceAdapterName,
749
+ 'Last contact': lastContactString
650
750
  }
651
751
  );
652
752
  }
@@ -654,22 +754,22 @@ class DeviceWatcher extends utils.Adapter {
654
754
  deviceState = 'Offline'; //set online state to offline
655
755
  this.offlineDevices.push(
656
756
  {
657
- Device: deviceName,
658
- Adapter: deviceAdapterName,
659
- Last_contact: lastContactString
757
+ 'Device': deviceName,
758
+ 'Adapter': deviceAdapterName,
759
+ 'Last contact': lastContactString
660
760
  }
661
761
  );
662
762
  }
663
763
  break;
664
- case 'hue extended':
764
+ case 'hue-extended':
665
765
  if (this.config.hueextMaxMinutes === -1) {
666
766
  if (!deviceUnreachState) {
667
767
  deviceState = 'Offline'; //set online state to offline
668
768
  this.offlineDevices.push(
669
769
  {
670
- Device: deviceName,
671
- Adapter: deviceAdapterName,
672
- Last_contact: lastContactString
770
+ 'Device': deviceName,
771
+ 'Adapter': deviceAdapterName,
772
+ 'Last contact': lastContactString
673
773
  }
674
774
  );
675
775
  }
@@ -677,9 +777,9 @@ class DeviceWatcher extends utils.Adapter {
677
777
  deviceState = 'Offline'; //set online state to offline
678
778
  this.offlineDevices.push(
679
779
  {
680
- Device: deviceName,
681
- Adapter: deviceAdapterName,
682
- Last_contact: lastContactString
780
+ 'Device': deviceName,
781
+ 'Adapter': deviceAdapterName,
782
+ 'Last contact': lastContactString
683
783
  }
684
784
  );
685
785
  }
@@ -690,9 +790,9 @@ class DeviceWatcher extends utils.Adapter {
690
790
  deviceState = 'Offline'; //set online state to offline
691
791
  this.offlineDevices.push(
692
792
  {
693
- Device: deviceName,
694
- Adapter: deviceAdapterName,
695
- Last_contact: lastContactString
793
+ 'Device': deviceName,
794
+ 'Adapter': deviceAdapterName,
795
+ 'Last contact': lastContactString
696
796
  }
697
797
  );
698
798
  }
@@ -700,22 +800,22 @@ class DeviceWatcher extends utils.Adapter {
700
800
  deviceState = 'Offline'; //set online state to offline
701
801
  this.offlineDevices.push(
702
802
  {
703
- Device: deviceName,
704
- Adapter: deviceAdapterName,
705
- Last_contact: lastContactString
803
+ 'Device': deviceName,
804
+ 'Adapter': deviceAdapterName,
805
+ 'Last contact': lastContactString
706
806
  }
707
807
  );
708
808
  }
709
809
  break;
710
- case 'nuki_extended':
810
+ case 'nuki-extended':
711
811
  if (this.config.nukiextendMaxMinutes === -1) {
712
812
  if (!deviceUnreachState) {
713
813
  deviceState = 'Offline'; //set online state to offline
714
814
  this.offlineDevices.push(
715
815
  {
716
- Device: deviceName,
717
- Adapter: deviceAdapterName,
718
- Last_contact: lastContactString
816
+ 'Device': deviceName,
817
+ 'Adapter': deviceAdapterName,
818
+ 'Last contact': lastContactString
719
819
  }
720
820
  );
721
821
  }
@@ -723,9 +823,9 @@ class DeviceWatcher extends utils.Adapter {
723
823
  deviceState = 'Offline'; //set online state to offline
724
824
  this.offlineDevices.push(
725
825
  {
726
- Device: deviceName,
727
- Adapter: deviceAdapterName,
728
- Last_contact: lastContactString
826
+ 'Device': deviceName,
827
+ 'Adapter': deviceAdapterName,
828
+ 'Last contact': lastContactString
729
829
  }
730
830
  );
731
831
  }
@@ -736,9 +836,9 @@ class DeviceWatcher extends utils.Adapter {
736
836
  deviceState = 'Offline'; //set online state to offline
737
837
  this.offlineDevices.push(
738
838
  {
739
- Device: deviceName,
740
- Adapter: deviceAdapterName,
741
- Last_contact: lastContactString
839
+ 'Device': deviceName,
840
+ 'Adapter': deviceAdapterName,
841
+ 'Last contact': lastContactString
742
842
  }
743
843
  );
744
844
  }
@@ -746,9 +846,9 @@ class DeviceWatcher extends utils.Adapter {
746
846
  deviceState = 'Offline'; //set online state to offline
747
847
  this.offlineDevices.push(
748
848
  {
749
- Device: deviceName,
750
- Adapter: deviceAdapterName,
751
- Last_contact: lastContactString
849
+ 'Device': deviceName,
850
+ 'Adapter': deviceAdapterName,
851
+ 'Last contact': lastContactString
752
852
  }
753
853
  );
754
854
  }
@@ -759,9 +859,9 @@ class DeviceWatcher extends utils.Adapter {
759
859
  deviceState = 'Offline'; //set online state to offline
760
860
  this.offlineDevices.push(
761
861
  {
762
- Device: deviceName,
763
- Adapter: deviceAdapterName,
764
- Last_contact: lastContactString
862
+ 'Device': deviceName,
863
+ 'Adapter': deviceAdapterName,
864
+ 'Last contact': lastContactString
765
865
  }
766
866
  );
767
867
  }
@@ -769,9 +869,9 @@ class DeviceWatcher extends utils.Adapter {
769
869
  deviceState = 'Offline'; //set online state to offline
770
870
  this.offlineDevices.push(
771
871
  {
772
- Device: deviceName,
773
- Adapter: deviceAdapterName,
774
- Last_contact: lastContactString
872
+ 'Device': deviceName,
873
+ 'Adapter': deviceAdapterName,
874
+ 'Last contact': lastContactString
775
875
  }
776
876
  );
777
877
  }
@@ -782,9 +882,9 @@ class DeviceWatcher extends utils.Adapter {
782
882
  deviceState = 'Offline'; //set online state to offline
783
883
  this.offlineDevices.push(
784
884
  {
785
- Device: deviceName,
786
- Adapter: deviceAdapterName,
787
- Last_contact: lastContactString
885
+ 'Device': deviceName,
886
+ 'Adapter': deviceAdapterName,
887
+ 'Last contact': lastContactString
788
888
  }
789
889
  );
790
890
  }
@@ -792,9 +892,9 @@ class DeviceWatcher extends utils.Adapter {
792
892
  deviceState = 'Offline'; //set online state to offline
793
893
  this.offlineDevices.push(
794
894
  {
795
- Device: deviceName,
796
- Adapter: deviceAdapterName,
797
- Last_contact: lastContactString
895
+ 'Device': deviceName,
896
+ 'Adapter': deviceAdapterName,
897
+ 'Last contact': lastContactString
798
898
  }
799
899
  );
800
900
  }
@@ -805,9 +905,9 @@ class DeviceWatcher extends utils.Adapter {
805
905
  deviceState = 'Offline'; //set online state to offline
806
906
  this.offlineDevices.push(
807
907
  {
808
- Device: deviceName,
809
- Adapter: deviceAdapterName,
810
- Last_contact: lastContactString
908
+ 'Device': deviceName,
909
+ 'Adapter': deviceAdapterName,
910
+ 'Last contact': lastContactString
811
911
  }
812
912
  );
813
913
  }
@@ -815,9 +915,9 @@ class DeviceWatcher extends utils.Adapter {
815
915
  deviceState = 'Offline'; //set online state to offline
816
916
  this.offlineDevices.push(
817
917
  {
818
- Device: deviceName,
819
- Adapter: deviceAdapterName,
820
- Last_contact: lastContactString
918
+ 'Device': deviceName,
919
+ 'Adapter': deviceAdapterName,
920
+ 'Last contact': lastContactString
821
921
  }
822
922
  );
823
923
  }
@@ -828,9 +928,9 @@ class DeviceWatcher extends utils.Adapter {
828
928
  deviceState = 'Offline'; //set online state to offline
829
929
  this.offlineDevices.push(
830
930
  {
831
- Device: deviceName,
832
- Adapter: deviceAdapterName,
833
- Last_contact: lastContactString
931
+ 'Device': deviceName,
932
+ 'Adapter': deviceAdapterName,
933
+ 'Last contact': lastContactString
834
934
  }
835
935
  );
836
936
  }
@@ -838,9 +938,9 @@ class DeviceWatcher extends utils.Adapter {
838
938
  deviceState = 'Offline'; //set online state to offline
839
939
  this.offlineDevices.push(
840
940
  {
841
- Device: deviceName,
842
- Adapter: deviceAdapterName,
843
- Last_contact: lastContactString
941
+ 'Device': deviceName,
942
+ 'Adapter': deviceAdapterName,
943
+ 'Last contact': lastContactString
844
944
  }
845
945
  );
846
946
  }
@@ -851,9 +951,9 @@ class DeviceWatcher extends utils.Adapter {
851
951
  deviceState = 'Offline'; //set online state to offline
852
952
  this.offlineDevices.push(
853
953
  {
854
- Device: deviceName,
855
- Adapter: deviceAdapterName,
856
- Last_contact: lastContactString
954
+ 'Device': deviceName,
955
+ 'Adapter': deviceAdapterName,
956
+ 'Last contact': lastContactString
857
957
  }
858
958
  );
859
959
  }
@@ -861,9 +961,9 @@ class DeviceWatcher extends utils.Adapter {
861
961
  deviceState = 'Offline'; //set online state to offline
862
962
  this.offlineDevices.push(
863
963
  {
864
- Device: deviceName,
865
- Adapter: deviceAdapterName,
866
- Last_contact: lastContactString
964
+ 'Device': deviceName,
965
+ 'Adapter': deviceAdapterName,
966
+ 'Last contact': lastContactString
867
967
  }
868
968
  );
869
969
  }
@@ -874,9 +974,9 @@ class DeviceWatcher extends utils.Adapter {
874
974
  deviceState = 'Offline'; //set online state to offline
875
975
  this.offlineDevices.push(
876
976
  {
877
- Device: deviceName,
878
- Adapter: deviceAdapterName,
879
- Last_contact: lastContactString
977
+ 'Device': deviceName,
978
+ 'Adapter': deviceAdapterName,
979
+ 'Last contact': lastContactString
880
980
  }
881
981
  );
882
982
  }
@@ -884,9 +984,9 @@ class DeviceWatcher extends utils.Adapter {
884
984
  deviceState = 'Offline'; //set online state to offline
885
985
  this.offlineDevices.push(
886
986
  {
887
- Device: deviceName,
888
- Adapter: deviceAdapterName,
889
- Last_contact: lastContactString
987
+ 'Device': deviceName,
988
+ 'Adapter': deviceAdapterName,
989
+ 'Last contact': lastContactString
890
990
  }
891
991
  );
892
992
  }
@@ -921,20 +1021,20 @@ class DeviceWatcher extends utils.Adapter {
921
1021
 
922
1022
  this.batteryPowered.push(
923
1023
  {
924
- Device: deviceName,
925
- Adapter: deviceAdapterName,
926
- Battery: batteryHealth
1024
+ 'Device': deviceName,
1025
+ 'Adapter': deviceAdapterName,
1026
+ 'Battery': batteryHealth
927
1027
  }
928
1028
  );
929
1029
  break;
930
- case 'hue extended':
1030
+ case 'hue-extended':
931
1031
  if (shortDeviceBatteryState) {
932
1032
  batteryHealth = shortDeviceBatteryState + '%';
933
1033
  this.batteryPowered.push(
934
1034
  {
935
- Device: deviceName,
936
- Adapter: deviceAdapterName,
937
- Battery: batteryHealth
1035
+ 'Device': deviceName,
1036
+ 'Adapter': deviceAdapterName,
1037
+ 'Battery': batteryHealth
938
1038
  }
939
1039
  );
940
1040
  }
@@ -943,9 +1043,9 @@ class DeviceWatcher extends utils.Adapter {
943
1043
  batteryHealth = (deviceBatteryState) + '%';
944
1044
  this.batteryPowered.push(
945
1045
  {
946
- Device: deviceName,
947
- Adapter: deviceAdapterName,
948
- Battery: batteryHealth
1046
+ 'Device': deviceName,
1047
+ 'Adapter': deviceAdapterName,
1048
+ 'Battery': batteryHealth
949
1049
  }
950
1050
  );
951
1051
  }
@@ -964,9 +1064,9 @@ class DeviceWatcher extends utils.Adapter {
964
1064
  if (deviceBatteryState && (deviceBatteryState < batteryWarningMin)) {
965
1065
  this.batteryLowPowered.push(
966
1066
  {
967
- Device: deviceName,
968
- Adapter: deviceAdapterName,
969
- Battery: batteryHealth
1067
+ 'Device': deviceName,
1068
+ 'Adapter': deviceAdapterName,
1069
+ 'Battery': batteryHealth
970
1070
  }
971
1071
  );
972
1072
  }
@@ -974,9 +1074,9 @@ class DeviceWatcher extends utils.Adapter {
974
1074
  if (deviceLowBatState || deviceLowBatStateHM) {
975
1075
  this.batteryLowPowered.push(
976
1076
  {
977
- Device: deviceName,
978
- Adapter: deviceAdapterName,
979
- Battery: batteryHealth
1077
+ 'Device': deviceName,
1078
+ 'Adapter': deviceAdapterName,
1079
+ 'Battery': batteryHealth
980
1080
  }
981
1081
  );
982
1082
  }
@@ -990,24 +1090,24 @@ class DeviceWatcher extends utils.Adapter {
990
1090
  if (deviceBatteryState !== null || shortDeviceBatteryState !== null) {
991
1091
  this.listAllDevices.push(
992
1092
  {
993
- Device: deviceName,
994
- Adapter: deviceAdapterName,
995
- Battery: batteryHealth,
996
- Link_quality: linkQuality,
997
- Last_contact: lastContactString,
998
- Status: deviceState
1093
+ 'Device': deviceName,
1094
+ 'Adapter': deviceAdapterName,
1095
+ 'Battery': batteryHealth,
1096
+ 'Signal strength': linkQuality,
1097
+ 'Last contact': lastContactString,
1098
+ 'Status': deviceState
999
1099
  }
1000
1100
  );
1001
1101
  }
1002
1102
  } else if (!this.config.listOnlyBattery) {
1003
1103
  this.listAllDevices.push(
1004
1104
  {
1005
- Device: deviceName,
1006
- Adapter: deviceAdapterName,
1007
- Battery: batteryHealth,
1008
- Link_quality: linkQuality,
1009
- Last_contact: lastContactString,
1010
- Status: deviceState
1105
+ 'Device': deviceName,
1106
+ 'Adapter': deviceAdapterName,
1107
+ 'Battery': batteryHealth,
1108
+ 'Signal strength': linkQuality,
1109
+ 'Last contact': lastContactString,
1110
+ 'Status': deviceState
1011
1111
  }
1012
1112
  );
1013
1113
  }
@@ -1154,7 +1254,7 @@ class DeviceWatcher extends utils.Adapter {
1154
1254
  }
1155
1255
 
1156
1256
  for (const id of this.offlineDevices) {
1157
- msg = `${msg} \n ${id['Device']} (${id['Last_contact']})`;
1257
+ msg = `${msg} \n ${id['Device']} (${id['Last contact']})`;
1158
1258
  }
1159
1259
  this.log.info(msg);
1160
1260
  await this.setStateAsync('lastNotification', msg, true);
@@ -1253,7 +1353,6 @@ class DeviceWatcher extends utils.Adapter {
1253
1353
  }
1254
1354
 
1255
1355
  try {
1256
-
1257
1356
  //Check if the message for low battery was already sent today
1258
1357
  const lastBatteryNotifyIndicator = await this.getOwnInitValue('info.lastBatteryNotification');
1259
1358
 
@@ -1262,12 +1361,12 @@ class DeviceWatcher extends utils.Adapter {
1262
1361
  let infotext = '';
1263
1362
 
1264
1363
  for (const id of this.batteryLowPowered) {
1265
- infotext = infotext + '\n' + id['Device'] + ' (' + id['Battery'] + ')'.split(', ');
1364
+ infotext = '\n' + id['Device'] + ' (' + id['Battery'] + ')'.split(', ');
1266
1365
  }
1267
1366
 
1268
1367
  if (this.lowBatteryPoweredCount > 0) {
1269
1368
  this.log.info(`Niedrige Batteriezustände: ${infotext}`);
1270
- await this.setStateAsync('lastNotification', infotext, true);
1369
+ await this.setStateAsync('lastNotification', `Niedrige Batteriezustände: ${infotext}`, true);
1271
1370
 
1272
1371
  if (this.config.instancePushover) {
1273
1372
  try {
@@ -1342,7 +1441,7 @@ class DeviceWatcher extends utils.Adapter {
1342
1441
  await this.setStateAsync(`${dpSubFolder}lowBatteryCount`, {val: this.lowBatteryPoweredCount, ack: true});
1343
1442
 
1344
1443
  if (this.deviceCounter == 0) {
1345
- this.listAllDevices = [{Device: '--keine--', Adapter: '', Battery: '', Last_contact: '', Link_quality: ''}]; //JSON-Info Gesamtliste mit Info je Gerät
1444
+ this.listAllDevices = [{'Device': '--none--', 'Adapter': '', 'Battery': '', 'Last contact': '', 'Signal strength': ''}]; //JSON-Info Gesamtliste mit Info je Gerät
1346
1445
 
1347
1446
  await this.setStateAsync(`${dpSubFolder}listAll`, {val: JSON.stringify(this.listAllDevices), ack: true});
1348
1447
  } else {
@@ -1350,7 +1449,7 @@ class DeviceWatcher extends utils.Adapter {
1350
1449
  }
1351
1450
 
1352
1451
  if (this.linkQualityCount == 0) {
1353
- this.linkQualityDevices = [{Device: '--keine--', Adapter: '', Link_quality: ''}]; //JSON-Info alle mit LinkQuality
1452
+ this.linkQualityDevices = [{'Device': '--none--', 'Adapter': '', 'Signal strength': ''}]; //JSON-Info alle mit LinkQuality
1354
1453
 
1355
1454
  await this.setStateAsync(`${dpSubFolder}linkQualityList`, {val: JSON.stringify(this.linkQualityDevices), ack: true});
1356
1455
  } else {
@@ -1359,7 +1458,7 @@ class DeviceWatcher extends utils.Adapter {
1359
1458
 
1360
1459
 
1361
1460
  if (this.offlineDevicesCount == 0) {
1362
- this.offlineDevices = [{Device: '--keine--', Adapter: '', Last_contact: ''}]; //JSON-Info alle offline-Geräte = 0
1461
+ this.offlineDevices = [{'Device': '--none--', 'Adapter': '', 'Last contact': ''}]; //JSON-Info alle offline-Geräte = 0
1363
1462
 
1364
1463
  await this.setStateAsync(`${dpSubFolder}offlineList`, {val: JSON.stringify(this.offlineDevices), ack: true});
1365
1464
  } else {
@@ -1367,7 +1466,7 @@ class DeviceWatcher extends utils.Adapter {
1367
1466
  }
1368
1467
 
1369
1468
  if (this.batteryPoweredCount == 0) {
1370
- this.batteryPowered = [{Device: '--keine--', Adapter: '', Battery: ''}]; //JSON-Info alle batteriebetriebenen Geräte
1469
+ this.batteryPowered = [{'Device': '--none--', 'Adapter': '', 'Battery': ''}]; //JSON-Info alle batteriebetriebenen Geräte
1371
1470
 
1372
1471
  await this.setStateAsync(`${dpSubFolder}batteryList`, {val: JSON.stringify(this.batteryPowered), ack: true});
1373
1472
  } else {
@@ -1375,7 +1474,7 @@ class DeviceWatcher extends utils.Adapter {
1375
1474
  }
1376
1475
 
1377
1476
  if (this.lowBatteryPoweredCount == 0) {
1378
- this.batteryLowPowered = [{Device: '--keine--', Adapter: '', Battery: ''}]; //JSON-Info alle batteriebetriebenen Geräte
1477
+ this.batteryLowPowered = [{'Device': '--none--', 'Adapter': '', 'Battery': ''}]; //JSON-Info alle batteriebetriebenen Geräte
1379
1478
 
1380
1479
  await this.setStateAsync(`${dpSubFolder}lowBatteryList`, {val: JSON.stringify(this.batteryLowPowered), ack: true});
1381
1480
  } else {