iobroker.device-watcher 2.0.2 → 2.0.3
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 +26 -45
- package/admin/i18n/de/translations.json +69 -67
- package/admin/i18n/en/translations.json +78 -76
- package/admin/i18n/es/translations.json +69 -67
- package/admin/i18n/fr/translations.json +69 -67
- package/admin/i18n/it/translations.json +69 -67
- package/admin/i18n/nl/translations.json +69 -67
- package/admin/i18n/pl/translations.json +69 -67
- package/admin/i18n/pt/translations.json +69 -67
- package/admin/i18n/ru/translations.json +69 -67
- package/admin/i18n/uk/translations.json +69 -67
- package/admin/i18n/zh-cn/translations.json +69 -67
- package/admin/jsonConfig.json +57 -0
- package/admin/words.js +86 -36
- package/io-package.json +74 -67
- package/lib/arrApart.js +29 -0
- package/main.js +43 -18
- package/package.json +1 -1
package/main.js
CHANGED
|
@@ -79,6 +79,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
79
79
|
enocean: this.config.enoceanDevices,
|
|
80
80
|
esphome: this.config.esphomeDevices,
|
|
81
81
|
fritzdect: this.config.fritzdectDevices,
|
|
82
|
+
fullybrowser: this.config.fullybrowserDevices,
|
|
82
83
|
ham: this.config.hamDevices,
|
|
83
84
|
harmony: this.config.harmonyDevices,
|
|
84
85
|
hmiP: this.config.hmiPDevices,
|
|
@@ -101,8 +102,10 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
101
102
|
shelly: this.config.shellyDevices,
|
|
102
103
|
sonoff: this.config.sonoffDevices,
|
|
103
104
|
sonos: this.config.sonosDevices,
|
|
105
|
+
sureflap: this.config.sureflapDevices,
|
|
104
106
|
switchbotBle: this.config.switchbotBleDevices,
|
|
105
107
|
tado: this.config.tadoDevices,
|
|
108
|
+
tapo: this.config.tapoDevices,
|
|
106
109
|
tradfri: this.config.tradfriDevices,
|
|
107
110
|
unifi: this.config.unifiDevices,
|
|
108
111
|
wled: this.config.wledDevices,
|
|
@@ -119,6 +122,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
119
122
|
enocean: this.config.enoceanMaxMinutes,
|
|
120
123
|
esphome: this.config.esphomeMaxMinutes,
|
|
121
124
|
fritzdect: this.config.fritzdectMaxMinutes,
|
|
125
|
+
fullybrowser: this.config.fullybrowserMaxMinutes,
|
|
122
126
|
ham: this.config.hamMaxMinutes,
|
|
123
127
|
harmony: this.config.harmonyMaxMinutes,
|
|
124
128
|
hmiP: this.config.hmiPMaxMinutes,
|
|
@@ -141,8 +145,10 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
141
145
|
shelly: this.config.shellyMaxMinutes,
|
|
142
146
|
sonoff: this.config.sonoffMaxMinutes,
|
|
143
147
|
sonos: this.config.sonosMaxMinutes,
|
|
148
|
+
sureflap: this.config.sureflapMaxMinutes,
|
|
144
149
|
switchbotBle: this.config.switchbotMaxMinutes,
|
|
145
150
|
tado: this.config.tadoMaxMinutes,
|
|
151
|
+
tapo: this.config.tapoMaxMinutes,
|
|
146
152
|
tradfri: this.config.tradfriMaxMinutes,
|
|
147
153
|
unifi: this.config.unifiMaxMinutes,
|
|
148
154
|
wled: this.config.wledMaxMinutes,
|
|
@@ -426,6 +432,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
426
432
|
// Get ID for Switchbot and ESPHome Devices
|
|
427
433
|
case 'switchbotBle':
|
|
428
434
|
case 'esphome':
|
|
435
|
+
case 'fullybrowser':
|
|
429
436
|
deviceName = await this.getInitValue(currDeviceString + this.arrDev[i].id);
|
|
430
437
|
break;
|
|
431
438
|
|
|
@@ -457,6 +464,19 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
457
464
|
deviceName = currDeviceString.slice(currDeviceString.lastIndexOf('.') + 1);
|
|
458
465
|
break;
|
|
459
466
|
|
|
467
|
+
// Format Device name
|
|
468
|
+
case 'sureflap':
|
|
469
|
+
if (deviceObject && typeof deviceObject === 'object') {
|
|
470
|
+
deviceName = deviceObject.common.name
|
|
471
|
+
// @ts-ignore FIXME: fix syntax error
|
|
472
|
+
.replace(/'/g, '')
|
|
473
|
+
.replace(/\(\d+\)/g, '')
|
|
474
|
+
.trim()
|
|
475
|
+
.replace('Hub', 'Hub -')
|
|
476
|
+
.replace('Device', 'Device -');
|
|
477
|
+
}
|
|
478
|
+
break;
|
|
479
|
+
|
|
460
480
|
//Get ID of foldername
|
|
461
481
|
case 'yeelight':
|
|
462
482
|
deviceName = shortCurrDeviceString.slice(shortCurrDeviceString.lastIndexOf('.') + 1);
|
|
@@ -702,9 +722,16 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
702
722
|
let isBatteryDevice;
|
|
703
723
|
|
|
704
724
|
// Get battery states
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
725
|
+
let deviceBatteryState = await this.getInitValue(currDeviceString + this.arrDev[i].battery);
|
|
726
|
+
if (deviceBatteryState === undefined) {
|
|
727
|
+
deviceBatteryState = await this.getInitValue(currDeviceString + this.arrDev[i].battery2);
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
// Get battery states with short path
|
|
731
|
+
let shortDeviceBatteryState = await this.getInitValue(shortCurrDeviceString + this.arrDev[i].battery);
|
|
732
|
+
if (shortDeviceBatteryState === undefined) {
|
|
733
|
+
shortDeviceBatteryState = await this.getInitValue(shortCurrDeviceString + this.arrDev[i].battery2);
|
|
734
|
+
}
|
|
708
735
|
|
|
709
736
|
// Get low bat states
|
|
710
737
|
let deviceLowBatState = await this.getInitValue(currDeviceString + this.arrDev[i].isLowBat);
|
|
@@ -712,7 +739,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
712
739
|
deviceLowBatState = await this.getInitValue(currDeviceString + this.arrDev[i].isLowBat2);
|
|
713
740
|
}
|
|
714
741
|
|
|
715
|
-
if (!deviceBatteryState && !shortDeviceBatteryState
|
|
742
|
+
if (!deviceBatteryState && !shortDeviceBatteryState) {
|
|
716
743
|
if (deviceLowBatState !== undefined) {
|
|
717
744
|
switch (this.arrDev[i].isLowBat || this.arrDev[i].isLowBat2) {
|
|
718
745
|
case 'none':
|
|
@@ -734,7 +761,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
734
761
|
} else {
|
|
735
762
|
switch (adapterID) {
|
|
736
763
|
case 'hmrpc':
|
|
737
|
-
if (deviceBatteryState === 0) {
|
|
764
|
+
if (deviceBatteryState === 0 || (deviceBatteryState && deviceBatteryState >= 6)) {
|
|
738
765
|
batteryHealth = ' - ';
|
|
739
766
|
} else {
|
|
740
767
|
batteryHealth = deviceBatteryState + 'V';
|
|
@@ -743,20 +770,13 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
743
770
|
break;
|
|
744
771
|
|
|
745
772
|
case 'hueExt':
|
|
746
|
-
if (shortDeviceBatteryState) {
|
|
747
|
-
batteryHealth = shortDeviceBatteryState + '%';
|
|
748
|
-
isBatteryDevice = true;
|
|
749
|
-
}
|
|
750
|
-
break;
|
|
751
773
|
case 'mihomeVacuum':
|
|
752
774
|
if (shortDeviceBatteryState) {
|
|
753
775
|
batteryHealth = shortDeviceBatteryState + '%';
|
|
754
776
|
isBatteryDevice = true;
|
|
755
|
-
} else if (shortDeviceBatteryState2) {
|
|
756
|
-
batteryHealth = shortDeviceBatteryState2 + '%';
|
|
757
|
-
isBatteryDevice = true;
|
|
758
777
|
}
|
|
759
778
|
break;
|
|
779
|
+
|
|
760
780
|
default:
|
|
761
781
|
batteryHealth = deviceBatteryState + '%';
|
|
762
782
|
isBatteryDevice = true;
|
|
@@ -1208,8 +1228,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1208
1228
|
deviceList = `${deviceList}\n${id['Device']} (${id['Battery']})`;
|
|
1209
1229
|
}
|
|
1210
1230
|
}
|
|
1211
|
-
|
|
1212
|
-
if (this.lowBatteryPoweredCountRaw > 0 && deviceList.length > 0) {
|
|
1231
|
+
if (deviceList.length > 0) {
|
|
1213
1232
|
this.log.info(`Niedrige Batteriezustände: ${deviceList}`);
|
|
1214
1233
|
this.setStateAsync('lastNotification', `Niedrige Batteriezustände: ${deviceList}`, true);
|
|
1215
1234
|
|
|
@@ -1447,7 +1466,9 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1447
1466
|
*/
|
|
1448
1467
|
async creatLinkQualityListHTML(devices, deviceCount) {
|
|
1449
1468
|
devices = devices.sort((a, b) => {
|
|
1450
|
-
|
|
1469
|
+
a = a.Device || '';
|
|
1470
|
+
b = b.Device || '';
|
|
1471
|
+
return a.localeCompare(b);
|
|
1451
1472
|
});
|
|
1452
1473
|
let html = `<center>
|
|
1453
1474
|
<b>Link Quality Devices:<font> ${deviceCount}</b><small></small></font>
|
|
@@ -1481,7 +1502,9 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1481
1502
|
*/
|
|
1482
1503
|
async createOfflineListHTML(devices, deviceCount) {
|
|
1483
1504
|
devices = devices.sort((a, b) => {
|
|
1484
|
-
|
|
1505
|
+
a = a.Device || '';
|
|
1506
|
+
b = b.Device || '';
|
|
1507
|
+
return a.localeCompare(b);
|
|
1485
1508
|
});
|
|
1486
1509
|
let html = `<center>
|
|
1487
1510
|
<b>Offline Devices: <font color=${deviceCount == 0 ? '#3bcf0e' : 'orange'}>${deviceCount}</b><small></small></font>
|
|
@@ -1516,7 +1539,9 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1516
1539
|
*/
|
|
1517
1540
|
async createBatteryListHTML(devices, deviceCount, isLowBatteryList) {
|
|
1518
1541
|
devices = devices.sort((a, b) => {
|
|
1519
|
-
|
|
1542
|
+
a = a.Device || '';
|
|
1543
|
+
b = b.Device || '';
|
|
1544
|
+
return a.localeCompare(b);
|
|
1520
1545
|
});
|
|
1521
1546
|
let html = `<center>
|
|
1522
1547
|
<b>${isLowBatteryList == true ? 'Schwache ' : ''}Batterie Devices: <font color=${isLowBatteryList == true ? (deviceCount > 0 ? 'orange' : '#3bcf0e') : ''}>${deviceCount}</b></font>
|