New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

iobroker.device-watcher

Package Overview
Dependencies
Maintainers
1
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.0.8 to 0.1.1

14

admin/i18n/de/translations.json

@@ -47,3 +47,15 @@ {

"List only devices with battery": "Nur Geräte mit Akku auflisten",
"Choose if only devices with battery should be listed or all devices": "Wählen Sie, ob nur Geräte mit Akku aufgelistet werden sollen oder alle Geräte"
"Choose if only devices with battery should be listed or all devices": "Wählen Sie, ob nur Geräte mit Akku aufgelistet werden sollen oder alle Geräte",
"Choose the priority": "Wählen Sie die Priorität",
"High Priority": "Hohe Priorität",
"With confirmation": "Mit Bestätigung",
"Use the true state from quality state, otherwise it will be converted in percent value.": "Verwenden Sie den wahren Zustand aus dem Qualitätszustand, sonst wird er in Prozentwerte umgewandelt.",
"Offline Time": "Offline-Zeit",
"Here you can choose the offline time of devices for each adapter. The device is considered offline after the specified time. If set to '-1', the adapter will use the datapoint available, reachable, alive etc. when the device has one of these.": "Hier können Sie die Offline-Zeit der Geräte für jeden Adapter auswählen. Wenn auf „-1“ gesetzt, verwendet der Adapter den Datenpunkt available, reachable, alive usw. wenn das Gerät einen davon hat.",
"Choose the day(s) where you want to get the message of low battery:": "Wählen Sie den/die Tag(e), an dem/denen Sie die Meldung über schwache Batterie erhalten möchten:",
"Here you can choose the offline time of devices for each adapter. ": "Hier können Sie die Offline-Zeit der Geräte für jeden Adapter auswählen.",
"Whatsapp Instance": "WhatsApp-Instanz",
"Please choose the Whatsapp instance": "Bitte wählen Sie die WhatsApp-Instanz aus",
"Recipient (optional)": "Empfänger (optional)",
"Choose your recipient": "Wählen Sie Ihren Empfänger"
}

@@ -29,2 +29,5 @@ {

"Title (optional)": "Title (optional)",
"Choose the priority": "Choose the priority",
"High Priority": "High Priority",
"With confirmation": "With confirmation",
"Choose your title for Pushmessage": "Choose your title for Pushmessage",

@@ -34,2 +37,6 @@ "Telegram Instance": "Telegram Instance",

"Choose your Chat-ID": "Choose your Chat-ID",
"Whatsapp Instance": "Whatsapp Instance",
"Please choose the Whatsapp instance": "Please choose the Whatsapp instance",
"Recipient (optional)": "Recipient (optional)",
"Choose your recipient": "Choose your recipient",
"Jarvis Instance": "Jarvis Instance",

@@ -49,3 +56,7 @@ "Please choose the jarvis instance": "Please choose the jarvis instance",

"List only devices with battery": "List only devices with battery",
"Choose if only devices with battery should be listed or all devices": "Choose if only devices with battery should be listed or all devices"
"Choose if only devices with battery should be listed or all devices": "Choose if only devices with battery should be listed or all devices",
"Use the true state from quality state, otherwise it will be converted in percent value.": "Use the true state from quality state, otherwise it will be converted in percent value.",
"Offline Time": "Offline Time",
"Here you can choose the offline time of devices for each adapter. The device is considered offline after the specified time. If set to '-1', the adapter will use the datapoint available, reachable, alive etc. when the device has one of these.": "Here you can choose the offline time of devices for each adapter. The device is considered offline after the specified time. If set to '-1', the adapter will use the datapoint available, reachable, alive etc. when the device has one of these.",
"Choose the day(s) where you want to get the message of low battery:": "Choose the day(s) where you want to get the message of low battery:"
}

@@ -55,3 +55,17 @@ {

"List only devices with battery": "Listar solo dispositivos con batería",
"Choose if only devices with battery should be listed or all devices": "Elija si solo deben aparecer en la lista los dispositivos con batería o todos los dispositivos"
"Choose if only devices with battery should be listed or all devices": "Elija si solo deben aparecer en la lista los dispositivos con batería o todos los dispositivos",
"Choose the priority": "Elige la prioridad",
"High Priority": "Alta prioridad",
"With confirmation": "Con confirmación",
"Use the true state from quality state, otherwise it will be converted in percent value.": "Utilice el estado verdadero del estado de calidad; de lo contrario, se convertirá en valor porcentual.",
"Offline Time": "Tiempo fuera de línea",
"Here you can choose the offline time of devices for each adapter. The device is considered offline after the specified time. If set to '-1', the adapter will use the datapoint available, reachable, alive etc. when the device has one of these.": "Aquí puede elegir el tiempo sin conexión de los dispositivos para cada adaptador. ",
"Choose the day(s) where you want to get the message of low battery:": "Elige el/los día(s) en los que quieres recibir el mensaje de batería baja:",
"Here you can choose the offline time of devices for each adapter. ": "Aquí puede elegir el tiempo sin conexión de los dispositivos para cada adaptador.",
"If set to '-1', the adapter will use the datapoint available, reachable, alive etc.": "Si se establece en '-1', el adaptador utilizará el punto de datos disponible, accesible, activo, etc.",
"when the device has one of these.": "cuando el dispositivo tiene uno de estos.",
"Whatsapp Instance": "Instancia de Whatsapp",
"Please choose the Whatsapp instance": "Elija la instancia de Whatsapp",
"Recipient (optional)": "Destinatario (opcional)",
"Choose your recipient": "Elige tu destinatario"
}

@@ -55,3 +55,17 @@ {

"List only devices with battery": "Répertorier uniquement les appareils avec batterie",
"Choose if only devices with battery should be listed or all devices": "Choisissez si seuls les appareils avec batterie doivent être répertoriés ou tous les appareils"
"Choose if only devices with battery should be listed or all devices": "Choisissez si seuls les appareils avec batterie doivent être répertoriés ou tous les appareils",
"Choose the priority": "Choisissez la priorité",
"High Priority": "Haute priorité",
"With confirmation": "Avec confirmation",
"Use the true state from quality state, otherwise it will be converted in percent value.": "Utilisez l'état réel de l'état de qualité, sinon il sera converti en pourcentage.",
"Offline Time": "Temps hors ligne",
"Here you can choose the offline time of devices for each adapter. The device is considered offline after the specified time. If set to '-1', the adapter will use the datapoint available, reachable, alive etc. when the device has one of these.": "Ici, vous pouvez choisir le temps hors ligne des appareils pour chaque adaptateur. ",
"Choose the day(s) where you want to get the message of low battery:": "Choisissez le(s) jour(s) où vous souhaitez recevoir le message de batterie faible :",
"Here you can choose the offline time of devices for each adapter. ": "Ici, vous pouvez choisir le temps hors ligne des appareils pour chaque adaptateur.",
"If set to '-1', the adapter will use the datapoint available, reachable, alive etc.": "S'il est défini sur '-1', l'adaptateur utilisera le point de données disponible, accessible, actif, etc.",
"when the device has one of these.": "lorsque l'appareil en possède un.",
"Whatsapp Instance": "Instance Whatsapp",
"Please choose the Whatsapp instance": "Veuillez choisir l'instance Whatsapp",
"Recipient (optional)": "Destinataire (facultatif)",
"Choose your recipient": "Choisissez votre destinataire"
}

