iobroker.device-watcher 2.10.0 → 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 +10 -0
- package/io-package.json +27 -27
- package/lib/translations.js +65 -0
- package/main.js +328 -229
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -189,6 +189,16 @@ It's possible to select:
|
|
|
189
189
|
Placeholder for the next version (at the beginning of the line):
|
|
190
190
|
### **WORK IN PROGRESS**
|
|
191
191
|
-->
|
|
192
|
+
### 2.10.2 (2024-01-20)
|
|
193
|
+
|
|
194
|
+
- (ciddi89) Fixed: typeError for available adapter update messages
|
|
195
|
+
- (ciddi89) Fixed: Lists for updatable adapter
|
|
196
|
+
|
|
197
|
+
### 2.10.1 (2024-01-15)
|
|
198
|
+
|
|
199
|
+
- (ciddi89) Fixed: several bugs from last version
|
|
200
|
+
- (ciddi89) Added: finished translations
|
|
201
|
+
|
|
192
202
|
### 2.10.0 (2024-01-13)
|
|
193
203
|
|
|
194
204
|
- (ciddi89) Fixed: Batterie value for shelly plus Gen2 devices [#282](https://github.com/ciddi89/ioBroker.device-watcher/issues/282)
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "device-watcher",
|
|
4
|
-
"version": "2.10.
|
|
4
|
+
"version": "2.10.2",
|
|
5
5
|
"news": {
|
|
6
|
+
"2.10.2": {
|
|
7
|
+
"en": "Fixed: typeError for available adapter update messages\nFixed: Lists for updatable adapter",
|
|
8
|
+
"de": "Behoben: Type-Fehler bei verfügbaren Adapter-Update-Nachrichten\nBehoben: Fehler bei Listen für Updatable Adapter",
|
|
9
|
+
"ru": "Исправлено: тип Ошибка для доступных сообщений обновления адаптера\nИсправлено: Списокы для обновляемого адаптера",
|
|
10
|
+
"pt": "Fixo: tipo Erro para mensagens de atualização do adaptador disponível\nCorrigido: Listas para adaptador updatable",
|
|
11
|
+
"nl": "Vast: type Fout bij het updaten van beschikbare adapterberichten\nVast: Lijsten voor updatable adapter",
|
|
12
|
+
"fr": "Correction : type Erreur pour les messages de mise à jour adaptateur disponibles\nCorrection : Listes pour adaptateur updatable",
|
|
13
|
+
"it": "Fisso: tipo Errore per i messaggi di aggiornamento dell'adattatore disponibili\nFisso: Liste per adattatore updatable",
|
|
14
|
+
"es": "Fijo: tipo Error para mensajes de actualización de adaptador disponibles\nFijación: Listas para adaptador actualizado",
|
|
15
|
+
"pl": "Naprawiono: typ Błąd dla dostępnych komunikatów aktualizacji adaptera\nNaprawiono: Listy do aktualizacji adaptera",
|
|
16
|
+
"uk": "Фіксований: тип Помилка для доступних повідомлень про оновлення адаптера\nВиправлено: Списки для адаптера",
|
|
17
|
+
"zh-cn": "固定:类型 可用适配器更新消息出错\n固定: 更新适配器列表"
|
|
18
|
+
},
|
|
19
|
+
"2.10.1": {
|
|
20
|
+
"en": "Fixed: several bugs from last version\nAdded: finished translations",
|
|
21
|
+
"de": "Behoben: mehrere Bugs aus der letzten Version\nHinzugefügt: fertige Übersetzungen",
|
|
22
|
+
"ru": "Исправлено: несколько ошибок из последней версии\nДобавлено: законченные переводы",
|
|
23
|
+
"pt": "Corrigido: vários bugs da última versão\nAdicionado: terminou traduções",
|
|
24
|
+
"nl": "Vast: meerdere bugs van de laatste versie\nToegevoegd: voltooide vertalingen",
|
|
25
|
+
"fr": "Correction : plusieurs bogues de la dernière version\nAjouté : traductions terminées",
|
|
26
|
+
"it": "Risolto: diversi bug dall'ultima versione\nAggiunto: finito traduzioni",
|
|
27
|
+
"es": "Corregido: varios errores de la última versión\nAñadido: traducciones terminadas",
|
|
28
|
+
"pl": "Naprawiono: kilka błędów z ostatniej wersji\nDodano: tłumaczenie gotowe",
|
|
29
|
+
"uk": "Виправлено: кілька помилок з останньої версії\nДодано: закінчені переклади",
|
|
30
|
+
"zh-cn": "固定: 上一个版本的一些错误\n添加:完成翻译"
|
|
31
|
+
},
|
|
6
32
|
"2.10.0": {
|
|
7
33
|
"en": "Fixed: Batterie value for shelly plus Gen2 devices [#282](https://github.com/ciddi89/ioBroker.device-watcher/issues/282)\nAdded: Option to display the last signal strength value when the device is offline [#282](https://github.com/ciddi89/ioBroker.device-watcher/issues/282)\nAdded: Translation for JSON lists, HTML lists and notifications [#245](https://github.com/ciddi89/ioBroker.device-watcher/issues/245)\nOther: clean up code",
|
|
8
34
|
"de": "Behoben: Batteriewert für Shelly plus Gen2 Geräte [#282](https://github.com/ciddi89/ioBroker.device-watcher/issues/282)\nHinzugefügt: Option, den letzten Signalstärkewert anzuzeigen, wenn das Gerät offline ist [#282](https://github.com/ciddi89/ioBroker.device-watcher/issues/282)\nHinzugefügt: Übersetzung für JSON-Listen, HTML-Listen und Benachrichtigungen [#245](https://github.com/ciddi89/ioBroker.device-watcher/issues/245)\nAndere: Code aufgeräumt",
|
|
@@ -67,32 +93,6 @@
|
|
|
67
93
|
"pl": "Fixed: Fullybroswer >v3 wykorzystuje niepospolitą nazwę",
|
|
68
94
|
"uk": "Виправлено: Fullybroswer >v3 використовувати id не загальна назва",
|
|
69
95
|
"zh-cn": "固定名称:全盘罗维塔 >v3"
|
|
70
|
-
},
|
|
71
|
-
"2.9.10": {
|
|
72
|
-
"en": "Fixed: Fullybroswer >v3 devicename\nFixed: Fullybroswer >v3 wifi signal",
|
|
73
|
-
"de": "Behoben: Fullybroswer >v3 Gerätename\nBehoben: Fullybroswer >v3 Wifi-Signal",
|
|
74
|
-
"ru": "Исправлено: Fullybroswer >v3 имя устройства\nИсправлено: Fullybroswer >v3 wifi сигнал",
|
|
75
|
-
"pt": "Fixo: Fullybroswer >v3 nome do dispositivo\nFixo: sinal wifi Fullybroswer >v3",
|
|
76
|
-
"nl": "Vertaling:\nQuality over Quantity (QoQ) Releases Vertaling:",
|
|
77
|
-
"fr": "Correction : Nom du dispositif Fullybroswer ACIAv3\nCorrection : signal wifi Fullybroswer ACIAv3",
|
|
78
|
-
"it": "Risolto: Fullybroswer >v3 nome del dispositivo\nFisso: Fullybroswer >v3 segnale wifi",
|
|
79
|
-
"es": "Fijación: Fullybroswer >v3 nombre de dispositivo\nFijación: Fullybroswer 3v3 señal wifi",
|
|
80
|
-
"pl": "Fixed: Fullybroswer >v3\nFixed: Fullybroswer >v3 wifi signal",
|
|
81
|
-
"uk": "Виправлено: Fullybroswer >v3 назва пристрою\nВиправлено: Fullybroswer >v3 Wi-Fi сигнал",
|
|
82
|
-
"zh-cn": "固定装置:全盘变压装置\n九. 固定:完全妓院"
|
|
83
|
-
},
|
|
84
|
-
"2.9.9": {
|
|
85
|
-
"en": "Fixed: Write log message of selected adapters only on startup",
|
|
86
|
-
"de": "Fixed: Log-Nachricht von ausgewählten Adaptern nur beim Start schreiben",
|
|
87
|
-
"ru": "Исправлено: Напишите лог-сообщение выбранных адаптеров только при запуске",
|
|
88
|
-
"pt": "Corrigido: Escreva a mensagem de log de adaptadores selecionados apenas na inicialização",
|
|
89
|
-
"nl": "Vertaling:",
|
|
90
|
-
"fr": "Correction : Écrivez un message de journal des adaptateurs sélectionnés uniquement au démarrage",
|
|
91
|
-
"it": "Risolto: Scrivi il messaggio di registro degli adattatori selezionati solo all'avvio",
|
|
92
|
-
"es": "Fijo: Escriba el mensaje de registro de adaptadores seleccionados sólo en el inicio",
|
|
93
|
-
"pl": "Fixed: Write log message to selected adapter tylko na początku",
|
|
94
|
-
"uk": "Виправлено: Напишіть лог повідомлення вибраних адаптерів тільки на запуску",
|
|
95
|
-
"zh-cn": "九. 固定:选择的适应者在开端的礼拜信息"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"titleLang": {
|
package/lib/translations.js
CHANGED
|
@@ -581,6 +581,71 @@ const translations = {
|
|
|
581
581
|
uk: 'Пристрої акумулятора',
|
|
582
582
|
'zh-cn': '电池设备',
|
|
583
583
|
},
|
|
584
|
+
instance_activated: {
|
|
585
|
+
en: 'Instance activated',
|
|
586
|
+
de: 'Instanz aktiviert',
|
|
587
|
+
ru: 'Активируется',
|
|
588
|
+
pt: 'Processo activado',
|
|
589
|
+
nl: 'Instantie geactiveerd',
|
|
590
|
+
fr: 'Instance activée',
|
|
591
|
+
it: 'Attivazione',
|
|
592
|
+
es: 'Instalación activada',
|
|
593
|
+
pl: 'Uruchamiony osąd',
|
|
594
|
+
uk: 'Інструкції активовані',
|
|
595
|
+
'zh-cn': '实例激活',
|
|
596
|
+
},
|
|
597
|
+
instance_deactivated: {
|
|
598
|
+
en: 'Instance deactivated',
|
|
599
|
+
de: 'Instanz deaktiviert',
|
|
600
|
+
ru: 'Экземпляр деактивирован',
|
|
601
|
+
pt: 'Instância desativada',
|
|
602
|
+
nl: 'Instantie gedeactiveerd',
|
|
603
|
+
fr: 'Instance désactivée',
|
|
604
|
+
it: 'Istanza disattivata',
|
|
605
|
+
es: 'Instancia desactivada',
|
|
606
|
+
pl: 'Instancja dezaktywowana',
|
|
607
|
+
uk: 'Екземпляр деактивовано',
|
|
608
|
+
'zh-cn': '实例已停用',
|
|
609
|
+
},
|
|
610
|
+
instance_okay: {
|
|
611
|
+
en: 'Instance okay',
|
|
612
|
+
de: 'Instanz okay',
|
|
613
|
+
ru: 'Экземпляр в норме',
|
|
614
|
+
pt: 'Instância OK',
|
|
615
|
+
nl: 'Instantie OK',
|
|
616
|
+
fr: 'Instance OK',
|
|
617
|
+
it: 'Istanza OK',
|
|
618
|
+
es: 'Instancia OK',
|
|
619
|
+
pl: 'Instancja OK',
|
|
620
|
+
uk: 'Екземпляр в нормі',
|
|
621
|
+
'zh-cn': '实例正常',
|
|
622
|
+
},
|
|
623
|
+
not_connected_host: {
|
|
624
|
+
en: 'Not connected to host',
|
|
625
|
+
de: 'Nicht mit Host verbunden',
|
|
626
|
+
ru: 'Не подключен к хосту',
|
|
627
|
+
pt: 'Não conectado ao host',
|
|
628
|
+
nl: 'Niet verbonden met host',
|
|
629
|
+
fr: 'Pas connecté au hôte',
|
|
630
|
+
it: 'Non connesso al host',
|
|
631
|
+
es: 'No conectado al host',
|
|
632
|
+
pl: 'Nie podłączony do hosta',
|
|
633
|
+
uk: "Не під'єднаний до хоста",
|
|
634
|
+
'zh-cn': '未连接到主机',
|
|
635
|
+
},
|
|
636
|
+
not_connected_device: {
|
|
637
|
+
en: 'Not connected to device or service',
|
|
638
|
+
de: 'Nicht mit Gerät oder Service verbunden',
|
|
639
|
+
ru: 'Не подключен к устройству или сервису',
|
|
640
|
+
pt: 'Não conectado ao dispositivo ou serviço',
|
|
641
|
+
nl: 'Niet verbonden met apparaat of dienst',
|
|
642
|
+
fr: 'Non connecté à un appareil ou à un service',
|
|
643
|
+
it: 'Non collegato al dispositivo o al servizio',
|
|
644
|
+
es: 'No conectado al dispositivo o servicio',
|
|
645
|
+
pl: 'Niepodłączone do urządzenia lub usługi',
|
|
646
|
+
uk: 'Не підключено до пристрою або сервісу',
|
|
647
|
+
'zh-cn': '未连接到设备或服务',
|
|
648
|
+
},
|
|
584
649
|
};
|
|
585
650
|
|
|
586
651
|
module.exports = translations;
|
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;
|
|
@@ -299,22 +310,22 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
299
310
|
await this.refreshData();
|
|
300
311
|
|
|
301
312
|
// send overview for low battery devices
|
|
302
|
-
if (this.config.checkSendBatteryMsgDaily) this.sendScheduleNotifications('lowBatteryDevices');
|
|
313
|
+
if (this.config.checkSendBatteryMsgDaily) await this.sendScheduleNotifications('lowBatteryDevices');
|
|
303
314
|
|
|
304
315
|
// send overview of offline devices
|
|
305
|
-
if (this.config.checkSendOfflineMsgDaily) this.sendScheduleNotifications('offlineDevices');
|
|
316
|
+
if (this.config.checkSendOfflineMsgDaily) await this.sendScheduleNotifications('offlineDevices');
|
|
306
317
|
|
|
307
318
|
// send overview of upgradeable devices
|
|
308
|
-
if (this.config.checkSendUpgradeMsgDaily) this.sendScheduleNotifications('updateDevices');
|
|
319
|
+
if (this.config.checkSendUpgradeMsgDaily) await this.sendScheduleNotifications('updateDevices');
|
|
309
320
|
|
|
310
321
|
// send overview of updatable adapters
|
|
311
|
-
if (this.config.checkSendAdapterUpdateMsgDaily) this.sendScheduleNotifications('updateAdapter');
|
|
322
|
+
if (this.config.checkSendAdapterUpdateMsgDaily) await this.sendScheduleNotifications('updateAdapter');
|
|
312
323
|
|
|
313
324
|
// send overview of deactivated instances
|
|
314
|
-
if (this.config.checkSendInstanceDeactivatedDaily) this.sendScheduleNotifications('deactivatedInstance');
|
|
325
|
+
if (this.config.checkSendInstanceDeactivatedDaily) await this.sendScheduleNotifications('deactivatedInstance');
|
|
315
326
|
|
|
316
327
|
// send overview of instances with error
|
|
317
|
-
if (this.config.checkSendInstanceFailedDaily) this.sendScheduleNotifications('errorInstance');
|
|
328
|
+
if (this.config.checkSendInstanceFailedDaily) await this.sendScheduleNotifications('errorInstance');
|
|
318
329
|
} catch (error) {
|
|
319
330
|
this.log.error(`[onReady] - ${error}`);
|
|
320
331
|
this.terminate ? this.terminate(15) : process.exit(15);
|
|
@@ -583,9 +594,9 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
583
594
|
this.refreshDataTimeout = null;
|
|
584
595
|
}
|
|
585
596
|
|
|
586
|
-
this.refreshDataTimeout = this.setTimeout(() => {
|
|
597
|
+
this.refreshDataTimeout = this.setTimeout(async () => {
|
|
587
598
|
this.log.debug('Updating Data');
|
|
588
|
-
this.refreshData();
|
|
599
|
+
await this.refreshData();
|
|
589
600
|
}, nextTimeout);
|
|
590
601
|
} // <-- refreshData end
|
|
591
602
|
|
|
@@ -1210,14 +1221,13 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1210
1221
|
const lastContact = this.getTimestamp(selector);
|
|
1211
1222
|
let lastContactString;
|
|
1212
1223
|
|
|
1224
|
+
lastContactString = `${this.formatDate(new Date(selector), 'hh:mm')}`;
|
|
1213
1225
|
if (Math.round(lastContact) > 100) {
|
|
1214
|
-
lastContactString = `${Math.round(lastContact / 60
|
|
1215
|
-
}
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
lastContactString = `${this.formatDate(new Date(selector), 'hh:mm')}`;
|
|
1226
|
+
lastContactString = `${Math.round(lastContact / 60)} ${translations.hours[this.userSystemLanguage]}`;
|
|
1227
|
+
}
|
|
1228
|
+
if (Math.round(lastContact / 60) > 48) {
|
|
1229
|
+
lastContactString = `${Math.round(lastContact / 60 / 24)} ${translations.days[this.userSystemLanguage]}`;
|
|
1219
1230
|
}
|
|
1220
|
-
|
|
1221
1231
|
return lastContactString;
|
|
1222
1232
|
}
|
|
1223
1233
|
|
|
@@ -1240,63 +1250,83 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1240
1250
|
const deviceUnreachSelector = await this.getForeignStateAsync(unreachDP);
|
|
1241
1251
|
const deviceStateSelector = await this.getForeignStateAsync(deviceStateSelectorDP); // for hmrpc devices
|
|
1242
1252
|
const rssiPeerSelector = await this.getForeignStateAsync(rssiPeerSelectorDP);
|
|
1243
|
-
const lastDeviceUnreachStateChange = deviceUnreachSelector
|
|
1244
|
-
|
|
1245
|
-
//
|
|
1253
|
+
const lastDeviceUnreachStateChange = deviceUnreachSelector != undefined ? this.getTimestamp(deviceUnreachSelector.lc) : this.getTimestamp(timeSelector.ts);
|
|
1254
|
+
// If there is no contact since user sets minutes add device in offline list
|
|
1255
|
+
// calculate to days after 48 hours
|
|
1246
1256
|
switch (unreachDP) {
|
|
1247
1257
|
case 'none':
|
|
1248
|
-
if (deviceTimeSelector)
|
|
1249
|
-
lastContactString = await this.getLastContact(deviceTimeSelector.ts);
|
|
1250
|
-
}
|
|
1258
|
+
if (deviceTimeSelector) lastContactString = await this.getLastContact(deviceTimeSelector.ts);
|
|
1251
1259
|
break;
|
|
1252
1260
|
|
|
1253
1261
|
default:
|
|
1254
|
-
//
|
|
1262
|
+
//State changed
|
|
1255
1263
|
if (adapterID === 'hmrpc') {
|
|
1256
1264
|
if (linkQuality !== ' - ' && deviceTimeSelector) {
|
|
1257
|
-
|
|
1265
|
+
if (deviceUnreachState === 1) {
|
|
1266
|
+
lastContactString = await this.getLastContact(deviceTimeSelector.lc);
|
|
1267
|
+
} else {
|
|
1268
|
+
lastContactString = await this.getLastContact(deviceTimeSelector.ts);
|
|
1269
|
+
}
|
|
1258
1270
|
} else {
|
|
1259
1271
|
if (deviceStateSelector) {
|
|
1260
|
-
//
|
|
1272
|
+
// because old hm devices don't send rssi states
|
|
1261
1273
|
lastContactString = await this.getLastContact(deviceStateSelector.ts);
|
|
1262
1274
|
} else if (rssiPeerSelector) {
|
|
1263
|
-
//
|
|
1275
|
+
// because old hm sensors don't send rssi/state values
|
|
1264
1276
|
lastContactString = await this.getLastContact(rssiPeerSelector.ts);
|
|
1265
1277
|
}
|
|
1266
1278
|
}
|
|
1267
1279
|
} else {
|
|
1268
1280
|
if ((!deviceUnreachState || deviceUnreachState === 0) && deviceTimeSelector) {
|
|
1269
1281
|
lastContactString = await this.getLastContact(deviceTimeSelector.lc);
|
|
1270
|
-
} else
|
|
1271
|
-
lastContactString = await this.getLastContact(deviceTimeSelector.ts);
|
|
1282
|
+
} else {
|
|
1283
|
+
if (deviceTimeSelector) lastContactString = await this.getLastContact(deviceTimeSelector.ts);
|
|
1272
1284
|
}
|
|
1273
1285
|
break;
|
|
1274
1286
|
}
|
|
1275
1287
|
}
|
|
1276
1288
|
|
|
1277
1289
|
/*=============================================
|
|
1278
|
-
|
|
1279
|
-
|
|
1290
|
+
= Set Online Status =
|
|
1291
|
+
=============================================*/
|
|
1280
1292
|
let lastContact;
|
|
1281
|
-
|
|
1282
1293
|
if (deviceTimeSelector) lastContact = this.getTimestamp(deviceTimeSelector.ts);
|
|
1283
1294
|
|
|
1284
1295
|
if (this.configMaxMinutes !== undefined) {
|
|
1285
|
-
let setOfflineState = false;
|
|
1286
|
-
|
|
1287
1296
|
switch (adapterID) {
|
|
1288
1297
|
case 'hmrpc':
|
|
1289
|
-
|
|
1290
|
-
(
|
|
1298
|
+
if (this.configMaxMinutes[adapterID] <= 0) {
|
|
1299
|
+
if (deviceUnreachState === 1) {
|
|
1300
|
+
deviceState = 'Offline'; //set online state to offline
|
|
1301
|
+
if (linkQuality !== ' - ') linkQuality = '0%'; // set linkQuality to nothing
|
|
1302
|
+
}
|
|
1303
|
+
} else if (lastDeviceUnreachStateChange > this.configMaxMinutes[adapterID] && deviceUnreachState === 1) {
|
|
1304
|
+
deviceState = 'Offline'; //set online state to offline
|
|
1305
|
+
if (linkQuality !== ' - ') linkQuality = '0%'; // set linkQuality to nothing
|
|
1306
|
+
}
|
|
1291
1307
|
break;
|
|
1292
1308
|
case 'proxmox':
|
|
1293
|
-
|
|
1294
|
-
(
|
|
1295
|
-
|
|
1309
|
+
if (this.configMaxMinutes[adapterID] <= 0) {
|
|
1310
|
+
if (deviceUnreachState !== 'running' && deviceUnreachState !== 'online') {
|
|
1311
|
+
deviceState = 'Offline'; //set online state to offline
|
|
1312
|
+
if (linkQuality !== ' - ') linkQuality = '0%'; // set linkQuality to nothing
|
|
1313
|
+
}
|
|
1314
|
+
} else if (lastDeviceUnreachStateChange > this.configMaxMinutes[adapterID] && deviceUnreachState !== 'running' && deviceUnreachState !== 'online') {
|
|
1315
|
+
deviceState = 'Offline'; //set online state to offline
|
|
1316
|
+
if (linkQuality !== ' - ') linkQuality = '0%'; // set linkQuality to nothing
|
|
1317
|
+
}
|
|
1296
1318
|
break;
|
|
1297
1319
|
case 'hmiP':
|
|
1298
1320
|
case 'maxcube':
|
|
1299
|
-
|
|
1321
|
+
if (this.configMaxMinutes[adapterID] <= 0) {
|
|
1322
|
+
if (deviceUnreachState) {
|
|
1323
|
+
deviceState = 'Offline'; //set online state to offline
|
|
1324
|
+
if (linkQuality !== ' - ') linkQuality = '0%'; // set linkQuality to nothing
|
|
1325
|
+
}
|
|
1326
|
+
} else if (lastDeviceUnreachStateChange > this.configMaxMinutes[adapterID] && deviceUnreachState) {
|
|
1327
|
+
deviceState = 'Offline'; //set online state to offline
|
|
1328
|
+
if (linkQuality !== ' - ') linkQuality = '0%'; // set linkQuality to nothing
|
|
1329
|
+
}
|
|
1300
1330
|
break;
|
|
1301
1331
|
case 'apcups':
|
|
1302
1332
|
case 'hue':
|
|
@@ -1309,36 +1339,74 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1309
1339
|
case 'unifi':
|
|
1310
1340
|
case 'zigbee':
|
|
1311
1341
|
case 'zigbee2MQTT':
|
|
1312
|
-
|
|
1342
|
+
if (this.configMaxMinutes[adapterID] <= 0) {
|
|
1343
|
+
if (!deviceUnreachState) {
|
|
1344
|
+
deviceState = 'Offline'; //set online state to offline
|
|
1345
|
+
if (linkQuality !== ' - ') linkQuality = '0%'; // set linkQuality to nothing
|
|
1346
|
+
}
|
|
1347
|
+
} else if (!deviceUnreachState && lastDeviceUnreachStateChange > this.configMaxMinutes[adapterID]) {
|
|
1348
|
+
deviceState = 'Offline'; //set online state to offline
|
|
1349
|
+
if (linkQuality !== ' - ') linkQuality = '0%'; // set linkQuality to nothing
|
|
1350
|
+
}
|
|
1313
1351
|
break;
|
|
1314
1352
|
case 'mqttClientZigbee2Mqtt':
|
|
1315
|
-
|
|
1316
|
-
(
|
|
1317
|
-
|
|
1353
|
+
if (this.configMaxMinutes[adapterID] <= 0) {
|
|
1354
|
+
if (deviceUnreachState !== 'online') {
|
|
1355
|
+
deviceState = 'Offline'; //set online state to offline
|
|
1356
|
+
if (linkQuality !== ' - ') linkQuality = '0%'; // set linkQuality to nothing
|
|
1357
|
+
}
|
|
1358
|
+
} else if (deviceUnreachState !== 'online' && lastDeviceUnreachStateChange > this.configMaxMinutes[adapterID]) {
|
|
1359
|
+
deviceState = 'Offline'; //set online state to offline
|
|
1360
|
+
if (linkQuality !== ' - ') linkQuality = '0%'; // set linkQuality to nothing
|
|
1361
|
+
}
|
|
1318
1362
|
break;
|
|
1319
1363
|
case 'mihome':
|
|
1320
1364
|
if (deviceUnreachState !== undefined) {
|
|
1321
|
-
|
|
1365
|
+
if (this.configMaxMinutes[adapterID] <= 0) {
|
|
1366
|
+
if (!deviceUnreachState) {
|
|
1367
|
+
deviceState = 'Offline'; //set online state to offline
|
|
1368
|
+
if (linkQuality !== ' - ') linkQuality = '0%'; // set linkQuality to nothing
|
|
1369
|
+
}
|
|
1370
|
+
} else if (lastContact && lastContact > this.configMaxMinutes[adapterID]) {
|
|
1371
|
+
deviceState = 'Offline'; //set online state to offline
|
|
1372
|
+
if (linkQuality !== ' - ') linkQuality = '0%'; // set linkQuality to nothing
|
|
1373
|
+
}
|
|
1322
1374
|
} else {
|
|
1323
|
-
|
|
1375
|
+
if (this.config.mihomeMaxMinutes <= 0) {
|
|
1376
|
+
if (this.configMaxMinutes[adapterID] <= 0) {
|
|
1377
|
+
deviceState = 'Offline'; //set online state to offline
|
|
1378
|
+
if (linkQuality !== ' - ') linkQuality = '0%'; // set linkQuality to nothing
|
|
1379
|
+
}
|
|
1380
|
+
} else if (lastContact && lastContact > this.configMaxMinutes[adapterID]) {
|
|
1381
|
+
deviceState = 'Offline'; //set online state to offline
|
|
1382
|
+
if (linkQuality !== ' - ') linkQuality = '0%'; // set linkQuality to nothing
|
|
1383
|
+
}
|
|
1324
1384
|
}
|
|
1325
1385
|
break;
|
|
1326
1386
|
case 'smartgarden':
|
|
1327
|
-
|
|
1328
|
-
(
|
|
1329
|
-
|
|
1387
|
+
if (this.configMaxMinutes[adapterID] <= 0) {
|
|
1388
|
+
if (deviceUnreachState === 'OFFLINE') {
|
|
1389
|
+
deviceState = 'Offline'; //set online state to offline
|
|
1390
|
+
if (linkQuality !== ' - ') linkQuality = '0%'; // set linkQuality to nothing
|
|
1391
|
+
}
|
|
1392
|
+
} else if (deviceUnreachState === 'OFFLINE' && lastDeviceUnreachStateChange > this.configMaxMinutes[adapterID]) {
|
|
1393
|
+
deviceState = 'Offline'; //set online state to offline
|
|
1394
|
+
if (linkQuality !== ' - ') linkQuality = '0%'; // set linkQuality to nothing
|
|
1395
|
+
}
|
|
1330
1396
|
break;
|
|
1331
1397
|
default:
|
|
1332
|
-
|
|
1398
|
+
if (this.configMaxMinutes[adapterID] <= 0) {
|
|
1399
|
+
if (!deviceUnreachState) {
|
|
1400
|
+
deviceState = 'Offline'; //set online state to offline
|
|
1401
|
+
if (linkQuality !== ' - ') linkQuality = '0%'; // set linkQuality to nothing
|
|
1402
|
+
}
|
|
1403
|
+
} else if (lastContact && lastContact > this.configMaxMinutes[adapterID]) {
|
|
1404
|
+
deviceState = 'Offline'; //set online state to offline
|
|
1405
|
+
if (linkQuality !== ' - ') linkQuality = '0%'; // set linkQuality to nothing
|
|
1406
|
+
}
|
|
1333
1407
|
break;
|
|
1334
1408
|
}
|
|
1335
|
-
|
|
1336
|
-
if (setOfflineState) {
|
|
1337
|
-
deviceState = 'Offline';
|
|
1338
|
-
if (linkQuality !== ' - ' && !this.config.showLastSignal) linkQuality = '0%';
|
|
1339
|
-
}
|
|
1340
1409
|
}
|
|
1341
|
-
|
|
1342
1410
|
return [lastContactString, deviceState, linkQuality];
|
|
1343
1411
|
} catch (error) {
|
|
1344
1412
|
this.log.error(`[getLastContact] - ${error}`);
|
|
@@ -1473,74 +1541,74 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1473
1541
|
async theLists(device) {
|
|
1474
1542
|
// Raw List with all devices for user
|
|
1475
1543
|
this.listAllDevicesUserRaw.push({
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1544
|
+
Device: device.Device,
|
|
1545
|
+
Adapter: device.Adapter,
|
|
1546
|
+
Instance: device.instance,
|
|
1547
|
+
'Instance connected': device.instancedeviceConnected,
|
|
1548
|
+
isBatteryDevice: device.isBatteryDevice,
|
|
1549
|
+
Battery: device.Battery,
|
|
1550
|
+
BatteryRaw: device.BatteryRaw,
|
|
1551
|
+
BatteryUnitRaw: device.BatteryUnitRaw,
|
|
1552
|
+
isLowBat: device.LowBat,
|
|
1553
|
+
'Signal strength': device.SignalStrength,
|
|
1554
|
+
'Signal strength Raw': device.SignalStrengthRaw,
|
|
1555
|
+
'Last contact': device.LastContact,
|
|
1556
|
+
'Update Available': device.Upgradable,
|
|
1557
|
+
Status: device.Status,
|
|
1490
1558
|
});
|
|
1491
1559
|
|
|
1492
1560
|
// List with all devices
|
|
1493
1561
|
this.listAllDevices.push({
|
|
1494
|
-
[translations.Device[this.
|
|
1495
|
-
[translations.Adapter[this.
|
|
1496
|
-
[translations.Battery[this.
|
|
1497
|
-
[translations.Signal_strength[this.
|
|
1498
|
-
[translations.Last_Contact[this.
|
|
1499
|
-
[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,
|
|
1500
1568
|
});
|
|
1501
1569
|
|
|
1502
1570
|
// LinkQuality lists
|
|
1503
1571
|
if (device.SignalStrength != ' - ') {
|
|
1504
1572
|
this.linkQualityDevices.push({
|
|
1505
|
-
[translations.Device[this.
|
|
1506
|
-
[translations.Adapter[this.
|
|
1507
|
-
[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,
|
|
1508
1576
|
});
|
|
1509
1577
|
}
|
|
1510
1578
|
|
|
1511
1579
|
// Battery lists
|
|
1512
1580
|
if (device.isBatteryDevice) {
|
|
1513
1581
|
this.batteryPowered.push({
|
|
1514
|
-
[translations.Device[this.
|
|
1515
|
-
[translations.Adapter[this.
|
|
1516
|
-
[translations.Battery[this.
|
|
1517
|
-
[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,
|
|
1518
1586
|
});
|
|
1519
1587
|
}
|
|
1520
1588
|
|
|
1521
1589
|
// Low Bat lists
|
|
1522
1590
|
if (device.LowBat && device.Status !== 'Offline') {
|
|
1523
1591
|
this.batteryLowPowered.push({
|
|
1524
|
-
[translations.Device[this.
|
|
1525
|
-
[translations.Adapter[this.
|
|
1526
|
-
[translations.Battery[this.
|
|
1592
|
+
[translations.Device[this.userSystemLanguage]]: device.Device,
|
|
1593
|
+
[translations.Adapter[this.userSystemLanguage]]: device.Adapter,
|
|
1594
|
+
[translations.Battery[this.userSystemLanguage]]: device.Battery,
|
|
1527
1595
|
});
|
|
1528
1596
|
}
|
|
1529
1597
|
|
|
1530
1598
|
// Offline List
|
|
1531
1599
|
if (device.Status === 'Offline') {
|
|
1532
1600
|
this.offlineDevices.push({
|
|
1533
|
-
[translations.Device[this.
|
|
1534
|
-
[translations.Adapter[this.
|
|
1535
|
-
[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,
|
|
1536
1604
|
});
|
|
1537
1605
|
}
|
|
1538
1606
|
|
|
1539
1607
|
// Device update List
|
|
1540
1608
|
if (device.Upgradable === true || device.Upgradable === 1) {
|
|
1541
1609
|
this.upgradableList.push({
|
|
1542
|
-
[translations.Device[this.
|
|
1543
|
-
[translations.Adapter[this.
|
|
1610
|
+
[translations.Device[this.userSystemLanguage]]: device.Device,
|
|
1611
|
+
[translations.Adapter[this.userSystemLanguage]]: device.Adapter,
|
|
1544
1612
|
});
|
|
1545
1613
|
}
|
|
1546
1614
|
}
|
|
@@ -1595,28 +1663,28 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1595
1663
|
// if no device is count, write the JSON List with default value
|
|
1596
1664
|
this.listAllDevices = [
|
|
1597
1665
|
{
|
|
1598
|
-
[translations.Device[this.
|
|
1599
|
-
[translations.Adapter[this.
|
|
1600
|
-
[translations.Battery[this.
|
|
1601
|
-
[translations.Signal_strength[this.
|
|
1602
|
-
[translations.Last_Contact[this.
|
|
1603
|
-
[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]]: '',
|
|
1604
1672
|
},
|
|
1605
1673
|
];
|
|
1606
1674
|
this.listAllDevicesUserRaw = [
|
|
1607
1675
|
{
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1676
|
+
Device: '--none--',
|
|
1677
|
+
Adapter: '',
|
|
1678
|
+
Instance: '',
|
|
1679
|
+
'Instance connected': '',
|
|
1680
|
+
isBatteryDevice: '',
|
|
1681
|
+
Battery: '',
|
|
1682
|
+
BatteryRaw: '',
|
|
1683
|
+
isLowBat: '',
|
|
1684
|
+
'Signal strength': '',
|
|
1685
|
+
'Last contact': '',
|
|
1686
|
+
UpdateAvailable: '',
|
|
1687
|
+
Status: '',
|
|
1620
1688
|
},
|
|
1621
1689
|
];
|
|
1622
1690
|
}
|
|
@@ -1628,9 +1696,9 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1628
1696
|
// if no device is count, write the JSON List with default value
|
|
1629
1697
|
this.linkQualityDevices = [
|
|
1630
1698
|
{
|
|
1631
|
-
[translations.Device[this.
|
|
1632
|
-
[translations.Adapter[this.
|
|
1633
|
-
[translations.Signal_strength[this.
|
|
1699
|
+
[translations.Device[this.userSystemLanguage]]: '--none--',
|
|
1700
|
+
[translations.Adapter[this.userSystemLanguage]]: '',
|
|
1701
|
+
[translations.Signal_strength[this.userSystemLanguage]]: '',
|
|
1634
1702
|
},
|
|
1635
1703
|
];
|
|
1636
1704
|
}
|
|
@@ -1645,9 +1713,9 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1645
1713
|
// if no device is count, write the JSON List with default value
|
|
1646
1714
|
this.offlineDevices = [
|
|
1647
1715
|
{
|
|
1648
|
-
[translations.Device[this.
|
|
1649
|
-
[translations.Adapter[this.
|
|
1650
|
-
[translations.Last_Contact[this.
|
|
1716
|
+
[translations.Device[this.userSystemLanguage]]: '--none--',
|
|
1717
|
+
[translations.Adapter[this.userSystemLanguage]]: '',
|
|
1718
|
+
[translations.Last_Contact[this.userSystemLanguage]]: '',
|
|
1651
1719
|
},
|
|
1652
1720
|
];
|
|
1653
1721
|
}
|
|
@@ -1662,9 +1730,9 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1662
1730
|
// if no device is count, write the JSON List with default value
|
|
1663
1731
|
this.upgradableList = [
|
|
1664
1732
|
{
|
|
1665
|
-
[translations.Device[this.
|
|
1666
|
-
[translations.Adapter[this.
|
|
1667
|
-
[translations.Last_Contact[this.
|
|
1733
|
+
[translations.Device[this.userSystemLanguage]]: '--none--',
|
|
1734
|
+
[translations.Adapter[this.userSystemLanguage]]: '',
|
|
1735
|
+
[translations.Last_Contact[this.userSystemLanguage]]: '',
|
|
1668
1736
|
},
|
|
1669
1737
|
];
|
|
1670
1738
|
}
|
|
@@ -1677,7 +1745,9 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1677
1745
|
// List battery powered
|
|
1678
1746
|
if (this.batteryPoweredCount === 0) {
|
|
1679
1747
|
// if no device is count, write the JSON List with default value
|
|
1680
|
-
this.batteryPowered = [
|
|
1748
|
+
this.batteryPowered = [
|
|
1749
|
+
{ [translations.Device[this.userSystemLanguage]]: '--none--', [translations.Adapter[this.userSystemLanguage]]: '', [translations.Battery[this.userSystemLanguage]]: '' },
|
|
1750
|
+
];
|
|
1681
1751
|
}
|
|
1682
1752
|
//write JSON list
|
|
1683
1753
|
await this.setStateChangedAsync(`devices.${dpSubFolder}batteryList`, {
|
|
@@ -1688,7 +1758,9 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
1688
1758
|
// list battery low powered
|
|
1689
1759
|
if (this.lowBatteryPoweredCount === 0) {
|
|
1690
1760
|
// if no device is count, write the JSON List with default value
|
|
1691
|
-
this.batteryLowPowered = [
|
|
1761
|
+
this.batteryLowPowered = [
|
|
1762
|
+
{ [translations.Device[this.userSystemLanguage]]: '--none--', [translations.Adapter[this.userSystemLanguage]]: '', [translations.Battery[this.userSystemLanguage]]: '' },
|
|
1763
|
+
];
|
|
1692
1764
|
}
|
|
1693
1765
|
//write JSON list
|
|
1694
1766
|
await this.setStateChangedAsync(`devices.${dpSubFolder}lowBatteryList`, {
|
|
@@ -2069,16 +2141,16 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
2069
2141
|
}
|
|
2070
2142
|
|
|
2071
2143
|
let isHealthy = false;
|
|
2072
|
-
let instanceStatusString =
|
|
2144
|
+
let instanceStatusString = translations.instance_deactivated[this.userSystemLanguage];
|
|
2073
2145
|
|
|
2074
2146
|
if (isAlive) {
|
|
2075
2147
|
if (connectedHostState && connectedDeviceState) {
|
|
2076
2148
|
isHealthy = true;
|
|
2077
|
-
instanceStatusString =
|
|
2149
|
+
instanceStatusString = translations.instance_okay[this.userSystemLanguage];
|
|
2078
2150
|
} else if (!connectedHostState) {
|
|
2079
|
-
instanceStatusString =
|
|
2151
|
+
instanceStatusString = translations.not_connected_host[this.userSystemLanguage];
|
|
2080
2152
|
} else if (!connectedDeviceState) {
|
|
2081
|
-
instanceStatusString =
|
|
2153
|
+
instanceStatusString = translations.not_connected_device[this.userSystemLanguage];
|
|
2082
2154
|
}
|
|
2083
2155
|
}
|
|
2084
2156
|
|
|
@@ -2094,7 +2166,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
2094
2166
|
let isAlive = await this.getInitValue(`system.adapter.${instanceID}.alive`);
|
|
2095
2167
|
let daemonIsAlive;
|
|
2096
2168
|
let isHealthy = false;
|
|
2097
|
-
let instanceStatusString = isAlive ?
|
|
2169
|
+
let instanceStatusString = isAlive ? translations.instance_activated[this.userSystemLanguage] : translations.instance_deactivated[this.userSystemLanguage];
|
|
2098
2170
|
|
|
2099
2171
|
if (isAlive) {
|
|
2100
2172
|
daemonIsAlive = await this.checkDaemonIsHealthy(instanceID);
|
|
@@ -2121,7 +2193,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
2121
2193
|
let diff;
|
|
2122
2194
|
let isAlive = false;
|
|
2123
2195
|
let isHealthy = false;
|
|
2124
|
-
let instanceStatusString =
|
|
2196
|
+
let instanceStatusString = translations.instance_deactivated[this.userSystemLanguage];
|
|
2125
2197
|
const isAliveSchedule = await this.getForeignStateAsync(`system.adapter.${instanceID}.alive`);
|
|
2126
2198
|
|
|
2127
2199
|
if (isAliveSchedule) {
|
|
@@ -2134,7 +2206,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
2134
2206
|
// if 5 minutes difference exceeded, instance is not alive
|
|
2135
2207
|
isAlive = true;
|
|
2136
2208
|
isHealthy = true;
|
|
2137
|
-
instanceStatusString =
|
|
2209
|
+
instanceStatusString = translations.instance_okay[this.userSystemLanguage];
|
|
2138
2210
|
}
|
|
2139
2211
|
}
|
|
2140
2212
|
}
|
|
@@ -2192,7 +2264,7 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
2192
2264
|
|
|
2193
2265
|
let isAlive = false;
|
|
2194
2266
|
let isHealthy = false;
|
|
2195
|
-
let instanceStatusString =
|
|
2267
|
+
let instanceStatusString = translations.instance_deactivated[this.userSystemLanguage];
|
|
2196
2268
|
|
|
2197
2269
|
switch (instanceMode) {
|
|
2198
2270
|
case 'schedule':
|
|
@@ -2267,9 +2339,9 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
2267
2339
|
|
|
2268
2340
|
for (const [adapter, updateData] of this.adapterUpdatesJsonRaw) {
|
|
2269
2341
|
this.listAdapterUpdates.push({
|
|
2270
|
-
[translations.Adapter[this.
|
|
2271
|
-
|
|
2272
|
-
|
|
2342
|
+
[translations.Adapter[this.userSystemLanguage]]: adapter,
|
|
2343
|
+
[translations.Available_Version[this.userSystemLanguage]]: updateData.newVersion,
|
|
2344
|
+
[translations.Installed_Version[this.userSystemLanguage]]: updateData.oldVersion,
|
|
2273
2345
|
});
|
|
2274
2346
|
}
|
|
2275
2347
|
this.countAdapterUpdates = this.listAdapterUpdates.length;
|
|
@@ -2283,9 +2355,14 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
2283
2355
|
// Write Datapoints for counts
|
|
2284
2356
|
await this.setStateChangedAsync(`adapterAndInstances.countAdapterUpdates`, { val: this.countAdapterUpdates, ack: true });
|
|
2285
2357
|
|
|
2286
|
-
// list deactivated instances
|
|
2287
2358
|
if (this.countAdapterUpdates === 0) {
|
|
2288
|
-
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
|
+
];
|
|
2289
2366
|
}
|
|
2290
2367
|
await this.setStateChangedAsync(`adapterAndInstances.listAdapterUpdates`, { val: JSON.stringify(this.listAdapterUpdates), ack: true });
|
|
2291
2368
|
}
|
|
@@ -2314,40 +2391,40 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
2314
2391
|
if (this.blacklistInstancesLists.includes(instance)) continue;
|
|
2315
2392
|
// all instances
|
|
2316
2393
|
this.listAllInstances.push({
|
|
2317
|
-
[translations.Adapter[this.
|
|
2318
|
-
[translations.Instance[this.
|
|
2319
|
-
[translations.Mode[this.
|
|
2320
|
-
[translations.Schedule[this.
|
|
2321
|
-
[translations.Version[this.
|
|
2322
|
-
[translations.Updateable[this.
|
|
2323
|
-
[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,
|
|
2324
2401
|
});
|
|
2325
2402
|
|
|
2326
2403
|
if (!instanceData.isAlive) {
|
|
2327
2404
|
// list with deactivated instances
|
|
2328
2405
|
this.listDeactivatedInstances.push({
|
|
2329
|
-
[translations.Adapter[this.
|
|
2330
|
-
[translations.Instance[this.
|
|
2331
|
-
[translations.Status[this.
|
|
2406
|
+
[translations.Adapter[this.userSystemLanguage]]: instanceData.Adapter,
|
|
2407
|
+
[translations.Instance[this.userSystemLanguage]]: instance,
|
|
2408
|
+
[translations.Status[this.userSystemLanguage]]: instanceData.status,
|
|
2332
2409
|
});
|
|
2333
2410
|
} else {
|
|
2334
2411
|
// list with active instances
|
|
2335
2412
|
this.listAllActiveInstances.push({
|
|
2336
|
-
[translations.Adapter[this.
|
|
2337
|
-
[translations.Instance[this.
|
|
2338
|
-
[translations.Mode[this.
|
|
2339
|
-
[translations.Schedule[this.
|
|
2340
|
-
[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,
|
|
2341
2418
|
});
|
|
2342
2419
|
}
|
|
2343
2420
|
|
|
2344
2421
|
// list with error instances
|
|
2345
2422
|
if (instanceData.isAlive && !instanceData.isHealthy) {
|
|
2346
2423
|
this.listErrorInstance.push({
|
|
2347
|
-
[translations.Adapter[this.
|
|
2348
|
-
[translations.Instance[this.
|
|
2349
|
-
[translations.Mode[this.
|
|
2350
|
-
[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,
|
|
2351
2428
|
});
|
|
2352
2429
|
}
|
|
2353
2430
|
}
|
|
@@ -2384,7 +2461,12 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
2384
2461
|
// list deactivated instances
|
|
2385
2462
|
if (this.countDeactivatedInstances === 0) {
|
|
2386
2463
|
this.listDeactivatedInstances = [
|
|
2387
|
-
{
|
|
2464
|
+
{
|
|
2465
|
+
[translations.Adapter[this.userSystemLanguage]]: '--none--',
|
|
2466
|
+
[translations.Instance[this.userSystemLanguage]]: '',
|
|
2467
|
+
[translations.Version[this.userSystemLanguage]]: '',
|
|
2468
|
+
[translations.Status[this.userSystemLanguage]]: '',
|
|
2469
|
+
},
|
|
2388
2470
|
];
|
|
2389
2471
|
}
|
|
2390
2472
|
await this.setStateChangedAsync(`adapterAndInstances.listDeactivatedInstances`, { val: JSON.stringify(this.listDeactivatedInstances), ack: true });
|
|
@@ -2393,7 +2475,12 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
2393
2475
|
// list error instances
|
|
2394
2476
|
if (this.countErrorInstance === 0) {
|
|
2395
2477
|
this.listErrorInstance = [
|
|
2396
|
-
{
|
|
2478
|
+
{
|
|
2479
|
+
[translations.Adapter[this.userSystemLanguage]]: '--none--',
|
|
2480
|
+
[translations.Instance[this.userSystemLanguage]]: '',
|
|
2481
|
+
[translations.Mode[this.userSystemLanguage]]: '',
|
|
2482
|
+
[translations.Status[this.userSystemLanguage]]: '',
|
|
2483
|
+
},
|
|
2397
2484
|
];
|
|
2398
2485
|
}
|
|
2399
2486
|
await this.setStateChangedAsync(`adapterAndInstances.listInstancesError`, { val: JSON.stringify(this.listErrorInstance), ack: true });
|
|
@@ -2970,9 +3057,14 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
2970
3057
|
*/
|
|
2971
3058
|
async sendStateNotifications(type, id) {
|
|
2972
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
|
+
}
|
|
2973
3067
|
|
|
2974
|
-
let objectData = this.listAllDevicesRaw.get(id);
|
|
2975
|
-
const adapterName = this.config.showAdapterNameinMsg ? `${objectData.Adapter}: ` : '';
|
|
2976
3068
|
let list = '';
|
|
2977
3069
|
let message = '';
|
|
2978
3070
|
|
|
@@ -2984,41 +3076,47 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
2984
3076
|
|
|
2985
3077
|
switch (type) {
|
|
2986
3078
|
case 'lowBatDevice':
|
|
2987
|
-
message = `${translations.Device_low_bat_detected[this.
|
|
2988
|
-
setMessage(message);
|
|
3079
|
+
message = `${translations.Device_low_bat_detected[this.userSystemLanguage]}: \n${adapterName} ${objectData.Device} (${objectData.Battery})`;
|
|
3080
|
+
await setMessage(message);
|
|
2989
3081
|
break;
|
|
2990
3082
|
|
|
2991
3083
|
case 'onlineStateDevice':
|
|
2992
3084
|
switch (objectData.Status) {
|
|
2993
3085
|
case 'Online':
|
|
2994
|
-
message = `${translations.Device_available_again[this.
|
|
3086
|
+
message = `${translations.Device_available_again[this.userSystemLanguage]}: \n${adapterName} ${objectData.Device} (${objectData.LastContact})`;
|
|
2995
3087
|
break;
|
|
2996
3088
|
|
|
2997
3089
|
case 'Offline':
|
|
2998
|
-
message = `${translations.Device_not_reachable[this.
|
|
3090
|
+
message = `${translations.Device_not_reachable[this.userSystemLanguage]}: \n${adapterName} ${objectData.Device} (${objectData.LastContact})`;
|
|
2999
3091
|
break;
|
|
3000
3092
|
}
|
|
3001
|
-
setMessage(message);
|
|
3093
|
+
await setMessage(message);
|
|
3002
3094
|
break;
|
|
3003
3095
|
|
|
3004
3096
|
case 'updateDevice':
|
|
3005
|
-
message = `${translations.Device_new_updates[this.
|
|
3006
|
-
setMessage(message);
|
|
3097
|
+
message = `${translations.Device_new_updates[this.userSystemLanguage]}: \n${adapterName} ${objectData.Device}`;
|
|
3098
|
+
await setMessage(message);
|
|
3007
3099
|
break;
|
|
3008
3100
|
|
|
3009
3101
|
case 'updateAdapter':
|
|
3010
3102
|
if (this.countAdapterUpdates === 0) return;
|
|
3011
3103
|
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
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}`;
|
|
3112
|
+
await setMessage(message);
|
|
3015
3113
|
break;
|
|
3016
3114
|
|
|
3017
3115
|
case 'errorInstance':
|
|
3018
3116
|
case 'deactivatedInstance':
|
|
3019
3117
|
objectData = this.listInstanceRaw.get(id);
|
|
3020
|
-
message = `${translations.Instance_Watchdog[this.
|
|
3021
|
-
setMessage(message);
|
|
3118
|
+
message = `${translations.Instance_Watchdog[this.userSystemLanguage]}:\n${id}: ${objectData.status}`;
|
|
3119
|
+
await setMessage(message);
|
|
3022
3120
|
break;
|
|
3023
3121
|
}
|
|
3024
3122
|
}
|
|
@@ -3050,27 +3148,27 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
3050
3148
|
|
|
3051
3149
|
const processInstanceList = (instanceList, property) => {
|
|
3052
3150
|
for (const id of instanceList) {
|
|
3053
|
-
if (this.blacklistInstancesNotify.includes(id[translations['Instance'][this.
|
|
3054
|
-
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]}` : ''}`;
|
|
3055
3153
|
}
|
|
3056
3154
|
};
|
|
3057
3155
|
|
|
3058
|
-
const processNotification = (list, messageType) => {
|
|
3156
|
+
const processNotification = async (list, messageType) => {
|
|
3059
3157
|
if (list.length === 0) return;
|
|
3060
3158
|
|
|
3061
3159
|
switch (checkDays.length) {
|
|
3062
3160
|
case 1:
|
|
3063
|
-
message = `${translations.Weekly_overview[this.
|
|
3161
|
+
message = `${translations.Weekly_overview[this.userSystemLanguage]} ${translations[messageType][this.userSystemLanguage]}: ${list}`;
|
|
3064
3162
|
break;
|
|
3065
3163
|
case 7:
|
|
3066
|
-
message = `${translations.Daily_overview[this.
|
|
3164
|
+
message = `${translations.Daily_overview[this.userSystemLanguage]} ${translations[messageType][this.userSystemLanguage]}: ${list}`;
|
|
3067
3165
|
break;
|
|
3068
3166
|
default:
|
|
3069
|
-
message = `${translations.Overview_of[this.
|
|
3167
|
+
message = `${translations.Overview_of[this.userSystemLanguage]} ${translations[messageType][this.userSystemLanguage]}: ${list}`;
|
|
3070
3168
|
break;
|
|
3071
3169
|
}
|
|
3072
3170
|
|
|
3073
|
-
setMessage(message);
|
|
3171
|
+
await setMessage(message);
|
|
3074
3172
|
};
|
|
3075
3173
|
|
|
3076
3174
|
switch (type) {
|
|
@@ -3083,10 +3181,10 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
3083
3181
|
}
|
|
3084
3182
|
this.log.debug(`Number of selected days for daily low battery devices message: ${checkDays.length}. Send Message on: ${checkDays.join(', ')} ...`);
|
|
3085
3183
|
|
|
3086
|
-
schedule.scheduleJob(`1 ${this.config.checkSendBatteryTime.split(':').reverse().join(' ')} * * ${checkDays.join(',')}`, () => {
|
|
3184
|
+
schedule.scheduleJob(`1 ${this.config.checkSendBatteryTime.split(':').reverse().join(' ')} * * ${checkDays.join(',')}`, async () => {
|
|
3087
3185
|
processDeviceList(this.batteryLowPoweredRaw, 'Device', 'Battery');
|
|
3088
3186
|
|
|
3089
|
-
processNotification(list, 'devices_low_bat');
|
|
3187
|
+
await processNotification(list, 'devices_low_bat');
|
|
3090
3188
|
});
|
|
3091
3189
|
break;
|
|
3092
3190
|
|
|
@@ -3099,10 +3197,10 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
3099
3197
|
}
|
|
3100
3198
|
this.log.debug(`Number of selected days for daily offline devices message: ${checkDays.length}. Send Message on: ${checkDays.join(', ')} ...`);
|
|
3101
3199
|
|
|
3102
|
-
schedule.scheduleJob(`2 ${this.config.checkSendOfflineTime.split(':').reverse().join(' ')} * * ${checkDays.join(',')}`, () => {
|
|
3200
|
+
schedule.scheduleJob(`2 ${this.config.checkSendOfflineTime.split(':').reverse().join(' ')} * * ${checkDays.join(',')}`, async () => {
|
|
3103
3201
|
processDeviceList(this.offlineDevicesRaw, `Device`, 'LastContact');
|
|
3104
3202
|
|
|
3105
|
-
processNotification(list, 'offline_devices');
|
|
3203
|
+
await processNotification(list, 'offline_devices');
|
|
3106
3204
|
});
|
|
3107
3205
|
break;
|
|
3108
3206
|
|
|
@@ -3115,10 +3213,10 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
3115
3213
|
}
|
|
3116
3214
|
this.log.debug(`Number of selected days for daily updatable devices message: ${checkDays.length}. Send Message on: ${checkDays.join(', ')} ...`);
|
|
3117
3215
|
|
|
3118
|
-
schedule.scheduleJob(`3 ${this.config.checkSendUpgradeTime.split(':').reverse().join(' ')} * * ${checkDays.join(',')}`, () => {
|
|
3216
|
+
schedule.scheduleJob(`3 ${this.config.checkSendUpgradeTime.split(':').reverse().join(' ')} * * ${checkDays.join(',')}`, async () => {
|
|
3119
3217
|
processDeviceList(this.upgradableDevicesRaw, 'Device');
|
|
3120
3218
|
|
|
3121
|
-
processNotification(list, 'available_updatable_devices');
|
|
3219
|
+
await processNotification(list, 'available_updatable_devices');
|
|
3122
3220
|
});
|
|
3123
3221
|
break;
|
|
3124
3222
|
|
|
@@ -3131,10 +3229,11 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
3131
3229
|
}
|
|
3132
3230
|
this.log.debug(`Number of selected days for daily adapter update message: ${checkDays.length}. Send Message on: ${checkDays.join(', ')} ...`);
|
|
3133
3231
|
|
|
3134
|
-
schedule.scheduleJob(`4 ${this.config.checkSendAdapterUpdateTime.split(':').reverse().join(' ')} * * ${checkDays.join(',')}`, () => {
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3232
|
+
schedule.scheduleJob(`4 ${this.config.checkSendAdapterUpdateTime.split(':').reverse().join(' ')} * * ${checkDays.join(',')}`, async () => {
|
|
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');
|
|
3138
3237
|
});
|
|
3139
3238
|
break;
|
|
3140
3239
|
|
|
@@ -3147,10 +3246,10 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
3147
3246
|
}
|
|
3148
3247
|
this.log.debug(`Number of selected days for daily instance error message: ${checkDays.length}. Send Message on: ${checkDays.join(', ')} ...`);
|
|
3149
3248
|
|
|
3150
|
-
schedule.scheduleJob(`5 ${this.config.checkSendInstanceFailedTime.split(':').reverse().join(' ')} * * ${checkDays.join(',')}`, () => {
|
|
3249
|
+
schedule.scheduleJob(`5 ${this.config.checkSendInstanceFailedTime.split(':').reverse().join(' ')} * * ${checkDays.join(',')}`, async () => {
|
|
3151
3250
|
processInstanceList(this.listErrorInstanceRaw, 'Status');
|
|
3152
3251
|
|
|
3153
|
-
processNotification(list, 'error_instances_msg');
|
|
3252
|
+
await processNotification(list, 'error_instances_msg');
|
|
3154
3253
|
});
|
|
3155
3254
|
break;
|
|
3156
3255
|
|
|
@@ -3163,10 +3262,10 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
3163
3262
|
}
|
|
3164
3263
|
this.log.debug(`Number of selected days for daily instance deactivated message: ${checkDays.length}. Send Message on: ${checkDays.join(', ')} ...`);
|
|
3165
3264
|
|
|
3166
|
-
schedule.scheduleJob(`5 ${this.config.checkSendInstanceDeactivatedTime.split(':').reverse().join(' ')} * * ${checkDays.join(',')}`, () => {
|
|
3265
|
+
schedule.scheduleJob(`5 ${this.config.checkSendInstanceDeactivatedTime.split(':').reverse().join(' ')} * * ${checkDays.join(',')}`, async () => {
|
|
3167
3266
|
processInstanceList(this.listDeactivatedInstances);
|
|
3168
3267
|
|
|
3169
|
-
processNotification(list, 'deactivated_instances_msg');
|
|
3268
|
+
await processNotification(list, 'deactivated_instances_msg');
|
|
3170
3269
|
});
|
|
3171
3270
|
break;
|
|
3172
3271
|
}
|
|
@@ -3191,14 +3290,14 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
3191
3290
|
return a.localeCompare(b);
|
|
3192
3291
|
});
|
|
3193
3292
|
html = `<center>
|
|
3194
|
-
<b>${[translations.Link_quality_devices[this.
|
|
3293
|
+
<b>${[translations.Link_quality_devices[this.userSystemLanguage]]}:<font> ${deviceCount}</b><small></small></font>
|
|
3195
3294
|
<p></p>
|
|
3196
3295
|
</center>
|
|
3197
3296
|
<table width=100%>
|
|
3198
3297
|
<tr>
|
|
3199
|
-
<th align=left>${[translations.Device[this.
|
|
3200
|
-
<th align=center width=120>${[translations.Adapter[this.
|
|
3201
|
-
<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>
|
|
3202
3301
|
</tr>
|
|
3203
3302
|
<tr>
|
|
3204
3303
|
<td colspan="5"><hr></td>
|
|
@@ -3206,9 +3305,9 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
3206
3305
|
|
|
3207
3306
|
for (const device of devices) {
|
|
3208
3307
|
html += `<tr>
|
|
3209
|
-
<td><font>${device[translations.Device[this.
|
|
3210
|
-
<td align=center><font>${device[translations.Adapter[this.
|
|
3211
|
-
<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>
|
|
3212
3311
|
</tr>`;
|
|
3213
3312
|
}
|
|
3214
3313
|
|
|
@@ -3222,14 +3321,14 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
3222
3321
|
return a.localeCompare(b);
|
|
3223
3322
|
});
|
|
3224
3323
|
html = `<center>
|
|
3225
|
-
<b>${[translations.offline_devices[this.
|
|
3324
|
+
<b>${[translations.offline_devices[this.userSystemLanguage]]}: <font color=${deviceCount === 0 ? '#3bcf0e' : 'orange'}>${deviceCount}</b><small></small></font>
|
|
3226
3325
|
<p></p>
|
|
3227
3326
|
</center>
|
|
3228
3327
|
<table width=100%>
|
|
3229
3328
|
<tr>
|
|
3230
|
-
<th align=left>${[translations.Device[this.
|
|
3231
|
-
<th align=center width=120>${[translations.Adapter[this.
|
|
3232
|
-
<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>
|
|
3233
3332
|
</tr>
|
|
3234
3333
|
<tr>
|
|
3235
3334
|
<td colspan="5"><hr></td>
|
|
@@ -3253,28 +3352,28 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
3253
3352
|
return a.localeCompare(b);
|
|
3254
3353
|
});
|
|
3255
3354
|
html = `<center>
|
|
3256
|
-
<b>${isLowBatteryList === true ? `${[translations.low[this.
|
|
3355
|
+
<b>${isLowBatteryList === true ? `${[translations.low[this.userSystemLanguage]]} ` : ''}${[translations.battery_devices[this.userSystemLanguage]]}:
|
|
3257
3356
|
<font color=${isLowBatteryList === true ? (deviceCount > 0 ? 'orange' : '#3bcf0e') : ''}>${deviceCount}</b></font>
|
|
3258
3357
|
<p></p>
|
|
3259
3358
|
</center>
|
|
3260
3359
|
<table width=100%>
|
|
3261
3360
|
<tr>
|
|
3262
|
-
<th align=left>${[translations.Device[this.
|
|
3263
|
-
<th align=center width=120>${[translations.Adapter[this.
|
|
3264
|
-
<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>
|
|
3265
3364
|
</tr>
|
|
3266
3365
|
<tr>
|
|
3267
3366
|
<td colspan="5"><hr></td>
|
|
3268
3367
|
</tr>`;
|
|
3269
3368
|
for (const device of devices) {
|
|
3270
3369
|
html += `<tr>
|
|
3271
|
-
<td><font>${device[translations.Device[this.
|
|
3272
|
-
<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>`;
|
|
3273
3372
|
|
|
3274
3373
|
if (isLowBatteryList) {
|
|
3275
|
-
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>`;
|
|
3276
3375
|
} else {
|
|
3277
|
-
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>`;
|
|
3278
3377
|
}
|
|
3279
3378
|
html += `</tr>`;
|
|
3280
3379
|
}
|
|
@@ -3295,14 +3394,14 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
3295
3394
|
switch (type) {
|
|
3296
3395
|
case 'allInstancesList':
|
|
3297
3396
|
html = `<center>
|
|
3298
|
-
<b>${[translations.All_Instances[this.
|
|
3397
|
+
<b>${[translations.All_Instances[this.userSystemLanguage]]}:<font> ${instancesCount}</b><small></small></font>
|
|
3299
3398
|
<p></p>
|
|
3300
3399
|
</center>
|
|
3301
3400
|
<table width=100%>
|
|
3302
3401
|
<tr>
|
|
3303
|
-
<th align=left>${[translations.Adapter[this.
|
|
3304
|
-
<th align=center>${[translations.Instance[this.
|
|
3305
|
-
<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>
|
|
3306
3405
|
</tr>
|
|
3307
3406
|
<tr>
|
|
3308
3407
|
<td colspan="5"><hr></td>
|
|
@@ -3321,14 +3420,14 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
3321
3420
|
|
|
3322
3421
|
case 'allActiveInstancesList':
|
|
3323
3422
|
html = `<center>
|
|
3324
|
-
<b>${[translations.Active_Instances[this.
|
|
3423
|
+
<b>${[translations.Active_Instances[this.userSystemLanguage]]}: <font> ${instancesCount}</b><small></small></font>
|
|
3325
3424
|
<p></p>
|
|
3326
3425
|
</center>
|
|
3327
3426
|
<table width=100%>
|
|
3328
3427
|
<tr>
|
|
3329
|
-
<th align=left>${[translations.Adapter[this.
|
|
3330
|
-
<th align=center>${[translations.Instance[this.
|
|
3331
|
-
<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>
|
|
3332
3431
|
</tr>
|
|
3333
3432
|
<tr>
|
|
3334
3433
|
<td colspan="5"><hr></td>
|
|
@@ -3349,24 +3448,24 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
3349
3448
|
|
|
3350
3449
|
case 'errorInstanceList':
|
|
3351
3450
|
html = `<center>
|
|
3352
|
-
<b>${[translations.Error_Instances[this.
|
|
3451
|
+
<b>${[translations.Error_Instances[this.userSystemLanguage]]}: <font color=${instancesCount === 0 ? '#3bcf0e' : 'orange'}>${instancesCount}</b><small></small></font>
|
|
3353
3452
|
<p></p>
|
|
3354
3453
|
</center>
|
|
3355
3454
|
<table width=100%>
|
|
3356
3455
|
<tr>
|
|
3357
|
-
<th align=left>${[translations.Adapter[this.
|
|
3358
|
-
<th align=center>${[translations.Instance[this.
|
|
3359
|
-
<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>
|
|
3360
3459
|
</tr>
|
|
3361
3460
|
<tr>
|
|
3362
3461
|
<td colspan="5"><hr></td>
|
|
3363
3462
|
</tr>`;
|
|
3364
3463
|
|
|
3365
|
-
for (const
|
|
3464
|
+
for (const instance of instances) {
|
|
3366
3465
|
html += `<tr>
|
|
3367
|
-
<td><font>${
|
|
3368
|
-
<td align=center><font>${instance}</font></td>
|
|
3369
|
-
<td align=center><font color=orange>${
|
|
3466
|
+
<td><font>${instance.Adapter}</font></td>
|
|
3467
|
+
<td align=center><font>${instance.Instance}</font></td>
|
|
3468
|
+
<td align=center><font color=orange>${instance.Status}</font></td>
|
|
3370
3469
|
</tr>`;
|
|
3371
3470
|
}
|
|
3372
3471
|
|
|
@@ -3375,14 +3474,14 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
3375
3474
|
|
|
3376
3475
|
case 'deactivatedInstanceList':
|
|
3377
3476
|
html = `<center>
|
|
3378
|
-
<b>${[translations.Deactivated_Instances[this.
|
|
3477
|
+
<b>${[translations.Deactivated_Instances[this.userSystemLanguage]]}: <font color=${instancesCount === 0 ? '#3bcf0e' : 'orange'}>${instancesCount}</b><small></small></font>
|
|
3379
3478
|
<p></p>
|
|
3380
3479
|
</center>
|
|
3381
3480
|
<table width=100%>
|
|
3382
3481
|
<tr>
|
|
3383
|
-
<th align=left>${[translations.Adapter[this.
|
|
3384
|
-
<th align=center>${[translations.Instance[this.
|
|
3385
|
-
<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>
|
|
3386
3485
|
</tr>
|
|
3387
3486
|
<tr>
|
|
3388
3487
|
<td colspan="5"><hr></td>
|
|
@@ -3403,14 +3502,14 @@ class DeviceWatcher extends utils.Adapter {
|
|
|
3403
3502
|
|
|
3404
3503
|
case 'updateAdapterList':
|
|
3405
3504
|
html = `<center>
|
|
3406
|
-
<b>${[translations.Updatable_adapters[this.
|
|
3505
|
+
<b>${[translations.Updatable_adapters[this.userSystemLanguage]]}: <font color=${instancesCount === 0 ? '#3bcf0e' : 'orange'}>${instancesCount}</b><small></small></font>
|
|
3407
3506
|
<p></p>
|
|
3408
3507
|
</center>
|
|
3409
3508
|
<table width=100%>
|
|
3410
3509
|
<tr>
|
|
3411
|
-
<th align=left>${[translations.Adapter[this.
|
|
3412
|
-
<th align=center>${[translations.Installed_Version[this.
|
|
3413
|
-
<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>
|
|
3414
3513
|
</tr>
|
|
3415
3514
|
<tr>
|
|
3416
3515
|
<td colspan="5"><hr></td>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.device-watcher",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.2",
|
|
4
4
|
"description": "Watchdog for devices",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Christian Behrends",
|
|
@@ -42,6 +42,8 @@
|
|
|
42
42
|
"@types/proxyquire": "^1.3.31",
|
|
43
43
|
"@types/sinon": "^17.0.2",
|
|
44
44
|
"@types/sinon-chai": "^3.2.12",
|
|
45
|
+
"@typescript-eslint/eslint-plugin": "^6.18.1",
|
|
46
|
+
"@typescript-eslint/parser": "^6.18.1",
|
|
45
47
|
"chai": "^4.3.10",
|
|
46
48
|
"chai-as-promised": "^7.1.1",
|
|
47
49
|
"cron-parser": "^4.9.0",
|