iobroker.device-watcher 2.10.3 → 2.10.5

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
@@ -83,9 +83,6 @@ class DeviceWatcher extends utils.Adapter {
83
83
  // Check if main function is running
84
84
  this.mainRunning = false;
85
85
 
86
- // System anguage
87
- this.userSystemLanguage;
88
-
89
86
  this.on('ready', this.onReady.bind(this));
90
87
  this.on('stateChange', this.onStateChange.bind(this));
91
88
  this.on('objectChange', this.onObjectChange.bind(this));
@@ -100,11 +97,14 @@ class DeviceWatcher extends utils.Adapter {
100
97
  this.log.debug(`Adapter ${adapterName} was started`);
101
98
 
102
99
  // set user language
103
- if (this.userSystemLanguage === undefined && this.userSystemLanguage === null) {
104
- this.userSystemLanguage = 'de';
105
- } else {
106
- this.userSystemLanguage = this.language;
100
+ if (this.config.userSelectedLanguage === '') {
101
+ if (this.language !== undefined && this.language !== null) {
102
+ this.config.userSelectedLanguage = this.language;
103
+ } else {
104
+ this.config.userSelectedLanguage = 'de';
105
+ }
107
106
  }
107
+ this.log.debug(`Set language to ${this.config.userSelectedLanguage}`);
108
108
 
109
109
  this.configCreateInstanceList = this.config.checkAdapterInstances;
110
110
  this.configListOnlyBattery = this.config.listOnlyBattery;
@@ -394,8 +394,7 @@ class DeviceWatcher extends utils.Adapter {
394
394
  */
395
395
  async onStateChange(id, state) {
396
396
  if (state) {
397
- this.log.debug(`State changed: ${id} changed ${state.val}`);
398
-
397
+ // this.log.debug(`State changed: ${id} changed ${state.val}`);
399
398
  try {
400
399
  /*=============================================
401
400
  = Instances / Adapter =
@@ -1223,10 +1222,10 @@ class DeviceWatcher extends utils.Adapter {
1223
1222
 
1224
1223
  lastContactString = `${this.formatDate(new Date(selector), 'hh:mm')}`;
1225
1224
  if (Math.round(lastContact) > 100) {
1226
- lastContactString = `${Math.round(lastContact / 60)} ${translations.hours[this.userSystemLanguage]}`;
1225
+ lastContactString = `${Math.round(lastContact / 60)} ${translations.hours[this.config.userSelectedLanguage]}`;
1227
1226
  }
1228
1227
  if (Math.round(lastContact / 60) > 48) {
1229
- lastContactString = `${Math.round(lastContact / 60 / 24)} ${translations.days[this.userSystemLanguage]}`;
1228
+ lastContactString = `${Math.round(lastContact / 60 / 24)} ${translations.days[this.config.userSelectedLanguage]}`;
1230
1229
  }
1231
1230
  return lastContactString;
1232
1231
  }
@@ -1417,7 +1416,7 @@ class DeviceWatcher extends utils.Adapter {
1417
1416
  * when was last contact of device
1418
1417
  */
1419
1418
  async checkLastContact() {
1420
- for (const [device, deviceData] of this.listAllDevicesRaw.entries()) {
1419
+ for (const [deviceID, deviceData] of this.listAllDevicesRaw.entries()) {
1421
1420
  if (deviceData.instancedeviceConnected !== false) {
1422
1421
  const oldContactState = deviceData.Status;
1423
1422
  deviceData.UnreachState = await this.getInitValue(deviceData.UnreachDP);
@@ -1436,7 +1435,10 @@ class DeviceWatcher extends utils.Adapter {
1436
1435
  deviceData.linkQuality = contactData[2];
1437
1436
  }
1438
1437
  if (this.config.checkSendOfflineMsg && oldContactState !== deviceData.Status && !this.blacklistNotify.includes(deviceData.Path)) {
1439
- await this.sendStateNotifications('Devices', 'onlineStateDevice', device);
1438
+ // check if the generally deviceData connected state is for a while true
1439
+ if (await this.getTimestampConnectionDP(deviceData.instanceDeviceConnectionDP, 50000)) {
1440
+ await this.sendStateNotifications('Devices', 'onlineStateDevice', deviceID);
1441
+ }
1440
1442
  }
1441
1443
  }
1442
1444
  }
@@ -1559,56 +1561,56 @@ class DeviceWatcher extends utils.Adapter {
1559
1561
 
1560
1562
  // List with all devices
1561
1563
  this.listAllDevices.push({
1562
- [translations.Device[this.userSystemLanguage]]: device.Device,
1563
- [translations.Adapter[this.userSystemLanguage]]: device.Adapter,
1564
- [translations.Battery[this.userSystemLanguage]]: device.Battery,
1565
- [translations.Signal_strength[this.userSystemLanguage]]: device.SignalStrength,
1566
- [translations.Last_Contact[this.userSystemLanguage]]: device.LastContact,
1567
- [translations.Status[this.userSystemLanguage]]: device.Status,
1564
+ [translations.Device[this.config.userSelectedLanguage]]: device.Device,
1565
+ [translations.Adapter[this.config.userSelectedLanguage]]: device.Adapter,
1566
+ [translations.Battery[this.config.userSelectedLanguage]]: device.Battery,
1567
+ [translations.Signal_strength[this.config.userSelectedLanguage]]: device.SignalStrength,
1568
+ [translations.Last_Contact[this.config.userSelectedLanguage]]: device.LastContact,
1569
+ [translations.Status[this.config.userSelectedLanguage]]: device.Status,
1568
1570
  });
1569
1571
 
1570
1572
  // LinkQuality lists
1571
1573
  if (device.SignalStrength != ' - ') {
1572
1574
  this.linkQualityDevices.push({
1573
- [translations.Device[this.userSystemLanguage]]: device.Device,
1574
- [translations.Adapter[this.userSystemLanguage]]: device.Adapter,
1575
- [translations.Signal_strength[this.userSystemLanguage]]: device.SignalStrength,
1575
+ [translations.Device[this.config.userSelectedLanguage]]: device.Device,
1576
+ [translations.Adapter[this.config.userSelectedLanguage]]: device.Adapter,
1577
+ [translations.Signal_strength[this.config.userSelectedLanguage]]: device.SignalStrength,
1576
1578
  });
1577
1579
  }
1578
1580
 
1579
1581
  // Battery lists
1580
1582
  if (device.isBatteryDevice) {
1581
1583
  this.batteryPowered.push({
1582
- [translations.Device[this.userSystemLanguage]]: device.Device,
1583
- [translations.Adapter[this.userSystemLanguage]]: device.Adapter,
1584
- [translations.Battery[this.userSystemLanguage]]: device.Battery,
1585
- [translations.Status[this.userSystemLanguage]]: device.Status,
1584
+ [translations.Device[this.config.userSelectedLanguage]]: device.Device,
1585
+ [translations.Adapter[this.config.userSelectedLanguage]]: device.Adapter,
1586
+ [translations.Battery[this.config.userSelectedLanguage]]: device.Battery,
1587
+ [translations.Status[this.config.userSelectedLanguage]]: device.Status,
1586
1588
  });
1587
1589
  }
1588
1590
 
1589
1591
  // Low Bat lists
1590
1592
  if (device.LowBat && device.Status !== 'Offline') {
1591
1593
  this.batteryLowPowered.push({
1592
- [translations.Device[this.userSystemLanguage]]: device.Device,
1593
- [translations.Adapter[this.userSystemLanguage]]: device.Adapter,
1594
- [translations.Battery[this.userSystemLanguage]]: device.Battery,
1594
+ [translations.Device[this.config.userSelectedLanguage]]: device.Device,
1595
+ [translations.Adapter[this.config.userSelectedLanguage]]: device.Adapter,
1596
+ [translations.Battery[this.config.userSelectedLanguage]]: device.Battery,
1595
1597
  });
1596
1598
  }
1597
1599
 
1598
1600
  // Offline List
1599
1601
  if (device.Status === 'Offline') {
1600
1602
  this.offlineDevices.push({
1601
- [translations.Device[this.userSystemLanguage]]: device.Device,
1602
- [translations.Adapter[this.userSystemLanguage]]: device.Adapter,
1603
- [translations.Last_Contact[this.userSystemLanguage]]: device.LastContact,
1603
+ [translations.Device[this.config.userSelectedLanguage]]: device.Device,
1604
+ [translations.Adapter[this.config.userSelectedLanguage]]: device.Adapter,
1605
+ [translations.Last_Contact[this.config.userSelectedLanguage]]: device.LastContact,
1604
1606
  });
1605
1607
  }
1606
1608
 
1607
1609
  // Device update List
1608
1610
  if (device.Upgradable === true || device.Upgradable === 1) {
1609
1611
  this.upgradableList.push({
1610
- [translations.Device[this.userSystemLanguage]]: device.Device,
1611
- [translations.Adapter[this.userSystemLanguage]]: device.Adapter,
1612
+ [translations.Device[this.config.userSelectedLanguage]]: device.Device,
1613
+ [translations.Adapter[this.config.userSelectedLanguage]]: device.Adapter,
1612
1614
  });
1613
1615
  }
1614
1616
  }
@@ -1663,12 +1665,12 @@ class DeviceWatcher extends utils.Adapter {
1663
1665
  // if no device is count, write the JSON List with default value
1664
1666
  this.listAllDevices = [
1665
1667
  {
1666
- [translations.Device[this.userSystemLanguage]]: '--none--',
1667
- [translations.Adapter[this.userSystemLanguage]]: '',
1668
- [translations.Battery[this.userSystemLanguage]]: '',
1669
- [translations.Signal_strength[this.userSystemLanguage]]: '',
1670
- [translations.Last_Contact[this.userSystemLanguage]]: '',
1671
- [translations.Status[this.userSystemLanguage]]: '',
1668
+ [translations.Device[this.config.userSelectedLanguage]]: '--none--',
1669
+ [translations.Adapter[this.config.userSelectedLanguage]]: '',
1670
+ [translations.Battery[this.config.userSelectedLanguage]]: '',
1671
+ [translations.Signal_strength[this.config.userSelectedLanguage]]: '',
1672
+ [translations.Last_Contact[this.config.userSelectedLanguage]]: '',
1673
+ [translations.Status[this.config.userSelectedLanguage]]: '',
1672
1674
  },
1673
1675
  ];
1674
1676
  this.listAllDevicesUserRaw = [
@@ -1696,9 +1698,9 @@ class DeviceWatcher extends utils.Adapter {
1696
1698
  // if no device is count, write the JSON List with default value
1697
1699
  this.linkQualityDevices = [
1698
1700
  {
1699
- [translations.Device[this.userSystemLanguage]]: '--none--',
1700
- [translations.Adapter[this.userSystemLanguage]]: '',
1701
- [translations.Signal_strength[this.userSystemLanguage]]: '',
1701
+ [translations.Device[this.config.userSelectedLanguage]]: '--none--',
1702
+ [translations.Adapter[this.config.userSelectedLanguage]]: '',
1703
+ [translations.Signal_strength[this.config.userSelectedLanguage]]: '',
1702
1704
  },
1703
1705
  ];
1704
1706
  }
@@ -1713,9 +1715,9 @@ class DeviceWatcher extends utils.Adapter {
1713
1715
  // if no device is count, write the JSON List with default value
1714
1716
  this.offlineDevices = [
1715
1717
  {
1716
- [translations.Device[this.userSystemLanguage]]: '--none--',
1717
- [translations.Adapter[this.userSystemLanguage]]: '',
1718
- [translations.Last_Contact[this.userSystemLanguage]]: '',
1718
+ [translations.Device[this.config.userSelectedLanguage]]: '--none--',
1719
+ [translations.Adapter[this.config.userSelectedLanguage]]: '',
1720
+ [translations.Last_Contact[this.config.userSelectedLanguage]]: '',
1719
1721
  },
1720
1722
  ];
1721
1723
  }
@@ -1730,9 +1732,9 @@ class DeviceWatcher extends utils.Adapter {
1730
1732
  // if no device is count, write the JSON List with default value
1731
1733
  this.upgradableList = [
1732
1734
  {
1733
- [translations.Device[this.userSystemLanguage]]: '--none--',
1734
- [translations.Adapter[this.userSystemLanguage]]: '',
1735
- [translations.Last_Contact[this.userSystemLanguage]]: '',
1735
+ [translations.Device[this.config.userSelectedLanguage]]: '--none--',
1736
+ [translations.Adapter[this.config.userSelectedLanguage]]: '',
1737
+ [translations.Last_Contact[this.config.userSelectedLanguage]]: '',
1736
1738
  },
1737
1739
  ];
1738
1740
  }
@@ -1746,7 +1748,11 @@ class DeviceWatcher extends utils.Adapter {
1746
1748
  if (this.batteryPoweredCount === 0) {
1747
1749
  // if no device is count, write the JSON List with default value
1748
1750
  this.batteryPowered = [
1749
- { [translations.Device[this.userSystemLanguage]]: '--none--', [translations.Adapter[this.userSystemLanguage]]: '', [translations.Battery[this.userSystemLanguage]]: '' },
1751
+ {
1752
+ [translations.Device[this.config.userSelectedLanguage]]: '--none--',
1753
+ [translations.Adapter[this.config.userSelectedLanguage]]: '',
1754
+ [translations.Battery[this.config.userSelectedLanguage]]: '',
1755
+ },
1750
1756
  ];
1751
1757
  }
1752
1758
  //write JSON list
@@ -1759,7 +1765,11 @@ class DeviceWatcher extends utils.Adapter {
1759
1765
  if (this.lowBatteryPoweredCount === 0) {
1760
1766
  // if no device is count, write the JSON List with default value
1761
1767
  this.batteryLowPowered = [
1762
- { [translations.Device[this.userSystemLanguage]]: '--none--', [translations.Adapter[this.userSystemLanguage]]: '', [translations.Battery[this.userSystemLanguage]]: '' },
1768
+ {
1769
+ [translations.Device[this.config.userSelectedLanguage]]: '--none--',
1770
+ [translations.Adapter[this.config.userSelectedLanguage]]: '',
1771
+ [translations.Battery[this.config.userSelectedLanguage]]: '',
1772
+ },
1763
1773
  ];
1764
1774
  }
1765
1775
  //write JSON list
@@ -1964,8 +1974,7 @@ class DeviceWatcher extends utils.Adapter {
1964
1974
 
1965
1975
  // device unreach
1966
1976
  case deviceData.UnreachDP:
1967
- if (deviceData.instanceDeviceConnectionDP.val !== undefined) {
1968
- // check if the generally deviceData connected state is for a while true
1977
+ if (deviceData.instancedeviceConnected !== undefined) {
1969
1978
  if (deviceData.UnreachState !== state.val) {
1970
1979
  oldStatus = deviceData.Status;
1971
1980
  deviceData.UnreachState = state.val;
@@ -1984,12 +1993,8 @@ class DeviceWatcher extends utils.Adapter {
1984
1993
  deviceData.SignalStrength = contactData[2];
1985
1994
  }
1986
1995
  if (this.config.checkSendOfflineMsg && oldStatus !== deviceData.Status && !this.blacklistNotify.includes(deviceData.Path)) {
1987
- if (deviceData.instanceDeviceConnectionDP.val !== undefined) {
1988
- // check if the generally deviceData connected state is for a while true
1989
- if (await this.getTimestampConnectionDP(deviceData.instanceDeviceConnectionDP, 20000)) {
1990
- await this.sendStateNotifications('Devices', 'onlineStateDevice', deviceID);
1991
- }
1992
- } else {
1996
+ // check if the generally deviceData connected state is for a while true
1997
+ if (await this.getTimestampConnectionDP(deviceData.instanceDeviceConnectionDP, 50000)) {
1993
1998
  await this.sendStateNotifications('Devices', 'onlineStateDevice', deviceID);
1994
1999
  }
1995
2000
  }
@@ -1999,6 +2004,7 @@ class DeviceWatcher extends utils.Adapter {
1999
2004
  }
2000
2005
  }
2001
2006
  }
2007
+
2002
2008
  /**
2003
2009
  * get all Instances at start
2004
2010
  */
@@ -2103,7 +2109,6 @@ class DeviceWatcher extends utils.Adapter {
2103
2109
  isConnectedHost: instanceConnectedHostVal,
2104
2110
  isConnectedDevice: instanceConnectedDeviceVal,
2105
2111
  status: instanceStatus,
2106
- checkIsRunning: false,
2107
2112
  aliveDP: `system.adapter.${instanceID}.alive`,
2108
2113
  hostConnectionDP: instanceConnectedHostDP,
2109
2114
  deviceConnectionDP: instanceConnectedDeviceDP,
@@ -2135,26 +2140,25 @@ class DeviceWatcher extends utils.Adapter {
2135
2140
  const connectedHostState = await this.getInitValue(`system.adapter.${instanceID}.connected`);
2136
2141
  const isAlive = await this.getInitValue(`system.adapter.${instanceID}.alive`);
2137
2142
  let connectedDeviceState = await this.getInitValue(`${instanceID}.info.connection`);
2138
-
2139
2143
  if (connectedDeviceState === undefined) {
2140
2144
  connectedDeviceState = true;
2141
2145
  }
2142
2146
 
2143
2147
  let isHealthy = false;
2144
- let instanceStatusString = translations.instance_deactivated[this.userSystemLanguage];
2148
+ let instanceStatusString = translations.instance_deactivated[this.config.userSelectedLanguage];
2145
2149
 
2146
2150
  if (isAlive) {
2147
2151
  if (connectedHostState && connectedDeviceState) {
2148
2152
  isHealthy = true;
2149
- instanceStatusString = translations.instance_okay[this.userSystemLanguage];
2153
+ instanceStatusString = translations.instance_okay[this.config.userSelectedLanguage];
2150
2154
  } else if (!connectedHostState) {
2151
- instanceStatusString = translations.not_connected_host[this.userSystemLanguage];
2155
+ instanceStatusString = translations.not_connected_host[this.config.userSelectedLanguage];
2152
2156
  } else if (!connectedDeviceState) {
2153
- instanceStatusString = translations.not_connected_device[this.userSystemLanguage];
2157
+ instanceStatusString = translations.not_connected_device[this.config.userSelectedLanguage];
2154
2158
  }
2155
2159
  }
2156
2160
 
2157
- return [Boolean(isAlive), Boolean(isHealthy), String(instanceStatusString)];
2161
+ return [Boolean(isAlive), Boolean(isHealthy), String(instanceStatusString), Boolean(connectedHostState), Boolean(connectedDeviceState)];
2158
2162
  }
2159
2163
 
2160
2164
  /**
@@ -2166,7 +2170,7 @@ class DeviceWatcher extends utils.Adapter {
2166
2170
  let isAlive = await this.getInitValue(`system.adapter.${instanceID}.alive`);
2167
2171
  let daemonIsAlive;
2168
2172
  let isHealthy = false;
2169
- let instanceStatusString = isAlive ? translations.instance_activated[this.userSystemLanguage] : translations.instance_deactivated[this.userSystemLanguage];
2173
+ let instanceStatusString = isAlive ? translations.instance_activated[this.config.userSelectedLanguage] : translations.instance_deactivated[this.config.userSelectedLanguage];
2170
2174
 
2171
2175
  if (isAlive) {
2172
2176
  daemonIsAlive = await this.checkDaemonIsHealthy(instanceID);
@@ -2182,8 +2186,10 @@ class DeviceWatcher extends utils.Adapter {
2182
2186
  isAlive = Boolean(daemonIsAlive[0]);
2183
2187
  isHealthy = Boolean(daemonIsAlive[1]);
2184
2188
  instanceStatusString = String(daemonIsAlive[2]);
2189
+ const connectedToHost = Boolean(daemonIsAlive[3]);
2190
+ const connectedToDevice = Boolean(daemonIsAlive[4]);
2185
2191
 
2186
- return [isAlive, isHealthy, instanceStatusString];
2192
+ return [isAlive, isHealthy, instanceStatusString, connectedToHost, connectedToDevice];
2187
2193
  }
2188
2194
 
2189
2195
  async checkScheduleisHealty(instanceID, scheduleTime) {
@@ -2193,7 +2199,7 @@ class DeviceWatcher extends utils.Adapter {
2193
2199
  let diff;
2194
2200
  let isAlive = false;
2195
2201
  let isHealthy = false;
2196
- let instanceStatusString = translations.instance_deactivated[this.userSystemLanguage];
2202
+ let instanceStatusString = translations.instance_deactivated[this.config.userSelectedLanguage];
2197
2203
  const isAliveSchedule = await this.getForeignStateAsync(`system.adapter.${instanceID}.alive`);
2198
2204
 
2199
2205
  if (isAliveSchedule) {
@@ -2206,7 +2212,7 @@ class DeviceWatcher extends utils.Adapter {
2206
2212
  // if 5 minutes difference exceeded, instance is not alive
2207
2213
  isAlive = true;
2208
2214
  isHealthy = true;
2209
- instanceStatusString = translations.instance_okay[this.userSystemLanguage];
2215
+ instanceStatusString = translations.instance_okay[this.config.userSelectedLanguage];
2210
2216
  }
2211
2217
  }
2212
2218
  }
@@ -2223,52 +2229,21 @@ class DeviceWatcher extends utils.Adapter {
2223
2229
  async setInstanceStatus(instanceMode, scheduleTime, instanceID) {
2224
2230
  let instanceDeactivationTime = (this.config.offlineTimeInstances * 1000) / 2;
2225
2231
  let instanceErrorTime = (this.config.errorTimeInstances * 1000) / 2;
2226
-
2227
- const checkScheduleIsHealthy = async () => {
2228
- const scheduleIsAlive = await this.checkScheduleisHealty(instanceID, scheduleTime);
2229
- return {
2230
- isAlive: Boolean(scheduleIsAlive[0]),
2231
- isHealthy: Boolean(scheduleIsAlive[1]),
2232
- instanceStatusString: String(scheduleIsAlive[2]),
2233
- };
2234
- };
2235
-
2236
- const checkDaemonIsHealthy = async () => {
2237
- const daemonIsAlive = await this.checkDaemonIsHealthy(instanceID);
2238
-
2239
- if (daemonIsAlive[0] && !daemonIsAlive[1]) {
2240
- await this.delay(instanceErrorTime);
2241
- const daemonIsAliveAfterDelay = await this.checkDaemonIsHealthy(instanceID);
2242
-
2243
- if (daemonIsAliveAfterDelay[0] && !daemonIsAliveAfterDelay[1]) {
2244
- await this.delay(instanceErrorTime);
2245
- const daemonIsAliveAfterSecondDelay = await this.checkDaemonIsHealthy(instanceID);
2246
-
2247
- if (daemonIsAliveAfterSecondDelay[0] && !daemonIsAliveAfterSecondDelay[1]) {
2248
- return {
2249
- isAlive: Boolean(daemonIsAliveAfterSecondDelay[0]),
2250
- isHealthy: Boolean(daemonIsAliveAfterSecondDelay[1]),
2251
- instanceStatusString: String(daemonIsAliveAfterSecondDelay[2]),
2252
- };
2253
- }
2254
- }
2255
- }
2256
-
2257
- const daemonIsNotAlive = await this.checkDaemonIsAlive(instanceID, instanceDeactivationTime);
2258
- return {
2259
- isAlive: Boolean(daemonIsNotAlive[0]),
2260
- isHealthy: Boolean(daemonIsNotAlive[1]),
2261
- instanceStatusString: String(daemonIsNotAlive[2]),
2262
- };
2263
- };
2264
-
2265
- let isAlive = false;
2266
- let isHealthy = false;
2267
- let instanceStatusString = translations.instance_deactivated[this.userSystemLanguage];
2232
+ let isAlive;
2233
+ let isHealthy;
2234
+ let instanceStatusString;
2235
+ let daemonIsAlive;
2236
+ let daemonIsNotAlive;
2237
+ let scheduleIsAlive;
2238
+ let connectedToHost;
2239
+ let connectedToDevice;
2268
2240
 
2269
2241
  switch (instanceMode) {
2270
2242
  case 'schedule':
2271
- ({ isAlive, isHealthy, instanceStatusString } = await checkScheduleIsHealthy());
2243
+ scheduleIsAlive = await this.checkScheduleisHealty(instanceID, scheduleTime);
2244
+ isAlive = Boolean(scheduleIsAlive[0]);
2245
+ isHealthy = Boolean(scheduleIsAlive[1]);
2246
+ instanceStatusString = String(scheduleIsAlive[2]);
2272
2247
  break;
2273
2248
  case 'daemon':
2274
2249
  // check with time the user did define for error and deactivation
@@ -2277,12 +2252,36 @@ class DeviceWatcher extends utils.Adapter {
2277
2252
  instanceDeactivationTime = (userTimeInstances.deactivationTime * 1000) / 2;
2278
2253
  instanceErrorTime = (userTimeInstances.errorTime * 1000) / 2;
2279
2254
  }
2255
+ daemonIsAlive = await this.checkDaemonIsHealthy(instanceID);
2256
+ if (daemonIsAlive[0] && !daemonIsAlive[1]) {
2257
+ await this.delay(instanceErrorTime);
2258
+ const daemonIsAliveAfterDelay = await this.checkDaemonIsHealthy(instanceID);
2259
+
2260
+ if (daemonIsAliveAfterDelay[0] && !daemonIsAliveAfterDelay[1]) {
2261
+ await this.delay(instanceErrorTime);
2262
+ const daemonIsAliveAfterSecondDelay = await this.checkDaemonIsHealthy(instanceID);
2263
+
2264
+ if (daemonIsAliveAfterSecondDelay[0] && !daemonIsAliveAfterSecondDelay[1]) {
2265
+ isAlive = Boolean(daemonIsAliveAfterSecondDelay[0]);
2266
+ isHealthy = Boolean(daemonIsAliveAfterSecondDelay[1]);
2267
+ instanceStatusString = String(daemonIsAliveAfterSecondDelay[2]);
2268
+ connectedToHost = Boolean(daemonIsAliveAfterSecondDelay[3]);
2269
+ connectedToDevice = Boolean(daemonIsAliveAfterSecondDelay[4]);
2270
+ }
2271
+ }
2272
+ } else {
2273
+ daemonIsNotAlive = await this.checkDaemonIsAlive(instanceID, instanceDeactivationTime);
2274
+ isAlive = Boolean(daemonIsNotAlive[0]);
2275
+ isHealthy = Boolean(daemonIsNotAlive[1]);
2276
+ instanceStatusString = String(daemonIsNotAlive[2]);
2277
+ connectedToHost = Boolean(daemonIsNotAlive[3]);
2278
+ connectedToDevice = Boolean(daemonIsNotAlive[4]);
2279
+ }
2280
2280
 
2281
- ({ isAlive, isHealthy, instanceStatusString } = await checkDaemonIsHealthy());
2282
2281
  break;
2283
2282
  }
2284
2283
 
2285
- return [isAlive, isHealthy, instanceStatusString];
2284
+ return [isAlive, isHealthy, instanceStatusString, connectedToHost, connectedToDevice];
2286
2285
  }
2287
2286
 
2288
2287
  /**
@@ -2339,9 +2338,9 @@ class DeviceWatcher extends utils.Adapter {
2339
2338
 
2340
2339
  for (const [adapter, updateData] of this.adapterUpdatesJsonRaw) {
2341
2340
  this.listAdapterUpdates.push({
2342
- [translations.Adapter[this.userSystemLanguage]]: adapter,
2343
- [translations.Available_Version[this.userSystemLanguage]]: updateData.newVersion,
2344
- [translations.Installed_Version[this.userSystemLanguage]]: updateData.oldVersion,
2341
+ [translations.Adapter[this.config.userSelectedLanguage]]: adapter,
2342
+ [translations.Available_Version[this.config.userSelectedLanguage]]: updateData.newVersion,
2343
+ [translations.Installed_Version[this.config.userSelectedLanguage]]: updateData.oldVersion,
2345
2344
  });
2346
2345
  }
2347
2346
  this.countAdapterUpdates = this.listAdapterUpdates.length;
@@ -2358,9 +2357,9 @@ class DeviceWatcher extends utils.Adapter {
2358
2357
  if (this.countAdapterUpdates === 0) {
2359
2358
  this.listAdapterUpdates = [
2360
2359
  {
2361
- [translations.Adapter[this.userSystemLanguage]]: '--none--',
2362
- [translations.Available_Version[this.userSystemLanguage]]: '',
2363
- [translations.Installed_Version[this.userSystemLanguage]]: '',
2360
+ [translations.Adapter[this.config.userSelectedLanguage]]: '--none--',
2361
+ [translations.Available_Version[this.config.userSelectedLanguage]]: '',
2362
+ [translations.Installed_Version[this.config.userSelectedLanguage]]: '',
2364
2363
  },
2365
2364
  ];
2366
2365
  }
@@ -2391,40 +2390,40 @@ class DeviceWatcher extends utils.Adapter {
2391
2390
  if (this.blacklistInstancesLists.includes(instance)) continue;
2392
2391
  // all instances
2393
2392
  this.listAllInstances.push({
2394
- [translations.Adapter[this.userSystemLanguage]]: instanceData.Adapter,
2395
- [translations.Instance[this.userSystemLanguage]]: instance,
2396
- [translations.Mode[this.userSystemLanguage]]: instanceData.instanceMode,
2397
- [translations.Schedule[this.userSystemLanguage]]: instanceData.schedule,
2398
- [translations.Version[this.userSystemLanguage]]: instanceData.adapterVersion,
2399
- [translations.Updateable[this.userSystemLanguage]]: instanceData.updateAvailable,
2400
- [translations.Status[this.userSystemLanguage]]: instanceData.status,
2393
+ [translations.Adapter[this.config.userSelectedLanguage]]: instanceData.Adapter,
2394
+ [translations.Instance[this.config.userSelectedLanguage]]: instance,
2395
+ [translations.Mode[this.config.userSelectedLanguage]]: instanceData.instanceMode,
2396
+ [translations.Schedule[this.config.userSelectedLanguage]]: instanceData.schedule,
2397
+ [translations.Version[this.config.userSelectedLanguage]]: instanceData.adapterVersion,
2398
+ [translations.Updateable[this.config.userSelectedLanguage]]: instanceData.updateAvailable,
2399
+ [translations.Status[this.config.userSelectedLanguage]]: instanceData.status,
2401
2400
  });
2402
2401
 
2403
2402
  if (!instanceData.isAlive) {
2404
2403
  // list with deactivated instances
2405
2404
  this.listDeactivatedInstances.push({
2406
- [translations.Adapter[this.userSystemLanguage]]: instanceData.Adapter,
2407
- [translations.Instance[this.userSystemLanguage]]: instance,
2408
- [translations.Status[this.userSystemLanguage]]: instanceData.status,
2405
+ [translations.Adapter[this.config.userSelectedLanguage]]: instanceData.Adapter,
2406
+ [translations.Instance[this.config.userSelectedLanguage]]: instance,
2407
+ [translations.Status[this.config.userSelectedLanguage]]: instanceData.status,
2409
2408
  });
2410
2409
  } else {
2411
2410
  // list with active instances
2412
2411
  this.listAllActiveInstances.push({
2413
- [translations.Adapter[this.userSystemLanguage]]: instanceData.Adapter,
2414
- [translations.Instance[this.userSystemLanguage]]: instance,
2415
- [translations.Mode[this.userSystemLanguage]]: instanceData.instanceMode,
2416
- [translations.Schedule[this.userSystemLanguage]]: instanceData.schedule,
2417
- [translations.Status[this.userSystemLanguage]]: instanceData.status,
2412
+ [translations.Adapter[this.config.userSelectedLanguage]]: instanceData.Adapter,
2413
+ [translations.Instance[this.config.userSelectedLanguage]]: instance,
2414
+ [translations.Mode[this.config.userSelectedLanguage]]: instanceData.instanceMode,
2415
+ [translations.Schedule[this.config.userSelectedLanguage]]: instanceData.schedule,
2416
+ [translations.Status[this.config.userSelectedLanguage]]: instanceData.status,
2418
2417
  });
2419
2418
  }
2420
2419
 
2421
2420
  // list with error instances
2422
2421
  if (instanceData.isAlive && !instanceData.isHealthy) {
2423
2422
  this.listErrorInstance.push({
2424
- [translations.Adapter[this.userSystemLanguage]]: instanceData.Adapter,
2425
- [translations.Instance[this.userSystemLanguage]]: instance,
2426
- [translations.Mode[this.userSystemLanguage]]: instanceData.instanceMode,
2427
- [translations.Status[this.userSystemLanguage]]: instanceData.status,
2423
+ [translations.Adapter[this.config.userSelectedLanguage]]: instanceData.Adapter,
2424
+ [translations.Instance[this.config.userSelectedLanguage]]: instance,
2425
+ [translations.Mode[this.config.userSelectedLanguage]]: instanceData.instanceMode,
2426
+ [translations.Status[this.config.userSelectedLanguage]]: instanceData.status,
2428
2427
  });
2429
2428
  }
2430
2429
  }
@@ -2462,10 +2461,10 @@ class DeviceWatcher extends utils.Adapter {
2462
2461
  if (this.countDeactivatedInstances === 0) {
2463
2462
  this.listDeactivatedInstances = [
2464
2463
  {
2465
- [translations.Adapter[this.userSystemLanguage]]: '--none--',
2466
- [translations.Instance[this.userSystemLanguage]]: '',
2467
- [translations.Version[this.userSystemLanguage]]: '',
2468
- [translations.Status[this.userSystemLanguage]]: '',
2464
+ [translations.Adapter[this.config.userSelectedLanguage]]: '--none--',
2465
+ [translations.Instance[this.config.userSelectedLanguage]]: '',
2466
+ [translations.Version[this.config.userSelectedLanguage]]: '',
2467
+ [translations.Status[this.config.userSelectedLanguage]]: '',
2469
2468
  },
2470
2469
  ];
2471
2470
  }
@@ -2476,10 +2475,10 @@ class DeviceWatcher extends utils.Adapter {
2476
2475
  if (this.countErrorInstance === 0) {
2477
2476
  this.listErrorInstance = [
2478
2477
  {
2479
- [translations.Adapter[this.userSystemLanguage]]: '--none--',
2480
- [translations.Instance[this.userSystemLanguage]]: '',
2481
- [translations.Mode[this.userSystemLanguage]]: '',
2482
- [translations.Status[this.userSystemLanguage]]: '',
2478
+ [translations.Adapter[this.config.userSelectedLanguage]]: '--none--',
2479
+ [translations.Instance[this.config.userSelectedLanguage]]: '',
2480
+ [translations.Mode[this.config.userSelectedLanguage]]: '',
2481
+ [translations.Status[this.config.userSelectedLanguage]]: '',
2483
2482
  },
2484
2483
  ];
2485
2484
  }
@@ -2524,15 +2523,13 @@ class DeviceWatcher extends utils.Adapter {
2524
2523
  let instanceStatusRaw;
2525
2524
 
2526
2525
  const checkInstance = async (instanceID, instanceData) => {
2527
- if (!instanceData.checkIsRunning) {
2528
- instanceData.checkIsRunning = true;
2529
- instanceStatusRaw = await this.setInstanceStatus(instanceData.instanceMode, instanceData.schedule, instanceID);
2530
- instanceData.isAlive = instanceStatusRaw[0];
2531
- instanceData.isHealthy = instanceStatusRaw[1];
2532
- instanceData.status = instanceStatusRaw[2];
2533
- instanceData.checkIsRunning = false;
2534
- return;
2535
- }
2526
+ instanceStatusRaw = await this.setInstanceStatus(instanceData.instanceMode, instanceData.schedule, instanceID);
2527
+ instanceData.isAlive = instanceStatusRaw[0];
2528
+ instanceData.isHealthy = instanceStatusRaw[1];
2529
+ instanceData.status = instanceStatusRaw[2];
2530
+ instanceData.isConnectedHost = instanceStatusRaw[3];
2531
+ instanceData.isConnectedDevice = instanceStatusRaw[4];
2532
+ return;
2536
2533
  };
2537
2534
 
2538
2535
  switch (id) {
@@ -3080,25 +3077,25 @@ class DeviceWatcher extends utils.Adapter {
3080
3077
 
3081
3078
  switch (type) {
3082
3079
  case 'lowBatDevice':
3083
- message = `${translations.Device_low_bat_detected[this.userSystemLanguage]}: \n${adapterName} ${objectData.Device} (${objectData.Battery})`;
3080
+ message = `${translations.Device_low_bat_detected[this.config.userSelectedLanguage]}: \n${adapterName} ${objectData.Device} (${objectData.Battery})`;
3084
3081
  await setMessage(message);
3085
3082
  break;
3086
3083
 
3087
3084
  case 'onlineStateDevice':
3088
3085
  switch (objectData.Status) {
3089
3086
  case 'Online':
3090
- message = `${translations.Device_available_again[this.userSystemLanguage]}: \n${adapterName} ${objectData.Device} (${objectData.LastContact})`;
3087
+ message = `${translations.Device_available_again[this.config.userSelectedLanguage]}: \n${adapterName} ${objectData.Device} (${objectData.LastContact})`;
3091
3088
  break;
3092
3089
 
3093
3090
  case 'Offline':
3094
- message = `${translations.Device_not_reachable[this.userSystemLanguage]}: \n${adapterName} ${objectData.Device} (${objectData.LastContact})`;
3091
+ message = `${translations.Device_not_reachable[this.config.userSelectedLanguage]}: \n${adapterName} ${objectData.Device} (${objectData.LastContact})`;
3095
3092
  break;
3096
3093
  }
3097
3094
  await setMessage(message);
3098
3095
  break;
3099
3096
 
3100
3097
  case 'updateDevice':
3101
- message = `${translations.Device_new_updates[this.userSystemLanguage]}: \n${adapterName} ${objectData.Device}`;
3098
+ message = `${translations.Device_new_updates[this.config.userSelectedLanguage]}: \n${adapterName} ${objectData.Device}`;
3102
3099
  await setMessage(message);
3103
3100
  break;
3104
3101
 
@@ -3109,16 +3106,16 @@ class DeviceWatcher extends utils.Adapter {
3109
3106
  list = '';
3110
3107
 
3111
3108
  for (const id of objectData) {
3112
- list = `${list}\n${id[translations.Adapter[this.userSystemLanguage]]}: v${id[translations.Available_Version[this.userSystemLanguage]]}`;
3109
+ list = `${list}\n${id[translations.Adapter[this.config.userSelectedLanguage]]}: v${id[translations.Available_Version[this.config.userSelectedLanguage]]}`;
3113
3110
  }
3114
3111
 
3115
- message = `${translations.Adapter_new_updates[this.userSystemLanguage]}: ${list}`;
3112
+ message = `${translations.Adapter_new_updates[this.config.userSelectedLanguage]}: ${list}`;
3116
3113
  await setMessage(message);
3117
3114
  break;
3118
3115
 
3119
3116
  case 'errorInstance':
3120
3117
  case 'deactivatedInstance':
3121
- message = `${translations.Instance_Watchdog[this.userSystemLanguage]}:\n${id}: ${objectData.status}`;
3118
+ message = `${translations.Instance_Watchdog[this.config.userSelectedLanguage]}:\n${id}: ${objectData.status}`;
3122
3119
  await setMessage(message);
3123
3120
  break;
3124
3121
  }
@@ -3143,6 +3140,7 @@ class DeviceWatcher extends utils.Adapter {
3143
3140
  };
3144
3141
 
3145
3142
  const processDeviceList = (deviceList, property1, property2) => {
3143
+ list = '';
3146
3144
  for (const id of deviceList) {
3147
3145
  if (this.blacklistNotify.includes(id.Path)) continue;
3148
3146
  list += `\n${!this.config.showAdapterNameinMsg ? '' : id.Adapter + ': '}${id[property1]}${property2 ? ` (${id[property2]})` : ''}`;
@@ -3150,9 +3148,10 @@ class DeviceWatcher extends utils.Adapter {
3150
3148
  };
3151
3149
 
3152
3150
  const processInstanceList = (instanceList, property) => {
3151
+ list = '';
3153
3152
  for (const id of instanceList) {
3154
- if (this.blacklistInstancesNotify.includes(id[translations['Instance'][this.userSystemLanguage]])) continue;
3155
- list += `\n${id[translations['Instance'][this.userSystemLanguage]]}${property ? `: ${id[property]}` : ''}`;
3153
+ if (this.blacklistInstancesNotify.includes(id[translations['Instance'][this.config.userSelectedLanguage]])) continue;
3154
+ list += `\n${id[translations['Instance'][this.config.userSelectedLanguage]]}${property ? `: ${id[property]}` : ''}`;
3156
3155
  }
3157
3156
  };
3158
3157
 
@@ -3161,13 +3160,13 @@ class DeviceWatcher extends utils.Adapter {
3161
3160
 
3162
3161
  switch (checkDays.length) {
3163
3162
  case 1:
3164
- message = `${translations.Weekly_overview[this.userSystemLanguage]} ${translations[messageType][this.userSystemLanguage]}: ${list}`;
3163
+ message = `${translations.Weekly_overview[this.config.userSelectedLanguage]} ${translations[messageType][this.config.userSelectedLanguage]}: ${list}`;
3165
3164
  break;
3166
3165
  case 7:
3167
- message = `${translations.Daily_overview[this.userSystemLanguage]} ${translations[messageType][this.userSystemLanguage]}: ${list}`;
3166
+ message = `${translations.Daily_overview[this.config.userSelectedLanguage]} ${translations[messageType][this.config.userSelectedLanguage]}: ${list}`;
3168
3167
  break;
3169
3168
  default:
3170
- message = `${translations.Overview_of[this.userSystemLanguage]} ${translations[messageType][this.userSystemLanguage]}: ${list}`;
3169
+ message = `${translations.Overview_of[this.config.userSelectedLanguage]} ${translations[messageType][this.config.userSelectedLanguage]}: ${list}`;
3171
3170
  break;
3172
3171
  }
3173
3172
 
@@ -3233,8 +3232,9 @@ class DeviceWatcher extends utils.Adapter {
3233
3232
  this.log.debug(`Number of selected days for daily adapter update message: ${checkDays.length}. Send Message on: ${checkDays.join(', ')} ...`);
3234
3233
 
3235
3234
  schedule.scheduleJob(`4 ${this.config.checkSendAdapterUpdateTime.split(':').reverse().join(' ')} * * ${checkDays.join(',')}`, async () => {
3235
+ list = '';
3236
3236
  for (const id of this.listAdapterUpdates) {
3237
- list = `${list}\n${id[translations.Adapter[this.userSystemLanguage]]}: v${id[translations.Available_Version[this.userSystemLanguage]]}`;
3237
+ list = `${list}\n${id[translations.Adapter[this.config.userSelectedLanguage]]}: v${id[translations.Available_Version[this.config.userSelectedLanguage]]}`;
3238
3238
  }
3239
3239
  await processNotification(list, 'available_adapter_updates');
3240
3240
  });
@@ -3293,14 +3293,14 @@ class DeviceWatcher extends utils.Adapter {
3293
3293
  return a.localeCompare(b);
3294
3294
  });
3295
3295
  html = `<center>
3296
- <b>${[translations.Link_quality_devices[this.userSystemLanguage]]}:<font> ${deviceCount}</b><small></small></font>
3296
+ <b>${[translations.Link_quality_devices[this.config.userSelectedLanguage]]}:<font> ${deviceCount}</b><small></small></font>
3297
3297
  <p></p>
3298
3298
  </center>
3299
3299
  <table width=100%>
3300
3300
  <tr>
3301
- <th align=left>${[translations.Device[this.userSystemLanguage]]}</th>
3302
- <th align=center width=120>${[translations.Adapter[this.userSystemLanguage]]}</th>
3303
- <th align=right>${[translations.Signal_strength[this.userSystemLanguage]]}</th>
3301
+ <th align=left>${[translations.Device[this.config.userSelectedLanguage]]}</th>
3302
+ <th align=center width=120>${[translations.Adapter[this.config.userSelectedLanguage]]}</th>
3303
+ <th align=right>${[translations.Signal_strength[this.config.userSelectedLanguage]]}</th>
3304
3304
  </tr>
3305
3305
  <tr>
3306
3306
  <td colspan="5"><hr></td>
@@ -3308,9 +3308,9 @@ class DeviceWatcher extends utils.Adapter {
3308
3308
 
3309
3309
  for (const device of devices) {
3310
3310
  html += `<tr>
3311
- <td><font>${device[translations.Device[this.userSystemLanguage]]}</font></td>
3312
- <td align=center><font>${device[translations.Adapter[this.userSystemLanguage]]}</font></td>
3313
- <td align=right><font>${device[translations.Signal_strength[this.userSystemLanguage]]}</font></td>
3311
+ <td><font>${device[translations.Device[this.config.userSelectedLanguage]]}</font></td>
3312
+ <td align=center><font>${device[translations.Adapter[this.config.userSelectedLanguage]]}</font></td>
3313
+ <td align=right><font>${device[translations.Signal_strength[this.config.userSelectedLanguage]]}</font></td>
3314
3314
  </tr>`;
3315
3315
  }
3316
3316
 
@@ -3324,14 +3324,14 @@ class DeviceWatcher extends utils.Adapter {
3324
3324
  return a.localeCompare(b);
3325
3325
  });
3326
3326
  html = `<center>
3327
- <b>${[translations.offline_devices[this.userSystemLanguage]]}: <font color=${deviceCount === 0 ? '#3bcf0e' : 'orange'}>${deviceCount}</b><small></small></font>
3327
+ <b>${[translations.offline_devices[this.config.userSelectedLanguage]]}: <font color=${deviceCount === 0 ? '#3bcf0e' : 'orange'}>${deviceCount}</b><small></small></font>
3328
3328
  <p></p>
3329
3329
  </center>
3330
3330
  <table width=100%>
3331
3331
  <tr>
3332
- <th align=left>${[translations.Device[this.userSystemLanguage]]}</th>
3333
- <th align=center width=120>${[translations.Adapter[this.userSystemLanguage]]}</th>
3334
- <th align=center>${[translations.Last_Contact[this.userSystemLanguage]]}</th>
3332
+ <th align=left>${[translations.Device[this.config.userSelectedLanguage]]}</th>
3333
+ <th align=center width=120>${[translations.Adapter[this.config.userSelectedLanguage]]}</th>
3334
+ <th align=center>${[translations.Last_Contact[this.config.userSelectedLanguage]]}</th>
3335
3335
  </tr>
3336
3336
  <tr>
3337
3337
  <td colspan="5"><hr></td>
@@ -3339,9 +3339,9 @@ class DeviceWatcher extends utils.Adapter {
3339
3339
 
3340
3340
  for (const device of devices) {
3341
3341
  html += `<tr>
3342
- <td><font>${device[translations.Device[this.userSystemLanguage]]}</font></td>
3343
- <td align=center><font>${device[translations.Adapter[this.userSystemLanguage]]}</font></td>
3344
- <td align=center><font color=orange>${device[translations.Last_Contact[this.userSystemLanguage]]}</font></td>
3342
+ <td><font>${device[translations.Device[this.config.userSelectedLanguage]]}</font></td>
3343
+ <td align=center><font>${device[translations.Adapter[this.config.userSelectedLanguage]]}</font></td>
3344
+ <td align=center><font color=orange>${device[translations.Last_Contact[this.config.userSelectedLanguage]]}</font></td>
3345
3345
  </tr>`;
3346
3346
  }
3347
3347
 
@@ -3355,28 +3355,28 @@ class DeviceWatcher extends utils.Adapter {
3355
3355
  return a.localeCompare(b);
3356
3356
  });
3357
3357
  html = `<center>
3358
- <b>${isLowBatteryList === true ? `${[translations.low[this.userSystemLanguage]]} ` : ''}${[translations.battery_devices[this.userSystemLanguage]]}:
3358
+ <b>${isLowBatteryList === true ? `${[translations.low[this.config.userSelectedLanguage]]} ` : ''}${[translations.battery_devices[this.config.userSelectedLanguage]]}:
3359
3359
  <font color=${isLowBatteryList === true ? (deviceCount > 0 ? 'orange' : '#3bcf0e') : ''}>${deviceCount}</b></font>
3360
3360
  <p></p>
3361
3361
  </center>
3362
3362
  <table width=100%>
3363
3363
  <tr>
3364
- <th align=left>${[translations.Device[this.userSystemLanguage]]}</th>
3365
- <th align=center width=120>${[translations.Adapter[this.userSystemLanguage]]}</th>
3366
- <th align=${isLowBatteryList ? 'center' : 'right'}>${[translations.Battery[this.userSystemLanguage]]}</th>
3364
+ <th align=left>${[translations.Device[this.config.userSelectedLanguage]]}</th>
3365
+ <th align=center width=120>${[translations.Adapter[this.config.userSelectedLanguage]]}</th>
3366
+ <th align=${isLowBatteryList ? 'center' : 'right'}>${[translations.Battery[this.config.userSelectedLanguage]]}</th>
3367
3367
  </tr>
3368
3368
  <tr>
3369
3369
  <td colspan="5"><hr></td>
3370
3370
  </tr>`;
3371
3371
  for (const device of devices) {
3372
3372
  html += `<tr>
3373
- <td><font>${device[translations.Device[this.userSystemLanguage]]}</font></td>
3374
- <td align=center><font>${device[translations.Adapter[this.userSystemLanguage]]}</font></td>`;
3373
+ <td><font>${device[translations.Device[this.config.userSelectedLanguage]]}</font></td>
3374
+ <td align=center><font>${device[translations.Adapter[this.config.userSelectedLanguage]]}</font></td>`;
3375
3375
 
3376
3376
  if (isLowBatteryList) {
3377
- html += `<td align=center><font color=orange>${device[translations.Battery[this.userSystemLanguage]]}</font></td>`;
3377
+ html += `<td align=center><font color=orange>${device[translations.Battery[this.config.userSelectedLanguage]]}</font></td>`;
3378
3378
  } else {
3379
- html += `<td align=right><font color=#3bcf0e>${device[translations.Battery[this.userSystemLanguage]]}</font></td>`;
3379
+ html += `<td align=right><font color=#3bcf0e>${device[translations.Battery[this.config.userSelectedLanguage]]}</font></td>`;
3380
3380
  }
3381
3381
  html += `</tr>`;
3382
3382
  }
@@ -3402,14 +3402,14 @@ class DeviceWatcher extends utils.Adapter {
3402
3402
  return a.localeCompare(b);
3403
3403
  });
3404
3404
  html = `<center>
3405
- <b>${[translations.All_Instances[this.userSystemLanguage]]}:<font> ${instancesCount}</b><small></small></font>
3405
+ <b>${[translations.All_Instances[this.config.userSelectedLanguage]]}:<font> ${instancesCount}</b><small></small></font>
3406
3406
  <p></p>
3407
3407
  </center>
3408
3408
  <table width=100%>
3409
3409
  <tr>
3410
- <th align=left>${[translations.Adapter[this.userSystemLanguage]]}</th>
3411
- <th align=center>${[translations.Instance[this.userSystemLanguage]]}</th>
3412
- <th align=center width=180>${[translations.Status[this.userSystemLanguage]]}</th>
3410
+ <th align=left>${[translations.Adapter[this.config.userSelectedLanguage]]}</th>
3411
+ <th align=center>${[translations.Instance[this.config.userSelectedLanguage]]}</th>
3412
+ <th align=center width=180>${[translations.Status[this.config.userSelectedLanguage]]}</th>
3413
3413
  </tr>
3414
3414
  <tr>
3415
3415
  <td colspan="5"><hr></td>
@@ -3417,9 +3417,9 @@ class DeviceWatcher extends utils.Adapter {
3417
3417
 
3418
3418
  for (const instanceData of instances) {
3419
3419
  html += `<tr>
3420
- <td><font>${instanceData[translations.Adapter[this.userSystemLanguage]]}</font></td>
3421
- <td align=center><font>${instanceData[translations.Instance[this.userSystemLanguage]]}</font></td>
3422
- <td align=center><font>${instanceData[translations.Status[this.userSystemLanguage]]}</font></td>
3420
+ <td><font>${instanceData[translations.Adapter[this.config.userSelectedLanguage]]}</font></td>
3421
+ <td align=center><font>${instanceData[translations.Instance[this.config.userSelectedLanguage]]}</font></td>
3422
+ <td align=center><font>${instanceData[translations.Status[this.config.userSelectedLanguage]]}</font></td>
3423
3423
  </tr>`;
3424
3424
  }
3425
3425
 
@@ -3433,14 +3433,14 @@ class DeviceWatcher extends utils.Adapter {
3433
3433
  return a.localeCompare(b);
3434
3434
  });
3435
3435
  html = `<center>
3436
- <b>${[translations.Active_Instances[this.userSystemLanguage]]}: <font> ${instancesCount}</b><small></small></font>
3436
+ <b>${[translations.Active_Instances[this.config.userSelectedLanguage]]}: <font> ${instancesCount}</b><small></small></font>
3437
3437
  <p></p>
3438
3438
  </center>
3439
3439
  <table width=100%>
3440
3440
  <tr>
3441
- <th align=left>${[translations.Adapter[this.userSystemLanguage]]}</th>
3442
- <th align=center>${[translations.Instance[this.userSystemLanguage]]}</th>
3443
- <th align=center width=180>${[translations.Status[this.userSystemLanguage]]}</th>
3441
+ <th align=left>${[translations.Adapter[this.config.userSelectedLanguage]]}</th>
3442
+ <th align=center>${[translations.Instance[this.config.userSelectedLanguage]]}</th>
3443
+ <th align=center width=180>${[translations.Status[this.config.userSelectedLanguage]]}</th>
3444
3444
  </tr>
3445
3445
  <tr>
3446
3446
  <td colspan="5"><hr></td>
@@ -3448,9 +3448,9 @@ class DeviceWatcher extends utils.Adapter {
3448
3448
 
3449
3449
  for (const instanceData of instances) {
3450
3450
  html += `<tr>
3451
- <td><font>${instanceData[translations.Adapter[this.userSystemLanguage]]}</font></td>
3452
- <td align=center><font>${instanceData[translations.Instance[this.userSystemLanguage]]}</font></td>
3453
- <td align=center><font color=orange>${instanceData[translations.Status[this.userSystemLanguage]]}</font></td>
3451
+ <td><font>${instanceData[translations.Adapter[this.config.userSelectedLanguage]]}</font></td>
3452
+ <td align=center><font>${instanceData[translations.Instance[this.config.userSelectedLanguage]]}</font></td>
3453
+ <td align=center><font color=orange>${instanceData[translations.Status[this.config.userSelectedLanguage]]}</font></td>
3454
3454
  </tr>`;
3455
3455
  }
3456
3456
 
@@ -3464,14 +3464,14 @@ class DeviceWatcher extends utils.Adapter {
3464
3464
  return a.localeCompare(b);
3465
3465
  });
3466
3466
  html = `<center>
3467
- <b>${[translations.Error_Instances[this.userSystemLanguage]]}: <font color=${instancesCount === 0 ? '#3bcf0e' : 'orange'}>${instancesCount}</b><small></small></font>
3467
+ <b>${[translations.Error_Instances[this.config.userSelectedLanguage]]}: <font color=${instancesCount === 0 ? '#3bcf0e' : 'orange'}>${instancesCount}</b><small></small></font>
3468
3468
  <p></p>
3469
3469
  </center>
3470
3470
  <table width=100%>
3471
3471
  <tr>
3472
- <th align=left>${[translations.Adapter[this.userSystemLanguage]]}</th>
3473
- <th align=center>${[translations.Instance[this.userSystemLanguage]]}</th>
3474
- <th align=center width=180>${[translations.Status[this.userSystemLanguage]]}</th>
3472
+ <th align=left>${[translations.Adapter[this.config.userSelectedLanguage]]}</th>
3473
+ <th align=center>${[translations.Instance[this.config.userSelectedLanguage]]}</th>
3474
+ <th align=center width=180>${[translations.Status[this.config.userSelectedLanguage]]}</th>
3475
3475
  </tr>
3476
3476
  <tr>
3477
3477
  <td colspan="5"><hr></td>
@@ -3479,9 +3479,9 @@ class DeviceWatcher extends utils.Adapter {
3479
3479
 
3480
3480
  for (const instanceData of instances) {
3481
3481
  html += `<tr>
3482
- <td><font>${instanceData[translations.Adapter[this.userSystemLanguage]]}</font></td>
3483
- <td align=center><font>${instanceData[translations.Instance[this.userSystemLanguage]]}</font></td>
3484
- <td align=center><font color=orange>${instanceData[translations.Status[this.userSystemLanguage]]}</font></td>
3482
+ <td><font>${instanceData[translations.Adapter[this.config.userSelectedLanguage]]}</font></td>
3483
+ <td align=center><font>${instanceData[translations.Instance[this.config.userSelectedLanguage]]}</font></td>
3484
+ <td align=center><font color=orange>${instanceData[translations.Status[this.config.userSelectedLanguage]]}</font></td>
3485
3485
  </tr>`;
3486
3486
  }
3487
3487
 
@@ -3495,14 +3495,14 @@ class DeviceWatcher extends utils.Adapter {
3495
3495
  return a.localeCompare(b);
3496
3496
  });
3497
3497
  html = `<center>
3498
- <b>${[translations.Deactivated_Instances[this.userSystemLanguage]]}: <font color=${instancesCount === 0 ? '#3bcf0e' : 'orange'}>${instancesCount}</b><small></small></font>
3498
+ <b>${[translations.Deactivated_Instances[this.config.userSelectedLanguage]]}: <font color=${instancesCount === 0 ? '#3bcf0e' : 'orange'}>${instancesCount}</b><small></small></font>
3499
3499
  <p></p>
3500
3500
  </center>
3501
3501
  <table width=100%>
3502
3502
  <tr>
3503
- <th align=left>${[translations.Adapter[this.userSystemLanguage]]}</th>
3504
- <th align=center>${[translations.Instance[this.userSystemLanguage]]}</th>
3505
- <th align=center width=180>${[translations.Status[this.userSystemLanguage]]}</th>
3503
+ <th align=left>${[translations.Adapter[this.config.userSelectedLanguage]]}</th>
3504
+ <th align=center>${[translations.Instance[this.config.userSelectedLanguage]]}</th>
3505
+ <th align=center width=180>${[translations.Status[this.config.userSelectedLanguage]]}</th>
3506
3506
  </tr>
3507
3507
  <tr>
3508
3508
  <td colspan="5"><hr></td>
@@ -3511,9 +3511,9 @@ class DeviceWatcher extends utils.Adapter {
3511
3511
  for (const instanceData of instances) {
3512
3512
  if (!instanceData.isAlive) {
3513
3513
  html += `<tr>
3514
- <td><font>${instanceData[translations.Adapter[this.userSystemLanguage]]}</font></td>
3515
- <td align=center><font>${instanceData[translations.Instance[this.userSystemLanguage]]}</font></td>
3516
- <td align=center><font color=orange>${instanceData[translations.Status[this.userSystemLanguage]]}</font></td>
3514
+ <td><font>${instanceData[translations.Adapter[this.config.userSelectedLanguage]]}</font></td>
3515
+ <td align=center><font>${instanceData[translations.Instance[this.config.userSelectedLanguage]]}</font></td>
3516
+ <td align=center><font color=orange>${instanceData[translations.Status[this.config.userSelectedLanguage]]}</font></td>
3517
3517
  </tr>`;
3518
3518
  }
3519
3519
  }
@@ -3523,14 +3523,14 @@ class DeviceWatcher extends utils.Adapter {
3523
3523
 
3524
3524
  case 'updateAdapterList':
3525
3525
  html = `<center>
3526
- <b>${[translations.Updatable_adapters[this.userSystemLanguage]]}: <font color=${instancesCount === 0 ? '#3bcf0e' : 'orange'}>${instancesCount}</b><small></small></font>
3526
+ <b>${[translations.Updatable_adapters[this.config.userSelectedLanguage]]}: <font color=${instancesCount === 0 ? '#3bcf0e' : 'orange'}>${instancesCount}</b><small></small></font>
3527
3527
  <p></p>
3528
3528
  </center>
3529
3529
  <table width=100%>
3530
3530
  <tr>
3531
- <th align=left>${[translations.Adapter[this.userSystemLanguage]]}</th>
3532
- <th align=center>${[translations.Installed_Version[this.userSystemLanguage]]}</th>
3533
- <th align=center>${[translations.Available_Version[this.userSystemLanguage]]}</th>
3531
+ <th align=left>${[translations.Adapter[this.config.userSelectedLanguage]]}</th>
3532
+ <th align=center>${[translations.Installed_Version[this.config.userSelectedLanguage]]}</th>
3533
+ <th align=center>${[translations.Available_Version[this.config.userSelectedLanguage]]}</th>
3534
3534
  </tr>
3535
3535
  <tr>
3536
3536
  <td colspan="5"><hr></td>
@@ -3539,9 +3539,9 @@ class DeviceWatcher extends utils.Adapter {
3539
3539
  for (const instanceData of instances.values()) {
3540
3540
  if (instanceData.updateAvailable !== ' - ') {
3541
3541
  html += `<tr>
3542
- <td><font>${instanceData[translations.Adapter[this.userSystemLanguage]]}</font></td>
3543
- <td align=center><font>${instanceData[translations.Installed_Version[this.userSystemLanguage]]}</font></td>
3544
- <td align=center><font color=orange>${instanceData[translations.Available_Version[this.userSystemLanguage]]}</font></td>
3542
+ <td><font>${instanceData[translations.Adapter[this.config.userSelectedLanguage]]}</font></td>
3543
+ <td align=center><font>${instanceData[translations.Installed_Version[this.config.userSelectedLanguage]]}</font></td>
3544
+ <td align=center><font color=orange>${instanceData[translations.Available_Version[this.config.userSelectedLanguage]]}</font></td>
3545
3545
  </tr>`;
3546
3546
  }
3547
3547
  }