1
0

Improve logging

This commit is contained in:
2023-08-13 06:11:03 +02:00
parent 136da94dee
commit 01240ffe4b

View File

@@ -209,16 +209,23 @@ class Watch {
initialAlertFunc = this.#watchObjects[watchUUID].initialAlertFunc; initialAlertFunc = this.#watchObjects[watchUUID].initialAlertFunc;
} }
// Create timer to run initial alert rule // Set alert state
this.#watchObjects[watchUUID].alert = true; this.#watchObjects[watchUUID].alert = true;
// Execute initial alert function or create timer to run initial alert rule if required
if (this.#watchObjects[watchUUID].alertDelay == '') {
console.log('Run initial alert function for watchObject ' + watchUUID);
initialAlertFunc();
} else {
console.log('Run initial alert function for watchObject ' + watchUUID + ' with delay setting ' + this.#watchObjects[watchUUID].alertDelay);
this.#watchObjects[watchUUID].startAlertTimer = actions.ScriptExecution.createTimer('startAlert ' + watchUUID, this.#watchObjects[watchUUID].startAlertTimer = actions.ScriptExecution.createTimer('startAlert ' + watchUUID,
time.toZDT(this.#watchObjects[watchUUID].alertDelay), time.toZDT(this.#watchObjects[watchUUID].alertDelay),
() => { () => {
console.log('Run initial alert function for watchObject ' + watchUUID); console.log('Run initial alert function for watchObject ' + watchUUID);
initialAlertFunc(); initialAlertFunc();
} }
); );
}
// Create timer to run repeat alert rule if required // Create timer to run repeat alert rule if required
if (this.#watchObjects[watchUUID].alertRepeat != '') { if (this.#watchObjects[watchUUID].alertRepeat != '') {