1
0

Add isDelayed function

This commit is contained in:
2024-01-07 14:45:23 +01:00
parent f1472a95e9
commit a52eac4309

View File

@@ -84,10 +84,18 @@ class Watch {
isAlert(watchUUID) { isAlert(watchUUID) {
log.debug('Check if there is a running alert for watchObject ' + watchUUID); log.debug('Check if there is a running alert for watchObject ' + watchUUID);
if (watchUUID in this.#watchObjects) { if (watchUUID in this.#watchObjects) {
console.error(this.#watchObjects[watchUUID].alert);
return this.#watchObjects[watchUUID].alert; return this.#watchObjects[watchUUID].alert;
} }
} }
isDelayed(watchUUID) {
log.debug('Check if startAlert for watchObject ' + watchUUID + 'is delayed');
if (watchUUID in this.#watchObjects) {
return this.#timers.isActive('startAlert ' + watchUUID);;
}
}
validateWatchConfig(params) { validateWatchConfig(params) {
if (params['item'] === undefined) { if (params['item'] === undefined) {
@@ -164,7 +172,10 @@ class Watch {
} }
#endAlert(watchUUID) { #endAlert(watchUUID) {
log.info(`End alert for watchObject ${watchUUID} triggered`); // Get itemName
let watchItemName = this.#watchObjects[watchUUID].item;
log.info(`End alert for watchObject ${watchUUID} (${watchItemName}) triggered`);
this.#watchObjects[watchUUID].alert = false; this.#watchObjects[watchUUID].alert = false;
// Run end alert function if existing // Run end alert function if existing