@@ -55,3 +55,17 @@ {

"List only devices with battery": "Elenca solo i dispositivi con batteria",
"Choose if only devices with battery should be listed or all devices": "Scegli se devono essere elencati solo i dispositivi con batteria o tutti i dispositivi"
"Choose if only devices with battery should be listed or all devices": "Scegli se devono essere elencati solo i dispositivi con batteria o tutti i dispositivi",
"Choose the priority": "Scegli la priorità",
"High Priority": "Priorità alta",
"With confirmation": "Con conferma",
"Use the true state from quality state, otherwise it will be converted in percent value.": "Usa lo stato vero dallo stato di qualità, altrimenti verrà convertito in valore percentuale.",
"Offline Time": "Tempo offline",
"Here you can choose the offline time of devices for each adapter. The device is considered offline after the specified time. If set to '-1', the adapter will use the datapoint available, reachable, alive etc. when the device has one of these.": "Qui puoi scegliere il tempo offline dei dispositivi per ciascun adattatore. ",
"Choose the day(s) where you want to get the message of low battery:": "Scegli i giorni in cui desideri ricevere il messaggio di batteria scarica:",
"Here you can choose the offline time of devices for each adapter. ": "Qui puoi scegliere il tempo offline dei dispositivi per ciascun adattatore.",
"If set to '-1', the adapter will use the datapoint available, reachable, alive etc.": "Se impostato su '-1', l'adattatore utilizzerà il punto dati disponibile, raggiungibile, vivo ecc.",
"when the device has one of these.": "quando il dispositivo ne ha uno.",
"Whatsapp Instance": "Istanza Whatsapp",
"Please choose the Whatsapp instance": "Scegli l'istanza di Whatsapp",
"Recipient (optional)": "Destinatario (facoltativo)",
"Choose your recipient": "Scegli il tuo destinatario"
}

@@ -55,3 +55,17 @@ {

"List only devices with battery": "Alleen apparaten met batterij weergeven",
"Choose if only devices with battery should be listed or all devices": "Kies of alleen apparaten met batterij moeten worden vermeld of alle apparaten"
"Choose if only devices with battery should be listed or all devices": "Kies of alleen apparaten met batterij moeten worden vermeld of alle apparaten",
"Choose the priority": "Kies de prioriteit",
"High Priority": "Hoge prioriteit",
"With confirmation": "Met bevestiging",
"Use the true state from quality state, otherwise it will be converted in percent value.": "Gebruik de ware staat van de kwaliteitsstatus, anders wordt deze omgezet in procentuele waarde.",
"Offline Time": "Offline tijd",
"Here you can choose the offline time of devices for each adapter. The device is considered offline after the specified time. If set to '-1', the adapter will use the datapoint available, reachable, alive etc. when the device has one of these.": "Hier kunt u voor elke adapter de offline tijd van apparaten kiezen. ",
"Choose the day(s) where you want to get the message of low battery:": "Kies de dag(en) waarop u de melding batterij bijna leeg wilt krijgen:",
"Here you can choose the offline time of devices for each adapter. ": "Hier kunt u voor elke adapter de offline tijd van apparaten kiezen.",
"If set to '-1', the adapter will use the datapoint available, reachable, alive etc.": "Indien ingesteld op '-1', gebruikt de adapter het beschikbare, bereikbare, actieve enz. Datapunt.",
"when the device has one of these.": "wanneer het apparaat een van deze heeft.",
"Whatsapp Instance": "Whatsapp-instantie",
"Please choose the Whatsapp instance": "Kies de WhatsApp-instantie",
"Recipient (optional)": "Ontvanger (optioneel)",
"Choose your recipient": "Kies je ontvanger"
}

@@ -55,3 +55,17 @@ {

"List only devices with battery": "Wyświetlaj tylko urządzenia z baterią",
"Choose if only devices with battery should be listed or all devices": "Wybierz, czy mają być wyświetlane tylko urządzenia z baterią, czy wszystkie urządzenia"
"Choose if only devices with battery should be listed or all devices": "Wybierz, czy mają być wyświetlane tylko urządzenia z baterią, czy wszystkie urządzenia",
"Choose the priority": "Wybierz priorytet",
"High Priority": "Wysoki priorytet",
"With confirmation": "Z potwierdzeniem",
"Use the true state from quality state, otherwise it will be converted in percent value.": "Użyj prawdziwego stanu ze stanu jakości, w przeciwnym razie zostanie przekonwertowany w wartości procentowej.",
"Offline Time": "Czas offline",
"Here you can choose the offline time of devices for each adapter. The device is considered offline after the specified time. If set to '-1', the adapter will use the datapoint available, reachable, alive etc. when the device has one of these.": "Tutaj możesz wybrać czas offline urządzeń dla każdego adaptera. ",
"Choose the day(s) where you want to get the message of low battery:": "Wybierz dzień lub dni, w których chcesz otrzymać komunikat o niskim poziomie baterii:",
"Here you can choose the offline time of devices for each adapter. ": "Tutaj możesz wybrać czas offline urządzeń dla każdego adaptera.",
"If set to '-1', the adapter will use the datapoint available, reachable, alive etc.": "Jeśli ustawiono na „-1”, adapter użyje dostępnego, osiągalnego, aktywnego itp. punktu danych.",
"when the device has one of these.": "gdy urządzenie ma jeden z nich.",
"Whatsapp Instance": "Instancja Whatsapp",
"Please choose the Whatsapp instance": "Wybierz instancję Whatsapp",
"Recipient (optional)": "Odbiorca (opcjonalnie)",
"Choose your recipient": "Wybierz odbiorcę"
}

@@ -55,3 +55,17 @@ {

"List only devices with battery": "Listar apenas dispositivos com bateria",
"Choose if only devices with battery should be listed or all devices": "Escolha se apenas os dispositivos com bateria devem ser listados ou todos os dispositivos"
"Choose if only devices with battery should be listed or all devices": "Escolha se apenas os dispositivos com bateria devem ser listados ou todos os dispositivos",
"Choose the priority": "Escolha a prioridade",
"High Priority": "Prioridade máxima",
"With confirmation": "Com confirmação",
"Use the true state from quality state, otherwise it will be converted in percent value.": "Use o estado verdadeiro do estado de qualidade, caso contrário, ele será convertido em valor percentual.",
"Offline Time": "Tempo off-line",
"Here you can choose the offline time of devices for each adapter. The device is considered offline after the specified time. If set to '-1', the adapter will use the datapoint available, reachable, alive etc. when the device has one of these.": "Aqui você pode escolher o tempo offline dos dispositivos para cada adaptador. ",
"Choose the day(s) where you want to get the message of low battery:": "Escolha o(s) dia(s) em que deseja receber a mensagem de bateria fraca:",
"Here you can choose the offline time of devices for each adapter. ": "Aqui você pode escolher o tempo offline dos dispositivos para cada adaptador.",
"If set to '-1', the adapter will use the datapoint available, reachable, alive etc.": "Se definido como '-1', o adaptador usará o ponto de dados disponível, alcançável, ativo etc.",
"when the device has one of these.": "quando o dispositivo tem um destes.",
"Whatsapp Instance": "Instância do Whatsapp",
"Please choose the Whatsapp instance": "Escolha a instância do Whatsapp",
"Recipient (optional)": "Destinatário (opcional)",
"Choose your recipient": "Escolha seu destinatário"
}

