iobroker.device-watcher 2.10.1 → 2.10.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/README.md +5 -0
- package/io-package.json +838 -860
- package/main.js +172 -130
- package/package.json +1 -1
package/main.js
CHANGED
|
@@ -80,8 +80,12 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
80
80
|
// Interval timer
|
|
81
81
|
this.refreshDataTimeout = null;
|
|
82
82
|
|
|
83
|
+
// Check if main function is running
|
|
83
84
|
this.mainRunning = false;
|
|
84
85
|
|
|
86
|
+
// System anguage
|
|
87
|
+
this.userSystemLanguage;
|
|
88
|
+
|
|
85
89
|
this.on('ready', this.onReady.bind(this));
|
|
86
90
|
this.on('stateChange', this.onStateChange.bind(this));
|
|
87
91
|
this.on('objectChange', this.onObjectChange.bind(this));
|
|
@@ -95,6 +99,13 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
95
99
|
async onReady() {
|
|
96
100
|
this.log.debug(`Adapter ${adapterName} was started`);
|
|
97
101
|
|
|
102
|
+
// set user language
|
|
103
|
+
if (this.userSystemLanguage === undefined && this.userSystemLanguage === null) {
|
|
104
|
+
this.userSystemLanguage = 'de';
|
|
105
|
+
} else {
|
|
106
|
+
this.userSystemLanguage = this.language;
|
|
107
|
+
}
|
|
108
|
+
|
|
98
109
|
this.configCreateInstanceList = this.config.checkAdapterInstances;
|
|
99
110
|
this.configListOnlyBattery = this.config.listOnlyBattery;
|
|
100
111
|
this.configCreateOwnFolder = this.config.createOwnFolder;
|
|
@@ -1212,10 +1223,10 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1212
1223
|
|
|
1213
1224
|
lastContactString = `${this.formatDate(new Date(selector), 'hh:mm')}`;
|
|
1214
1225
|
if (Math.round(lastContact) > 100) {
|
|
1215
|
-
lastContactString = `${Math.round(lastContact / 60)} ${translations.hours[this.
|
|
1226
|
+
lastContactString = `${Math.round(lastContact / 60)} ${translations.hours[this.userSystemLanguage]}`;
|
|
1216
1227
|
}
|
|
1217
1228
|
if (Math.round(lastContact / 60) > 48) {
|
|
1218
|
-
lastContactString = `${Math.round(lastContact / 60 / 24)} ${translations.days[this.
|
|
1229
|
+
lastContactString = `${Math.round(lastContact / 60 / 24)} ${translations.days[this.userSystemLanguage]}`;
|
|
1219
1230
|
}
|
|
1220
1231
|
return lastContactString;
|
|
1221
1232
|
}
|
|
@@ -1548,56 +1559,56 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1548
1559
|
|
|
1549
1560
|
// List with all devices
|
|
1550
1561
|
this.listAllDevices.push({
|
|
1551
|
-
[translations.Device[this.
|
|
1552
|
-
[translations.Adapter[this.
|
|
1553
|
-
[translations.Battery[this.
|
|
1554
|
-
[translations.Signal_strength[this.
|
|
1555
|
-
[translations.Last_Contact[this.
|
|
1556
|
-
[translations.Status[this.
|
|
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,
|
|
1557
1568
|
});
|
|
1558
1569
|
|
|
1559
1570
|
// LinkQuality lists
|
|
1560
1571
|
if (device.SignalStrength != ' - ') {
|
|
1561
1572
|
this.linkQualityDevices.push({
|
|
1562
|
-
[translations.Device[this.
|
|
1563
|
-
[translations.Adapter[this.
|
|
1564
|
-
[translations.Signal_strength[this.
|
|
1573
|
+
[translations.Device[this.userSystemLanguage]]: device.Device,
|
|
1574
|
+
[translations.Adapter[this.userSystemLanguage]]: device.Adapter,
|
|
1575
|
+
[translations.Signal_strength[this.userSystemLanguage]]: device.SignalStrength,
|
|
1565
1576
|
});
|
|
1566
1577
|
}
|
|
1567
1578
|
|
|
1568
1579
|
// Battery lists
|
|
1569
1580
|
if (device.isBatteryDevice) {
|
|
1570
1581
|
this.batteryPowered.push({
|
|
1571
|
-
[translations.Device[this.
|
|
1572
|
-
[translations.Adapter[this.
|
|
1573
|
-
[translations.Battery[this.
|
|
1574
|
-
[translations.Status[this.
|
|
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,
|
|
1575
1586
|
});
|
|
1576
1587
|
}
|
|
1577
1588
|
|
|
1578
1589
|
// Low Bat lists
|
|
1579
1590
|
if (device.LowBat && device.Status !== 'Offline') {
|
|
1580
1591
|
this.batteryLowPowered.push({
|
|
1581
|
-
[translations.Device[this.
|
|
1582
|
-
[translations.Adapter[this.
|
|
1583
|
-
[translations.Battery[this.
|
|
1592
|
+
[translations.Device[this.userSystemLanguage]]: device.Device,
|
|
1593
|
+
[translations.Adapter[this.userSystemLanguage]]: device.Adapter,
|
|
1594
|
+
[translations.Battery[this.userSystemLanguage]]: device.Battery,
|
|
1584
1595
|
});
|
|
1585
1596
|
}
|
|
1586
1597
|
|
|
1587
1598
|
// Offline List
|
|
1588
1599
|
if (device.Status === 'Offline') {
|
|
1589
1600
|
this.offlineDevices.push({
|
|
1590
|
-
[translations.Device[this.
|
|
1591
|
-
[translations.Adapter[this.
|
|
1592
|
-
[translations.Last_Contact[this.
|
|
1601
|
+
[translations.Device[this.userSystemLanguage]]: device.Device,
|
|
1602
|
+
[translations.Adapter[this.userSystemLanguage]]: device.Adapter,
|
|
1603
|
+
[translations.Last_Contact[this.userSystemLanguage]]: device.LastContact,
|
|
1593
1604
|
});
|
|
1594
1605
|
}
|
|
1595
1606
|
|
|
1596
1607
|
// Device update List
|
|
1597
1608
|
if (device.Upgradable === true || device.Upgradable === 1) {
|
|
1598
1609
|
this.upgradableList.push({
|
|
1599
|
-
[translations.Device[this.
|
|
1600
|
-
[translations.Adapter[this.
|
|
1610
|
+
[translations.Device[this.userSystemLanguage]]: device.Device,
|
|
1611
|
+
[translations.Adapter[this.userSystemLanguage]]: device.Adapter,
|
|
1601
1612
|
});
|
|
1602
1613
|
}
|
|
1603
1614
|
}
|
|
@@ -1652,12 +1663,12 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1652
1663
|
// if no device is count, write the JSON List with default value
|
|
1653
1664
|
this.listAllDevices = [
|
|
1654
1665
|
{
|
|
1655
|
-
[translations.Device[this.
|
|
1656
|
-
[translations.Adapter[this.
|
|
1657
|
-
[translations.Battery[this.
|
|
1658
|
-
[translations.Signal_strength[this.
|
|
1659
|
-
[translations.Last_Contact[this.
|
|
1660
|
-
[translations.Status[this.
|
|
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]]: '',
|
|
1661
1672
|
},
|
|
1662
1673
|
];
|
|
1663
1674
|
this.listAllDevicesUserRaw = [
|
|
@@ -1685,9 +1696,9 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1685
1696
|
// if no device is count, write the JSON List with default value
|
|
1686
1697
|
this.linkQualityDevices = [
|
|
1687
1698
|
{
|
|
1688
|
-
[translations.Device[this.
|
|
1689
|
-
[translations.Adapter[this.
|
|
1690
|
-
[translations.Signal_strength[this.
|
|
1699
|
+
[translations.Device[this.userSystemLanguage]]: '--none--',
|
|
1700
|
+
[translations.Adapter[this.userSystemLanguage]]: '',
|
|
1701
|
+
[translations.Signal_strength[this.userSystemLanguage]]: '',
|
|
1691
1702
|
},
|
|
1692
1703
|
];
|
|
1693
1704
|
}
|
|
@@ -1702,9 +1713,9 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1702
1713
|
// if no device is count, write the JSON List with default value
|
|
1703
1714
|
this.offlineDevices = [
|
|
1704
1715
|
{
|
|
1705
|
-
[translations.Device[this.
|
|
1706
|
-
[translations.Adapter[this.
|
|
1707
|
-
[translations.Last_Contact[this.
|
|
1716
|
+
[translations.Device[this.userSystemLanguage]]: '--none--',
|
|
1717
|
+
[translations.Adapter[this.userSystemLanguage]]: '',
|
|
1718
|
+
[translations.Last_Contact[this.userSystemLanguage]]: '',
|
|
1708
1719
|
},
|
|
1709
1720
|
];
|
|
1710
1721
|
}
|
|
@@ -1719,9 +1730,9 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1719
1730
|
// if no device is count, write the JSON List with default value
|
|
1720
1731
|
this.upgradableList = [
|
|
1721
1732
|
{
|
|
1722
|
-
[translations.Device[this.
|
|
1723
|
-
[translations.Adapter[this.
|
|
1724
|
-
[translations.Last_Contact[this.
|
|
1733
|
+
[translations.Device[this.userSystemLanguage]]: '--none--',
|
|
1734
|
+
[translations.Adapter[this.userSystemLanguage]]: '',
|
|
1735
|
+
[translations.Last_Contact[this.userSystemLanguage]]: '',
|
|
1725
1736
|
},
|
|
1726
1737
|
];
|
|
1727
1738
|
}
|
|
@@ -1734,7 +1745,9 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1734
1745
|
// List battery powered
|
|
1735
1746
|
if (this.batteryPoweredCount === 0) {
|
|
1736
1747
|
// if no device is count, write the JSON List with default value
|
|
1737
|
-
this.batteryPowered = [
|
|
1748
|
+
this.batteryPowered = [
|
|
1749
|
+
{ [translations.Device[this.userSystemLanguage]]: '--none--', [translations.Adapter[this.userSystemLanguage]]: '', [translations.Battery[this.userSystemLanguage]]: '' },
|
|
1750
|
+
];
|
|
1738
1751
|
}
|
|
1739
1752
|
//write JSON list
|
|
1740
1753
|
await this.setStateChangedAsync(`devices.${dpSubFolder}batteryList`, {
|
|
@@ -1745,7 +1758,9 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1745
1758
|
// list battery low powered
|
|
1746
1759
|
if (this.lowBatteryPoweredCount === 0) {
|
|
1747
1760
|
// if no device is count, write the JSON List with default value
|
|
1748
|
-
this.batteryLowPowered = [
|
|
1761
|
+
this.batteryLowPowered = [
|
|
1762
|
+
{ [translations.Device[this.userSystemLanguage]]: '--none--', [translations.Adapter[this.userSystemLanguage]]: '', [translations.Battery[this.userSystemLanguage]]: '' },
|
|
1763
|
+
];
|
|
1749
1764
|
}
|
|
1750
1765
|
//write JSON list
|
|
1751
1766
|
await this.setStateChangedAsync(`devices.${dpSubFolder}lowBatteryList`, {
|
|
@@ -2126,16 +2141,16 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
2126
2141
|
}
|
|
2127
2142
|
|
|
2128
2143
|
let isHealthy = false;
|
|
2129
|
-
let instanceStatusString = translations.instance_deactivated[this.
|
|
2144
|
+
let instanceStatusString = translations.instance_deactivated[this.userSystemLanguage];
|
|
2130
2145
|
|
|
2131
2146
|
if (isAlive) {
|
|
2132
2147
|
if (connectedHostState && connectedDeviceState) {
|
|
2133
2148
|
isHealthy = true;
|
|
2134
|
-
instanceStatusString = translations.instance_okay[this.
|
|
2149
|
+
instanceStatusString = translations.instance_okay[this.userSystemLanguage];
|
|
2135
2150
|
} else if (!connectedHostState) {
|
|
2136
|
-
instanceStatusString = translations.not_connected_host[this.
|
|
2151
|
+
instanceStatusString = translations.not_connected_host[this.userSystemLanguage];
|
|
2137
2152
|
} else if (!connectedDeviceState) {
|
|
2138
|
-
instanceStatusString = translations.not_connected_device[this.
|
|
2153
|
+
instanceStatusString = translations.not_connected_device[this.userSystemLanguage];
|
|
2139
2154
|
}
|
|
2140
2155
|
}
|
|
2141
2156
|
|
|
@@ -2151,7 +2166,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
2151
2166
|
let isAlive = await this.getInitValue(`system.adapter.${instanceID}.alive`);
|
|
2152
2167
|
let daemonIsAlive;
|
|
2153
2168
|
let isHealthy = false;
|
|
2154
|
-
let instanceStatusString = isAlive ? translations.instance_activated[this.
|
|
2169
|
+
let instanceStatusString = isAlive ? translations.instance_activated[this.userSystemLanguage] : translations.instance_deactivated[this.userSystemLanguage];
|
|
2155
2170
|
|
|
2156
2171
|
if (isAlive) {
|
|
2157
2172
|
daemonIsAlive = await this.checkDaemonIsHealthy(instanceID);
|
|
@@ -2178,7 +2193,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
2178
2193
|
let diff;
|
|
2179
2194
|
let isAlive = false;
|
|
2180
2195
|
let isHealthy = false;
|
|
2181
|
-
let instanceStatusString = translations.instance_deactivated[this.
|
|
2196
|
+
let instanceStatusString = translations.instance_deactivated[this.userSystemLanguage];
|
|
2182
2197
|
const isAliveSchedule = await this.getForeignStateAsync(`system.adapter.${instanceID}.alive`);
|
|
2183
2198
|
|
|
2184
2199
|
if (isAliveSchedule) {
|
|
@@ -2191,7 +2206,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
2191
2206
|
// if 5 minutes difference exceeded, instance is not alive
|
|
2192
2207
|
isAlive = true;
|
|
2193
2208
|
isHealthy = true;
|
|
2194
|
-
instanceStatusString = translations.instance_okay[this.
|
|
2209
|
+
instanceStatusString = translations.instance_okay[this.userSystemLanguage];
|
|
2195
2210
|
}
|
|
2196
2211
|
}
|
|
2197
2212
|
}
|
|
@@ -2249,7 +2264,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
2249
2264
|
|
|
2250
2265
|
let isAlive = false;
|
|
2251
2266
|
let isHealthy = false;
|
|
2252
|
-
let instanceStatusString = translations.instance_deactivated[this.
|
|
2267
|
+
let instanceStatusString = translations.instance_deactivated[this.userSystemLanguage];
|
|
2253
2268
|
|
|
2254
2269
|
switch (instanceMode) {
|
|
2255
2270
|
case 'schedule':
|
|
@@ -2324,9 +2339,9 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
2324
2339
|
|
|
2325
2340
|
for (const [adapter, updateData] of this.adapterUpdatesJsonRaw) {
|
|
2326
2341
|
this.listAdapterUpdates.push({
|
|
2327
|
-
[translations.Adapter[this.
|
|
2328
|
-
|
|
2329
|
-
|
|
2342
|
+
[translations.Adapter[this.userSystemLanguage]]: adapter,
|
|
2343
|
+
[translations.Available_Version[this.userSystemLanguage]]: updateData.newVersion,
|
|
2344
|
+
[translations.Installed_Version[this.userSystemLanguage]]: updateData.oldVersion,
|
|
2330
2345
|
});
|
|
2331
2346
|
}
|
|
2332
2347
|
this.countAdapterUpdates = this.listAdapterUpdates.length;
|
|
@@ -2340,9 +2355,14 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
2340
2355
|
// Write Datapoints for counts
|
|
2341
2356
|
await this.setStateChangedAsync(`adapterAndInstances.countAdapterUpdates`, { val: this.countAdapterUpdates, ack: true });
|
|
2342
2357
|
|
|
2343
|
-
// list deactivated instances
|
|
2344
2358
|
if (this.countAdapterUpdates === 0) {
|
|
2345
|
-
this.listAdapterUpdates = [
|
|
2359
|
+
this.listAdapterUpdates = [
|
|
2360
|
+
{
|
|
2361
|
+
[translations.Adapter[this.userSystemLanguage]]: '--none--',
|
|
2362
|
+
[translations.Available_Version[this.userSystemLanguage]]: '',
|
|
2363
|
+
[translations.Installed_Version[this.userSystemLanguage]]: '',
|
|
2364
|
+
},
|
|
2365
|
+
];
|
|
2346
2366
|
}
|
|
2347
2367
|
await this.setStateChangedAsync(`adapterAndInstances.listAdapterUpdates`, { val: JSON.stringify(this.listAdapterUpdates), ack: true });
|
|
2348
2368
|
}
|
|
@@ -2371,40 +2391,40 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
2371
2391
|
if (this.blacklistInstancesLists.includes(instance)) continue;
|
|
2372
2392
|
// all instances
|
|
2373
2393
|
this.listAllInstances.push({
|
|
2374
|
-
[translations.Adapter[this.
|
|
2375
|
-
[translations.Instance[this.
|
|
2376
|
-
[translations.Mode[this.
|
|
2377
|
-
[translations.Schedule[this.
|
|
2378
|
-
[translations.Version[this.
|
|
2379
|
-
[translations.Updateable[this.
|
|
2380
|
-
[translations.Status[this.
|
|
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,
|
|
2381
2401
|
});
|
|
2382
2402
|
|
|
2383
2403
|
if (!instanceData.isAlive) {
|
|
2384
2404
|
// list with deactivated instances
|
|
2385
2405
|
this.listDeactivatedInstances.push({
|
|
2386
|
-
[translations.Adapter[this.
|
|
2387
|
-
[translations.Instance[this.
|
|
2388
|
-
[translations.Status[this.
|
|
2406
|
+
[translations.Adapter[this.userSystemLanguage]]: instanceData.Adapter,
|
|
2407
|
+
[translations.Instance[this.userSystemLanguage]]: instance,
|
|
2408
|
+
[translations.Status[this.userSystemLanguage]]: instanceData.status,
|
|
2389
2409
|
});
|
|
2390
2410
|
} else {
|
|
2391
2411
|
// list with active instances
|
|
2392
2412
|
this.listAllActiveInstances.push({
|
|
2393
|
-
[translations.Adapter[this.
|
|
2394
|
-
[translations.Instance[this.
|
|
2395
|
-
[translations.Mode[this.
|
|
2396
|
-
[translations.Schedule[this.
|
|
2397
|
-
[translations.Status[this.
|
|
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,
|
|
2398
2418
|
});
|
|
2399
2419
|
}
|
|
2400
2420
|
|
|
2401
2421
|
// list with error instances
|
|
2402
2422
|
if (instanceData.isAlive && !instanceData.isHealthy) {
|
|
2403
2423
|
this.listErrorInstance.push({
|
|
2404
|
-
[translations.Adapter[this.
|
|
2405
|
-
[translations.Instance[this.
|
|
2406
|
-
[translations.Mode[this.
|
|
2407
|
-
[translations.Status[this.
|
|
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,
|
|
2408
2428
|
});
|
|
2409
2429
|
}
|
|
2410
2430
|
}
|
|
@@ -2441,7 +2461,12 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
2441
2461
|
// list deactivated instances
|
|
2442
2462
|
if (this.countDeactivatedInstances === 0) {
|
|
2443
2463
|
this.listDeactivatedInstances = [
|
|
2444
|
-
{
|
|
2464
|
+
{
|
|
2465
|
+
[translations.Adapter[this.userSystemLanguage]]: '--none--',
|
|
2466
|
+
[translations.Instance[this.userSystemLanguage]]: '',
|
|
2467
|
+
[translations.Version[this.userSystemLanguage]]: '',
|
|
2468
|
+
[translations.Status[this.userSystemLanguage]]: '',
|
|
2469
|
+
},
|
|
2445
2470
|
];
|
|
2446
2471
|
}
|
|
2447
2472
|
await this.setStateChangedAsync(`adapterAndInstances.listDeactivatedInstances`, { val: JSON.stringify(this.listDeactivatedInstances), ack: true });
|
|
@@ -2450,7 +2475,12 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
2450
2475
|
// list error instances
|
|
2451
2476
|
if (this.countErrorInstance === 0) {
|
|
2452
2477
|
this.listErrorInstance = [
|
|
2453
|
-
{
|
|
2478
|
+
{
|
|
2479
|
+
[translations.Adapter[this.userSystemLanguage]]: '--none--',
|
|
2480
|
+
[translations.Instance[this.userSystemLanguage]]: '',
|
|
2481
|
+
[translations.Mode[this.userSystemLanguage]]: '',
|
|
2482
|
+
[translations.Status[this.userSystemLanguage]]: '',
|
|
2483
|
+
},
|
|
2454
2484
|
];
|
|
2455
2485
|
}
|
|
2456
2486
|
await this.setStateChangedAsync(`adapterAndInstances.listInstancesError`, { val: JSON.stringify(this.listErrorInstance), ack: true });
|
|
@@ -3027,9 +3057,14 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
3027
3057
|
*/
|
|
3028
3058
|
async sendStateNotifications(type, id) {
|
|
3029
3059
|
if (isUnloaded) return;
|
|
3060
|
+
let objectData;
|
|
3061
|
+
let adapterName;
|
|
3062
|
+
|
|
3063
|
+
if (id !== null) {
|
|
3064
|
+
objectData = this.listAllDevicesRaw.get(id);
|
|
3065
|
+
adapterName = this.config.showAdapterNameinMsg ? `${objectData.Adapter}: ` : '';
|
|
3066
|
+
}
|
|
3030
3067
|
|
|
3031
|
-
let objectData = this.listAllDevicesRaw.get(id);
|
|
3032
|
-
const adapterName = this.config.showAdapterNameinMsg ? `${objectData.Adapter}: ` : '';
|
|
3033
3068
|
let list = '';
|
|
3034
3069
|
let message = '';
|
|
3035
3070
|
|
|
@@ -3041,40 +3076,46 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
3041
3076
|
|
|
3042
3077
|
switch (type) {
|
|
3043
3078
|
case 'lowBatDevice':
|
|
3044
|
-
message = `${translations.Device_low_bat_detected[this.
|
|
3079
|
+
message = `${translations.Device_low_bat_detected[this.userSystemLanguage]}: \n${adapterName} ${objectData.Device} (${objectData.Battery})`;
|
|
3045
3080
|
await setMessage(message);
|
|
3046
3081
|
break;
|
|
3047
3082
|
|
|
3048
3083
|
case 'onlineStateDevice':
|
|
3049
3084
|
switch (objectData.Status) {
|
|
3050
3085
|
case 'Online':
|
|
3051
|
-
message = `${translations.Device_available_again[this.
|
|
3086
|
+
message = `${translations.Device_available_again[this.userSystemLanguage]}: \n${adapterName} ${objectData.Device} (${objectData.LastContact})`;
|
|
3052
3087
|
break;
|
|
3053
3088
|
|
|
3054
3089
|
case 'Offline':
|
|
3055
|
-
message = `${translations.Device_not_reachable[this.
|
|
3090
|
+
message = `${translations.Device_not_reachable[this.userSystemLanguage]}: \n${adapterName} ${objectData.Device} (${objectData.LastContact})`;
|
|
3056
3091
|
break;
|
|
3057
3092
|
}
|
|
3058
3093
|
await setMessage(message);
|
|
3059
3094
|
break;
|
|
3060
3095
|
|
|
3061
3096
|
case 'updateDevice':
|
|
3062
|
-
message = `${translations.Device_new_updates[this.
|
|
3097
|
+
message = `${translations.Device_new_updates[this.userSystemLanguage]}: \n${adapterName} ${objectData.Device}`;
|
|
3063
3098
|
await setMessage(message);
|
|
3064
3099
|
break;
|
|
3065
3100
|
|
|
3066
3101
|
case 'updateAdapter':
|
|
3067
3102
|
if (this.countAdapterUpdates === 0) return;
|
|
3068
3103
|
|
|
3069
|
-
|
|
3070
|
-
|
|
3104
|
+
objectData = this.listAdapterUpdates;
|
|
3105
|
+
list = '';
|
|
3106
|
+
|
|
3107
|
+
for (const id of objectData) {
|
|
3108
|
+
list = `${list}\n${id[translations.Adapter[this.userSystemLanguage]]}: v${id[translations.Available_Version[this.userSystemLanguage]]}`;
|
|
3109
|
+
}
|
|
3110
|
+
|
|
3111
|
+
message = `${translations.Adapter_new_updates[this.userSystemLanguage]}: ${list}`;
|
|
3071
3112
|
await setMessage(message);
|
|
3072
3113
|
break;
|
|
3073
3114
|
|
|
3074
3115
|
case 'errorInstance':
|
|
3075
3116
|
case 'deactivatedInstance':
|
|
3076
3117
|
objectData = this.listInstanceRaw.get(id);
|
|
3077
|
-
message = `${translations.Instance_Watchdog[this.
|
|
3118
|
+
message = `${translations.Instance_Watchdog[this.userSystemLanguage]}:\n${id}: ${objectData.status}`;
|
|
3078
3119
|
await setMessage(message);
|
|
3079
3120
|
break;
|
|
3080
3121
|
}
|
|
@@ -3107,8 +3148,8 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
3107
3148
|
|
|
3108
3149
|
const processInstanceList = (instanceList, property) => {
|
|
3109
3150
|
for (const id of instanceList) {
|
|
3110
|
-
if (this.blacklistInstancesNotify.includes(id[translations['Instance'][this.
|
|
3111
|
-
list += `\n${id[translations['Instance'][this.
|
|
3151
|
+
if (this.blacklistInstancesNotify.includes(id[translations['Instance'][this.userSystemLanguage]])) continue;
|
|
3152
|
+
list += `\n${id[translations['Instance'][this.userSystemLanguage]]}${property ? `: ${id[property]}` : ''}`;
|
|
3112
3153
|
}
|
|
3113
3154
|
};
|
|
3114
3155
|
|
|
@@ -3117,13 +3158,13 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
3117
3158
|
|
|
3118
3159
|
switch (checkDays.length) {
|
|
3119
3160
|
case 1:
|
|
3120
|
-
message = `${translations.Weekly_overview[this.
|
|
3161
|
+
message = `${translations.Weekly_overview[this.userSystemLanguage]} ${translations[messageType][this.userSystemLanguage]}: ${list}`;
|
|
3121
3162
|
break;
|
|
3122
3163
|
case 7:
|
|
3123
|
-
message = `${translations.Daily_overview[this.
|
|
3164
|
+
message = `${translations.Daily_overview[this.userSystemLanguage]} ${translations[messageType][this.userSystemLanguage]}: ${list}`;
|
|
3124
3165
|
break;
|
|
3125
3166
|
default:
|
|
3126
|
-
message = `${translations.Overview_of[this.
|
|
3167
|
+
message = `${translations.Overview_of[this.userSystemLanguage]} ${translations[messageType][this.userSystemLanguage]}: ${list}`;
|
|
3127
3168
|
break;
|
|
3128
3169
|
}
|
|
3129
3170
|
|
|
@@ -3189,9 +3230,10 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
3189
3230
|
this.log.debug(`Number of selected days for daily adapter update message: ${checkDays.length}. Send Message on: ${checkDays.join(', ')} ...`);
|
|
3190
3231
|
|
|
3191
3232
|
schedule.scheduleJob(`4 ${this.config.checkSendAdapterUpdateTime.split(':').reverse().join(' ')} * * ${checkDays.join(',')}`, async () => {
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3233
|
+
for (const id of this.listAdapterUpdates) {
|
|
3234
|
+
list = `${list}\n${id[translations.Adapter[this.userSystemLanguage]]}: v${id[translations.Available_Version[this.userSystemLanguage]]}`;
|
|
3235
|
+
}
|
|
3236
|
+
await processNotification(list, 'available_adapter_updates');
|
|
3195
3237
|
});
|
|
3196
3238
|
break;
|
|
3197
3239
|
|
|
@@ -3248,14 +3290,14 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
3248
3290
|
return a.localeCompare(b);
|
|
3249
3291
|
});
|
|
3250
3292
|
html = `<center>
|
|
3251
|
-
<b>${[translations.Link_quality_devices[this.
|
|
3293
|
+
<b>${[translations.Link_quality_devices[this.userSystemLanguage]]}:<font> ${deviceCount}</b><small></small></font>
|
|
3252
3294
|
<p></p>
|
|
3253
3295
|
</center>
|
|
3254
3296
|
<table width=100%>
|
|
3255
3297
|
<tr>
|
|
3256
|
-
<th align=left>${[translations.Device[this.
|
|
3257
|
-
<th align=center width=120>${[translations.Adapter[this.
|
|
3258
|
-
<th align=right>${[translations.Signal_strength[this.
|
|
3298
|
+
<th align=left>${[translations.Device[this.userSystemLanguage]]}</th>
|
|
3299
|
+
<th align=center width=120>${[translations.Adapter[this.userSystemLanguage]]}</th>
|
|
3300
|
+
<th align=right>${[translations.Signal_strength[this.userSystemLanguage]]}</th>
|
|
3259
3301
|
</tr>
|
|
3260
3302
|
<tr>
|
|
3261
3303
|
<td colspan="5"><hr></td>
|
|
@@ -3263,9 +3305,9 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
3263
3305
|
|
|
3264
3306
|
for (const device of devices) {
|
|
3265
3307
|
html += `<tr>
|
|
3266
|
-
<td><font>${device[translations.Device[this.
|
|
3267
|
-
<td align=center><font>${device[translations.Adapter[this.
|
|
3268
|
-
<td align=right><font>${device[translations.Signal_strength[this.
|
|
3308
|
+
<td><font>${device[translations.Device[this.userSystemLanguage]]}</font></td>
|
|
3309
|
+
<td align=center><font>${device[translations.Adapter[this.userSystemLanguage]]}</font></td>
|
|
3310
|
+
<td align=right><font>${device[translations.Signal_strength[this.userSystemLanguage]]}</font></td>
|
|
3269
3311
|
</tr>`;
|
|
3270
3312
|
}
|
|
3271
3313
|
|
|
@@ -3279,14 +3321,14 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
3279
3321
|
return a.localeCompare(b);
|
|
3280
3322
|
});
|
|
3281
3323
|
html = `<center>
|
|
3282
|
-
<b>${[translations.offline_devices[this.
|
|
3324
|
+
<b>${[translations.offline_devices[this.userSystemLanguage]]}: <font color=${deviceCount === 0 ? '#3bcf0e' : 'orange'}>${deviceCount}</b><small></small></font>
|
|
3283
3325
|
<p></p>
|
|
3284
3326
|
</center>
|
|
3285
3327
|
<table width=100%>
|
|
3286
3328
|
<tr>
|
|
3287
|
-
<th align=left>${[translations.Device[this.
|
|
3288
|
-
<th align=center width=120>${[translations.Adapter[this.
|
|
3289
|
-
<th align=center>${[translations.Last_Contact[this.
|
|
3329
|
+
<th align=left>${[translations.Device[this.userSystemLanguage]]}</th>
|
|
3330
|
+
<th align=center width=120>${[translations.Adapter[this.userSystemLanguage]]}</th>
|
|
3331
|
+
<th align=center>${[translations.Last_Contact[this.userSystemLanguage]]}</th>
|
|
3290
3332
|
</tr>
|
|
3291
3333
|
<tr>
|
|
3292
3334
|
<td colspan="5"><hr></td>
|
|
@@ -3310,28 +3352,28 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
3310
3352
|
return a.localeCompare(b);
|
|
3311
3353
|
});
|
|
3312
3354
|
html = `<center>
|
|
3313
|
-
<b>${isLowBatteryList === true ? `${[translations.low[this.
|
|
3355
|
+
<b>${isLowBatteryList === true ? `${[translations.low[this.userSystemLanguage]]} ` : ''}${[translations.battery_devices[this.userSystemLanguage]]}:
|
|
3314
3356
|
<font color=${isLowBatteryList === true ? (deviceCount > 0 ? 'orange' : '#3bcf0e') : ''}>${deviceCount}</b></font>
|
|
3315
3357
|
<p></p>
|
|
3316
3358
|
</center>
|
|
3317
3359
|
<table width=100%>
|
|
3318
3360
|
<tr>
|
|
3319
|
-
<th align=left>${[translations.Device[this.
|
|
3320
|
-
<th align=center width=120>${[translations.Adapter[this.
|
|
3321
|
-
<th align=${isLowBatteryList ? 'center' : 'right'}>${[translations.Battery[this.
|
|
3361
|
+
<th align=left>${[translations.Device[this.userSystemLanguage]]}</th>
|
|
3362
|
+
<th align=center width=120>${[translations.Adapter[this.userSystemLanguage]]}</th>
|
|
3363
|
+
<th align=${isLowBatteryList ? 'center' : 'right'}>${[translations.Battery[this.userSystemLanguage]]}</th>
|
|
3322
3364
|
</tr>
|
|
3323
3365
|
<tr>
|
|
3324
3366
|
<td colspan="5"><hr></td>
|
|
3325
3367
|
</tr>`;
|
|
3326
3368
|
for (const device of devices) {
|
|
3327
3369
|
html += `<tr>
|
|
3328
|
-
<td><font>${device[translations.Device[this.
|
|
3329
|
-
<td align=center><font>${device[translations.Adapter[this.
|
|
3370
|
+
<td><font>${device[translations.Device[this.userSystemLanguage]]}</font></td>
|
|
3371
|
+
<td align=center><font>${device[translations.Adapter[this.userSystemLanguage]]}</font></td>`;
|
|
3330
3372
|
|
|
3331
3373
|
if (isLowBatteryList) {
|
|
3332
|
-
html += `<td align=center><font color=orange>${device[translations.Battery[this.
|
|
3374
|
+
html += `<td align=center><font color=orange>${device[translations.Battery[this.userSystemLanguage]]}</font></td>`;
|
|
3333
3375
|
} else {
|
|
3334
|
-
html += `<td align=right><font color=#3bcf0e>${device[translations.Battery[this.
|
|
3376
|
+
html += `<td align=right><font color=#3bcf0e>${device[translations.Battery[this.userSystemLanguage]]}</font></td>`;
|
|
3335
3377
|
}
|
|
3336
3378
|
html += `</tr>`;
|
|
3337
3379
|
}
|
|
@@ -3352,14 +3394,14 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
3352
3394
|
switch (type) {
|
|
3353
3395
|
case 'allInstancesList':
|
|
3354
3396
|
html = `<center>
|
|
3355
|
-
<b>${[translations.All_Instances[this.
|
|
3397
|
+
<b>${[translations.All_Instances[this.userSystemLanguage]]}:<font> ${instancesCount}</b><small></small></font>
|
|
3356
3398
|
<p></p>
|
|
3357
3399
|
</center>
|
|
3358
3400
|
<table width=100%>
|
|
3359
3401
|
<tr>
|
|
3360
|
-
<th align=left>${[translations.Adapter[this.
|
|
3361
|
-
<th align=center>${[translations.Instance[this.
|
|
3362
|
-
<th align=center width=180>${[translations.Status[this.
|
|
3402
|
+
<th align=left>${[translations.Adapter[this.userSystemLanguage]]}</th>
|
|
3403
|
+
<th align=center>${[translations.Instance[this.userSystemLanguage]]}</th>
|
|
3404
|
+
<th align=center width=180>${[translations.Status[this.userSystemLanguage]]}</th>
|
|
3363
3405
|
</tr>
|
|
3364
3406
|
<tr>
|
|
3365
3407
|
<td colspan="5"><hr></td>
|
|
@@ -3378,14 +3420,14 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
3378
3420
|
|
|
3379
3421
|
case 'allActiveInstancesList':
|
|
3380
3422
|
html = `<center>
|
|
3381
|
-
<b>${[translations.Active_Instances[this.
|
|
3423
|
+
<b>${[translations.Active_Instances[this.userSystemLanguage]]}: <font> ${instancesCount}</b><small></small></font>
|
|
3382
3424
|
<p></p>
|
|
3383
3425
|
</center>
|
|
3384
3426
|
<table width=100%>
|
|
3385
3427
|
<tr>
|
|
3386
|
-
<th align=left>${[translations.Adapter[this.
|
|
3387
|
-
<th align=center>${[translations.Instance[this.
|
|
3388
|
-
<th align=center width=180>${[translations.Status[this.
|
|
3428
|
+
<th align=left>${[translations.Adapter[this.userSystemLanguage]]}</th>
|
|
3429
|
+
<th align=center>${[translations.Instance[this.userSystemLanguage]]}</th>
|
|
3430
|
+
<th align=center width=180>${[translations.Status[this.userSystemLanguage]]}</th>
|
|
3389
3431
|
</tr>
|
|
3390
3432
|
<tr>
|
|
3391
3433
|
<td colspan="5"><hr></td>
|
|
@@ -3406,14 +3448,14 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
3406
3448
|
|
|
3407
3449
|
case 'errorInstanceList':
|
|
3408
3450
|
html = `<center>
|
|
3409
|
-
<b>${[translations.Error_Instances[this.
|
|
3451
|
+
<b>${[translations.Error_Instances[this.userSystemLanguage]]}: <font color=${instancesCount === 0 ? '#3bcf0e' : 'orange'}>${instancesCount}</b><small></small></font>
|
|
3410
3452
|
<p></p>
|
|
3411
3453
|
</center>
|
|
3412
3454
|
<table width=100%>
|
|
3413
3455
|
<tr>
|
|
3414
|
-
<th align=left>${[translations.Adapter[this.
|
|
3415
|
-
<th align=center>${[translations.Instance[this.
|
|
3416
|
-
<th align=center width=180>${[translations.Status[this.
|
|
3456
|
+
<th align=left>${[translations.Adapter[this.userSystemLanguage]]}</th>
|
|
3457
|
+
<th align=center>${[translations.Instance[this.userSystemLanguage]]}</th>
|
|
3458
|
+
<th align=center width=180>${[translations.Status[this.userSystemLanguage]]}</th>
|
|
3417
3459
|
</tr>
|
|
3418
3460
|
<tr>
|
|
3419
3461
|
<td colspan="5"><hr></td>
|
|
@@ -3432,14 +3474,14 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
3432
3474
|
|
|
3433
3475
|
case 'deactivatedInstanceList':
|
|
3434
3476
|
html = `<center>
|
|
3435
|
-
<b>${[translations.Deactivated_Instances[this.
|
|
3477
|
+
<b>${[translations.Deactivated_Instances[this.userSystemLanguage]]}: <font color=${instancesCount === 0 ? '#3bcf0e' : 'orange'}>${instancesCount}</b><small></small></font>
|
|
3436
3478
|
<p></p>
|
|
3437
3479
|
</center>
|
|
3438
3480
|
<table width=100%>
|
|
3439
3481
|
<tr>
|
|
3440
|
-
<th align=left>${[translations.Adapter[this.
|
|
3441
|
-
<th align=center>${[translations.Instance[this.
|
|
3442
|
-
<th align=center width=180>${[translations.Status[this.
|
|
3482
|
+
<th align=left>${[translations.Adapter[this.userSystemLanguage]]}</th>
|
|
3483
|
+
<th align=center>${[translations.Instance[this.userSystemLanguage]]}</th>
|
|
3484
|
+
<th align=center width=180>${[translations.Status[this.userSystemLanguage]]}</th>
|
|
3443
3485
|
</tr>
|
|
3444
3486
|
<tr>
|
|
3445
3487
|
<td colspan="5"><hr></td>
|
|
@@ -3460,14 +3502,14 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
3460
3502
|
|
|
3461
3503
|
case 'updateAdapterList':
|
|
3462
3504
|
html = `<center>
|
|
3463
|
-
<b>${[translations.Updatable_adapters[this.
|
|
3505
|
+
<b>${[translations.Updatable_adapters[this.userSystemLanguage]]}: <font color=${instancesCount === 0 ? '#3bcf0e' : 'orange'}>${instancesCount}</b><small></small></font>
|
|
3464
3506
|
<p></p>
|
|
3465
3507
|
</center>
|
|
3466
3508
|
<table width=100%>
|
|
3467
3509
|
<tr>
|
|
3468
|
-
<th align=left>${[translations.Adapter[this.
|
|
3469
|
-
<th align=center>${[translations.Installed_Version[this.
|
|
3470
|
-
<th align=center>${[translations.Available_Version[this.
|
|
3510
|
+
<th align=left>${[translations.Adapter[this.userSystemLanguage]]}</th>
|
|
3511
|
+
<th align=center>${[translations.Installed_Version[this.userSystemLanguage]]}</th>
|
|
3512
|
+
<th align=center>${[translations.Available_Version[this.userSystemLanguage]]}</th>
|
|
3471
3513
|
</tr>
|
|
3472
3514
|
<tr>
|
|
3473
3515
|
<td colspan="5"><hr></td>
|