Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

iobroker.device-watcher

Package Overview
Dependencies
Maintainers
2
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iobroker.device-watcher - npm Package Compare versions

Comparing version 0.2.4 to 0.3.0

4

admin/i18n/de/translations.json

@@ -69,3 +69,5 @@ {

"Use the true value of the signal strength, or it is converted to %": "Verwenden Sie den wahren Wert der Signalstärke oder konvertieren Sie ihn in %",
"Here you can define the offline times of each adapter. If you want to use the data points of the devices (online, available, reachable etc.) directly to determine the status, enter '-1'.": "Hier können Sie die offline Zeiten von jedem Adapter definieren. Falls Sie direkt die Datenpunkte der Geräte (online, available, reachable usw.) nutzen wollen um den Status zu ermitteln, tragen sie '-1' ein."
"Here you can define the offline times of each adapter. If you want to use the data points of the devices (online, available, reachable etc.) directly to determine the status, enter '-1'.": "Hier können Sie die offline Zeiten von jedem Adapter definieren. Falls Sie direkt die Datenpunkte der Geräte (online, available, reachable usw.) nutzen wollen um den Status zu ermitteln, tragen sie '-1' ein.",
"Create additionally HTML lists": "Erstellen Sie zusätzlich HTML-Listen",
"Create the lists also in HTML": "Erstellen Sie die Listen auch in HTML"
}

@@ -66,3 +66,5 @@ {

"Create own folders for each adapter":"Create own folders for each adapter",
"Use the true value of the signal strength, or it is converted to %": "Use the true value of the signal strength, Or it is converted to %"
"Use the true value of the signal strength, or it is converted to %": "Use the true value of the signal strength, Or it is converted to %",
"Create additionally HTML lists": "Create additionally HTML lists",
"Create the lists also in HTML": "Create the lists also in HTML"
}

@@ -69,3 +69,5 @@ {

"Use the true value of the signal strength, or it is converted to %": "Utilice el valor real de la intensidad de la señal, o se convierte a %",
"Here you can define the offline times of each adapter. If you want to use the data points of the devices (online, available, reachable etc.) directly to determine the status, enter '-1'.": "Aquí puede definir los tiempos fuera de línea de cada adaptador. "
"Here you can define the offline times of each adapter. If you want to use the data points of the devices (online, available, reachable etc.) directly to determine the status, enter '-1'.": "Aquí puede definir los tiempos fuera de línea de cada adaptador. ",
"Create additionally HTML lists": "Crear listas HTML adicionales",
"Create the lists also in HTML": "Crea las listas también en HTML"
}

@@ -69,3 +69,5 @@ {

"Use the true value of the signal strength, or it is converted to %": "Utilisez la vraie valeur de la force du signal, ou elle est convertie en %",
"Here you can define the offline times of each adapter. If you want to use the data points of the devices (online, available, reachable etc.) directly to determine the status, enter '-1'.": "Ici, vous pouvez définir les heures hors ligne de chaque adaptateur. "
"Here you can define the offline times of each adapter. If you want to use the data points of the devices (online, available, reachable etc.) directly to determine the status, enter '-1'.": "Ici, vous pouvez définir les heures hors ligne de chaque adaptateur. ",
"Create additionally HTML lists": "Créer des listes HTML supplémentaires",
"Create the lists also in HTML": "Créez les listes aussi en HTML"
}

@@ -69,3 +69,5 @@ {

"Use the true value of the signal strength, or it is converted to %": "Usa il vero valore della potenza del segnale, oppure viene convertito in %",
"Here you can define the offline times of each adapter. If you want to use the data points of the devices (online, available, reachable etc.) directly to determine the status, enter '-1'.": "Qui puoi definire i tempi offline di ciascun adattatore. "
"Here you can define the offline times of each adapter. If you want to use the data points of the devices (online, available, reachable etc.) directly to determine the status, enter '-1'.": "Qui puoi definire i tempi offline di ciascun adattatore. ",
"Create additionally HTML lists": "Crea elenchi HTML aggiuntivi",
"Create the lists also in HTML": "Crea le liste anche in HTML"
}

@@ -69,3 +69,5 @@ {

"Use the true value of the signal strength, or it is converted to %": "Gebruik de werkelijke waarde van de signaalsterkte, of het wordt geconverteerd naar %",
"Here you can define the offline times of each adapter. If you want to use the data points of the devices (online, available, reachable etc.) directly to determine the status, enter '-1'.": "Hier kunt u de offline tijden van elke adapter definiëren. "
"Here you can define the offline times of each adapter. If you want to use the data points of the devices (online, available, reachable etc.) directly to determine the status, enter '-1'.": "Hier kunt u de offline tijden van elke adapter definiëren. ",
"Create additionally HTML lists": "Extra HTML-lijsten maken",
"Create the lists also in HTML": "Maak de lijsten ook in HTML aan"
}

@@ -69,3 +69,5 @@ {

"Use the true value of the signal strength, or it is converted to %": "Użyj prawdziwej wartości siły sygnału lub jest konwertowane na %",
"Here you can define the offline times of each adapter. If you want to use the data points of the devices (online, available, reachable etc.) directly to determine the status, enter '-1'.": "Tutaj możesz zdefiniować czasy offline każdego adaptera. "
"Here you can define the offline times of each adapter. If you want to use the data points of the devices (online, available, reachable etc.) directly to determine the status, enter '-1'.": "Tutaj możesz zdefiniować czasy offline każdego adaptera. ",
"Create additionally HTML lists": "Utwórz dodatkowo listy HTML",
"Create the lists also in HTML": "Twórz listy również w HTML"
}

@@ -69,3 +69,5 @@ {

"Use the true value of the signal strength, or it is converted to %": "Use o valor real da força do sinal, ou é convertido em %",
"Here you can define the offline times of each adapter. If you want to use the data points of the devices (online, available, reachable etc.) directly to determine the status, enter '-1'.": "Aqui você pode definir os tempos offline de cada adaptador. "
"Here you can define the offline times of each adapter. If you want to use the data points of the devices (online, available, reachable etc.) directly to determine the status, enter '-1'.": "Aqui você pode definir os tempos offline de cada adaptador. ",
"Create additionally HTML lists": "Crie listas HTML adicionais",
"Create the lists also in HTML": "Crie as listas também em HTML"
}

@@ -69,3 +69,5 @@ {

"Use the true value of the signal strength, or it is converted to %": "Используйте истинное значение уровня сигнала или преобразуйте его в %",
"Here you can define the offline times of each adapter. If you want to use the data points of the devices (online, available, reachable etc.) directly to determine the status, enter '-1'.": "Здесь вы можете определить время автономной работы каждого адаптера. "
"Here you can define the offline times of each adapter. If you want to use the data points of the devices (online, available, reachable etc.) directly to determine the status, enter '-1'.": "Здесь вы можете определить время автономной работы каждого адаптера. ",
"Create additionally HTML lists": "Создание дополнительных HTML-списков",
"Create the lists also in HTML": "Создавайте списки также в HTML"
}

