iobroker.device-watcher 2.2.2 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +132 -31
- package/admin/i18n/de/translations.json +4 -1
- package/admin/i18n/en/translations.json +4 -1
- package/admin/i18n/es/translations.json +4 -1
- package/admin/i18n/fr/translations.json +4 -1
- package/admin/i18n/it/translations.json +4 -1
- package/admin/i18n/nl/translations.json +4 -1
- package/admin/i18n/pl/translations.json +4 -1
- package/admin/i18n/pt/translations.json +4 -1
- package/admin/i18n/ru/translations.json +4 -1
- package/admin/i18n/uk/translations.json +4 -1
- package/admin/i18n/zh-cn/translations.json +4 -1
- package/admin/jsonConfig.json +27 -1
- package/io-package.json +104 -27
- package/lib/arrApart.js +80 -5
- package/main.js +402 -175
- package/package.json +7 -7
package/main.js
CHANGED
|
@@ -30,6 +30,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
30
30
|
this.batteryLowPowered = [];
|
|
31
31
|
this.listAllDevices = [];
|
|
32
32
|
this.blacklistLists = [];
|
|
33
|
+
this.blacklistAdapterLists = [];
|
|
33
34
|
this.blacklistNotify = [];
|
|
34
35
|
this.arrDev = [];
|
|
35
36
|
this.adapterSelected = [];
|
|
@@ -78,6 +79,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
78
79
|
deconz: this.config.deconzDevices,
|
|
79
80
|
enocean: this.config.enoceanDevices,
|
|
80
81
|
esphome: this.config.esphomeDevices,
|
|
82
|
+
eusec: this.config.eusecDevices,
|
|
81
83
|
fritzdect: this.config.fritzdectDevices,
|
|
82
84
|
fullybrowser: this.config.fullybrowserDevices,
|
|
83
85
|
ham: this.config.hamDevices,
|
|
@@ -126,6 +128,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
126
128
|
deconz: this.config.deconzMaxMinutes,
|
|
127
129
|
enocean: this.config.enoceanMaxMinutes,
|
|
128
130
|
esphome: this.config.esphomeMaxMinutes,
|
|
131
|
+
eusec: this.config.eusecMaxMinutes,
|
|
129
132
|
fritzdect: this.config.fritzdectMaxMinutes,
|
|
130
133
|
fullybrowser: this.config.fullybrowserMaxMinutes,
|
|
131
134
|
ham: this.config.hamMaxMinutes,
|
|
@@ -247,6 +250,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
247
250
|
let oldLowBatState;
|
|
248
251
|
let contactData;
|
|
249
252
|
let oldStatus;
|
|
253
|
+
let isLowBatValue;
|
|
250
254
|
|
|
251
255
|
for (const device of this.listAllDevicesRaw) {
|
|
252
256
|
// On statechange update available datapoint
|
|
@@ -271,7 +275,12 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
271
275
|
|
|
272
276
|
device.Battery = batteryData[0];
|
|
273
277
|
device.BatteryRaw = batteryData[2];
|
|
274
|
-
|
|
278
|
+
if (device.LowBatDP !== 'none') {
|
|
279
|
+
isLowBatValue = await this.getInitValue(device.LowBatDP);
|
|
280
|
+
} else {
|
|
281
|
+
isLowBatValue = undefined;
|
|
282
|
+
}
|
|
283
|
+
device.LowBat = await this.setLowbatIndicator(state.val, isLowBatValue, device.faultReport, device.adapterID);
|
|
275
284
|
|
|
276
285
|
if (device.LowBat && oldLowBatState !== device.LowBat) {
|
|
277
286
|
if (this.config.checkSendBatteryMsg && !this.blacklistNotify.includes(device.Path)) {
|
|
@@ -287,7 +296,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
287
296
|
batteryData = await this.getBatteryData(device.BatteryRaw, state.val, device.adapterID);
|
|
288
297
|
device.Battery = batteryData[0];
|
|
289
298
|
device.BatteryRaw = batteryData[2];
|
|
290
|
-
device.LowBat = await this.setLowbatIndicator(device.BatteryRaw, state.val, device.
|
|
299
|
+
device.LowBat = await this.setLowbatIndicator(device.BatteryRaw, state.val, device.faultReport, device.adapterID);
|
|
291
300
|
|
|
292
301
|
if (device.LowBat && oldLowBatState !== device.LowBat) {
|
|
293
302
|
if (this.config.checkSendBatteryMsg && !this.blacklistNotify.includes(device.Path)) {
|
|
@@ -295,16 +304,30 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
295
304
|
}
|
|
296
305
|
}
|
|
297
306
|
}
|
|
307
|
+
break;
|
|
298
308
|
|
|
309
|
+
case device.faultReportDP:
|
|
310
|
+
if (device.isBatteryDevice) {
|
|
311
|
+
oldLowBatState = device.LowBat;
|
|
312
|
+
batteryData = await this.getBatteryData(device.BatteryRaw, oldLowBatState, device.adapterID);
|
|
313
|
+
|
|
314
|
+
device.Battery = batteryData[0];
|
|
315
|
+
device.BatteryRaw = batteryData[2];
|
|
316
|
+
device.LowBat = await this.setLowbatIndicator(device.BatteryRaw, undefined, state.val, device.adapterID);
|
|
317
|
+
|
|
318
|
+
if (device.LowBat && oldLowBatState !== device.LowBat) {
|
|
319
|
+
if (this.config.checkSendBatteryMsg && !this.blacklistNotify.includes(device.Path)) {
|
|
320
|
+
await this.sendLowBatNoticiation(device.Device, device.Adapter, device.Battery);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
299
324
|
break;
|
|
325
|
+
|
|
300
326
|
case device.UnreachDP:
|
|
301
|
-
case device.DeviceStateSelectorDP:
|
|
302
|
-
case device.rssiPeerSelectorDP:
|
|
303
|
-
case device.Path:
|
|
304
327
|
oldStatus = device.Status;
|
|
305
328
|
device.UnreachState = await this.getInitValue(device.UnreachDP);
|
|
306
329
|
contactData = await this.getOnlineState(
|
|
307
|
-
device.
|
|
330
|
+
device.timeSelector,
|
|
308
331
|
device.adapterID,
|
|
309
332
|
device.UnreachDP,
|
|
310
333
|
device.SignalStrength,
|
|
@@ -318,7 +341,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
318
341
|
device.SignalStrength = contactData[2];
|
|
319
342
|
}
|
|
320
343
|
|
|
321
|
-
if (
|
|
344
|
+
if (this.config.checkSendOfflineMsg && oldStatus !== device.Status && !this.blacklistNotify.includes(device.Path)) {
|
|
322
345
|
await this.sendOfflineNotifications(device.Device, device.Adapter, device.Status, device.LastContact);
|
|
323
346
|
}
|
|
324
347
|
break;
|
|
@@ -341,7 +364,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
341
364
|
try {
|
|
342
365
|
result = this.listAllDevicesRaw;
|
|
343
366
|
for (const element in result) {
|
|
344
|
-
const label =
|
|
367
|
+
const label = `${result[element].Adapter}: ${result[element].Device}`;
|
|
345
368
|
const myValueObject = {
|
|
346
369
|
deviceName: result[element].Device,
|
|
347
370
|
adapter: result[element].Adapter,
|
|
@@ -350,7 +373,13 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
350
373
|
devices[myCount] = { label: label, value: JSON.stringify(myValueObject) };
|
|
351
374
|
myCount++;
|
|
352
375
|
}
|
|
353
|
-
|
|
376
|
+
const sortDevices = devices.slice(0);
|
|
377
|
+
sortDevices.sort(function (a, b) {
|
|
378
|
+
const x = a.label;
|
|
379
|
+
const y = b.label;
|
|
380
|
+
return x < y ? -1 : x > y ? 1 : 0;
|
|
381
|
+
});
|
|
382
|
+
this.sendTo(obj.from, obj.command, sortDevices, obj.callback);
|
|
354
383
|
} catch (error) {
|
|
355
384
|
this.sendTo(obj.from, obj.command, obj.callback);
|
|
356
385
|
}
|
|
@@ -490,6 +519,9 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
490
519
|
if (myBlacklist[i].checkIgnorLists) {
|
|
491
520
|
this.blacklistLists.push(blacklistParse.path);
|
|
492
521
|
}
|
|
522
|
+
if (myBlacklist[i].checkIgnorAdapterLists) {
|
|
523
|
+
this.blacklistAdapterLists.push(blacklistParse.path);
|
|
524
|
+
}
|
|
493
525
|
// push devices in list to ignor device in notifications
|
|
494
526
|
if (myBlacklist[i].checkIgnorNotify) {
|
|
495
527
|
this.blacklistNotify.push(blacklistParse.path);
|
|
@@ -500,6 +532,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
500
532
|
}
|
|
501
533
|
|
|
502
534
|
if (this.blacklistLists.length >= 1) this.log.info(`Found items on blacklist for lists: ${this.blacklistLists}`);
|
|
535
|
+
if (this.blacklistAdapterLists.length >= 1) this.log.info(`Found items on blacklist for lists: ${this.blacklistAdapterLists}`);
|
|
503
536
|
if (this.blacklistNotify.length >= 1) this.log.info(`Found items on blacklist for notificatioons: ${this.blacklistNotify}`);
|
|
504
537
|
} else {
|
|
505
538
|
return; // cancel run if unloaded was called.
|
|
@@ -526,15 +559,23 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
526
559
|
let folderName;
|
|
527
560
|
let deviceID;
|
|
528
561
|
|
|
529
|
-
// Get ID with currDeviceString from datapoint
|
|
530
562
|
switch (this.arrDev[i].adapterID) {
|
|
531
|
-
// Get ID
|
|
563
|
+
// Get ID with currDeviceString from datapoint
|
|
532
564
|
case 'switchbotBle':
|
|
533
565
|
case 'esphome':
|
|
534
566
|
case 'apcups':
|
|
535
567
|
deviceName = await this.getInitValue(currDeviceString + this.arrDev[i].id);
|
|
536
568
|
break;
|
|
537
569
|
|
|
570
|
+
case 'eusec':
|
|
571
|
+
deviceName = await this.getInitValue(currDeviceString + this.arrDev[i].id);
|
|
572
|
+
if (deviceName === null || deviceName === undefined) {
|
|
573
|
+
if (deviceObject && typeof deviceObject === 'object') {
|
|
574
|
+
deviceName = deviceObject.common.name;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
break;
|
|
578
|
+
|
|
538
579
|
case 'fullybrowser':
|
|
539
580
|
deviceName = (await this.getInitValue(currDeviceString + this.arrDev[i].id)) + ' ' + (await this.getInitValue(currDeviceString + this.arrDev[i].id2));
|
|
540
581
|
break;
|
|
@@ -677,77 +718,93 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
677
718
|
let batteryHealth;
|
|
678
719
|
let isBatteryDevice;
|
|
679
720
|
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
default:
|
|
686
|
-
if (deviceLowBatState !== true || deviceLowBatState === 'NORMAL' || deviceLowBatState === 1) {
|
|
721
|
+
switch (adapterID) {
|
|
722
|
+
case 'hmrpc':
|
|
723
|
+
if (deviceBatteryState === undefined) {
|
|
724
|
+
if (deviceLowBatState !== undefined) {
|
|
725
|
+
if (deviceLowBatState !== 1) {
|
|
687
726
|
batteryHealth = 'ok';
|
|
688
|
-
isBatteryDevice = true;
|
|
689
727
|
} else {
|
|
690
728
|
batteryHealth = 'low';
|
|
691
|
-
isBatteryDevice = true;
|
|
692
729
|
}
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
switch (adapterID) {
|
|
700
|
-
case 'hmrpc':
|
|
701
|
-
if (deviceBatteryState === 0 || (deviceBatteryState && deviceBatteryState >= 6)) {
|
|
730
|
+
isBatteryDevice = true;
|
|
731
|
+
} else {
|
|
732
|
+
batteryHealth = ' - ';
|
|
733
|
+
}
|
|
734
|
+
} else {
|
|
735
|
+
if (deviceBatteryState === 0 || deviceBatteryState >= 6) {
|
|
702
736
|
batteryHealth = ' - ';
|
|
703
737
|
} else {
|
|
704
738
|
batteryHealth = deviceBatteryState + 'V';
|
|
705
739
|
batteryHealthRaw = deviceBatteryState;
|
|
706
740
|
isBatteryDevice = true;
|
|
707
741
|
}
|
|
708
|
-
|
|
709
|
-
|
|
742
|
+
}
|
|
743
|
+
break;
|
|
744
|
+
default:
|
|
745
|
+
if (deviceBatteryState === undefined) {
|
|
746
|
+
if (deviceLowBatState !== undefined) {
|
|
747
|
+
if (deviceLowBatState !== true || deviceLowBatState === 'NORMAL' || deviceLowBatState === 1) {
|
|
748
|
+
batteryHealth = 'ok';
|
|
749
|
+
} else {
|
|
750
|
+
batteryHealth = 'low';
|
|
751
|
+
}
|
|
752
|
+
isBatteryDevice = true;
|
|
753
|
+
} else {
|
|
754
|
+
batteryHealth = ' - ';
|
|
755
|
+
}
|
|
756
|
+
} else {
|
|
710
757
|
batteryHealth = deviceBatteryState + '%';
|
|
711
758
|
batteryHealthRaw = deviceBatteryState;
|
|
712
759
|
isBatteryDevice = true;
|
|
713
|
-
|
|
714
|
-
|
|
760
|
+
}
|
|
761
|
+
break;
|
|
715
762
|
}
|
|
763
|
+
|
|
716
764
|
return [batteryHealth, isBatteryDevice, batteryHealthRaw];
|
|
717
765
|
}
|
|
718
766
|
|
|
719
767
|
/**
|
|
720
|
-
*set low bat indicator
|
|
768
|
+
* set low bat indicator
|
|
721
769
|
* @param {object} deviceBatteryState
|
|
722
770
|
* @param {object} deviceLowBatState
|
|
723
|
-
* @param {object}
|
|
771
|
+
* @param {object} faultReportState
|
|
772
|
+
* @param {object} adapterID
|
|
724
773
|
*/
|
|
725
774
|
|
|
726
|
-
async setLowbatIndicator(deviceBatteryState, deviceLowBatState,
|
|
775
|
+
async setLowbatIndicator(deviceBatteryState, deviceLowBatState, faultReportState, adapterID) {
|
|
727
776
|
let lowBatIndicator = false;
|
|
728
777
|
/*=============================================
|
|
729
778
|
= Set Lowbat indicator =
|
|
730
779
|
=============================================*/
|
|
731
|
-
if (deviceLowBatState !==
|
|
732
|
-
switch (
|
|
733
|
-
case '
|
|
734
|
-
if (deviceLowBatState ===
|
|
780
|
+
if (deviceLowBatState !== undefined || faultReportState !== undefined) {
|
|
781
|
+
switch (adapterID) {
|
|
782
|
+
case 'hmrpc':
|
|
783
|
+
if (deviceLowBatState === 1 || faultReportState === 6) {
|
|
735
784
|
lowBatIndicator = true;
|
|
736
785
|
}
|
|
737
786
|
break;
|
|
787
|
+
default:
|
|
788
|
+
switch (typeof deviceLowBatState) {
|
|
789
|
+
case 'number':
|
|
790
|
+
if (deviceLowBatState === 0) {
|
|
791
|
+
lowBatIndicator = true;
|
|
792
|
+
}
|
|
793
|
+
break;
|
|
738
794
|
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
795
|
+
case 'string':
|
|
796
|
+
if (deviceLowBatState !== 'NORMAL') {
|
|
797
|
+
// Tado devices
|
|
798
|
+
lowBatIndicator = true;
|
|
799
|
+
}
|
|
800
|
+
break;
|
|
745
801
|
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
802
|
+
case 'boolean':
|
|
803
|
+
if (deviceLowBatState) {
|
|
804
|
+
lowBatIndicator = true;
|
|
805
|
+
}
|
|
806
|
+
break;
|
|
749
807
|
}
|
|
750
|
-
break;
|
|
751
808
|
}
|
|
752
809
|
} else {
|
|
753
810
|
if (deviceBatteryState < this.config.minWarnBatterie) {
|
|
@@ -777,7 +834,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
777
834
|
|
|
778
835
|
/**
|
|
779
836
|
* get online state and time
|
|
780
|
-
* @param {object}
|
|
837
|
+
* @param {object} timeSelector - device Timeselector
|
|
781
838
|
* @param {string} adapterID - ID of Adapter
|
|
782
839
|
* @param {string} unreachDP - Datapoint of Unreach
|
|
783
840
|
* @param {object} linkQuality - Linkquality Value
|
|
@@ -785,33 +842,33 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
785
842
|
* @param {string} deviceStateSelectorDP - Selector of device state (like .state)
|
|
786
843
|
* @param {string} rssiPeerSelectorDP - HM RSSI Peer Datapoint
|
|
787
844
|
*/
|
|
788
|
-
async getOnlineState(
|
|
845
|
+
async getOnlineState(timeSelector, adapterID, unreachDP, linkQuality, deviceUnreachState, deviceStateSelectorDP, rssiPeerSelectorDP) {
|
|
789
846
|
let lastContactString;
|
|
790
847
|
let deviceState = 'Online';
|
|
791
848
|
|
|
792
849
|
try {
|
|
793
|
-
const
|
|
794
|
-
if (
|
|
850
|
+
const deviceTimeSelector = await this.getForeignStateAsync(timeSelector);
|
|
851
|
+
if (deviceTimeSelector) {
|
|
795
852
|
const deviceUnreachSelector = await this.getForeignStateAsync(unreachDP);
|
|
796
853
|
const deviceStateSelector = await this.getForeignStateAsync(deviceStateSelectorDP); // for hmrpc devices
|
|
797
854
|
const rssiPeerSelector = await this.getForeignStateAsync(rssiPeerSelectorDP);
|
|
798
|
-
const lastContact = await this.getTimestamp(
|
|
799
|
-
const lastDeviceUnreachStateChange = deviceUnreachSelector != undefined ? await this.getTimestamp(deviceUnreachSelector.lc) : await this.getTimestamp(
|
|
855
|
+
const lastContact = await this.getTimestamp(deviceTimeSelector.ts);
|
|
856
|
+
const lastDeviceUnreachStateChange = deviceUnreachSelector != undefined ? await this.getTimestamp(deviceUnreachSelector.lc) : await this.getTimestamp(timeSelector.ts);
|
|
800
857
|
// If there is no contact since user sets minutes add device in offline list
|
|
801
858
|
// calculate to days after 48 hours
|
|
802
859
|
switch (unreachDP) {
|
|
803
860
|
case 'none':
|
|
804
|
-
lastContactString = await this.getLastContact(
|
|
861
|
+
lastContactString = await this.getLastContact(deviceTimeSelector.ts);
|
|
805
862
|
break;
|
|
806
863
|
|
|
807
864
|
default:
|
|
808
865
|
//State changed
|
|
809
866
|
if (adapterID === 'hmrpc') {
|
|
810
867
|
if (linkQuality !== ' - ') {
|
|
811
|
-
if (deviceUnreachState) {
|
|
812
|
-
lastContactString = await this.getLastContact(
|
|
868
|
+
if (deviceUnreachState === 1) {
|
|
869
|
+
lastContactString = await this.getLastContact(deviceTimeSelector.lc);
|
|
813
870
|
} else {
|
|
814
|
-
lastContactString = await this.getLastContact(
|
|
871
|
+
lastContactString = await this.getLastContact(deviceTimeSelector.ts);
|
|
815
872
|
}
|
|
816
873
|
} else {
|
|
817
874
|
if (deviceStateSelector) {
|
|
@@ -823,10 +880,10 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
823
880
|
}
|
|
824
881
|
}
|
|
825
882
|
} else {
|
|
826
|
-
if (
|
|
827
|
-
lastContactString = await this.getLastContact(
|
|
883
|
+
if (deviceUnreachState === 0) {
|
|
884
|
+
lastContactString = await this.getLastContact(deviceTimeSelector.lc);
|
|
828
885
|
} else {
|
|
829
|
-
lastContactString = await this.getLastContact(
|
|
886
|
+
lastContactString = await this.getLastContact(deviceTimeSelector.ts);
|
|
830
887
|
}
|
|
831
888
|
break;
|
|
832
889
|
}
|
|
@@ -838,6 +895,16 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
838
895
|
if (this.maxMinutes !== undefined) {
|
|
839
896
|
switch (adapterID) {
|
|
840
897
|
case 'hmrpc':
|
|
898
|
+
if (this.maxMinutes[adapterID] <= 0) {
|
|
899
|
+
if (deviceUnreachState === 1) {
|
|
900
|
+
deviceState = 'Offline'; //set online state to offline
|
|
901
|
+
linkQuality = '0%'; // set linkQuality to nothing
|
|
902
|
+
}
|
|
903
|
+
} else if (lastDeviceUnreachStateChange > this.maxMinutes[adapterID] && deviceUnreachState === 1) {
|
|
904
|
+
deviceState = 'Offline'; //set online state to offline
|
|
905
|
+
linkQuality = '0%'; // set linkQuality to nothing
|
|
906
|
+
}
|
|
907
|
+
break;
|
|
841
908
|
case 'hmiP':
|
|
842
909
|
case 'maxcube':
|
|
843
910
|
if (this.maxMinutes[adapterID] <= 0) {
|
|
@@ -932,7 +999,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
932
999
|
const oldContactState = device.Status;
|
|
933
1000
|
device.UnreachState = await this.getInitValue(device.UnreachDP);
|
|
934
1001
|
const contactData = await this.getOnlineState(
|
|
935
|
-
device.
|
|
1002
|
+
device.timeSelector,
|
|
936
1003
|
device.adapterID,
|
|
937
1004
|
device.UnreachDP,
|
|
938
1005
|
device.SignalStrength,
|
|
@@ -1011,49 +1078,65 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1011
1078
|
=============================================*/
|
|
1012
1079
|
let deviceBatteryStateDP;
|
|
1013
1080
|
let deviceBatteryState;
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1081
|
+
let batteryHealth;
|
|
1082
|
+
let batteryHealthRaw;
|
|
1083
|
+
let lowBatIndicator;
|
|
1084
|
+
let isBatteryDevice;
|
|
1085
|
+
let isLowBatDP;
|
|
1086
|
+
let faultReportingDP;
|
|
1087
|
+
let faultReportingState;
|
|
1088
|
+
|
|
1089
|
+
const deviceChargerStateDP = currDeviceString + this.arrDev[i].charger;
|
|
1090
|
+
const deviceChargerState = await this.getInitValue(deviceChargerStateDP);
|
|
1091
|
+
|
|
1092
|
+
if (deviceChargerState === undefined || deviceChargerState === false) {
|
|
1093
|
+
// Get battery states
|
|
1094
|
+
switch (adapterID) {
|
|
1095
|
+
case 'hueExt':
|
|
1096
|
+
case 'mihomeVacuum':
|
|
1097
|
+
case 'mqttNuki':
|
|
1098
|
+
deviceBatteryStateDP = shortCurrDeviceString + this.arrDev[i].battery;
|
|
1023
1099
|
deviceBatteryState = await this.getInitValue(deviceBatteryStateDP);
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
deviceBatteryStateDP = currDeviceString + this.arrDev[i].
|
|
1100
|
+
if (deviceBatteryState === undefined) {
|
|
1101
|
+
deviceBatteryStateDP = shortCurrDeviceString + this.arrDev[i].battery2;
|
|
1102
|
+
deviceBatteryState = await this.getInitValue(deviceBatteryStateDP);
|
|
1103
|
+
}
|
|
1104
|
+
break;
|
|
1105
|
+
default:
|
|
1106
|
+
deviceBatteryStateDP = currDeviceString + this.arrDev[i].battery;
|
|
1031
1107
|
deviceBatteryState = await this.getInitValue(deviceBatteryStateDP);
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1108
|
+
if (deviceBatteryState === undefined) {
|
|
1109
|
+
deviceBatteryStateDP = currDeviceString + this.arrDev[i].battery2;
|
|
1110
|
+
deviceBatteryState = await this.getInitValue(deviceBatteryStateDP);
|
|
1111
|
+
}
|
|
1112
|
+
break;
|
|
1113
|
+
}
|
|
1035
1114
|
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1115
|
+
// Get low bat states
|
|
1116
|
+
isLowBatDP = currDeviceString + this.arrDev[i].isLowBat;
|
|
1117
|
+
let deviceLowBatState = await this.getInitValue(isLowBatDP);
|
|
1118
|
+
if (deviceLowBatState === undefined) {
|
|
1119
|
+
isLowBatDP = currDeviceString + this.arrDev[i].isLowBat2;
|
|
1120
|
+
deviceLowBatState = await this.getInitValue(isLowBatDP);
|
|
1121
|
+
}
|
|
1122
|
+
if (deviceLowBatState === undefined) isLowBatDP = 'none';
|
|
1044
1123
|
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
this.subscribeForeignStatesAsync(isLowBatDP);
|
|
1124
|
+
faultReportingDP = shortCurrDeviceString + this.arrDev[i].faultReporting;
|
|
1125
|
+
faultReportingState = await this.getInitValue(faultReportingDP);
|
|
1048
1126
|
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1127
|
+
//subscribe to states
|
|
1128
|
+
this.subscribeForeignStatesAsync(deviceBatteryStateDP);
|
|
1129
|
+
this.subscribeForeignStatesAsync(isLowBatDP);
|
|
1130
|
+
this.subscribeForeignStatesAsync(faultReportingDP);
|
|
1131
|
+
|
|
1132
|
+
const batteryData = await this.getBatteryData(deviceBatteryState, deviceLowBatState, adapterID);
|
|
1133
|
+
batteryHealth = batteryData[0];
|
|
1134
|
+
batteryHealthRaw = batteryData[2];
|
|
1135
|
+
isBatteryDevice = batteryData[1];
|
|
1054
1136
|
|
|
1055
|
-
|
|
1056
|
-
|
|
1137
|
+
if (isBatteryDevice) {
|
|
1138
|
+
lowBatIndicator = await this.setLowbatIndicator(deviceBatteryState, deviceLowBatState, faultReportingState, adapterID);
|
|
1139
|
+
}
|
|
1057
1140
|
}
|
|
1058
1141
|
|
|
1059
1142
|
/*=============================================
|
|
@@ -1062,6 +1145,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1062
1145
|
let unreachDP = currDeviceString + this.arrDev[i].reach;
|
|
1063
1146
|
const deviceStateSelectorDP = shortCurrDeviceString + this.arrDev[i].stateValue;
|
|
1064
1147
|
const rssiPeerSelectorDP = currDeviceString + this.arrDev[i].rssiPeerState;
|
|
1148
|
+
const timeSelector = currDeviceString + this.arrDev[i].timeSelector;
|
|
1065
1149
|
|
|
1066
1150
|
let deviceUnreachState = await this.getInitValue(unreachDP);
|
|
1067
1151
|
if (deviceUnreachState === undefined) {
|
|
@@ -1070,12 +1154,12 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1070
1154
|
}
|
|
1071
1155
|
|
|
1072
1156
|
// subscribe to states
|
|
1073
|
-
this.subscribeForeignStatesAsync(
|
|
1157
|
+
this.subscribeForeignStatesAsync(timeSelector);
|
|
1074
1158
|
this.subscribeForeignStatesAsync(unreachDP);
|
|
1075
1159
|
this.subscribeForeignStatesAsync(deviceStateSelectorDP);
|
|
1076
1160
|
this.subscribeForeignStatesAsync(rssiPeerSelectorDP);
|
|
1077
1161
|
|
|
1078
|
-
const onlineState = await this.getOnlineState(
|
|
1162
|
+
const onlineState = await this.getOnlineState(timeSelector, adapterID, unreachDP, linkQuality, deviceUnreachState, deviceStateSelectorDP, rssiPeerSelectorDP);
|
|
1079
1163
|
let deviceState;
|
|
1080
1164
|
let lastContactString;
|
|
1081
1165
|
|
|
@@ -1114,12 +1198,15 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1114
1198
|
Device: deviceName,
|
|
1115
1199
|
adapterID: adapterID,
|
|
1116
1200
|
Adapter: adapter,
|
|
1201
|
+
timeSelector: timeSelector,
|
|
1117
1202
|
isBatteryDevice: isBatteryDevice,
|
|
1118
1203
|
Battery: batteryHealth,
|
|
1119
1204
|
BatteryRaw: batteryHealthRaw,
|
|
1120
1205
|
batteryDP: deviceBatteryStateDP,
|
|
1121
1206
|
LowBat: lowBatIndicator,
|
|
1122
1207
|
LowBatDP: isLowBatDP,
|
|
1208
|
+
faultReport: faultReportingState,
|
|
1209
|
+
faultReportDP: faultReportingDP,
|
|
1123
1210
|
SignalStrengthDP: deviceQualityDP,
|
|
1124
1211
|
SignalStrength: linkQuality,
|
|
1125
1212
|
UnreachState: deviceUnreachState,
|
|
@@ -1138,12 +1225,15 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1138
1225
|
Device: deviceName,
|
|
1139
1226
|
adapterID: adapterID,
|
|
1140
1227
|
Adapter: adapter,
|
|
1228
|
+
timeSelector: timeSelector,
|
|
1141
1229
|
isBatteryDevice: isBatteryDevice,
|
|
1142
1230
|
Battery: batteryHealth,
|
|
1143
1231
|
BatteryRaw: batteryHealthRaw,
|
|
1144
1232
|
batteryDP: deviceBatteryStateDP,
|
|
1145
1233
|
LowBat: lowBatIndicator,
|
|
1146
1234
|
LowBatDP: isLowBatDP,
|
|
1235
|
+
faultReport: faultReportingState,
|
|
1236
|
+
faultReportDP: faultReportingDP,
|
|
1147
1237
|
SignalStrengthDP: deviceQualityDP,
|
|
1148
1238
|
SignalStrength: linkQuality,
|
|
1149
1239
|
UnreachState: deviceUnreachState,
|
|
@@ -1181,78 +1271,35 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1181
1271
|
}
|
|
1182
1272
|
|
|
1183
1273
|
for (const device of this.listAllDevicesRaw) {
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
}
|
|
1204
|
-
|
|
1205
|
-
/*---------- fill user lists ----------*/
|
|
1206
|
-
if (!this.blacklistLists.includes(device.Path)) {
|
|
1207
|
-
this.listAllDevices.push({
|
|
1208
|
-
Device: device.Device,
|
|
1209
|
-
Adapter: device.Adapter,
|
|
1210
|
-
Battery: device.Battery,
|
|
1211
|
-
'Signal strength': device.SignalStrength,
|
|
1212
|
-
'Last contact': device.LastContact,
|
|
1213
|
-
Status: device.Status,
|
|
1214
|
-
});
|
|
1215
|
-
// LinkQuality lists
|
|
1216
|
-
if (device.SignalStrength != ' - ') {
|
|
1217
|
-
this.linkQualityDevices.push({
|
|
1218
|
-
Device: device.Device,
|
|
1219
|
-
Adapter: device.Adapter,
|
|
1220
|
-
'Signal strength': device.SignalStrength,
|
|
1221
|
-
});
|
|
1222
|
-
}
|
|
1223
|
-
// Battery lists
|
|
1224
|
-
if (device['isBatteryDevice']) {
|
|
1225
|
-
this.batteryPowered.push({
|
|
1226
|
-
Device: device.Device,
|
|
1227
|
-
Adapter: device.Adapter,
|
|
1228
|
-
Battery: device.Battery,
|
|
1229
|
-
Status: device.Status,
|
|
1230
|
-
});
|
|
1231
|
-
}
|
|
1232
|
-
// Low Bat lists
|
|
1233
|
-
if (device.LowBat && device.Status !== 'Offline') {
|
|
1234
|
-
this.batteryLowPowered.push({
|
|
1235
|
-
Device: device.Device,
|
|
1236
|
-
Adapter: device.Adapter,
|
|
1237
|
-
Battery: device.Battery,
|
|
1238
|
-
});
|
|
1239
|
-
}
|
|
1274
|
+
/*---------- fill raw lists ----------*/
|
|
1275
|
+
// low bat list
|
|
1276
|
+
if (device.LowBat && device.Status !== 'Offline') {
|
|
1277
|
+
this.batteryLowPoweredRaw.push({
|
|
1278
|
+
Path: device.Path,
|
|
1279
|
+
Device: device.Device,
|
|
1280
|
+
Adapter: device.Adapter,
|
|
1281
|
+
Battery: device.Battery,
|
|
1282
|
+
});
|
|
1283
|
+
}
|
|
1284
|
+
// offline raw list
|
|
1285
|
+
if (device.Status === 'Offline') {
|
|
1286
|
+
this.offlineDevicesRaw.push({
|
|
1287
|
+
Path: device.Path,
|
|
1288
|
+
Device: device.Device,
|
|
1289
|
+
Adapter: device.Adapter,
|
|
1290
|
+
LastContact: device.LastContact,
|
|
1291
|
+
});
|
|
1292
|
+
}
|
|
1240
1293
|
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
Device: device.Device,
|
|
1245
|
-
Adapter: device.Adapter,
|
|
1246
|
-
'Last contact': device.LastContact,
|
|
1247
|
-
});
|
|
1248
|
-
}
|
|
1294
|
+
if (adptName === '' && !this.blacklistLists.includes(device.Path)) {
|
|
1295
|
+
await this.theLists(device);
|
|
1296
|
+
}
|
|
1249
1297
|
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
});
|
|
1298
|
+
if (this.config.createOwnFolder && adptName !== '') {
|
|
1299
|
+
if (device.adapterID.includes(adptName)) {
|
|
1300
|
+
/*---------- fill user lists for each adapter ----------*/
|
|
1301
|
+
if (!this.blacklistAdapterLists.includes(device.Path)) {
|
|
1302
|
+
await this.theLists(device);
|
|
1256
1303
|
}
|
|
1257
1304
|
}
|
|
1258
1305
|
}
|
|
@@ -1260,6 +1307,67 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1260
1307
|
await this.countDevices();
|
|
1261
1308
|
}
|
|
1262
1309
|
|
|
1310
|
+
/**
|
|
1311
|
+
* fill the lists for user
|
|
1312
|
+
* @param {object} device
|
|
1313
|
+
*/
|
|
1314
|
+
async theLists(device) {
|
|
1315
|
+
// List with all devices
|
|
1316
|
+
this.listAllDevices.push({
|
|
1317
|
+
Device: device.Device,
|
|
1318
|
+
Adapter: device.Adapter,
|
|
1319
|
+
Battery: device.Battery,
|
|
1320
|
+
'Signal strength': device.SignalStrength,
|
|
1321
|
+
'Last contact': device.LastContact,
|
|
1322
|
+
Status: device.Status,
|
|
1323
|
+
});
|
|
1324
|
+
|
|
1325
|
+
// LinkQuality lists
|
|
1326
|
+
if (device.SignalStrength != ' - ') {
|
|
1327
|
+
this.linkQualityDevices.push({
|
|
1328
|
+
Device: device.Device,
|
|
1329
|
+
Adapter: device.Adapter,
|
|
1330
|
+
'Signal strength': device.SignalStrength,
|
|
1331
|
+
});
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
// Battery lists
|
|
1335
|
+
if (device.isBatteryDevice) {
|
|
1336
|
+
this.batteryPowered.push({
|
|
1337
|
+
Device: device.Device,
|
|
1338
|
+
Adapter: device.Adapter,
|
|
1339
|
+
Battery: device.Battery,
|
|
1340
|
+
Status: device.Status,
|
|
1341
|
+
});
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
// Low Bat lists
|
|
1345
|
+
if (device.LowBat && device.Status !== 'Offline') {
|
|
1346
|
+
this.batteryLowPowered.push({
|
|
1347
|
+
Device: device.Device,
|
|
1348
|
+
Adapter: device.Adapter,
|
|
1349
|
+
Battery: device.Battery,
|
|
1350
|
+
});
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
// Offline List
|
|
1354
|
+
if (device.Status === 'Offline') {
|
|
1355
|
+
this.offlineDevices.push({
|
|
1356
|
+
Device: device.Device,
|
|
1357
|
+
Adapter: device.Adapter,
|
|
1358
|
+
'Last contact': device.LastContact,
|
|
1359
|
+
});
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
// Device update List
|
|
1363
|
+
if (device.Upgradable) {
|
|
1364
|
+
this.upgradableList.push({
|
|
1365
|
+
Device: device.Device,
|
|
1366
|
+
Adapter: device.Adapter,
|
|
1367
|
+
});
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1263
1371
|
/**
|
|
1264
1372
|
* Count devices for each type
|
|
1265
1373
|
*/
|
|
@@ -1744,18 +1852,21 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1744
1852
|
dpSubFolder = '';
|
|
1745
1853
|
}
|
|
1746
1854
|
|
|
1855
|
+
// Write Datapoints for counts
|
|
1747
1856
|
await this.setStateAsync(`${dpSubFolder}offlineCount`, { val: this.offlineDevicesCount, ack: true });
|
|
1748
1857
|
await this.setStateAsync(`${dpSubFolder}countAll`, { val: this.deviceCounter, ack: true });
|
|
1749
1858
|
await this.setStateAsync(`${dpSubFolder}batteryCount`, { val: this.batteryPoweredCount, ack: true });
|
|
1750
1859
|
await this.setStateAsync(`${dpSubFolder}lowBatteryCount`, { val: this.lowBatteryPoweredCount, ack: true });
|
|
1751
1860
|
await this.setStateAsync(`${dpSubFolder}upgradableCount`, { val: this.upgradableDevicesCount, ack: true });
|
|
1752
1861
|
|
|
1862
|
+
// List all devices
|
|
1753
1863
|
if (this.deviceCounter === 0) {
|
|
1754
1864
|
// if no device is count, write the JSON List with default value
|
|
1755
1865
|
this.listAllDevices = [{ Device: '--none--', Adapter: '', Battery: '', 'Last contact': '', 'Signal strength': '' }];
|
|
1756
1866
|
}
|
|
1757
1867
|
await this.setStateAsync(`${dpSubFolder}listAll`, { val: JSON.stringify(this.listAllDevices), ack: true });
|
|
1758
1868
|
|
|
1869
|
+
// List link quality
|
|
1759
1870
|
if (this.linkQualityCount === 0) {
|
|
1760
1871
|
// if no device is count, write the JSON List with default value
|
|
1761
1872
|
this.linkQualityDevices = [{ Device: '--none--', Adapter: '', 'Signal strength': '' }];
|
|
@@ -1766,6 +1877,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1766
1877
|
ack: true,
|
|
1767
1878
|
});
|
|
1768
1879
|
|
|
1880
|
+
// List offline devices
|
|
1769
1881
|
if (this.offlineDevicesCount === 0) {
|
|
1770
1882
|
// if no device is count, write the JSON List with default value
|
|
1771
1883
|
this.offlineDevices = [{ Device: '--none--', Adapter: '', 'Last contact': '' }];
|
|
@@ -1776,6 +1888,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1776
1888
|
ack: true,
|
|
1777
1889
|
});
|
|
1778
1890
|
|
|
1891
|
+
// List updatable
|
|
1779
1892
|
if (this.upgradableDevicesCount === 0) {
|
|
1780
1893
|
// if no device is count, write the JSON List with default value
|
|
1781
1894
|
this.upgradableList = [{ Device: '--none--', Adapter: '', 'Last contact': '' }];
|
|
@@ -1786,6 +1899,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1786
1899
|
ack: true,
|
|
1787
1900
|
});
|
|
1788
1901
|
|
|
1902
|
+
// List battery powered
|
|
1789
1903
|
if (this.batteryPoweredCount === 0) {
|
|
1790
1904
|
// if no device is count, write the JSON List with default value
|
|
1791
1905
|
this.batteryPowered = [{ Device: '--none--', Adapter: '', Battery: '' }];
|
|
@@ -1796,6 +1910,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1796
1910
|
ack: true,
|
|
1797
1911
|
});
|
|
1798
1912
|
|
|
1913
|
+
// list battery low powered
|
|
1799
1914
|
if (this.lowBatteryPoweredCount === 0) {
|
|
1800
1915
|
// if no device is count, write the JSON List with default value
|
|
1801
1916
|
this.batteryLowPowered = [{ Device: '--none--', Adapter: '', Battery: '' }];
|
|
@@ -1806,6 +1921,43 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1806
1921
|
ack: true,
|
|
1807
1922
|
});
|
|
1808
1923
|
|
|
1924
|
+
// set booleans datapoints
|
|
1925
|
+
if (this.offlineDevicesCount === 0) {
|
|
1926
|
+
await this.setStateAsync(`${dpSubFolder}oneDeviceOffline`, {
|
|
1927
|
+
val: false,
|
|
1928
|
+
ack: true,
|
|
1929
|
+
});
|
|
1930
|
+
} else {
|
|
1931
|
+
await this.setStateAsync(`${dpSubFolder}oneDeviceOffline`, {
|
|
1932
|
+
val: true,
|
|
1933
|
+
ack: true,
|
|
1934
|
+
});
|
|
1935
|
+
}
|
|
1936
|
+
|
|
1937
|
+
if (this.lowBatteryPoweredCount === 0) {
|
|
1938
|
+
await this.setStateAsync(`${dpSubFolder}oneDeviceLowBat`, {
|
|
1939
|
+
val: false,
|
|
1940
|
+
ack: true,
|
|
1941
|
+
});
|
|
1942
|
+
} else {
|
|
1943
|
+
await this.setStateAsync(`${dpSubFolder}oneDeviceLowBat`, {
|
|
1944
|
+
val: true,
|
|
1945
|
+
ack: true,
|
|
1946
|
+
});
|
|
1947
|
+
}
|
|
1948
|
+
|
|
1949
|
+
if (this.upgradableDevicesCount === 0) {
|
|
1950
|
+
await this.setStateAsync(`${dpSubFolder}oneDeviceUpdatable`, {
|
|
1951
|
+
val: false,
|
|
1952
|
+
ack: true,
|
|
1953
|
+
});
|
|
1954
|
+
} else {
|
|
1955
|
+
await this.setStateAsync(`${dpSubFolder}oneDeviceUpdatable`, {
|
|
1956
|
+
val: true,
|
|
1957
|
+
ack: true,
|
|
1958
|
+
});
|
|
1959
|
+
}
|
|
1960
|
+
|
|
1809
1961
|
//write HTML list
|
|
1810
1962
|
if (this.createHtmlList) {
|
|
1811
1963
|
await this.setStateAsync(`${dpSubFolder}linkQualityListHTML`, {
|
|
@@ -1863,7 +2015,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1863
2015
|
html += `<tr>
|
|
1864
2016
|
<td><font>${device.Device}</font></td>
|
|
1865
2017
|
<td align=center><font>${device.Adapter}</font></td>
|
|
1866
|
-
<td align=right><font>${device
|
|
2018
|
+
<td align=right><font>${device['Signal strength']}</font></td>
|
|
1867
2019
|
</tr>`;
|
|
1868
2020
|
}
|
|
1869
2021
|
|
|
@@ -1899,7 +2051,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1899
2051
|
html += `<tr>
|
|
1900
2052
|
<td><font>${device.Device}</font></td>
|
|
1901
2053
|
<td align=center><font>${device.Adapter}</font></td>
|
|
1902
|
-
<td align=center><font color=orange>${device
|
|
2054
|
+
<td align=center><font color=orange>${device['Last contact']}</font></td>
|
|
1903
2055
|
</tr>`;
|
|
1904
2056
|
}
|
|
1905
2057
|
|
|
@@ -2007,6 +2159,31 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
2007
2159
|
native: {},
|
|
2008
2160
|
});
|
|
2009
2161
|
|
|
2162
|
+
await this.setObjectNotExistsAsync(`${adptName}.oneDeviceOffline`, {
|
|
2163
|
+
type: 'state',
|
|
2164
|
+
common: {
|
|
2165
|
+
name: {
|
|
2166
|
+
en: 'Is one device with offline',
|
|
2167
|
+
de: 'Ist ein Gerät mit Offline',
|
|
2168
|
+
ru: 'Это одно устройство с offline',
|
|
2169
|
+
pt: 'É um dispositivo com offline',
|
|
2170
|
+
nl: 'Is een apparaat met offline',
|
|
2171
|
+
fr: 'Est un appareil avec hors ligne',
|
|
2172
|
+
it: 'È un dispositivo con offline',
|
|
2173
|
+
es: 'Es un dispositivo sin conexión',
|
|
2174
|
+
pl: 'Jest to jeden urządzenie z offlinem',
|
|
2175
|
+
uk: 'Є один пристрій з автономним',
|
|
2176
|
+
'zh-cn': '一处有线装置',
|
|
2177
|
+
},
|
|
2178
|
+
type: 'boolean',
|
|
2179
|
+
role: 'state',
|
|
2180
|
+
read: true,
|
|
2181
|
+
write: false,
|
|
2182
|
+
def: false,
|
|
2183
|
+
},
|
|
2184
|
+
native: {},
|
|
2185
|
+
});
|
|
2186
|
+
|
|
2010
2187
|
await this.setObjectNotExistsAsync(`${adptName}.listAll`, {
|
|
2011
2188
|
type: 'state',
|
|
2012
2189
|
common: {
|
|
@@ -2145,6 +2322,31 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
2145
2322
|
native: {},
|
|
2146
2323
|
});
|
|
2147
2324
|
|
|
2325
|
+
await this.setObjectNotExistsAsync(`${adptName}.oneDeviceLowBat`, {
|
|
2326
|
+
type: 'state',
|
|
2327
|
+
common: {
|
|
2328
|
+
name: {
|
|
2329
|
+
en: 'Is one device with low battery',
|
|
2330
|
+
de: 'Ist ein Gerät mit niedrigem Akku',
|
|
2331
|
+
ru: 'Один прибор с низкой батареей',
|
|
2332
|
+
pt: 'É um dispositivo com bateria baixa',
|
|
2333
|
+
nl: 'Is een apparaat met lage batterijen',
|
|
2334
|
+
fr: 'Est un appareil avec batterie basse',
|
|
2335
|
+
it: 'È un dispositivo con batteria bassa',
|
|
2336
|
+
es: 'Es un dispositivo con batería baja',
|
|
2337
|
+
pl: 'Jest to jeden urządzenie z niską baterią',
|
|
2338
|
+
uk: 'Є одним пристроєм з низьких акумуляторів',
|
|
2339
|
+
'zh-cn': '低电池的装置',
|
|
2340
|
+
},
|
|
2341
|
+
type: 'boolean',
|
|
2342
|
+
role: 'state',
|
|
2343
|
+
read: true,
|
|
2344
|
+
write: false,
|
|
2345
|
+
def: false,
|
|
2346
|
+
},
|
|
2347
|
+
native: {},
|
|
2348
|
+
});
|
|
2349
|
+
|
|
2148
2350
|
await this.setObjectNotExistsAsync(`${adptName}.batteryCount`, {
|
|
2149
2351
|
type: 'state',
|
|
2150
2352
|
common: {
|
|
@@ -2215,6 +2417,31 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
2215
2417
|
},
|
|
2216
2418
|
native: {},
|
|
2217
2419
|
});
|
|
2420
|
+
|
|
2421
|
+
await this.setObjectNotExistsAsync(`${adptName}.oneDeviceUpdatable`, {
|
|
2422
|
+
type: 'state',
|
|
2423
|
+
common: {
|
|
2424
|
+
name: {
|
|
2425
|
+
en: 'Is one device updatable',
|
|
2426
|
+
de: 'Ist ein Gerät aufnehmbar',
|
|
2427
|
+
ru: 'Одно устройство обновляется',
|
|
2428
|
+
pt: 'É um dispositivo updatable',
|
|
2429
|
+
nl: 'Is een apparaat updat',
|
|
2430
|
+
fr: "Est-ce qu'un appareil est indéfectible",
|
|
2431
|
+
it: 'È un dispositivo updatable',
|
|
2432
|
+
es: 'Es un dispositivo actualizado',
|
|
2433
|
+
pl: 'Jest to jedno urządzenie updatable',
|
|
2434
|
+
uk: 'Є одним пристроєм',
|
|
2435
|
+
'zh-cn': '一台装置',
|
|
2436
|
+
},
|
|
2437
|
+
type: 'boolean',
|
|
2438
|
+
role: 'state',
|
|
2439
|
+
read: true,
|
|
2440
|
+
write: false,
|
|
2441
|
+
def: false,
|
|
2442
|
+
},
|
|
2443
|
+
native: {},
|
|
2444
|
+
});
|
|
2218
2445
|
}
|
|
2219
2446
|
|
|
2220
2447
|
/**
|