Water Sensor Email Alerts
While having the sensor print out the status of the water sensor to the Terminal window is useful, it would be impractical for us to sit in front of the Terminal all day long waiting for water to be detected. It would be more helpful to receive an email notification whenever we have a water leak from a dishwasher, clothes washing machine, or even a basement leak. Using the print statement stubs we already have in place from our test script, we can easily add an email function that can be called in lieu of printing.
If you have your own email server already set up, you can use that server instead of public servers. But nearly everyone has a Gmail account, so this example will use Gmail as the mail server that will relay ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access