From ca1213d204f621eb20e5355077b654adc59f97ad Mon Sep 17 00:00:00 2001 From: Christian Weimann Date: Wed, 16 Aug 2023 16:37:44 +0200 Subject: [PATCH] Add Unreach monitoring --- utils/equipment.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/utils/equipment.js b/utils/equipment.js index 0ead667..6954a73 100644 --- a/utils/equipment.js +++ b/utils/equipment.js @@ -37,6 +37,17 @@ class Equipment { alertRepeat: 'PT23H' }); } + + // Check if equipment has Unreach item + if (this.hasProperty('Unreach')) { + this.watch['Unreach'] = new watch.Watch(this.getPropertyItemName('Unreach')); + this.watch['Unreach'].add({ + targetState: 'ON', + alertFunc: () => { this.#notifyUnreach(); }, + alertDelay: 'PT15M', + alertRepeat: 'PT1H' + }); + } } getValue(propertyName, defaultValue = '') { @@ -79,6 +90,10 @@ class Equipment { console.warn(`${this.name} has a low battery level.`); } + #notifyUnreach() { + console.warn(`${this.name} is offline.`); + } + gc() { console.log('Denitialization of eqipment ' + this.name);