@@ -55,3 +55,17 @@ {

"List only devices with battery": "Список только устройств с аккумулятором",
"Choose if only devices with battery should be listed or all devices": "Выберите, должны ли быть перечислены только устройства с аккумулятором или все устройства"
"Choose if only devices with battery should be listed or all devices": "Выберите, должны ли быть перечислены только устройства с аккумулятором или все устройства",
"Choose the priority": "Выберите приоритет",
"High Priority": "Высокий приоритет",
"With confirmation": "С подтверждением",
"Use the true state from quality state, otherwise it will be converted in percent value.": "Используйте истинное состояние из состояния качества, иначе оно будет преобразовано в процентное значение.",
"Offline Time": "Время автономной работы",
"Here you can choose the offline time of devices for each adapter. The device is considered offline after the specified time. If set to '-1', the adapter will use the datapoint available, reachable, alive etc. when the device has one of these.": "Здесь вы можете выбрать время автономной работы устройств для каждого адаптера. ",
"Choose the day(s) where you want to get the message of low battery:": "Выберите день (дни), когда вы хотите получать сообщение о низком заряде батареи:",
"Here you can choose the offline time of devices for each adapter. ": "Здесь вы можете выбрать время автономной работы устройств для каждого адаптера.",
"If set to '-1', the adapter will use the datapoint available, reachable, alive etc.": "Если установлено значение «-1», адаптер будет использовать доступную, достижимую, активную точку данных и т. д.",
"when the device has one of these.": "когда устройство имеет один из них.",
"Whatsapp Instance": "WhatsApp экземпляр",
"Please choose the Whatsapp instance": "Пожалуйста, выберите экземпляр WhatsApp",
"Recipient (optional)": "Получатель (необязательно)",
"Choose your recipient": "Выберите получателя"
}

@@ -55,3 +55,17 @@ {

"List only devices with battery": "仅列出带电池的设备",
"Choose if only devices with battery should be listed or all devices": "选择是否应仅列出带电池的设备或所有设备"
"Choose if only devices with battery should be listed or all devices": "选择是否应仅列出带电池的设备或所有设备",
"Choose the priority": "选择优先级",
"High Priority": "高优先级",
"With confirmation": "经确认",
"Use the true state from quality state, otherwise it will be converted in percent value.": "使用质量状态中的真实状态,否则将转换为百分比值。",
"Offline Time": "离线时间",
"Here you can choose the offline time of devices for each adapter. The device is considered offline after the specified time. If set to '-1', the adapter will use the datapoint available, reachable, alive etc. when the device has one of these.": "您可以在此处为每个适配器选择设备的离线时间。",
"Choose the day(s) where you want to get the message of low battery:": "选择您希望收到电池电量不足消息的日期:",
"Here you can choose the offline time of devices for each adapter. ": "您可以在此处为每个适配器选择设备的离线时间。",
"If set to '-1', the adapter will use the datapoint available, reachable, alive etc.": "如果设置为“-1”,适配器将使用可用、可达、活动等数据点。",
"when the device has one of these.": "当设备具有其中之一时。",
"Whatsapp Instance": "Whatsapp 实例",
"Please choose the Whatsapp instance": "请选择 Whatsapp 实例",
"Recipient (optional)": "收件人(可选)",
"Choose your recipient": "选择您的收件人"
}

435

admin/jsonConfig.json

