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 ...
Get Portable Python Projects now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.