@@ -69,3 +69,5 @@ {

"Use the true value of the signal strength, or it is converted to %": "使用信号强度的真实值,或者转换为%",
"Here you can define the offline times of each adapter. If you want to use the data points of the devices (online, available, reachable etc.) directly to determine the status, enter '-1'.": "您可以在此处定义每个适配器的离线时间。"
"Here you can define the offline times of each adapter. If you want to use the data points of the devices (online, available, reachable etc.) directly to determine the status, enter '-1'.": "您可以在此处定义每个适配器的离线时间。",
"Create additionally HTML lists": "额外创建 HTML 列表",
"Create the lists also in HTML": "也在 HTML 中创建列表"
}

@@ -35,3 +35,3 @@ {

},
"dectDevices": {
"fritzdectDevices": {
"type": "checkbox",

@@ -43,2 +43,9 @@ "sm": 6,

},
"enoceanDevices": {
"type": "checkbox",
"sm": 6,
"md": 6,
"lg": 3,
"label": "Enocean"
},
"esphomeDevices": {

@@ -79,2 +86,9 @@ "type": "checkbox",

},
"mihomeVacuumDevices": {
"type": "checkbox",
"sm": 6,
"md": 6,
"lg": 3,
"label": "MiHome Vacuum"
},
"nukiExtDevices": {

@@ -567,2 +581,10 @@ "type": "checkbox",

},
"createHtmlList": {
"type": "checkbox",
"sm": 12,
"md": 6,
"lg": 4,
"label": "Create additionally HTML lists",
"help": "Create the lists also in HTML"
},
"_headerOfflineTime": {

@@ -620,2 +642,14 @@ "type": "header",

},
"enoceanMaxMinutes": {
"type": "number",
"min": 0,
"max": 100000,
"sm": 6,
"md": 6,
"lg": 3,
"label": "Enocean",
"help": "in minutes",
"hidden": "!data.enoceanDevices",
"hideOnlyControl": false
},
"esphomeMaxMinutes": {

@@ -642,3 +676,3 @@ "type": "number",

"help": "in minutes",
"hidden": "!data.dectDevices",
"hidden": "!data.fritzdectDevices",
"hideOnlyControl": false

@@ -694,2 +728,14 @@ },

},
"mihomeVacuumMaxMinutes": {
"type": "number",
"min": 0,
"max": 100000,
"sm": 6,
"md": 6,
"lg": 3,
"label": "Mihome Vacuum",
"help": "in minutes",
"hidden": "!data.mihomeVacuumDevices",
"hideOnlyControl": false
},
"nukiextendMaxMinutes": {

@@ -696,0 +742,0 @@ "type": "number",

{
"common": {
"name": "device-watcher",
"version": "0.2.4",
"version": "0.3.0",
"news": {
"0.3.0": {
"en": "removed channelnumber in Homematic devices name\nadded function to create html list\nadded german and english documentation",
"de": "kanalnummer entfernt in Homematic Gerätename\nfunktion hinzugefügt, um html-liste zu erstellen\ndeutsche und englische dokumentation",
"ru": "удаленный номер канала в имени Homematic устройств\nдобавлена функция для создания списка html\nдобавлена немецкая и английская документация",
"pt": "número de canal removido no nome de dispositivos Homematic\nfunção adicionada para criar lista html\nadicionado alemão e inglês documentação",
"nl": "verwijderde kanaal in Homema apparatuur\nvertaling:\nvertaling:",
"fr": "le nombre de canaux supprimés dans le nom des dispositifs Homematic\nfonction ajoutée pour créer la liste html\ndocuments allemands et anglais ajoutés",
"it": "numero di canale rimosso nel nome dei dispositivi Homematic\nfunzione aggiunta per creare l'elenco html\naggiunta documentazione tedesca e inglese",
"es": "número de canal eliminado en el nombre de dispositivos Homemáticos\nfunción agregada para crear la lista html\ndocumentación alemana e inglesa",
"pl": "usunąć numer kanałowy w nazwie Homematic\ndodano funkcję do tworzenia listy html\ndodał germanizm i english documentation",
"zh-cn": "拆除家庭装置名称的渠道\nd. 增设的编制名单的职能\n增 录"
},
"0.2.4": {

@@ -225,2 +237,3 @@ "en": "many changes of code, comments and error handling",

"esphomeDevices": false,
"enoceanDevices": false,
"zigbeeDevices": false,

@@ -233,3 +246,3 @@ "bleDevices": false,

"zwaveDevices": false,
"dectDevices": false,
"fritzdectDevices": false,
"hueDevices": false,

@@ -242,5 +255,7 @@ "hueExtDevices": false,

"mihomeDevices": false,
"mihomeVacuumDevices": false,
"trueState": false,
"listOnlyBattery": false,
"createOwnFolder": false,
"createHtmlList": false,
"checkSendOfflineMsg": false,

@@ -277,2 +292,3 @@ "checkSendBatteryMsg": false,

"esphomeMaxMinutes": -1,
"enoceanMaxMinutes": 300,
"fritzdectMaxMinutes": -1,

@@ -283,2 +299,3 @@ "homematicMaxMinutes": -1,

"mihomeMaxMinutes": 300,
"mihomeVacuumMaxMinutes": 300,
"nukiextendMaxMinutes": -1,

@@ -323,12 +340,12 @@ "pingMaxMinutes": -1,

"name": {
"en": "List of offline devices",
"de": "Liste der Offline-Geräte",
"ru": "Список оффлайн устройств",
"pt": "Lista de dispositivos off-line",
"nl": "List van offline apparatuur",
"fr": "Liste des dispositifs hors ligne",
"it": "Elenco dei dispositivi offline",
"es": "Lista de dispositivos sin conexión",
"pl": "Lista urządzeń offline",
"zh-cn": "线装置清单"
"en": "JSON List of offline devices",
"de": "JSON Liste der Offline-Geräte",
"ru": "JSON Список оффлайн устройств",
"pt": "JSON Lista de dispositivos off-line",
"nl": "JSON List van offline apparatuur",
"fr": "JSON Liste des dispositifs hors ligne",
"it": "JSON Elenco dei dispositivi offline",
"es": "JSON Lista de dispositivos sin conexión",
"pl": "JSON Lista urządzeń offline",
"zh-cn": "JSON 线装置清单"
},

@@ -347,12 +364,12 @@ "type": "array",

"name": {
"en": "List of all devices",
"de": "Liste aller Geräte",
"ru": "Список всех устройств",
"pt": "Lista de todos os dispositivos",
"nl": "List van alle apparaten",
"fr": "Liste de tous les dispositifs",
"it": "Elenco di tutti i dispositivi",
"es": "Lista de todos los dispositivos",
"pl": "Lista wszystkich urządzeń",
"zh-cn": "所有装置清单"
"en": "JSON List of all devices",
"de": "JSON Liste aller Geräte",
"ru": "JSON Список всех устройств",
"pt": "JSON Lista de todos os dispositivos",
"nl": "JSON List van alle apparaten",
"fr": "JSON Liste de tous les dispositifs",
"it": "JSON Elenco di tutti i dispositivi",
"es": "JSON Lista de todos los dispositivos",
"pl": "JSON Lista wszystkich urządzeń",
"zh-cn": "JSON 所有装置清单"
},

@@ -371,12 +388,12 @@ "type": "array",

"name": {
"en": "List of devices with signal strength",
"de": "Liste der Geräte mit Signalstärke",
"ru": "Список устройств с силой сигнала",
"pt": "Lista de dispositivos com força de sinal",
"nl": "List van apparaten met signaalkracht",
"fr": "Liste des dispositifs avec force de signal",
"it": "Elenco dei dispositivi con forza del segnale",
"es": "Lista de dispositivos con fuerza de señal",
"pl": "Lista urządzeń z siłą sygnałową",
"zh-cn": "具有信号实力的装置清单"
"en": "JSON List of devices with signal strength",
"de": "JSON Liste der Geräte mit Signalstärke",
"ru": "JSON Список устройств с силой сигнала",
"pt": "JSON Lista de dispositivos com força de sinal",
"nl": "JSON List van apparaten met signaalkracht",
"fr": "JSON Liste des dispositifs avec force de signal",
"it": "JSON Elenco dei dispositivi con forza del segnale",
"es": "JSON Lista de dispositivos con fuerza de señal",
"pl": "JSON Lista urządzeń z siłą sygnałową",
"zh-cn": "JSON 具有信号实力的装置清单"
},

@@ -418,12 +435,12 @@ "type": "array",

"name": {
"en": "List of devices with battery state",
"de": "Liste der Geräte mit Batteriezustand",
"ru": "Список устройств с состоянием батареи",
"pt": "Lista de dispositivos com estado da bateria",
"nl": "List van apparaten met batterij staat",
"fr": "Liste des appareils avec état de batterie",
"it": "Elenco dei dispositivi con stato della batteria",
"es": "Lista de dispositivos con estado de batería",
"pl": "Lista urządzeń z baterią stanową",
"zh-cn": "电池国装置清单"
"en": "JSON List of devices with battery state",
"de": "JSON Liste der Geräte mit Batteriezustand",
"ru": "JSON Список устройств с состоянием батареи",
"pt": "JSON Lista de dispositivos com estado da bateria",
"nl": "JSON List van apparaten met batterij staat",
"fr": "JSON Liste des appareils avec état de batterie",
"it": "JSON Elenco dei dispositivi con stato della batteria",
"es": "JSON Lista de dispositivos con estado de batería",
"pl": "JSON Lista urządzeń z baterią stanową",
"zh-cn": "JSON 电池国装置清单"
},

@@ -442,12 +459,12 @@ "type": "array",

"name": {
"en": "List of devices with low battery state",
"de": "Liste der Geräte mit niedrigem Batteriezustand",
"ru": "Список устройств с низким состоянием батареи",
"pt": "Lista de dispositivos com baixo estado da bateria",
"nl": "List van apparaten met lage batterij staat",
"fr": "Liste des appareils à faible état de batterie",
"it": "Elenco di dispositivi con stato di batteria basso",
"es": "Lista de dispositivos con estado de batería bajo",
"pl": "Lista urządzeń o niskim stanie baterii",
"zh-cn": "低电池国家装置清单"
"en": "JSON List of devices with low battery state",
"de": "JSON Liste der Geräte mit niedrigem Batteriezustand",
"ru": "JSON Список устройств с низким состоянием батареи",
"pt": "JSON Lista de dispositivos com baixo estado da bateria",
"nl": "JSON List van apparaten met lage batterij staat",
"fr": "JSON Liste des appareils à faible état de batterie",
"it": "JSON Elenco di dispositivi con stato di batteria basso",
"es": "JSON Lista de dispositivos con estado de batería bajo",
"pl": "JSON Lista urządzeń o niskim stanie baterii",
"zh-cn": "JSON 低电池国家装置清单"
},

@@ -454,0 +471,0 @@ "type": "array",

@@ -29,152 +29,168 @@ /* jshint -W097 */

// arrays
this.offlineDevices = [],
this.linkQualityDevices = [];
this.batteryPowered = [];
this.batteryLowPowered = [];
this.listAllDevices = [];
this.blacklistArr = [];
this.arrDev = [];
this.adapterSelected = [];
this.offlineDevices = [];
this.linkQualityDevices = [];
this.batteryPowered = [];
this.batteryLowPowered = [];
this.listAllDevices = [];
this.blacklistArr = [];
this.arrDev = [];
this.adapterSelected = [];
// counts
this.offlineDevicesCount = 0;
this.deviceCounter = 0;
this.linkQualityCount = 0;
this.batteryPoweredCount = 0;
this.lowBatteryPoweredCount = 0;
this.offlineDevicesCount = 0;
this.deviceCounter = 0;
this.linkQualityCount = 0;
this.batteryPoweredCount = 0;
this.lowBatteryPoweredCount = 0;
this.deviceReachable = '';
this.deviceReachable = '';
// arrays of supported adapters
this.arrApart = {
alexa2: {
'Selektor':'alexa2.*.online',
'adapter':'alexa2',
'battery':'none',
'reach':'.online',
'isLowBat':'none'
alexa2: {
'Selektor': 'alexa2.*.online',
'adapter': 'alexa2',
'battery': 'none',
'reach': '.online',
'isLowBat': 'none'
},
ble: {
'Selektor':'ble.*.rssi',
'adapter':'ble',
'battery':'.battery',
'reach':'none',
'isLowBat':'none'
ble: {
'Selektor': 'ble.*.rssi',
'adapter': 'ble',
'battery': '.battery',
'reach': 'none',
'isLowBat': 'none'
},
esphome: {
'Selektor':'esphome.*._online',
'adapter':'esphome',
'battery':'none',
'reach':'._online',
'isLowBat':'none',
'id':'.name'
deconz: {
'Selektor': 'deconz.*.reachable',
'adapter': 'deconz',
'battery': '.battery',
'reach': '.reachable',
'isLowBat': 'none'
},
zigbee: {
'Selektor':'zigbee.*.link_quality',
'adapter':'zigbee',
'battery':'.battery',
'reach':'.available',
'isLowBat':'.battery_low'
enocean: {
'Selektor': 'enocean.*.rssi',
'adapter': 'enocean',
'battery': '.BS',
'reach': 'none',
'isLowBat': 'none'
},
sonoff: {
'Selektor':'sonoff.*.Uptime',
'adapter':'sonoff',
'rssiState': '.Wifi_RSSI',
'battery':'.battery',
'reach':'.alive',
'isLowBat':'none'
esphome: {
'Selektor': 'esphome.*._online',
'adapter': 'esphome',
'battery': 'none',
'reach': '._online',
'isLowBat': 'none',
'id': '.name'
},
shelly: {
'Selektor':'shelly.*.rssi',
'adapter':'shelly',
'battery':'.sensor.battery',
'reach':'.online',
'isLowBat':'none'
fritzdect: {
'Selektor': 'fritzdect.*.present',
'adapter': 'fritzDect',
'battery': '.battery',
'reach': '.present',
'isLowBat': '.batterylow'
},
homematic: {
'Selektor':'hm-rpc.*.UNREACH',
'adapter':'homematic',
'rssiState':'.RSSI_DEVICE',
'battery':'.OPERATING_VOLTAGE',
'reach':'.UNREACH',
'isLowBat':'.LOW_BAT',
'isLowBat2':'.LOWBAT'
homematic: {
'Selektor': 'hm-rpc.*.UNREACH',
'adapter': 'homematic',
'rssiState': '.RSSI_DEVICE',
'battery': '.OPERATING_VOLTAGE',
'reach': '.UNREACH',
'isLowBat': '.LOW_BAT',
'isLowBat2': '.LOWBAT'
},
deconz: {
'Selektor':'deconz.*.reachable',
'adapter':'deconz',
'battery':'.battery',
'reach':'.reachable',
'isLowBat':'none'
hue: {
'Selektor': 'hue.*.reachable',
'adapter': 'hue',
'battery': '.battery',
'reach': '.reachable',
'isLowBat': 'none'
},
zwave: {
'Selektor':'zwave2.*.ready',
'adapter':'zwave',
'battery':'.Battery.level',
'reach':'.ready',
'isLowBat':'.Battery.isLow'
hueExt: {
'Selektor': 'hue-extended.*.reachable',
'adapter': 'hue-extended',
'battery': '.config.battery',
'reach': '.reachable',
'isLowBat': 'none'
},
dect: {
'Selektor':'fritzdect.*.present',
'adapter':'fritzDect',
'battery':'.battery',
'reach':'.present',
'isLowBat':'.batterylow'
mihome: {
'Selektor': 'mihome.*.percent',
'adapter': 'miHome',
'battery': '.percent',
'reach': 'none',
'isLowBat': 'none'
},
hue: {
'Selektor':'hue.*.reachable',
'adapter':'hue',
'battery':'.battery',
'reach':'.reachable',
'isLowBat':'none'
mihomeGW: {
'Selektor': 'mihome.*.connected',
'adapter': 'miHome',
'battery': 'none',
'reach': '.connected',
'isLowBat': 'none'
},
hueExt: {
'Selektor':'hue-extended.*.reachable',
'adapter':'hue-extended',
'battery':'.config.battery',
'reach':'.reachable',
'isLowBat':'none'
mihomeVacuum: {
'Selektor': 'mihome-vacuum.*.wifi_signal',
'adapter': 'mihomeVacuum',
'rssiState': '.wifi_signal',
'battery': '.info.battery',
'battery2': '.control.battary_life',
'reach': '.connection',
'isLowBat': 'none'
},
ping: {
'Selektor':'ping.*.alive',
'adapter':'ping',
'battery':'none',
'reach':'.alive',
'isLowBat':'none'
nukiExt: {
'Selektor': 'nuki-extended.*.batteryCritical',
'adapter': 'nuki-extended',
'battery': '.batteryCharge',
'reach': 'none',
'isLowBat': '.batteryCritical'
},
switchbotBle: {
'Selektor':'switchbot-ble.*.rssi',
'adapter':'switchbotBle',
'battery':'.battery',
'reach':'none',
'isLowBat':'none',
'id':'.id'
ping: {
'Selektor': 'ping.*.alive',
'adapter': 'ping',
'battery': 'none',
'reach': '.alive',
'isLowBat': 'none'
},
sonos: {
'Selektor':'sonos.*.alive',
'adapter':'sonos',
'battery':'none',
'reach':'.alive',
'isLowBat':'none'
shelly: {
'Selektor': 'shelly.*.rssi',
'adapter': 'shelly',
'battery': '.sensor.battery',
'reach': '.online',
'isLowBat': 'none'
},
mihome: {
'Selektor':'mihome.*.percent',
'adapter':'miHome',
'battery':'.percent',
'reach':'none',
'isLowBat':'none'
sonoff: {
'Selektor': 'sonoff.*.Uptime',
'adapter': 'sonoff',
'rssiState': '.Wifi_Signal',
'battery': '.battery',
'reach': '.alive',
'isLowBat': 'none'
},
mihomeGW: {
'Selektor':'mihome.*.connected',
'adapter':'miHome',
'battery':'none',
'reach':'.connected',
'isLowBat':'none'
sonos: {
'Selektor': 'sonos.*.alive',
'adapter': 'sonos',
'battery': 'none',
'reach': '.alive',
'isLowBat': 'none'
},
nukiExt: {
'Selektor':'nuki-extended.*.batteryCritical',
'adapter':'nuki-extended',
'battery':'.batteryCharge',
'reach':'none',
'isLowBat':'.batteryCritical'
switchbotBle: {
'Selektor': 'switchbot-ble.*.rssi',
'adapter': 'switchbotBle',
'battery': '.battery',
'reach': 'none',
'isLowBat': 'none',
'id': '.id'
},
zigbee: {
'Selektor': 'zigbee.*.link_quality',
'adapter': 'zigbee',
'battery': '.battery',
'reach': '.available',
'isLowBat': '.battery_low'
},
zwave: {
'Selektor': 'zwave2.*.ready',
'adapter': 'zwave',
'battery': '.Battery.level',
'reach': '.ready',
'isLowBat': '.Battery.isLow'
}

@@ -204,23 +220,25 @@ };

this.supAdapter = {
alexa2: this.config.alexa2Devices,
esphome: this.config.esphomeDevices,
zigbee: this.config.zigbeeDevices,
ble: this.config.bleDevices,
sonoff: this.config.sonoffDevices,
shelly: this.config.shellyDevices,
homematic: this.config.homematicDevices,
deconz: this.config.deconzDevices,
zwave: this.config.zwaveDevices,
dect: this.config.dectDevices,
hue: this.config.hueDevices,
hueExt: this.config.hueExtDevices,
nukiExt: this.config.nukiExtDevices,
ping: this.config.pingDevices,
switchbotBle: this.config.switchbotBleDevices,
sonos: this.config.sonosDevices,
mihome: this.config.mihomeDevices,
mihomeGW: this.config.mihomeDevices
alexa2: this.config.alexa2Devices,
ble: this.config.bleDevices,
deconz: this.config.deconzDevices,
enocean: this.config.enoceanDevices,
esphome: this.config.esphomeDevices,
fritzdect: this.config.fritzdectDevices,
homematic: this.config.homematicDevices,
hue: this.config.hueDevices,
hueExt: this.config.hueExtDevices,
mihome: this.config.mihomeDevices,
mihomeGW: this.config.mihomeDevices,
mihomeVacuum: this.config.mihomeVacuumDevices,
nukiExt: this.config.nukiExtDevices,
ping: this.config.pingDevices,
shelly: this.config.shellyDevices,
sonoff: this.config.sonoffDevices,
sonos: this.config.sonosDevices,
switchbotBle: this.config.switchbotBleDevices,
zigbee: this.config.zigbeeDevices,
zwave: this.config.zwaveDevices,
};
for(const [id] of Object.entries(this.arrApart)) {
for (const [id] of Object.entries(this.arrApart)) {
if (this.supAdapter[id]) {

@@ -243,3 +261,3 @@ this.arrDev.push(this.arrApart[id]);

try {
for(const [id] of Object.entries(this.arrApart)) {
for (const [id] of Object.entries(this.arrApart)) {
if (this.supAdapter[id]) {

@@ -249,2 +267,3 @@

await this.createDPsForEachAdapter(id);
if (this.config.createHtmlList) await this.createHtmlListDatapoints(id);
this.log.debug(`Created datapoints for ${await this.capitalize(id)}`);

@@ -262,2 +281,3 @@ await this.createDataForEachAdapter(id);

try {
if (this.config.createHtmlList) await this.createHtmlListDatapoints();
await this.createDataOfAllAdapter();

@@ -278,6 +298,5 @@ this.log.debug(`Created and filled data for all adapters`);

/**
* @param {string} [sentence] - Word which should be capitalize
**/
async capitalize(sentence)
{
* @param {string} [sentence] - Word which should be capitalize
**/
async capitalize(sentence) {
//make the first letter uppercase

@@ -288,4 +307,4 @@ return sentence && sentence[0].toUpperCase() + sentence.slice(1);

/**
* @param {object} [obj] - State of datapoint
**/
* @param {object} [obj] - State of datapoint
**/
async getInitValue(obj) {

@@ -298,4 +317,4 @@ //state can be null or undefinded

/**
* @param {object} [obj] - State of own datapoint
**/
* @param {object} [obj] - State of own datapoint
**/
async getOwnInitValue(obj) {

@@ -309,4 +328,4 @@ //state can be null or undefinded for own states

/**
* @param {object} [adptName] - Adaptername of devices
**/
* @param {object} [adptName] - Adaptername of devices
**/
async createDPsForEachAdapter(adptName) {

@@ -344,2 +363,3 @@

});
await this.setObjectNotExistsAsync(`${adptName}.offlineList`, {

@@ -367,2 +387,3 @@ 'type': 'state',

});
await this.setObjectNotExistsAsync(`${adptName}.listAll`, {

@@ -390,2 +411,3 @@ 'type': 'state',

});
await this.setObjectNotExistsAsync(`${adptName}.linkQualityList`, {

@@ -413,2 +435,3 @@ 'type': 'state',

});
await this.setObjectNotExistsAsync(`${adptName}.countAll`, {

@@ -436,2 +459,3 @@ 'type': 'state',

});
await this.setObjectNotExistsAsync(`${adptName}.batteryList`, {

@@ -459,2 +483,3 @@ 'type': 'state',

});
await this.setObjectNotExistsAsync(`${adptName}.lowBatteryList`, {

@@ -482,2 +507,3 @@ 'type': 'state',

});
await this.setObjectNotExistsAsync(`${adptName}.lowBatteryCount`, {

@@ -505,2 +531,3 @@ 'type': 'state',

});
await this.setObjectNotExistsAsync(`${adptName}.batteryCount`, {

@@ -531,11 +558,117 @@ 'type': 'state',

/**
* @param {object} [i] - Device Object
**/
* @param {object} [adptName] - Adaptername of devices
**/
async createHtmlListDatapoints(adptName) {
let dpSubFolder;
//write the datapoints in subfolders with the adaptername otherwise write the dP's in the root folder
if (adptName) {
dpSubFolder = `${adptName}.`;
} else {
dpSubFolder = '';
}
await this.setObjectNotExistsAsync(`${dpSubFolder}offlineListHTML`, {
'type': 'state',
'common': {
'name': {
'en': 'HTML List of offline devices',
'de': 'HTML Liste der Offline-Geräte',
'ru': 'HTML Список оффлайн устройств',
'pt': 'HTML Lista de dispositivos off-line',
'nl': 'HTML List van offline apparatuur',
'fr': 'HTML Liste des dispositifs hors ligne',
'it': 'HTML Elenco dei dispositivi offline',
'es': 'HTML Lista de dispositivos sin conexión',
'pl': 'HTML Lista urządzeń offline',
'zh-cn': 'HTML 线装置清单'
},
'type': 'string',
'role': 'html',
'read': true,
'write': false,
},
'native': {}
});
await this.setObjectNotExistsAsync(`${dpSubFolder}linkQualityListHTML`, {
'type': 'state',
'common': {
'name': {
'en': 'HTML List of devices with signal strength',
'de': 'HTML Liste der Geräte mit Signalstärke',
'ru': 'HTML Список устройств с силой сигнала',
'pt': 'HTML Lista de dispositivos com força de sinal',
'nl': 'HTML List van apparaten met signaalkracht',
'fr': 'HTML Liste des dispositifs avec force de signal',
'it': 'HTML Elenco dei dispositivi con forza del segnale',
'es': 'HTML Lista de dispositivos con fuerza de señal',
'pl': 'HTML Lista urządzeń z siłą sygnałową',
'zh-cn': 'HTML 具有信号实力的装置清单'
},
'type': 'string',
'role': 'value',
'read': true,
'write': false,
},
'native': {}
});
await this.setObjectNotExistsAsync(`${dpSubFolder}batteryListHTML`, {
'type': 'state',
'common': {
'name': {
'en': 'HTML List of devices with battery state',
'de': 'HTML Liste der Geräte mit Batteriezustand',
'ru': 'HTML Список устройств с состоянием батареи',
'pt': 'HTML Lista de dispositivos com estado da bateria',
'nl': 'HTML List van apparaten met batterij staat',
'fr': 'HTML Liste des appareils avec état de batterie',
'it': 'HTML Elenco dei dispositivi con stato della batteria',
'es': 'HTML Lista de dispositivos con estado de batería',
'pl': 'HTML Lista urządzeń z baterią stanową',
'zh-cn': 'HTML 电池国装置清单'
},
'type': 'string',
'role': 'html',
'read': true,
'write': false,
},
'native': {}
});
await this.setObjectNotExistsAsync(`${dpSubFolder}lowBatteryListHTML`, {
'type': 'state',
'common': {
'name': {
'en': 'HTML List of devices with low battery state',
'de': 'HTML Liste der Geräte mit niedrigem Batteriezustand',
'ru': 'HTML Список устройств с низким состоянием батареи',
'pt': 'HTML Lista de dispositivos com baixo estado da bateria',
'nl': 'HTML List van apparaten met lage batterij staat',
'fr': 'HTML Liste des appareils à faible état de batterie',
'it': 'HTML Elenco di dispositivi con stato di batteria basso',
'es': 'HTML Lista de dispositivos con estado de batería bajo',
'pl': 'HTML Lista urządzeń o niskim stanie baterii',
'zh-cn': 'HTML 低电池国家装置清单'
},
'type': 'string',
'role': 'html',
'read': true,
'write': false,
},
'native': {}
});
}
/**
* @param {object} [i] - Device Object
**/
async createData(i) {
const devices = await this.getForeignStatesAsync(this.arrDev[i].Selektor);
const devices = await this.getForeignStatesAsync(this.arrDev[i].Selektor);
const deviceAdapterName = await this.capitalize(this.arrDev[i].adapter);
const myBlacklist = this.config.tableBlacklist;
const myBlacklist = this.config.tableBlacklist;
/*---------- Loop for blacklist ----------*/
for(const i in myBlacklist){
for (const i in myBlacklist) {
this.blacklistArr.push(myBlacklist[i].device);

@@ -546,7 +679,7 @@ this.log.debug(`Found items on the blacklist: ${this.blacklistArr}`);

/*---------- Start of second main loop ----------*/
for(const [id] of Object.entries(devices)) {
for (const [id] of Object.entries(devices)) {
if (!this.blacklistArr.includes(id)) {
const currDeviceString = id.slice(0, (id.lastIndexOf('.') + 1) - 1);
const shortCurrDeviceString = currDeviceString.slice(0, (currDeviceString.lastIndexOf('.') + 1) - 1);
const currDeviceString = id.slice(0, (id.lastIndexOf('.') + 1) - 1);
const shortCurrDeviceString = currDeviceString.slice(0, (currDeviceString.lastIndexOf('.') + 1) - 1);

@@ -565,3 +698,5 @@ //Get device name

case 'hue-extended':
if (shortDeviceObject && typeof shortDeviceObject === 'object') {
case 'mihomeVacuum':
case 'homematic':
if (shortDeviceObject && typeof shortDeviceObject === 'object') {
deviceName = shortDeviceObject.common.name;

@@ -579,5 +714,7 @@ }

const deviceMainSelector = await this.getForeignStateAsync(id);
// 3. Get battery states
const deviceBatteryState = await this.getInitValue(currDeviceString + this.arrDev[i].battery);
const shortDeviceBatteryState = await this.getInitValue(shortCurrDeviceString + this.arrDev[i].battery);
const deviceBatteryState = await this.getInitValue(currDeviceString + this.arrDev[i].battery);
const shortDeviceBatteryState = await this.getInitValue(shortCurrDeviceString + this.arrDev[i].battery);
const shortDeviceBatteryState2 = await this.getInitValue(shortCurrDeviceString + this.arrDev[i].battery2);

@@ -589,4 +726,5 @@ // 1. Get link quality

switch (this.arrDev[i].adapter) {
case 'sonoff':
case 'mihomeVacuum':
case 'homematic':
case 'sonoff':
deviceQualityState = await this.getForeignStateAsync(currDeviceString + this.arrDev[i].rssiState);

@@ -598,3 +736,3 @@ break;

if ((deviceQualityState) && (typeof deviceQualityState.val === 'number')){
if ((deviceQualityState) && (typeof deviceQualityState.val === 'number')) {
if (this.config.trueState) {

@@ -606,3 +744,3 @@ linkQuality = deviceQualityState.val;

} else if ((deviceQualityState.val) >= 0) {
linkQuality = parseFloat((100/255 * deviceQualityState.val).toFixed(0)) + '%';
linkQuality = parseFloat((100 / 255 * deviceQualityState.val).toFixed(0)) + '%';
}

@@ -630,3 +768,3 @@ }

} else {
// no linkQuality available for powered devices
// no linkQuality available for powered devices
linkQuality = ' - ';

@@ -649,10 +787,9 @@ }

const getLastContact = async () => {
lastContactString = this.formatDate(new Date((deviceMainSelector.ts)), 'hh:mm') + ' Uhr';
if (Math.round(lastContact) > 100) {
lastContactString = Math.round(lastContact/60) + ' Stunden';
lastContactString = Math.round(lastContact / 60) + ' Stunden';
}
if (Math.round(lastContact/60) > 48) {
lastContactString = Math.round(lastContact/60/24) + ' Tagen';
if (Math.round(lastContact / 60) > 48) {
lastContactString = Math.round(lastContact / 60 / 24) + ' Tagen';
}

@@ -665,6 +802,6 @@ return lastContactString;

if (Math.round(lastStateChange) > 100) {
lastContactString = Math.round(lastStateChange/60) + ' Stunden';
lastContactString = Math.round(lastStateChange / 60) + ' Stunden';
}
if (Math.round(lastStateChange/60) > 48) {
lastContactString = Math.round(lastStateChange/60/24) + ' Tagen';
if (Math.round(lastStateChange / 60) > 48) {
lastContactString = Math.round(lastStateChange / 60 / 24) + ' Tagen';
}

@@ -747,2 +884,13 @@ return lastContactString;

break;
case 'enocean':
if (this.config.enoceanMaxMinutes === -1) {
if (!deviceUnreachState) {
deviceState = 'Offline'; //set online state to offline
await pushOfflineDevice();
}
} else if (lastContact > this.config.enoceanMaxMinutes) {
deviceState = 'Offline'; //set online state to offline
await pushOfflineDevice();
}
break;
case 'esphome':

@@ -814,2 +962,13 @@ if (this.config.esphomeMaxMinutes === -1) {

break;
case 'mihomeVacuum':
if (this.config.mihomeVacuumMaxMinutes === -1) {
if (!deviceUnreachState) {
deviceState = 'Offline'; //set online state to offline
await pushOfflineDevice();
}
} else if (lastContact > this.config.mihomeVacuumMaxMinutes) {
deviceState = 'Offline'; //set online state to offline
await pushOfflineDevice();
}
break;
case 'nuki-extended':

@@ -949,2 +1108,23 @@ if (this.config.nukiextendMaxMinutes === -1) {

break;
case 'mihomeVacuum':
if (shortDeviceBatteryState) {
batteryHealth = shortDeviceBatteryState + '%';
this.batteryPowered.push(
{
'Device': deviceName,
'Adapter': deviceAdapterName,
'Battery': batteryHealth
}
);
} else if (shortDeviceBatteryState2) {
batteryHealth = shortDeviceBatteryState2 + '%';
this.batteryPowered.push(
{
'Device': deviceName,
'Adapter': deviceAdapterName,
'Battery': batteryHealth
}
);
}
break;
default:

@@ -966,5 +1146,5 @@ batteryHealth = (deviceBatteryState) + '%';

// 3c. Count how many devices are with low battery
const batteryWarningMin = this.config.minWarnBatterie;
const deviceLowBatState = await this.getInitValue(currDeviceString + this.arrDev[i].isLowBat);
const deviceLowBatStateHM = await this.getInitValue(currDeviceString + this.arrDev[i].isLowBat2);
const batteryWarningMin = this.config.minWarnBatterie;
const deviceLowBatState = await this.getInitValue(currDeviceString + this.arrDev[i].isLowBat);
const deviceLowBatStateHM = await this.getInitValue(currDeviceString + this.arrDev[i].isLowBat2);

@@ -1042,4 +1222,4 @@ switch (this.arrDev[i].adapter) {

/**
* @param {string} [adptName] - Adapter name
*/
* @param {string} [adptName] - Adapter name
*/
async createDataForEachAdapter(adptName) {

@@ -1092,4 +1272,4 @@ // create Data for each Adapter in own lists

* Notification service
* @param {string} [text] - Text which should be send
**/
* @param {string} [text] - Text which should be send
**/
async sendNotification(text) {

@@ -1187,3 +1367,3 @@

const jsonText = JSON.stringify(text);
await this.setForeignStateAsync(`${this.config.instanceJarvis}.addNotification`, '{"title":"'+ this.config.titleJarvis +' (' + this.formatDate(new Date(), 'DD.MM.YYYY - hh:mm:ss') + ')","message": ' + jsonText + ',"display": "drawer"}');
await this.setForeignStateAsync(`${this.config.instanceJarvis}.addNotification`, '{"title":"' + this.config.titleJarvis + ' (' + this.formatDate(new Date(), 'DD.MM.YYYY - hh:mm:ss') + ')","message": ' + jsonText + ',"display": "drawer"}');
}

@@ -1205,3 +1385,3 @@ }

const jsonText = JSON.stringify(text);
await this.setForeignStateAsync(`${this.config.instanceLovelace}.notifications.add`, '{"message":' + jsonText + ', "title":"'+ this.config.titleLovelace +' (' + this.formatDate(new Date(), 'DD.MM.YYYY - hh:mm:ss') + ')"}');
await this.setForeignStateAsync(`${this.config.instanceLovelace}.notifications.add`, '{"message":' + jsonText + ', "title":"' + this.config.titleLovelace + ' (' + this.formatDate(new Date(), 'DD.MM.YYYY - hh:mm:ss') + ')"}');
}

@@ -1268,3 +1448,3 @@ }

checkDays.forEach(object => {
if((object >= 0) && today == object){
if ((object >= 0) && today == object) {
checkToday = true;

@@ -1285,6 +1465,6 @@ }

// set indicator for send message first to 'false', after sending to 'true'
if (now.getHours() < 11) {await this.setStateAsync('info.lastBatteryNotification', false, true);}
if (now.getHours() < 11) { await this.setStateAsync('info.lastBatteryNotification', false, true); }
// if time is > 11 (12:00 pm create message for low battery devices)
if ((now.getHours() > 11) && (!lastBatteryNotifyIndicator) && (checkToday != undefined)){
if ((now.getHours() > 11) && (!lastBatteryNotifyIndicator) && (checkToday != undefined)) {
let msg = '';

@@ -1300,3 +1480,3 @@

await this.sendNotification(msg);
await this.sendNotification(`Niedriege Batteriezustände: ${msg}`);

@@ -1319,16 +1499,16 @@ await this.setStateAsync('info.lastBatteryNotification', true, true);

// arrays
this.offlineDevices = [],
this.linkQualityDevices = [];
this.batteryPowered = [];
this.batteryLowPowered = [];
this.listAllDevices = [];
this.offlineDevices = [],
this.linkQualityDevices = [];
this.batteryPowered = [];
this.batteryLowPowered = [];
this.listAllDevices = [];
// counts
this.offlineDevicesCount = 0;
this.deviceCounter = 0;
this.linkQualityCount = 0;
this.batteryPoweredCount = 0;
this.lowBatteryPoweredCount = 0;
this.offlineDevicesCount = 0;
this.deviceCounter = 0;
this.linkQualityCount = 0;
this.batteryPoweredCount = 0;
this.lowBatteryPoweredCount = 0;
this.deviceReachable = '';
this.deviceReachable = '';

@@ -1340,4 +1520,4 @@ this.log.debug(`Function finished: ${this.resetVars.name}`);

/**
* @param {string} [adptName] - Adaptername
*/
* @param {string} [adptName] - Adaptername
*/
async writeDatapoints(adptName) {

@@ -1355,54 +1535,51 @@ // fill the datapoints

} else {
dpSubFolder = '';}
dpSubFolder = '';
}
await this.setStateAsync(`${dpSubFolder}offlineCount`, {val: this.offlineDevicesCount, ack: true});
await this.setStateAsync(`${dpSubFolder}countAll`, {val: this.deviceCounter, ack: true});
await this.setStateAsync(`${dpSubFolder}batteryCount`, {val: this.batteryPoweredCount, ack: true});
await this.setStateAsync(`${dpSubFolder}lowBatteryCount`, {val: this.lowBatteryPoweredCount, ack: true});
await this.setStateAsync(`${dpSubFolder}offlineCount`, { val: this.offlineDevicesCount, ack: true });
await this.setStateAsync(`${dpSubFolder}countAll`, { val: this.deviceCounter, ack: true });
await this.setStateAsync(`${dpSubFolder}batteryCount`, { val: this.batteryPoweredCount, ack: true });
await this.setStateAsync(`${dpSubFolder}lowBatteryCount`, { val: this.lowBatteryPoweredCount, ack: true });
if (this.deviceCounter == 0) {
// if no device is count, write the JSON List with default value
this.listAllDevices = [{'Device': '--none--', 'Adapter': '', 'Battery': '', 'Last contact': '', 'Signal strength': ''}];
await this.setStateAsync(`${dpSubFolder}listAll`, {val: JSON.stringify(this.listAllDevices), ack: true});
} else {
await this.setStateAsync(`${dpSubFolder}listAll`, {val: JSON.stringify(this.listAllDevices), ack: true});
this.listAllDevices = [{ 'Device': '--none--', 'Adapter': '', 'Battery': '', 'Last contact': '', 'Signal strength': '' }];
}
await this.setStateAsync(`${dpSubFolder}listAll`, { val: JSON.stringify(this.listAllDevices), ack: true });
if (this.linkQualityCount == 0) {
// if no device is count, write the JSON List with default value
this.linkQualityDevices = [{'Device': '--none--', 'Adapter': '', 'Signal strength': ''}];
await this.setStateAsync(`${dpSubFolder}linkQualityList`, {val: JSON.stringify(this.linkQualityDevices), ack: true});
} else {
await this.setStateAsync(`${dpSubFolder}linkQualityList`, {val: JSON.stringify(this.linkQualityDevices), ack: true});
this.linkQualityDevices = [{ 'Device': '--none--', 'Adapter': '', 'Signal strength': '' }];
}
//write JSON list
await this.setStateAsync(`${dpSubFolder}linkQualityList`, { val: JSON.stringify(this.linkQualityDevices), ack: true });
//write HTML list
if (this.config.createHtmlList) await this.setStateAsync(`${dpSubFolder}linkQualityListHTML`, { val: await this.creatLinkQualityListHTML(this.linkQualityDevices, this.linkQualityCount), ack: true });
if (this.offlineDevicesCount == 0) {
// if no device is count, write the JSON List with default value
this.offlineDevices = [{'Device': '--none--', 'Adapter': '', 'Last contact': ''}];
await this.setStateAsync(`${dpSubFolder}offlineList`, {val: JSON.stringify(this.offlineDevices), ack: true});
} else {
await this.setStateAsync(`${dpSubFolder}offlineList`, {val: JSON.stringify(this.offlineDevices), ack: true});
this.offlineDevices = [{ 'Device': '--none--', 'Adapter': '', 'Last contact': '' }];
}
//write JSON list
await this.setStateAsync(`${dpSubFolder}offlineList`, { val: JSON.stringify(this.offlineDevices), ack: true });
//write HTML list
if (this.config.createHtmlList) await this.setStateAsync(`${dpSubFolder}offlineListHTML`, { val: await this.createOfflineListHTML(this.offlineDevices, this.offlineDevicesCount), ack: true });
if (this.batteryPoweredCount == 0) {
// if no device is count, write the JSON List with default value
this.batteryPowered = [{'Device': '--none--', 'Adapter': '', 'Battery': ''}];
await this.setStateAsync(`${dpSubFolder}batteryList`, {val: JSON.stringify(this.batteryPowered), ack: true});
} else {
await this.setStateAsync(`${dpSubFolder}batteryList`, {val: JSON.stringify(this.batteryPowered), ack: true});
this.batteryPowered = [{ 'Device': '--none--', 'Adapter': '', 'Battery': '' }];
}
//write JSON list
await this.setStateAsync(`${dpSubFolder}batteryList`, { val: JSON.stringify(this.batteryPowered), ack: true });
//write HTML list
if (this.config.createHtmlList) await this.setStateAsync(`${dpSubFolder}batteryListHTML`, { val: await this.createBatteryListHTML(this.batteryPowered, this.batteryPoweredCount, false), ack: true });
if (this.lowBatteryPoweredCount == 0) {
// if no device is count, write the JSON List with default value
this.batteryLowPowered = [{'Device': '--none--', 'Adapter': '', 'Battery': ''}];
await this.setStateAsync(`${dpSubFolder}lowBatteryList`, {val: JSON.stringify(this.batteryLowPowered), ack: true});
} else {
await this.setStateAsync(`${dpSubFolder}lowBatteryList`, {val: JSON.stringify(this.batteryLowPowered), ack: true});
this.batteryLowPowered = [{ 'Device': '--none--', 'Adapter': '', 'Battery': '' }];
}
//write JSON list
await this.setStateAsync(`${dpSubFolder}lowBatteryList`, { val: JSON.stringify(this.batteryLowPowered), ack: true });
//write HTML list
if (this.config.createHtmlList) await this.setStateAsync(`${dpSubFolder}lowBatteryListHTML`, { val: await this.createBatteryListHTML(this.batteryLowPowered, this.lowBatteryPoweredCount, true), ack: true });

@@ -1420,5 +1597,108 @@ // create timestamp of last run

/**
* @param {string} [codePart] - Message Prefix
* @param {object} [error] - Sentry message
*/
* @param {object} [devices] - Device
* @param {number} [deviceCount] - Counted devices
*/
async creatLinkQualityListHTML(devices, deviceCount) {
devices = devices.sort((a, b) => { return a.Device.localeCompare(b.Device); });
let html = `<center>
<b>Link Quality Devices:<font> ${deviceCount}</b><small></small></font>
<p></p>
</center>
<table width=100%>
<tr>
<th align=left>Device</th>
<th align=center width=120>Adapter</th>
<th align=right>Link Quality</th>
</tr>
<tr>
<td colspan="5"><hr></td>
</tr>`;
for (const device of devices) {
html += `<tr>
<td><font>${device.Device}</font></td>
<td align=center><font>${device.Adapter}</font></td>
<td align=right><font>${device['Signal strength']}</font></td>
</tr>`;
}
html += '</table>';
return html;
}
/**
* @param {object} [devices] - Device
* @param {number} [deviceCount] - Counted devices
*/
async createOfflineListHTML(devices, deviceCount) {
devices = devices.sort((a, b) => { return a.Device.localeCompare(b.Device); });
let html = `<center>
<b>Offline Devices: <font color=${deviceCount == 0 ? '#3bcf0e' : 'orange'}>${deviceCount}</b><small></small></font>
<p></p>
</center>
<table width=100%>
<tr>
<th align=left>Device</th>
<th align=center width=120>Adapter</th>
<th align=center>Letzter Kontakt</th>
</tr>
<tr>
<td colspan="5"><hr></td>
</tr>`;
for (const device of devices) {
html += `<tr>
<td><font>${device.Device}</font></td>
<td align=center><font>${device.Adapter}</font></td>
<td align=center><font color=orange>${device['Last contact']}</font></td>
</tr>`;
}
html += '</table>';
return html;
}
/**
* @param {object} [devices] - Device
* @param {object} [deviceCount] - Counted devices
* @param {object} [isLowBatteryList] - list Low Battery Devices
*/
async createBatteryListHTML(devices, deviceCount, isLowBatteryList) {
devices = devices.sort((a, b) => { return a.Device.localeCompare(b.Device); });
let html = `<center>
<b>${isLowBatteryList == true ? 'Schwache ' : ''}Batterie Devices: <font color=${isLowBatteryList == true ? (deviceCount > 0 ? 'orange' : '#3bcf0e') : ''}>${deviceCount}</b></font>
<p></p>
</center>
<table width=100%>
<tr>
<th align=left>Device</th>
<th align=center width=120>Adapter</th>
<th align=${isLowBatteryList ? 'center' : 'right'}>Batterie</th>
</tr>
<tr>
<td colspan="5"><hr></td>
</tr>`;
for (const device of devices) {
html += `<tr>
<td><font>${device.Device}</font></td>
<td align=center><font>${device.Adapter}</font></td>`;
if (isLowBatteryList) {
html += `<td align=center><font color=orange>${device.Battery == ' - ' ? 'schwach' : device.Battery}</font></td>`;
} else {
html += `<td align=right><font color=#3bcf0e>${device.Battery == ' - ' ? 'ok' : device.Battery}</font></td>`;
}
html += `</tr>`;
}
html += '</table>';
return html;
}
/**
* @param {string} [codePart] - Message Prefix
* @param {object} [error] - Sentry message
*/
errorReporting(codePart, error) {

@@ -1425,0 +1705,0 @@ const msg = `[${codePart}] error: ${error.message}`;

{
"name": "iobroker.device-watcher",
"version": "0.2.4",
"version": "0.3.0",
"description": "Watchdog for devices",

@@ -28,3 +28,3 @@ "author": {

"devDependencies": {
"@alcalzone/release-script": "^2.2.2",
"@alcalzone/release-script": "^3.5.9",
"@iobroker/adapter-dev": "^1.0.0",

@@ -35,3 +35,3 @@ "@iobroker/testing": "^3.0.2",

"@types/mocha": "^9.1.1",
"@types/node": "^14.18.22",
"@types/node": "^18.6.3",
"@types/proxyquire": "^1.3.28",

@@ -47,3 +47,3 @@ "@types/sinon": "^10.0.13",

"sinon-chai": "^3.7.0",
"typescript": "~4.5.5"
"typescript": "~4.7.4"
},

@@ -50,0 +50,0 @@ "main": "main.js",

@@ -7,6 +7,6 @@ ![Logo](admin/device-watcher.png)

![Number of Installations](https://iobroker.live/badges/device-watcher-installed.svg)
![Current version in stable repository](https://iobroker.live/badges/device-watcher-stable.svg)
<!--![Current version in stable repository](https://iobroker.live/badges/device-watcher-stable.svg)-->
[![GitHub license](https://img.shields.io/github/license/ciddi89/ioBroker.device-watcher)](https://github.com/ciddi89/ioBroker.device-watcher/blob/main/LICENSE)
![GitHub commit activity](https://img.shields.io/github/commit-activity/m/ciddi89/ioBroker.device-watcher)
![GitHub commits since tagged version (branch)](https://img.shields.io/github/commits-since/ciddi89/ioBroker.device-watcher/v0.2.3)
![GitHub commits since tagged version (branch)](https://img.shields.io/github/commits-since/ciddi89/ioBroker.device-watcher/v0.2.4)
![GitHub last commit](https://img.shields.io/github/last-commit/ciddi89/ioBroker.device-watcher)

@@ -19,4 +19,9 @@ ![GitHub issues](https://img.shields.io/github/issues/ciddi89/ioBroker.device-watcher)

## Sentry
**This adapter uses Sentry libraries to automatically report exceptions and code errors to the developers.** For more details and for information how to disable the error reporting see [Sentry-Plugin Documentation](https://github.com/ioBroker/plugin-sentry#plugin-sentry)! Sentry reporting is used starting with js-controller 3.0.
## Documentation
🇬🇧 [Documentation](/docs/en/README.md)</br>
🇩🇪 [Dokumentation](/docs/de/README.md)
## Device-Watcher adapter for ioBroker

@@ -30,4 +35,5 @@

* Deconz
* Enocean
* ESPHome
* FritzDect
* ESPHome
* Homematic

@@ -37,4 +43,5 @@ * Hue

* MiHome
* MiHome Vacuum
* Nuki Extended
* Ping (You have to set the option 'Advanced Information / Erweiterte Information' in the instance settings of ping for each device)
* Ping (You have to set the option 'Advanced Information / Erweiterte Information' in the instance settings of ping for each device)
* Shelly

@@ -83,2 +90,6 @@ * Sonoff

-->
### 0.3.0 (2022-08-10)
- removed channelnumber in Homematic devices name
- added function to create html list
- added german and english documentation
### 0.2.4 (2022-07-31)

@@ -85,0 +96,0 @@ - many changes of code, comments and error handling

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc