iobroker.device-watcher 2.0.0 → 2.0.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
@@ -8,7 +8,7 @@
8
8
  [![GitHub license](https://img.shields.io/github/license/ciddi89/ioBroker.device-watcher)](https://github.com/ciddi89/ioBroker.device-watcher/blob/main/LICENSE)
9
9
  ![GitHub repo size](https://img.shields.io/github/repo-size/ciddi89/ioBroker.device-watcher)
10
10
  ![GitHub commit activity](https://img.shields.io/github/commit-activity/m/ciddi89/ioBroker.device-watcher)
11
- ![GitHub commits since tagged version (branch)](https://img.shields.io/github/commits-since/ciddi89/ioBroker.device-watcher/v2.0.0)
11
+ ![GitHub commits since tagged version (branch)](https://img.shields.io/github/commits-since/ciddi89/ioBroker.device-watcher/v2.0.1)
12
12
  ![GitHub last commit](https://img.shields.io/github/last-commit/ciddi89/ioBroker.device-watcher)
13
13
  ![GitHub issues](https://img.shields.io/github/issues/ciddi89/ioBroker.device-watcher)
14
14
 
@@ -98,7 +98,6 @@ If you found a bug or you have an improvement suggestion, feel free to open an i
98
98
  ![list3.png](admin/images/list3.png)
99
99
 
100
100
  ## To-Do
101
- - make blacklist more user-friendly
102
101
  - clean up the code
103
102
  - add support for reaction on state-changes
104
103
  - send offline text only from the device that goes offline
@@ -108,6 +107,11 @@ If you found a bug or you have an improvement suggestion, feel free to open an i
108
107
  Placeholder for the next version (at the beginning of the line):
109
108
  ### **WORK IN PROGRESS**
110
109
  -->
110
+ ### 2.0.1 (2022-11-02)
111
+ - If the device is offline, set signal strength to '0%'
112
+ - If the device is offline, set battery to ' - '
113
+ - repair some small issues in the lists
114
+
111
115
  ### 2.0.0 (2022-11-01)
112
116
  - added Lupusec, HS100 adapter, Zigbee2MQTT and MaxCube
113
117
  - changed name of Homematic to HM-RPC
package/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "device-watcher",
4
- "version": "2.0.0",
4
+ "version": "2.0.1",
5
5
  "news": {
6
+ "2.0.1": {
7
+ "en": "If the device is offline, set signal strength to '0%'\nIf the device is offline, set battery to ' - '\nrepair some small issues in the lists",
8
+ "de": "Ist das Gerät offline, setzen Sie Signalstärke auf 0%\nWenn das Gerät offline ist, setzen Sie Batterie auf ' - '\neinige kleine probleme in den listen reparieren",
9
+ "ru": "Если устройство оффлайн, установите силу сигнала до 0%\nЕсли устройство оффлайн, установите аккумулятор в ' - '\nотремонтировать некоторые небольшие проблемы в списках",
10
+ "pt": "Se o dispositivo estiver offline, defina a força do sinal para 0%\nSe o dispositivo estiver offline, configure a bateria para ' - '\nreparar alguns pequenos problemas nas listas",
11
+ "nl": "Als het apparaat offline is, zet een signaalstilstand op 0%\nAls het apparaat offline is, zet dan batterij op '\nrepareer wat kleine kwesties in de lijst",
12
+ "fr": "Si l'appareil est hors ligne, définir la résistance du signal à 0%\nSi l'appareil est hors ligne, régler la batterie à ' - '\nréparer quelques petits problèmes dans les listes",
13
+ "it": "Se il dispositivo è offline, impostare la forza del segnale a 0%\nSe il dispositivo è offline, impostare la batteria a ' - '\nriparare alcuni piccoli problemi nelle liste",
14
+ "es": "Si el dispositivo está fuera de línea, establece la fuerza de señal al 0%\nSi el dispositivo está fuera de línea, establece la batería a ' - '\nreparar algunas pequeñas cuestiones en las listas",
15
+ "pl": "Jeśli urządzenie jest offline, ustawia siłę sygnału do 0%\nJeśli urządzenie jest wycinane, ustawiono baterię do '- '\nwyremontowano drobne problemy w listach",
16
+ "uk": "Якщо пристрій вимкнено, встановлюється міцність сигналу на 0%\nЯкщо пристрій вимкнено, встановіть акумулятор до ' - '\nремонт деяких невеликих питань у переліках",
17
+ "zh-cn": "如果装置落空,信号强度达到0%\n如果装置不线,便将电池到该地。\n在名单中修理一些小型问题"
18
+ },
6
19
  "2.0.0": {
7
20
  "en": "added Lupusec, HS100 adapter, Zigbee2MQTT and MaxCube\nchanged name of Homematic to HM-RPC\nmade a completly makeover of the blacklist\nclean up the code and shorten some",
8
21
  "de": "lupusec, HS100 Adapter, Zigbee2MQTT und MaxCube\ngeänderter Name von Homematic zu HM-RPC\naus einem kompletten makeover der blacklist\nden code reinigen und einige verkürzen",
@@ -75,18 +88,6 @@
75
88
  "es": "muchos cambios de código, comentarios y manejo de errores",
76
89
  "pl": "wiele zmian kodu, komentarzy i obsługi błędów",
77
90
  "zh-cn": "守则、评论和错误处理的许多变化"
78
- },
79
- "0.2.3": {
80
- "en": "many changes of code, comments and error handling",
81
- "de": "viele änderungen von code, kommentaren und fehlerbehandlung",
82
- "ru": "много изменений кода, комментариев и обработки ошибок",
83
- "pt": "muitas mudanças de código, comentários e manipulação de erros",
84
- "nl": "veel veranderingen van code, commentaar en fouten",
85
- "fr": "de nombreux changements de code, de commentaires et de traitement des erreurs",
86
- "it": "molte modifiche di codice, commenti e gestione degli errori",
87
- "es": "muchos cambios de código, comentarios y manejo de errores",
88
- "pl": "wiele zmian kodu, komentarzy i obsługi błędów",
89
- "zh-cn": "守则、评论和错误处理的许多变化"
90
91
  }
91
92
  },
92
93
  "titleLang": {
package/main.js CHANGED
@@ -538,39 +538,31 @@ class DeviceWatcher extends utils.Adapter {
538
538
  */
539
539
  async createData(i) {
540
540
  const devices = await this.getForeignStatesAsync(this.arrDev[i].Selektor);
541
- const deviceAdapterName = await this.capitalize(this.arrDev[i].adapter);
541
+ const adapterID = this.arrDev[i].adapter;
542
542
 
543
- /*---------- Start of second main loop ----------*/
543
+ /*---------- Start of loop ----------*/
544
544
  for (const [id] of Object.entries(devices)) {
545
545
  if (!isUnloaded) {
546
546
 
547
-
548
-
547
+ /*=============================================
548
+ = Get device name =
549
+ =============================================*/
549
550
  const deviceName = await this.getDeviceName(id, i);
550
551
 
552
+
553
+ /*=============================================
554
+ = Get path to datapoints =
555
+ =============================================*/
551
556
  const currDeviceString = id.slice(0, (id.lastIndexOf('.') + 1) - 1);
552
557
  const shortCurrDeviceString = currDeviceString.slice(0, (currDeviceString.lastIndexOf('.') + 1) - 1);
553
558
 
554
- // Get battery states
555
- const deviceBatteryState = await this.getInitValue(currDeviceString + this.arrDev[i].battery);
556
- const shortDeviceBatteryState = await this.getInitValue(shortCurrDeviceString + this.arrDev[i].battery);
557
- const shortDeviceBatteryState2 = await this.getInitValue(shortCurrDeviceString + this.arrDev[i].battery2);
558
-
559
-
560
- //this.devices[deviceName] = currDeviceString + this.arrDev[i].reach;
561
-
562
- /*for (const [value] of Object.entries(this.devices)) {
563
- this.log.warn(`${value}`);
564
- this.subscribeForeignStatesAsync(value);
565
- }*/
566
- //this.subscribeForeignStatesAsync(currDeviceString + this.arrDev[i].reach);
567
- // <--- END TEST
568
-
569
- // Get link quality
559
+ /*=============================================
560
+ = Get signal strength =
561
+ =============================================*/
570
562
  let deviceQualityState;
571
563
  let linkQuality;
572
564
 
573
- switch (this.arrDev[i].adapter) {
565
+ switch (adapterID) {
574
566
  case 'mihomeVacuum':
575
567
  deviceQualityState = await this.getForeignStateAsync(shortCurrDeviceString + this.arrDev[i].rssiState);
576
568
  break;
@@ -593,7 +585,7 @@ class DeviceWatcher extends utils.Adapter {
593
585
  if (this.config.trueState) {
594
586
  linkQuality = deviceQualityState.val;
595
587
  } else {
596
- switch (this.arrDev[i].adapter) {
588
+ switch (adapterID) {
597
589
  case 'roomba':
598
590
  case 'sonoff':
599
591
  linkQuality = deviceQualityState.val + '%'; // If quality state is already an percent value
@@ -618,7 +610,7 @@ class DeviceWatcher extends utils.Adapter {
618
610
  break;
619
611
 
620
612
  case 'string':
621
- switch (this.arrDev[i].adapter) {
613
+ switch (adapterID) {
622
614
  case 'netatmo':
623
615
  // for Netatmo devices
624
616
  linkQuality = deviceQualityState.val;
@@ -633,10 +625,96 @@ class DeviceWatcher extends utils.Adapter {
633
625
  linkQuality = ' - ';
634
626
  }
635
627
 
636
- // When was the last contact to the device?
628
+ /*=============================================
629
+ = Get battery data =
630
+ =============================================*/
631
+ let batteryHealth;
632
+ let lowBatIndicator;
633
+
634
+ // Get battery states
635
+ const deviceBatteryState = await this.getInitValue(currDeviceString + this.arrDev[i].battery);
636
+ const shortDeviceBatteryState = await this.getInitValue(shortCurrDeviceString + this.arrDev[i].battery);
637
+ const shortDeviceBatteryState2 = await this.getInitValue(shortCurrDeviceString + this.arrDev[i].battery2);
638
+
639
+ // Get low bat states
640
+ let deviceLowBatState = await this.getInitValue(currDeviceString + this.arrDev[i].isLowBat);
641
+ if (deviceLowBatState === undefined) {
642
+ deviceLowBatState = await this.getInitValue(currDeviceString + this.arrDev[i].isLowBat2);
643
+ }
644
+
645
+ if ((!deviceBatteryState) && (!shortDeviceBatteryState) && (!shortDeviceBatteryState2)) {
646
+ if (deviceLowBatState !== undefined) {
647
+ switch (this.arrDev[i].isLowBat || this.arrDev[i].isLowBat2) {
648
+ case 'none':
649
+ batteryHealth = ' - ';
650
+ break;
651
+ default:
652
+ if ((deviceLowBatState === false) || (deviceLowBatState === 'NORMAL') || (deviceLowBatState === 1)) {
653
+ batteryHealth = 'ok';
654
+ } else {
655
+ batteryHealth = 'low';
656
+ }
657
+ break;
658
+ }
659
+ } else {
660
+ batteryHealth = ' - ';
661
+ }
662
+ } else {
663
+ switch (adapterID) {
664
+ case 'hmrpc':
665
+ if (deviceBatteryState === 0) {
666
+ batteryHealth = ' - ';
667
+ } else {
668
+ batteryHealth = deviceBatteryState + 'V';
669
+ }
670
+ break;
671
+
672
+ case 'hue-extended':
673
+ if (shortDeviceBatteryState) {
674
+ batteryHealth = shortDeviceBatteryState + '%';
675
+ }
676
+ break;
677
+ case 'mihomeVacuum':
678
+ if (shortDeviceBatteryState) {
679
+ batteryHealth = shortDeviceBatteryState + '%';
680
+ } else if (shortDeviceBatteryState2) {
681
+ batteryHealth = shortDeviceBatteryState2 + '%';
682
+ }
683
+ break;
684
+ default:
685
+ batteryHealth = (deviceBatteryState) + '%';
686
+ }
687
+ }
688
+
689
+ /*=============================================
690
+ = Set Lowbat indicator =
691
+ =============================================*/
692
+ switch (adapterID) {
693
+ case 'hmrpc': // there are differnt low bat states between hm and hmIp devices
694
+ if (deviceLowBatState) {
695
+ lowBatIndicator = true;
696
+ }
697
+ break;
698
+ case 'tado': // there is an string as indicator
699
+ if (deviceLowBatState != 'NORMAL') {
700
+ lowBatIndicator = true;
701
+ }
702
+ break;
703
+
704
+ default: // for all other devices with low bat states
705
+ if ((deviceLowBatState === true) || (deviceLowBatState === 0)) {
706
+ lowBatIndicator = true;
707
+ } else if (deviceBatteryState && (deviceBatteryState < this.config.minWarnBatterie)) { // if the battery state is under the set limit
708
+ lowBatIndicator = true;
709
+ }
710
+ }
711
+
712
+ /*=============================================
713
+ = Get last contact of device =
714
+ =============================================*/
637
715
  let lastContactString;
638
- let deviceState = 'Online';
639
716
  let lastDeviceUnreachStateChange;
717
+ let deviceState = 'Online';
640
718
 
641
719
  const deviceMainSelector = await this.getForeignStateAsync(id);
642
720
  const deviceStateSelector = await this.getForeignStateAsync(shortCurrDeviceString + this.arrDev[i].stateValue); // for hmrpc devices
@@ -682,7 +760,7 @@ class DeviceWatcher extends utils.Adapter {
682
760
 
683
761
  default:
684
762
  //State changed
685
- if (this.arrDev[i].adapter === 'hmrpc') {
763
+ if (adapterID === 'hmrpc') {
686
764
  if (linkQuality != ' - ') {
687
765
  if (deviceUnreachState) {
688
766
  await getLastStateChange();
@@ -718,7 +796,6 @@ class DeviceWatcher extends utils.Adapter {
718
796
  await getLastContactOfState();
719
797
  }
720
798
  }
721
-
722
799
  } else {
723
800
  if (!deviceUnreachState) {
724
801
  await getLastStateChange();
@@ -729,8 +806,9 @@ class DeviceWatcher extends utils.Adapter {
729
806
  }
730
807
  }
731
808
 
732
- const adapterID = this.arrDev[i].adapter;
733
-
809
+ /*=============================================
810
+ = Set Online Status =
811
+ =============================================*/
734
812
  switch (adapterID) {
735
813
  case 'hmrpc':
736
814
  case 'hmiP':
@@ -738,28 +816,39 @@ class DeviceWatcher extends utils.Adapter {
738
816
  if ((this.maxMinutes !== undefined) && (this.maxMinutes[adapterID] === -1)) {
739
817
  if (deviceUnreachState) {
740
818
  deviceState = 'Offline'; //set online state to offline
819
+ linkQuality = '0%'; // set linkQuality to nothing
820
+ batteryHealth = ' - '; // set batteryhelth to nothing
741
821
  }
742
822
  } else if ((this.maxMinutes !== undefined) && (lastContact > this.maxMinutes[adapterID])) {
743
823
  deviceState = 'Offline'; //set online state to offline
824
+ linkQuality = '0%'; // set linkQuality to nothing
825
+ batteryHealth = ' - '; // set batteryhelth to nothing
744
826
  }
745
827
  break;
746
828
  case 'ping':
747
829
  if ((this.maxMinutes !== undefined) && (this.maxMinutes[adapterID] === -1)) {
748
830
  if (!deviceUnreachState) {
749
831
  deviceState = 'Offline'; //set online state to offline
832
+ linkQuality = '0%'; // set linkQuality to nothing
833
+ batteryHealth = ' - '; // set batteryhelth to nothing
750
834
  }
751
835
  } else if ((this.maxMinutes !== undefined) && (lastContact > this.maxMinutes[adapterID]) && (!deviceUnreachState)) {
752
836
  deviceState = 'Offline'; //set online state to offline
837
+ linkQuality = '0%'; // set linkQuality to nothing
838
+ batteryHealth = ' - '; // set batteryhelth to nothing
753
839
  }
754
840
  break;
755
841
  case 'unifi':
756
842
  if ((this.maxMinutes !== undefined) && (this.maxMinutes[adapterID] === -1)) {
757
843
  if (deviceUnreachState === 0) {
758
844
  deviceState = 'Offline'; //set online state to offline
845
+ linkQuality = '0%'; // set linkQuality to nothing
846
+ batteryHealth = ' - '; // set batteryhelth to nothing
759
847
  }
760
848
  } else if ((this.maxMinutes !== undefined) && (lastContact > this.maxMinutes[adapterID])) {
761
849
  deviceState = 'Offline'; //set online state to offline
762
-
850
+ linkQuality = '0%'; // set linkQuality to nothing
851
+ batteryHealth = ' - '; // set batteryhelth to nothing
763
852
  }
764
853
  break;
765
854
  case 'shelly':
@@ -767,18 +856,26 @@ class DeviceWatcher extends utils.Adapter {
767
856
  if ((this.maxMinutes !== undefined) && (this.maxMinutes[adapterID] === -1)) {
768
857
  if (!deviceUnreachState) {
769
858
  deviceState = 'Offline'; //set online state to offline
859
+ linkQuality = '0%'; // set linkQuality to nothing
860
+ batteryHealth = ' - '; // set batteryhelth to nothing
770
861
  }
771
862
  } else if ((!deviceUnreachState) && (typeof lastDeviceUnreachStateChange !== 'undefined') && (this.maxMinutes !== undefined) && (lastContact > this.maxMinutes[adapterID])) {
772
863
  deviceState = 'Offline'; //set online state to offline
864
+ linkQuality = '0%'; // set linkQuality to nothing
865
+ batteryHealth = ' - '; // set batteryhelth to nothing
773
866
  }
774
867
  break;
775
868
  case 'mihomeVacuum':
776
869
  if ((this.maxMinutes !== undefined) && (this.maxMinutes[adapterID] === -1)) {
777
870
  if (!shortDeviceUnreachState) {
778
871
  deviceState = 'Offline'; //set online state to offline
872
+ linkQuality = '0%'; // set linkQuality to nothing
873
+ batteryHealth = ' - '; // set batteryhelth to nothing
779
874
  }
780
875
  } else if ((this.maxMinutes !== undefined) && (lastContact > this.maxMinutes[adapterID])) {
781
876
  deviceState = 'Offline'; //set online state to offline
877
+ linkQuality = '0%'; // set linkQuality to nothing
878
+ batteryHealth = ' - '; // set batteryhelth to nothing
782
879
  }
783
880
  break;
784
881
  case 'miHome':
@@ -786,17 +883,25 @@ class DeviceWatcher extends utils.Adapter {
786
883
  if ((this.maxMinutes !== undefined) && (this.maxMinutes[adapterID] === -1)) {
787
884
  if (!deviceUnreachState) {
788
885
  deviceState = 'Offline'; //set online state to offline
886
+ linkQuality = '0%'; // set linkQuality to nothing
887
+ batteryHealth = ' - '; // set batteryhelth to nothing
789
888
  }
790
889
  } else if ((this.maxMinutes !== undefined) && (lastContact > this.maxMinutes[adapterID])) {
791
890
  deviceState = 'Offline'; //set online state to offline
891
+ linkQuality = '0%'; // set linkQuality to nothing
892
+ batteryHealth = ' - '; // set batteryhelth to nothing
792
893
  }
793
894
  } else {
794
895
  if (this.config.mihomeMaxMinutes === -1) {
795
896
  if ((this.maxMinutes !== undefined) && (this.maxMinutes[adapterID] === -1)) {
796
897
  deviceState = 'Offline'; //set online state to offline
898
+ linkQuality = '0%'; // set linkQuality to nothing
899
+ batteryHealth = ' - '; // set batteryhelth to nothing
797
900
  }
798
901
  } else if ((this.maxMinutes !== undefined) && (lastContact > this.maxMinutes[adapterID])) {
799
902
  deviceState = 'Offline'; //set online state to offline
903
+ linkQuality = '0%'; // set linkQuality to nothing
904
+ batteryHealth = ' - '; // set batteryhelth to nothing
800
905
  }
801
906
  }
802
907
  break;
@@ -804,9 +909,13 @@ class DeviceWatcher extends utils.Adapter {
804
909
  if ((this.maxMinutes !== undefined) && (this.maxMinutes[adapterID] === -1)) {
805
910
  if (!deviceUnreachState) {
806
911
  deviceState = 'Offline'; //set online state to offline
912
+ linkQuality = '0%'; // set linkQuality to nothing
913
+ batteryHealth = ' - '; // set batteryhelth to nothing
807
914
  }
808
915
  } else if ((this.maxMinutes !== undefined) && (lastContact > this.maxMinutes[adapterID])) {
809
916
  deviceState = 'Offline'; //set online state to offline
917
+ linkQuality = '0%'; // set linkQuality to nothing
918
+ batteryHealth = ' - '; // set batteryhelth to nothing
810
919
  }
811
920
  break;
812
921
  }
@@ -815,85 +924,18 @@ class DeviceWatcher extends utils.Adapter {
815
924
  }
816
925
  }
817
926
 
818
- // Get battery states
819
- let batteryHealth;
820
- let lowBatIndicator;
821
- let deviceLowBatState = await this.getInitValue(currDeviceString + this.arrDev[i].isLowBat);
822
- if (deviceLowBatState === undefined) {
823
- deviceLowBatState = await this.getInitValue(currDeviceString + this.arrDev[i].isLowBat2);
824
- }
927
+ /*=============================================
928
+ = Fill Raw Lists =
929
+ =============================================*/
825
930
 
826
- if ((!deviceBatteryState) && (!shortDeviceBatteryState) && (!shortDeviceBatteryState2)) {
827
- if (deviceLowBatState !== undefined) {
828
- switch (this.arrDev[i].isLowBat || this.arrDev[i].isLowBat2) {
829
- case 'none':
830
- batteryHealth = ' - ';
831
- break;
832
- default:
833
- if ((deviceLowBatState === false) || (deviceLowBatState === 'NORMAL') || (deviceLowBatState === 1)) {
834
- batteryHealth = 'ok';
835
- } else {
836
- batteryHealth = 'low';
837
- }
838
- break;
839
- }
840
- } else {
841
- batteryHealth = ' - ';
842
- }
843
- } else {
844
- switch (this.arrDev[i].adapter) {
845
- case 'hmrpc':
846
- if (deviceBatteryState === 0) {
847
- batteryHealth = ' - ';
848
- } else {
849
- batteryHealth = deviceBatteryState + 'V';
850
- }
851
- break;
852
-
853
- case 'hue-extended':
854
- if (shortDeviceBatteryState) {
855
- batteryHealth = shortDeviceBatteryState + '%';
856
- }
857
- break;
858
- case 'mihomeVacuum':
859
- if (shortDeviceBatteryState) {
860
- batteryHealth = shortDeviceBatteryState + '%';
861
- } else if (shortDeviceBatteryState2) {
862
- batteryHealth = shortDeviceBatteryState2 + '%';
863
- }
864
- break;
865
- default:
866
- batteryHealth = (deviceBatteryState) + '%';
867
- }
868
- }
869
-
870
- // fill list with low battery devices
871
- switch (this.arrDev[i].adapter) {
872
- case 'hmrpc': // there are differnt low bat states between hm and hmIp devices
873
- if (deviceLowBatState) {
874
- lowBatIndicator = true;
875
- }
876
- break;
877
- case 'tado': // there is an string as indicator
878
- if (deviceLowBatState != 'NORMAL') {
879
- lowBatIndicator = true;
880
- }
881
- break;
882
-
883
- default: // for all other devices with low bat states
884
- if ((deviceLowBatState === true) || (deviceLowBatState === 0)) {
885
- lowBatIndicator = true;
886
- } else if (deviceBatteryState && (deviceBatteryState < this.config.minWarnBatterie)) { // if the battery state is under the set limit
887
- lowBatIndicator = true;
888
- }
889
- }
890
- if (this.listOnlyBattery) { // Add only devices with battery in the list
931
+ /* Add only devices with battery in the rawlist */
932
+ if (this.listOnlyBattery) {
891
933
  if (deviceBatteryState || shortDeviceBatteryState) {
892
934
  this.listAllDevicesRaw.push(
893
935
  {
894
936
  'Path': id,
895
937
  'Device': deviceName,
896
- 'Adapter': deviceAdapterName,
938
+ 'Adapter': await this.capitalize(adapterID),
897
939
  'Battery': batteryHealth,
898
940
  'LowBat': lowBatIndicator,
899
941
  'Signal strength': linkQuality,
@@ -902,12 +944,13 @@ class DeviceWatcher extends utils.Adapter {
902
944
  }
903
945
  );
904
946
  }
905
- } else { // Add all devices
947
+ } else {
948
+ /* Add all devices */
906
949
  this.listAllDevicesRaw.push(
907
950
  {
908
951
  'Path': id,
909
952
  'Device': deviceName,
910
- 'Adapter': deviceAdapterName,
953
+ 'Adapter': await this.capitalize(adapterID),
911
954
  'Battery': batteryHealth,
912
955
  'LowBat': lowBatIndicator,
913
956
  'Signal strength': linkQuality,
@@ -917,7 +960,8 @@ class DeviceWatcher extends utils.Adapter {
917
960
  );
918
961
  }
919
962
  } else {
920
- return; // cancel run if unloaded was called.
963
+ /* cancel run if unloaded was called. */
964
+ return;
921
965
  }
922
966
  } // <-- end of loop
923
967
  await this.createLists();
@@ -932,6 +976,8 @@ class DeviceWatcher extends utils.Adapter {
932
976
  // create Data for each Adapter in own lists
933
977
  this.log.debug(`Function started: ${this.createDataForEachAdapter.name}`);
934
978
 
979
+ await this.resetVars(); // reset the arrays and counts
980
+
935
981
  try {
936
982
  for (let i = 0; i < this.arrDev.length; i++) {
937
983
 
@@ -939,8 +985,8 @@ class DeviceWatcher extends utils.Adapter {
939
985
  await this.createData(i);
940
986
  }
941
987
  }
988
+
942
989
  await this.writeDatapoints(adptName); // fill the datapoints
943
- await this.resetVars(); // reset the arrays and counts
944
990
 
945
991
  } catch (error) {
946
992
  this.errorReporting('[createDataForEachAdapter]', error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.device-watcher",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Watchdog for devices",
5
5
  "author": {
6
6
  "name": "Christian Behrends",