[{"id":"912350e5.6edcb","type":"bean","name":"Water Sensor Bean","uuid":"","connectiontype":"timeout","connectiontimeout":"2"},{"id":"5ec0d702.a13f28","type":"bean serial","name":"Bean Serial","bean":"912350e5.6edcb","newline":"\\n","bin":"false","out":"char","addchar":true,"x":302.5,"y":83,"z":"ab0aaa47.54f558","wires":[["5bc0a855.a43f58"]]},{"id":"5bc0a855.a43f58","type":"function","name":"moisture threshold","func":"context.previousMoisture = context.previousMoisture || 0;\nvar moisture = msg.payload;\n\nvar upperThreshold = 400;\n\n// Check if the new moisture is different from the previous\nif (context.previousMoisture != moisture){\n    // Check if moisture outside threshold\n\tif ( moisture >= upperThreshold){\n        // Compose alert email\n\t\tmsg.payload = \"Water detected! Current moisture is \" + (String(moisture)-upperThreshold) + \" above threshold.\";\n        return msg;\n\t}\n}","outputs":1,"valid":true,"x":505.5,"y":83,"z":"ab0aaa47.54f558","wires":[["918c428b.6e73c"]]},{"id":"6915426.f96eabc","type":"inject","name":"1 min interval","topic":"","payload":"!","payloadType":"string","repeat":"60","crontab":"","once":false,"x":143.5,"y":83,"z":"ab0aaa47.54f558","wires":[["5ec0d702.a13f28"]]},{"id":"918c428b.6e73c","type":"e-mail","server":"smtp.gmail.com","port":"465","name":"","dname":"Email","x":679.5,"y":83,"z":"ab0aaa47.54f558","wires":[]}]