@@ -12,14 +12,14 @@ {

"text": "Choose devices to watch",
"size": 1
"size": 2
},
"zigbeeDevices": {
"alexa2Devices": {
"type": "checkbox",
"sm": 12,
"sm": 6,
"md": 6,
"lg": 3,
"label": "Zigbee"
"label": "Alexa2"
},
"bleDevices": {
"type": "checkbox",
"sm": 12,
"sm": 6,
"md": 6,

@@ -29,61 +29,54 @@ "lg": 3,

},
"sonoffDevices": {
"deconzDevices": {
"type": "checkbox",
"sm": 12,
"sm": 6,
"md": 6,
"lg": 3,
"label": "Sonoff"
"label": "Deconz"
},
"shellyDevices": {
"dectDevices": {
"type": "checkbox",
"sm": 12,
"sm": 6,
"md": 6,
"lg": 3,
"label": "Shelly"
"label": "FritzDect"
},
"homematicDevices": {
"esphomeDevices": {
"type": "checkbox",
"sm": 12,
"sm": 6,
"md": 6,
"lg": 3,
"label": "Homematic"
"label": "EspHome"
},
"deconzDevices": {
"homematicDevices": {
"type": "checkbox",
"sm": 12,
"sm": 6,
"md": 6,
"lg": 3,
"label": "Deconz"
"label": "Homematic"
},
"zwaveDevices": {
"hueDevices": {
"type": "checkbox",
"sm": 12,
"sm": 6,
"md": 6,
"lg": 3,
"label": "Zwave"
"label": "Hue"
},
"dectDevices": {
"hueExtDevices": {
"type": "checkbox",
"sm": 12,
"sm": 6,
"md": 6,
"lg": 3,
"label": "FritzDect"
"label": "Hue Extended"
},
"hueDevices": {
"mihomeDevices": {
"type": "checkbox",
"sm": 12,
"sm": 6,
"md": 6,
"lg": 3,
"label": "Hue"
"label": "MiHome"
},
"hueExtDevices": {
"type": "checkbox",
"sm": 12,
"md": 6,
"lg": 3,
"label": "Hue Extended"
},
"nukiExtDevices": {
"type": "checkbox",
"sm": 12,
"sm": 6,
"md": 6,

@@ -95,3 +88,3 @@ "lg": 3,

"type": "checkbox",
"sm": 12,
"sm": 6,
"md": 6,

@@ -101,12 +94,19 @@ "lg": 3,

},
"switchbotBleDevices": {
"shellyDevices": {
"type": "checkbox",
"sm": 12,
"sm": 6,
"md": 6,
"lg": 3,
"label": "Switchbot Ble"
"label": "Shelly"
},
"sonoffDevices": {
"type": "checkbox",
"sm": 6,
"md": 6,
"lg": 3,
"label": "Sonoff"
},
"sonosDevices": {
"type": "checkbox",
"sm": 12,
"sm": 6,
"md": 6,

@@ -116,40 +116,22 @@ "lg": 3,

},
"mihomeDevices": {
"switchbotBleDevices": {
"type": "checkbox",
"sm": 12,
"sm": 6,
"md": 6,
"lg": 3,
"label": "MiHome"
"label": "Switchbot Ble"
},
"_headerOtherSettings": {
"type": "header",
"text": "Other Settings",
"size": 1
},
"trueState": {
"newLine": true,
"zigbeeDevices": {
"type": "checkbox",
"sm": 12,
"sm": 6,
"md": 6,
"lg": 4,
"label": "True State",
"help": "Use the true state from quality state"
"lg": 3,
"label": "Zigbee"
},
"listOnlyBattery": {
"zwaveDevices": {
"type": "checkbox",
"sm": 12,
"sm": 6,
"md": 6,
"lg": 4,
"label": "List only devices with battery",
"help": "Choose if only devices with battery should be listed or all devices"
},
"maxMinutes": {
"type": "number",
"min": 0,
"max": 100000,
"sm": 12,
"md": 6,
"lg": 4,
"label": "Offline time of Devices",
"help": "in minutes"
"lg": 3,
"label": "Zwave"
}

@@ -165,3 +147,3 @@ }

"text":"Common Notification Settings",
"size": 1
"size": 2
},

@@ -172,3 +154,3 @@ "checkSendOfflineMsg": {

"md": 6,
"lg": 4,
"lg": 3,
"label": "Send offline message",

@@ -184,5 +166,5 @@ "help": "Get message if an device is not reachable"

"type":"checkbox",
"sm": 4,
"md": 4,
"lg": 4,
"sm": 12,
"md": 12,
"lg": 6,
"label": "Send batterie message",

@@ -195,14 +177,28 @@ "help": "Get message if an device has low battery"

"max": 100,
"sm": 8,
"md": 6,
"sm": 12,
"md": 12,
"lg": 4,
"label": "From how much min % would you get a message",
"help": "in percent"
"help": "in percent",
"hidden": "!data.checkSendBatteryMsg",
"hideOnlyControl": true
},
"chooseDay": {
"sm": 8,
"md": 6,
"lg": 4,
"newLine": true,
"sm": 12,
"md": 12,
"lg": 6,
"hidden": "!data.checkSendBatteryMsg",
"hideOnlyControl": true,
"items": {
"_textDays": {
"type": "staticText",
"text": "Choose the day(s) where you want to get the message of low battery:",
"style": {
"fontSize": 16,
"marginTop": 20
}
},
"checkMonday": {
"newLine": true,
"type": "checkbox",

@@ -241,3 +237,3 @@ "label": "Mon"

"text": "Pushover",
"size": 1
"size": 2
},

@@ -264,2 +260,15 @@ "instancePushover": {

},
"prioPushover": {
"type": "select",
"sm": 12,
"md": 4,
"lg": 4,
"help": "Choose the priority",
"options": [
{"label": "Normal", "value": ""},
{"label": "High Priority", "value": 1},
{"label": "Silent", "value": -1},
{"label": "With confirmation", "value": 2}
]
},
"titlePushover": {

@@ -277,3 +286,3 @@ "type": "text",

"text": "Telegram",
"size": 1
"size": 2
},

@@ -308,2 +317,28 @@ "instanceTelegram": {

},
"headerWhatsapp": {
"newLine": "true",
"type": "header",
"text": "Whatsapp",
"size": 2
},
"instanceWhatsapp": {
"newLine": true,
"type": "instance",
"adapter": "whatsapp-cmb",
"all": true,
"allowDeactivate": true,
"sm": 12,
"md": 4,
"lg": 4,
"label": "Whatsapp Instance",
"help": "Please choose the Whatsapp instance"
},
"phoneWhatapp": {
"type": "text",
"sm": 12,
"md": 4,
"lg": 4,
"label": "Recipient (optional)",
"help": "Choose your recipient"
},
"_headerEmail": {

@@ -313,3 +348,3 @@ "newLine": true,

"text": "Email",
"size": 1
"size": 2
},

@@ -348,3 +383,3 @@ "instanceEmail": {

"text": "Jarvis Notification",
"size": 1
"size": 2
},

@@ -375,3 +410,3 @@ "instanceJarvis": {

"text": "Lovelace Notification",
"size": 1
"size": 2
},

@@ -414,7 +449,7 @@ "instanceLovelace": {

"type": "objectId",
"width": "40%",
"title": "Choose which devices should be excluded",
"attr": "device",
"width": "50%",
"title": "Choose which devices should be excluded",
"filter": false,
"sort": false,
"attr": "device",
"default": ""

@@ -424,4 +459,7 @@ },

"type": "text",
"width": "60%",
"title": "Info",
"width": "50%",
"attr": "ownNotes",
"filter":false,
"sort":false,
"label": "Add own notes, name, etc"

@@ -432,4 +470,225 @@ }

}
},
"_expertSettings": {
"type": "panel",
"label": "Expert Settings",
"items": {
"_headerOtherSettings": {
"type": "header",
"text": "Other Settings",
"size": 2
},
"trueState": {
"newLine": true,
"type": "checkbox",
"sm": 12,
"md": 6,
"lg": 4,
"label": "True State",
"help": "Use the true state from quality state, otherwise it will be converted in percent value."
},
"_placeholder": {
"type":"staticText",
"sm": 0,
"md": 0,
"lg": 1,
"placeholder": true
},
"listOnlyBattery": {
"type": "checkbox",
"sm": 12,
"md": 6,
"lg": 4,
"label": "List only devices with battery",
"help": "Choose if only devices with battery should be listed or all devices"
},
"_headerOfflineTime": {
"type": "header",
"text": "Offline Time",
"size": 2
},
"textOfflineTime": {
"type": "staticText",
"text": "Here you can choose the offline time of devices for each adapter. The device is considered offline after the specified time. If set to '-1', the adapter will use the datapoint available, reachable, alive etc. when the device has one of these.",
"sm": 12,
"md": 12,
"lg": 12,
"style": {
"fontSize": 16,
"marginBottom": 20
}
},
"alexa2MaxMinutes": {
"type": "number",
"min": -1,
"max": 100000,
"sm": 6,
"md": 6,
"lg": 3,
"label": "Alexa2",
"help": "in minutes"
},
"bleMaxMinutes": {
"type": "number",
"min": 0,
"max": 100000,
"sm": 6,
"md": 6,
"lg": 3,
"label": "Ble",
"help": "in minutes"
},
"deconzMaxMinutes": {
"type": "number",
"min": -1,
"max": 100000,
"sm": 6,
"md": 6,
"lg": 3,
"label": "Deconz",
"help": "in minutes"
},
"esphomeMaxMinutes": {
"type": "number",
"min": -1,
"max": 100000,
"sm": 6,
"md": 6,
"lg": 3,
"label": "EspHome",
"help": "in minutes"
},
"fritzdectMaxMinutes": {
"type": "number",
"min": -1,
"max": 100000,
"sm": 6,
"md": 6,
"lg": 3,
"label": "FritzDect",
"help": "in minutes"
},
"homematicMaxMinutes": {
"type": "number",
"min": -1,
"max": 100000,
"sm": 6,
"md": 6,
"lg": 3,
"label": "Homematic",
"help": "in minutes"
},
"hueMaxMinutes": {
"type": "number",
"min": -1,
"max": 100000,
"sm": 6,
"md": 6,
"lg": 3,
"label": "Hue",
"help": "in minutes"
},
"hueextMaxMinutes": {
"type": "number",
"min": -1,
"max": 100000,
"sm": 6,
"md": 6,
"lg": 3,
"label": "HueExtended",
"help": "in minutes"
},
"mihomeMaxMinutes": {
"type": "number",
"min": 0,
"max": 100000,
"sm": 6,
"md": 6,
"lg": 3,
"label": "MiHome",
"help": "in minutes"
},
"nukiextendMaxMinutes": {
"type": "number",
"min": -1,
"max": 100000,
"sm": 6,
"md": 6,
"lg": 3,
"label": "Nuki Extended",
"help": "in minutes"
},
"pingMaxMinutes": {
"type": "number",
"min": -1,
"max": 100000,
"sm": 6,
"md": 6,
"lg": 3,
"label": "Ping",
"help": "in minutes"
},
"shellyMaxMinutes": {
"type": "number",
"min": -1,
"max": 100000,
"sm": 6,
"md": 6,
"lg": 3,
"label": "Shelly",
"help": "in minutes"
},
"sonoffMaxMinutes": {
"type": "number",
"min": -1,
"max": 100000,
"sm": 6,
"md": 6,
"lg": 3,
"label": "Sonoff",
"help": "in minutes"
},
"sonosMaxMinutes": {
"type": "number",
"min": -1,
"max": 100000,
"sm": 6,
"md": 6,
"lg": 3,
"label": "Sonos",
"help": "in minutes"
},
"switchbotMaxMinutes": {
"type": "number",
"min": 0,
"max": 100000,
"sm": 6,
"md": 6,
"lg": 3,
"label": "Switchbot Ble",
"help": "in minutes"
},
"zigbeeMaxMinutes": {
"type": "number",
"min": -1,
"max": 100000,
"sm": 6,
"md": 6,
"lg": 3,
"label": "Zigbee",
"help": "in minutes"
},
"zwaveMaxMinutes": {
"type": "number",
"min": -1,
"max": 100000,
"sm": 6,
"md": 6,
"lg": 3,
"label": "Zwave",
"help": "in minutes"
}
}
}
}
}
{
"common": {
"name": "device-watcher",
"version": "0.0.8",
"version": "0.1.1",
"news": {

@@ -55,13 +55,25 @@ "0.0.1": {

"0.0.8": {
"en": "some improvements of code",
"de": "einige verbesserungen des codes",
"ru": "некоторые улучшения кода",
"pt": "algumas melhorias de código",
"nl": "wat verbetering van code",
"fr": "quelques améliorations du code",
"it": "alcuni miglioramenti del codice",
"es": "algunas mejoras del código",
"pl": "ulepszenia kodu",
"zh-cn": "守则的一些改进"
}
"en": "some improvements of code",
"de": "einige verbesserungen des codes",
"ru": "некоторые улучшения кода",
"pt": "algumas melhorias de código",
"nl": "wat verbetering van code",
"fr": "quelques améliorations du code",
"it": "alcuni miglioramenti del codice",
"es": "algunas mejoras del código",
"pl": "ulepszenia kodu",
"zh-cn": "守则的一些改进"
},
"0.1.1": {
"en": "- changed wrong type of datapoint lastCheck\n- added possibility to choose own offline time for each adapter\n- added Whatsapp notification services\n- improved sonoff devices\n- added row with online and offline status in table allDevices\n- added alexa2 and esphome devices\n- Added priority for pushover notifications",
"de": "- falsche Art von Datenpunkt zuletzt geändert Überprüfung\n- zusätzliche möglichkeit, eigene offline-zeit für jeden adapter zu wählen\n- hinzugefügt Whatsapp Benachrichtigungsdienste\n- verbesserte sonoff-geräte\n- Zeile mit Online- und Offline-Status in Tabelle alleGeräte hinzugefügt\n- zusätzliche alexa2 und esphome-geräte\n- Priorität für Pushover-Benachrichtigungen hinzugefügt",
"ru": "- изменен неправильный тип данных точка последний Проверить\n- добавлена возможность выбрать собственное оффлайн время для каждого адаптера\n- добавлены услуги уведомлений WhatsApp\n- улучшенные устройства sonoff\n- добавлен ряд с онлайн и оффлайн статусом в таблице allDevices\n- добавлены alexa2 и esphome устройства\n- Добавлен приоритет для pushover уведомлений",
"pt": "- mudou o tipo errado de datapoint último Verificação\n- possibilidade adicional de escolher o próprio tempo offline para cada adaptador\n- adicionado serviços de notificação Whatsapp\n- dispositivos de sonoff melhorados\n- linha adicionada com status on-line e offline na tabela allDevices\n- adicionado alexa2 e dispositivos esphome\n- Prioridade adicional para notificações pushover",
"nl": "- Verschoonde soort datapoint. Check\n- voegde de mogelijkheid om vrije tijd te kiezen voor elke adapter\n- Vertaling:\n- verbeterde sonoff apparatuur\nVertaling:\n- vertaling:\n- Voorrang toegevoegd voor pushover-informatie",
"fr": "- le dernier type de datapoint modifié Check\n- possibilité supplémentaire de choisir son temps hors ligne pour chaque adaptateur\n- ajout des services de notification Whatsapp\n- dispositifs améliorés de sonoff\n- rang ajouté avec statut en ligne et hors ligne dans la table tousDevices\n- ajout des appareils alexa2 et esphome\n- Ajout de la priorité pour les notifications pushover",
"it": "- cambiato tipo errato di datapoint ultimo Check\n- possibilità aggiunta di scegliere il proprio tempo offline per ogni adattatore\n- aggiunto servizi di notifica Whatsapp\n- dispositivi sonoff migliorati\n- riga aggiunta con lo stato online e offline nella tabella allDevices\n- aggiunto alexa2 e dispositivi esphome\n- Aggiunta priorità per le notifiche pushover",
"es": "- cambio de tipo equivocado de datapoint último Check\n- la posibilidad de elegir el tiempo libre para cada adaptador\n- añadido servicios de notificación de Whatsapp\n- mejores dispositivos de desnivel\n- fila agregada con el estado online y offline en la tabla allDevices\n- añadidos dispositivos alexa2 y esphome\n- Mayor prioridad para las notificaciones de empuje",
"pl": "Zmienił błędny typ danych ostatni. Check\n- dodano możliwość wyboru własnego czasu na dopasowanie do każdego adaptera\n- dodano usługi notyfikacyjne\n- ulepszone urządzenia sonoff\n- dodano wiersze z statusem online i offline w tabeli\n- dodano urządzenia alexa2 i esphome\nAdded priorytet dla powiadomień o przesunięciach",
"zh-cn": "- 上次改变错误数据点 检查\n- 为每个适应者选择自己的时间\n- 增加通知服务\n- 改善儿子装置\n- 在表格中加上网上和超线地位\n- 增加一台风2和麻风装置\n- 优先移交通知"
}
},

@@ -118,3 +130,2 @@ "title": "Device-Watcher",

"materialize": true,
"eraseOnUpload": true,
"adminUI": {

@@ -135,2 +146,4 @@ "config": "json"

"native": {
"alexa2Devices": false,
"esphomeDevices": false,
"zigbeeDevices": false,

@@ -153,3 +166,2 @@ "bleDevices": false,

"listOnlyBattery": false,
"maxMinutes": 300,
"checkSendOfflineMsg": false,

@@ -168,2 +180,3 @@ "checkSendBatteryMsg": false,

"devicePushover": "",
"prioPushover": "",
"instanceEmail": "",

@@ -175,2 +188,4 @@ "subjectEmail": "",

"chatIdTelegram": "",
"instanceWhatsapp": "",
"phoneWhatsapp": "",
"instanceJarvis": "",

@@ -180,3 +195,20 @@ "titleJarvis": "Device-Watcher",

"titleLovelace": "Device-Watcher",
"tableBlacklist": []
"tableBlacklist": [],
"alexa2MaxMinutes": -1,
"bleMaxMinutes": 300,
"deconzMaxMinutes": -1,
"esphomeMaxMinutes": -1,
"fritzdectMaxMinutes": -1,
"homematicMaxMinutes": -1,
"hueMaxMinutes": -1,
"hueextMaxMinutes": -1,
"mihomeMaxMinutes": 300,
"nukiextendMaxMinutes": -1,
"pingMaxMinutes": -1,
"shellyMaxMinutes": -1,
"sonoffMaxMinutes": -1,
"sonosMaxMinutes": -1,
"switchbotMaxMinutes": 300,
"zigbeeMaxMinutes": 300,
"zwaveMaxMinutes": -1
},

@@ -307,3 +339,3 @@ "objects": [],

"name": "Timestamp of last run",
"type": "object",
"type": "string",
"role": "indicator",

@@ -310,0 +342,0 @@ "read": true,

@@ -26,9 +26,10 @@ /* jshint -W097 */

// arrays
this.offlineDevices = [],
this.linkQualityDevices = [];
this.batteryPowered = [];
this.batteryLowPowered = [];
this.listAllDevices = [];
this.blacklistArr = [];
this.arrDev = [];
this.offlineDevices = [],
this.linkQualityDevices = [];
this.batteryPowered = [];
this.batteryLowPowered = [];
this.listAllDevices = [];
this.blacklistArr = [];
this.arrDev = [];
this.adapterSelected = [];

@@ -42,24 +43,142 @@ // counts

this.deviceReachable = '';
// arrays of supported adapters
this.arrApart = {
//**** This Datapoints are only for the dev ****//
test: {'Selektor':'0_userdata.*.UNREACH', 'adapter':'test', 'rssiState':'.RSSI_DEVICE', 'battery':'.OPERATING_VOLTAGE', 'reach':'.UNREACH'},
test2: {'Selektor':'0_userdata.*.reachable', 'adapter':'test2', 'battery':'none', 'reach':'none', 'isLowBat':'none'},
test3: {'Selektor':'0_userdata.*.link_quality', 'adapter':'test3', 'battery':'.battery', 'reach':'none', 'isLowBat':'none'},
test: {'Selektor':'0_userdata.*.UNREACH', 'adapter':'homematic', 'rssiState':'.RSSI_DEVICE', 'battery':'.OPERATING_VOLTAGE', 'reach':'.UNREACH'},
test2: {'Selektor':'0_userdata.*.alive', 'adapter':'esphome', 'rssiState': '.Wifi_RSSI', 'battery':'none', 'reach':'.alive', 'isLowBat':'none', 'id':'.name'},
test3: {'Selektor':'0_userdata.*.link_quality', 'adapter':'zigbee', 'battery':'.battery', 'reach':'available', 'isLowBat':'none'},
//**** End of Dev Datapoints ****//
ble: {'Selektor':'ble.*.rssi', 'adapter':'Ble', 'battery':'.battery', 'reach':'none', 'isLowBat':'none'},
zigbee: {'Selektor':'zigbee.*.link_quality', 'adapter':'zigbee', 'battery':'.battery', 'reach':'none', 'isLowBat':'none'},
sonoff: {'Selektor':'sonoff.*.Wifi_RSSI', 'adapter':'sonoff', 'battery':'.battery', 'reach':'none', 'isLowBat':'none'},
shelly: {'Selektor':'shelly.*.rssi', 'adapter':'shelly', 'battery':'.sensor.battery', 'reach':'none', 'isLowBat':'none'},
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'},
zwave: {'Selektor':'zwave2.*.ready', 'adapter':'zwave', 'battery':'.Battery.level', 'reach':'.ready', 'isLowBat':'.Battery.isLow'},
dect: {'Selektor':'fritzdect.*.present', 'adapter':'fritzDect', 'battery':'.battery', 'reach':'.present', 'isLowBat':'.batterylow'},
hue: {'Selektor':'hue.*.reachable', 'adapter':'hue', 'battery':'.battery', 'reach':'.reachable', 'isLowBat':'none'},
hueExt: {'Selektor':'hue-extended.*.reachable', 'adapter':'hue extended', 'battery':'.config.battery', 'reach':'.reachable', 'isLowBat':'none'},
ping: {'Selektor':'ping.*.alive', 'adapter':'ping', 'battery':'none', 'reach':'.alive', 'isLowBat':'none'},
switchbotBle: {'Selektor':'switchbot-ble.*.rssi', 'adapter':'switchbot ble', 'battery':'.battery', 'reach':'none', 'isLowBat':'none', 'id':'.id'},
sonos: {'Selektor':'sonos.*.alive', 'adapter':'sonos', 'battery':'none', 'reach':'.alive', 'isLowBat':'none'},
mihome: {'Selektor':'mihome.*.percent', 'adapter':'miHome', 'battery':'.percent', 'reach':'none', 'isLowBat':'none'},
mihomeGW: {'Selektor':'mihome.*.connected', 'adapter':'miHome', 'battery':'none', 'reach':'.connected', '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'
},
esphome: {
'Selektor':'esphome.*._online',
'adapter':'esphome',
'battery':'none',
'reach':'._online',
'isLowBat':'none',
'id':'.name'
},
zigbee: {
'Selektor':'zigbee.*.link_quality',
'adapter':'zigbee',
'battery':'.battery',
'reach':'.available',
'isLowBat':'none'
},
sonoff: {
'Selektor':'sonoff.*.Uptime',
'adapter':'sonoff',
'rssiState': '.Wifi_RSSI',
'battery':'.battery',
'reach':'.alive',
'isLowBat':'none'
},
shelly: {
'Selektor':'shelly.*.rssi',
'adapter':'shelly',
'battery':'.sensor.battery',
'reach':'.online',
'isLowBat':'none'
},
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'
},
zwave: {
'Selektor':'zwave2.*.ready',
'adapter':'zwave',
'battery':'.Battery.level',
'reach':'.ready',
'isLowBat':'.Battery.isLow'
},
dect: {
'Selektor':'fritzdect.*.present',
'adapter':'fritzDect',
'battery':'.battery',
'reach':'.present',
'isLowBat':'.batterylow'
},
hue: {
'Selektor':'hue.*.reachable',
'adapter':'hue',
'battery':'.battery',
'reach':'.reachable',
'isLowBat':'none'
},
hueExt: {
'Selektor':'hue-extended.*.reachable',
'adapter':'hue extended',
'battery':'.config.battery',
'reach':'.reachable',
'isLowBat':'none'
},
ping: {
'Selektor':'ping.*.alive',
'adapter':'ping',
'battery':'none',
'reach':'.alive',
'isLowBat':'none'
},
switchbotBle: {
'Selektor':'switchbot-ble.*.rssi',
'adapter':'switchbot ble',
'battery':'.battery',
'reach':'none',
'isLowBat':'none',
'id':'.id'
},
sonos: {
'Selektor':'sonos.*.alive',
'adapter':'sonos',
'battery':'none',
'reach':'.alive',
'isLowBat':'none'
},
mihome: {
'Selektor':'mihome.*.percent',
'adapter':'miHome',
'battery':'.percent',
'reach':'none',
'isLowBat':'none'
},
mihomeGW: {
'Selektor':'mihome.*.connected',
'adapter':'miHome',
'battery':'none',
'reach':'.connected',
'isLowBat':'none'
},
nukiExt: {
'Selektor':'nuki-extended.*.batteryCritical',
'adapter':'nuki_extended',
'battery':'none',
'reach':'none',
'isLowBat':'.batteryCritical'
}
};

@@ -86,2 +205,3 @@ }

{
//make the first letter uppercase
return sentence && sentence[0].toUpperCase() + sentence.slice(1);

@@ -91,2 +211,3 @@ }

async getInitValue(obj) {
//state can be null or undefinded
const foreignState = await this.getForeignStateAsync(obj);

@@ -97,2 +218,3 @@ if (foreignState) return foreignState.val;

async getOwnInitValue(obj) {
//state can be null or undefinded for own states
const stateVal = await this.getStateAsync(obj);

@@ -102,2 +224,3 @@ if (stateVal) return stateVal.val;

//create datapoints for each adapter
async createDPsForEachAdapter(adptName) {

@@ -214,16 +337,8 @@ await this.setObjectNotExistsAsync(`${adptName}.offlineCount`, {

async mainForAdapter(adptName) {
for (let i = 0; i < this.arrDev.length; i++) {
switch (this.arrDev[i].adapter) {
case adptName:
await this.setStateAsync(`${adptName}.offlineCount`, {val: 2, ack: true});
break;
}
}
}
async main() {
this.log.debug(`Function started: ${this.main.name}`);
const supAdapter = {
this.supAdapter = {
alexa2: this.config.alexa2Devices,
esphome: this.config.esphomeDevices,
zigbee: this.config.zigbeeDevices,

@@ -250,30 +365,10 @@ ble: this.config.bleDevices,

if (!supAdapter.zigbee &&
!supAdapter.ble &&
!supAdapter.sonoff &&
!supAdapter.shelly &&
!supAdapter.homematic &&
!supAdapter.deconz &&
!supAdapter.zwave &&
!supAdapter.dect &&
!supAdapter.hue &&
!supAdapter.hueExt &&
!supAdapter.nukiExt &&
!supAdapter.ping &&
!supAdapter.switchbotBle &&
!supAdapter.sonos &&
!supAdapter.mihome
) {
this.log.warn('No devices selected. Pleased check the instance configuration');
}
for(const [id] of Object.entries(this.arrApart)) {
const idAdapter = supAdapter[id];
const idAdapter = this.supAdapter[id];
if (idAdapter) {
this.log.info(`${await this.capitalize(id)} was selected. Loading data...`);
this.arrDev.push(this.arrApart[id]);
this.adapterSelected.push(await this.capitalize(id));
/*try {
await this.createDPsForEachAdapter(id);
this.log.debug(`Created datapoints for ${await this.capitalize(id)}`);
await this.mainForAdapter(id);
} catch (e) {

@@ -285,2 +380,9 @@ this.log.warn(`Error at creating datapoints for each adapter: ${e}`);

//Check if one Adapter is selected.
if (this.adapterSelected.length >= 1) {
this.log.info(`Number of selected adapters: ${this.adapterSelected.length}. Loading data from: ${(this.adapterSelected).join(', ')} ...`);
} else {
this.log.warn(`No adapter selected. Please check the instance configuration!`);
}
this.log.debug(JSON.stringify(this.arrDev));

@@ -293,3 +395,3 @@

const devices = await this.getForeignStatesAsync(this.arrDev[i].Selektor);
const deviceAdapterName = this.arrDev[i].adapter;
const deviceAdapterName = await this.capitalize(this.arrDev[i].adapter);
const myBlacklist = this.config.tableBlacklist;

@@ -325,8 +427,8 @@

//Get ID for Switchbot Devices
if (this.arrDev[i].adapter === 'switchbot ble') {
const switchbotID = await this.getForeignStateAsync(currDeviceString + this.arrDev[i].id);
if (switchbotID) {
deviceName = switchbotID.val;
}
//Get ID for Switchbot and ESPHome Devices
switch (this.arrDev[i].adapter) {
case 'switchbot ble':
case 'esphome':
deviceName = await this.getInitValue(currDeviceString + this.arrDev[i].id);
break;
}

@@ -340,2 +442,3 @@

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

@@ -375,47 +478,444 @@ break;

if (deviceQualityState) {
const deviceMainSelector = await this.getForeignStateAsync(id);
let deviceState = 'Online';
if (deviceMainSelector) {
try {
const time = new Date();
const lastContact = Math.round((time.getTime() - deviceQualityState.ts) / 1000 / 60);
const lastContact = Math.round((time.getTime() - deviceMainSelector.ts) / 1000 / 60);
const lastStateChange = Math.round((time.getTime() - deviceMainSelector.lc) / 1000 / 60);
const deviceUnreachState = await this.getInitValue(currDeviceString + this.arrDev[i].reach);
const getLastContact = async () => {
lastContactString = this.formatDate(new Date((deviceMainSelector.ts)), 'hh:mm') + ' Uhr';
if (Math.round(lastContact) > 100) {
lastContactString = Math.round(lastContact/60) + ' Stunden';
}
if (Math.round(lastContact/60) > 48) {
lastContactString = Math.round(lastContact/60/24) + ' Tagen';
}
return lastContactString;
};
const getLastStateChange = async () => {
lastContactString = this.formatDate(new Date((deviceMainSelector.lc)), 'hh:mm') + ' Uhr';
if (Math.round(lastStateChange) > 100) {
lastContactString = Math.round(lastStateChange/60) + ' Stunden';
}
if (Math.round(lastStateChange/60) > 48) {
lastContactString = Math.round(lastStateChange/60/24) + ' Tagen';
}
return lastContactString;
};
// 2b. wenn seit X Minuten kein Kontakt mehr besteht, nimm Gerät in Liste auf
//Rechne auf Tage um, wenn mehr als 48 Stunden seit letztem Kontakt vergangen sind
//lastContactString = Math.round(lastContact) + ' Minuten';
lastContactString = this.formatDate(new Date((deviceQualityState.ts)), 'hh:mm') + ' Uhr';
if (Math.round(lastContact) > 100) {
lastContactString = Math.round(lastContact/60) + ' Stunden';
switch (this.arrDev[i].adapter) {
case 'ping':
//State changed
if (!deviceUnreachState) {
await getLastStateChange();
} else {
await getLastContact();
}
break;
default:
await getLastContact();
break;
}
if (Math.round(lastContact/60) > 48) {
lastContactString = Math.round(lastContact/60/24) + ' Tagen';
}
if (this.arrDev[i].reach === 'none') {
if (lastContact > this.config.maxMinutes) {
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
switch (this.arrDev[i].adapter) {
case 'alexa2':
if (this.config.alexa2MaxMinutes === -1) {
if (!deviceUnreachState) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
);
}
} else {
if ((deviceUnreachState) && (this.arrDev[i].adapter === 'homematic')) {
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
} else if (lastContact > this.config.alexa2MaxMinutes) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
break;
case 'ble':
if (this.config.bleMaxMinutes === -1) {
if (!deviceUnreachState) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
);
} else if ((!deviceUnreachState) && (this.arrDev[i].adapter != 'homematic')) {
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
} else if (lastContact > this.config.bleMaxMinutes) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
break;
case 'deconz':
if (this.config.deconzMaxMinutes === -1) {
if (!deviceUnreachState) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
);
}
} else if (lastContact > this.config.deconzMaxMinutes) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
break;
case 'esphome':
if (this.config.esphomeMaxMinutes === -1) {
if (!deviceUnreachState) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
} else if (lastContact > this.config.esphomeMaxMinutes) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
break;
case 'fritzDect':
if (this.config.fritzdectMaxMinutes === -1) {
if (!deviceUnreachState) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
} else if (lastContact > this.config.fritzdectMaxMinutes) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
break;
case 'homematic':
if (this.config.homematicMaxMinutes === -1) {
if (deviceUnreachState) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
} else if (lastContact > this.config.homematicMaxMinutes) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
break;
case 'hue':
if (this.config.hueMaxMinutes === -1) {
if (!deviceUnreachState) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
} else if (lastContact > this.config.hueMaxMinutes) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
break;
case 'hue extended':
if (this.config.hueextMaxMinutes === -1) {
if (!deviceUnreachState) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
} else if (lastContact > this.config.hueextMaxMinutes) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
break;
case 'miHome':
if (this.config.mihomeMaxMinutes === -1) {
if (!deviceUnreachState) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
} else if (lastContact > this.config.mihomeMaxMinutes) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
break;
case 'nuki_extended':
if (this.config.nukiextendMaxMinutes === -1) {
if (!deviceUnreachState) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
} else if (lastContact > this.config.nukiextendMaxMinutes) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
break;
case 'ping':
if (this.config.pingMaxMinutes === -1) {
if (!deviceUnreachState) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
} else if ((lastStateChange > this.config.pingMaxMinutes) && (!deviceUnreachState)) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
break;
case 'shelly':
if (this.config.shellyMaxMinutes === -1) {
if (!deviceUnreachState) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
} else if (lastContact > this.config.shellyMaxMinutes) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
break;
case 'sonoff':
if (this.config.sonoffMaxMinutes === -1) {
if (!deviceUnreachState) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
} else if (lastContact > this.config.sonoffMaxMinutes) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
break;
case 'sonos':
if (this.config.sonosMaxMinutes === -1) {
if (!deviceUnreachState) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
} else if (lastContact > this.config.sonosMaxMinutes) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
break;
case 'switchbot ble':
if (this.config.switchbotMaxMinutes === -1) {
if (!deviceUnreachState) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
} else if (lastContact > this.config.switchbotMaxMinutes) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
break;
case 'zigbee':
if (this.config.zigbeeMaxMinutes === -1) {
if (!deviceUnreachState) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
} else if (lastContact > this.config.zigbeeMaxMinutes) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
break;
case 'zwave':
if (this.config.zwaveMaxMinutes === -1) {
if (!deviceUnreachState) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
} else if (lastContact > this.config.zwaveMaxMinutes) {
deviceState = 'Offline'; //set online state to offline
this.offlineDevices.push(
{
Device: deviceName,
Adapter: deviceAdapterName,
Last_contact: lastContactString
}
);
}
break;
}

@@ -427,2 +927,4 @@ } catch (e) {

// 2c. Count how many devcies are offline

@@ -439,3 +941,2 @@ this.offlineDevicesCount = this.offlineDevices.length;

} else {
this.log.debug(`Adapter ${this.arrDev[i].adapter}`);

@@ -517,3 +1018,2 @@ switch (this.arrDev[i].adapter) {

// 4. Add all devices in the list
// only pusk if available
if (this.config.listOnlyBattery) {

@@ -526,4 +1026,5 @@ if (deviceBatteryState !== null || shortDeviceBatteryState !== null) {

Battery: batteryHealth,
Link_quality: linkQuality,
Last_contact: lastContactString,
Link_quality: linkQuality
Status: deviceState
}

@@ -538,4 +1039,5 @@ );

Battery: batteryHealth,
Link_quality: linkQuality,
Last_contact: lastContactString,
Link_quality: linkQuality
Status: deviceState
}

@@ -551,4 +1053,5 @@ );

} //<---End of main loop
this.log.debug(`Function finished: ${this.main.name}`);
}
} //<--End of main function

@@ -564,3 +1067,4 @@ async sendNotifications() {

title: this.config.titlePushover,
device: this.config.devicePushover
device: this.config.devicePushover,
prio: this.config.prioPushover

@@ -573,2 +1077,6 @@ };

};
const whatsapp = {
instance: this.config.instanceWhatsapp,
phone: this.config.phoneWhatsapp
};
const email = {

@@ -605,3 +1113,4 @@ instance: this.config.instanceEmail,

title: pushover.title,
device: pushover.device
device: pushover.device,
priority: pushover.prio
});

@@ -618,2 +1127,9 @@ };

const sendWhatsapp = async (text) => {
await this.sendToAsync(whatsapp.instance, 'send', {
text: text,
phone: whatsapp.phone
});
};
const sendEmail = async (text) => {

@@ -641,10 +1157,11 @@ await this.sendToAsync(email.instance, 'send', {

if ((this.offlineDevicesCount != offlineDevicesCountOld) && (this.offlineDevicesCount != 0)) {
if (this.offlineDevicesCount == 1) {
if ((this.offlineDevicesCount != offlineDevicesCountOld)) {
if (this.offlineDevicesCount == 1) { // make singular if it is only one device
msg = 'Folgendes Gerät ist seit einiger Zeit nicht erreichbar: \n';
} else if (this.offlineDevicesCount >= 2) {
msg = 'Folgende ' + this.offlineDevicesCount + ' Geräte sind seit einiger Zeit nicht erreichbar: \n';
} else if (this.offlineDevicesCount >= 2) { //make plural if it is more than one device
msg = `Folgende ${this.offlineDevicesCount} Geräte sind seit einiger Zeit nicht erreichbar: \n`;
}
for (const id of this.offlineDevices) {
msg = msg + '\n' + id['Device'] + ' ' + /*id['room'] +*/ ' (' + id['Last_contact'] + ')';
msg = `${msg} \n ${id['Device']} (${id['Last_contact']})`;
}

@@ -667,2 +1184,9 @@ this.log.info(msg);

}
if (whatsapp.instance) {
try {
await sendWhatsapp(msg);
} catch (e) {
this.log.warn (`Getting error at sending notification ${e}`);
}
}
if (email.instance) {

@@ -693,3 +1217,3 @@ try {

}
}
}//<--End of offline notification

@@ -731,4 +1255,4 @@ /*---------- Low battery Notification ----------*/

const batteryValue = parseFloat(id['Battery'].replace('%', ''));
if ((batteryValue < batteryWarningMin) && (id['Adapter'] != 'homematic')) {
infotext = infotext + '\n' + id['Device'] + ' ' + /*id['room'] +*/ ' (' + id['Battery'] + ')'.split(', ');
if ((batteryValue < batteryWarningMin) && (id['Adapter'] != 'Homematic')) {
infotext = infotext + '\n' + id['Device'] + ' ' + ' (' + id['Battery'] + ')'.split(', ');
++batteryMinCount;

@@ -756,2 +1280,9 @@ }

}
if (whatsapp.instance) {
try {
await sendWhatsapp(`Batteriezustände: ${infotext}`);
} catch (e) {
this.log.warn (`Getting error at sending notification ${e}`);
}
}
if (email.instance) {

@@ -785,6 +1316,6 @@ try {

}
}
/*===== End of Section notifications ======*/
}//<--End of battery notification
this.log.debug(`Function finished: ${this.sendNotifications.name}`);
}
/*===== End of Section notifications ======*/

@@ -851,5 +1382,5 @@ async writeDatapoints() {

}
/*===== End of writing Datapoints ======*/
this.log.debug(`Function finished: ${this.writeDatapoints.name}`);
}
/*===== End of writing Datapoints ======*/

@@ -856,0 +1387,0 @@

{
"name": "iobroker.device-watcher",
"version": "0.0.8",
"version": "0.1.1",
"description": "Watchdog for wireless devices",

@@ -5,0 +5,0 @@ "author": "Christian Behrends <mail@christian-behrends.de>",

@@ -39,2 +39,12 @@ ![Logo](admin/device-watcher.png)

-->
### 0.1.1 (2022-07-22)
- changed wrong type of datapoint lastCheck
- added possibility to choose own offline time for each adapter
- added Whatsapp notification services
- improved sonoff devices
- added row with online and offline status in table allDevices
- added alexa2 and esphome devices
- Added priority for pushover notifications
### 0.0.8 (2022-07-05)

@@ -41,0 +51,0 @@

Sorry, the diff of this file is not supported yet

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