Shut off the water supply valve during a triger water leakage sensor

Shuts off the water valve after 3 seconds after the leakage sensor triggers and sends an Email

Task

Event:
— Triggering the water leakage sensor

Do:
— Shut off the water supply valve
— Send email

Additional terms:
1. Cancel the overlap of the water supply valve in case of short-term sensor triggering (accidentally touched with a rag).

Script

/** 
* @name Water leak
* @desc Shuts off the water valve 3 seconds after the leakage sensor has tripped.
* and send email
* @version 4
*/

const actor  = Device("ActorD", "Water valve"); 
const sensor = Device("SensorD", "Leakage sensor");  

startOnChange([sensor,actor], sensor.isOn() && actor.isOn());  

script({
    
    start() {
     this.startTimer("T1", 3, "close");       
    },
    
    close() {
     actor.off();  
     this.info("email", "OWNER", 'Water leak! The water valve is shut off!')
    }
});
Close Menu