예제 #1
0
def send_valve_command_error():
    email = Class_eMail()
    email.send_Text_Mail(
        '',
        "The drip irrigation system master water valve control function was called with an invalid argument."
    )
    del email
예제 #2
0
def send_valve_open():
    email = Class_eMail()
    email.send_Text_Mail(
        '', "The drip irrigation system master water valve is open.")
    print("The drip irrigation system master water valve is open.", flush=True)
    del email
    return
예제 #3
0
def send_valve_commanded_stop():
    email = Class_eMail()
    email.send_Text_Mail(
        '',
        "The drip irrigation system master water valve is being commanded to stop."
    )
    del email
예제 #4
0
def sendAlertEmail(sensor, weight):
    header = "[{}] {} - {} ({}g)".format(getCurrentTime(TIME_FULL_FORMAT),
                                         sensor.name, DICT_STOCK_EMPTY, weight)
    print("Sending email(" + header + ")")
    email = Class_eMail()
    email.send_Text_Mail(header, "")
    del email
예제 #5
0
def send_valve_stop():
    """Send command valve to stop message."""
    email = Class_eMail()
    email.send_Text_Mail(
        '',
        "The drip irrigation system master water valve is being commanded to stop."
    )
    del email
예제 #6
0
def onChangeItemEmail(name, items, weight, added):
    header = "[{}] {} - ".format(getCurrentTime(TIME_FULL_FORMAT), name)
    if (added == True):
        header += DICT_ADDED
    else:
        header += DICT_TAKE_OFF
    header += " {} {} ({}g)".format(items, DICT_ITEM, weight)
    print("Sending email(" + header + ")")
    email = Class_eMail()
    email.send_Text_Mail(header, "")
    del email
예제 #7
0
def send_valve_stuck():
    email = Class_eMail()
    email.send_Text_Mail(
        '',
        "The drip irrigation system master water valve is in an indeterminate state."
    )
    print(
        "The drip irrigation system master water valve is in an indeterminate state.",
        flush=True)
    del email
    return
예제 #8
0
def sendDailyReport():
    print("Sending daily report...")
    raportMsg = "{}:  {} \n\n".format(DICT_DAY, getCurrentDay())
    for sensor in sensorList:
        raportMsg += "{}\n".format(sensor.name)
        raportMsg += "\t{}:  {}\n".format(DICT_SOLD, sensor.itemsSold)
        raportMsg += "\t{}:  {}\n".format(DICT_IN_STOCK, sensor.itemsLeft)
    raportMsg += "\n{}:  {}".format(DICT_REPORT_TIME,
                                    getCurrentTime(TIME_FULL_FORMAT))
    raportMsg += "\n{}:  {}h".format(DICT_UPTIME, getUptime())
    email = Class_eMail()
    email.send_Text_Mail("{} {}".format(DICT_REPORT_FROM, getCurrentDay()),
                         raportMsg)
    print("Daily report sent")
예제 #9
0
##------------------------------------------
##--- based on demo.py by Pradeep Singh, found at:
##--- https://iotbytes.wordpress.com/programmatically-send-e-mail-from-raspberry-pi-using-python-and-gmail/
##------------------------------------------

#import the class definition from "email_handler.py" file
from email_handler import Class_eMail

# set the email ID where you want to send the test email
# this should really be in an array or read from a config file
To_Email_ID1 = "{some address}"
To_Email_ID2 = "{some other address"

Subject = "Watch Alert";
Message = "Watch Alert: HELP pressed.";

# Send Plain Text Email(s)
# this should really be in a loop
email = Class_eMail()
email.send_Text_Mail(To_Email_ID1, Subject, Message)
del email

email = Class_eMail()
email.send_Text_Mail(To_Email_ID2, Subject, Message)
del email
예제 #10
0
파일: demo2.py 프로젝트: jgonz096/CS179J
##------------------------------------------
##--- Author: Pradeep Singh
##--- Blog: https://iotbytes.wordpress.com/programmatically-send-e-mail-from-raspberry-pi-using-python-and-gmail/
##--- Date: 21st Feb 2017
##--- Version: 1.0
##--- Python Ver: 2.7
##------------------------------------------



#import the class definition from "email_handler.py" file
from email_handler import Class_eMail

#set the email ID where you want to send the test email 
To_Email_ID = "*****@*****.**"


# Send Plain Text Email 
email = Class_eMail()
email.send_Text_Mail(To_Email_ID, 'Trap Notice', 'Your Trapmaster69 has caught something. Please check it.')
del email


# Send HTML Email
#email = Class_eMail()
#email.send_HTML_Mail(To_Email_ID, 'HTML Mail Subject', '<html><h1>This is sample HTML test email body</h1></html>')
#del email

예제 #11
0
import sys


sys.path.insert(1, '/home/pi/Desktop/HomeMonitoring')

#TODO: move all configs to JSON

#import the class definition from "email_handler.py" file
from email_handler import Class_eMail

#set the email ID where you want to send the email 
To_Email_ID = "*****@*****.**"
DETECTIONS_PATH = '/home/pi/Desktop/Detections/'

# Send HTML Email
email = Class_eMail()
#email.send_HTML_Mail(To_Email_ID, 'Home Monitoring', '<html><h1>Someone is in the house</h1></html>')
fp = open(DETECTIONS_PATH + 'Detection_latest.jpg', 'rb')
email.send_Image_Mail(To_Email_ID, 'Home Monitoring', fp.read())
fp.close()
 
del email

예제 #12
0
파일: demo.py 프로젝트: jgonz096/CS179J
##------------------------------------------
##--- Author: Pradeep Singh
##--- Blog: https://iotbytes.wordpress.com/programmatically-send-e-mail-from-raspberry-pi-using-python-and-gmail/
##--- Date: 21st Feb 2017
##--- Version: 1.0
##--- Python Ver: 2.7
##------------------------------------------



#import the class definition from "email_handler.py" file
from email_handler import Class_eMail

#set the email ID where you want to send the test email 
To_Email_ID = "*****@*****.**"


# Send Plain Text Email 
email = Class_eMail()
email.send_Text_Mail(To_Email_ID, 'Plain Text Mail Subject', 'This is sample plain test email body.')
del email


# Send HTML Email
email = Class_eMail()
email.send_HTML_Mail(To_Email_ID, 'HTML Mail Subject', '<html><h1>This is sample HTML test email body</h1></html>')
del email

예제 #13
0
#import the class definition from "email_handler.py" file
from email_handler import Class_eMail
#import common
import sys
sys.path.append('/home/pi/Desktop/zsw/git/done')
import utils

conf = {
    'code': "1234",
    'cards': [72046226359, 405839336734],
    'temp_max': 35,
    'temp_min': 10,
    'email': '*****@*****.**'
}

#set the email ID where you want to send the test email
# global data
To_Email_ID = conf['email']
#print(To_Email_ID)

# warning
warning_subject = 'Warning!'
warning_text = 'Warning! \
                The password was incorrect. \
                Please enter the correct password.'

# Send Plain Text Email
email = Class_eMail()
email.send_Text_Mail(To_Email_ID, warning_subject, warning_text)
del email
예제 #14
0
while True:
    try:

        # Read the ultrasonic ranger distance

        distance_cm = grovepi.ultrasonicRead(ranger)

        if distance_cm < 10 and not sent:  #Check if the bin is full and the email hasn't been sent already
            if pickup_timer * delay < (timer - delay):
                pickup_timer += 1
                print("Sensor has been obstructed for %d seconds" %
                      (pickup_timer * delay))
            else:
                # Send Plain Text Email
                email = Class_eMail()
                email.send_Text_Mail(To_Email_ID, 'Plain Text Mail Subject',
                                     'This is sample plain test email body.')
                del email

                sent = True
                pickup_timer = 0
                print "Email sent"

                url = baseurl + "Needs+to+be+emptied"

        elif distance_cm < 10 and sent:
            print "Email not sent"
        else:
            print "Email not sent"
            sent = False
예제 #15
0
from email_handler import Class_eMail

import RPi.GPIO as GPIO
from time import sleep
import datetime
import getpass
GPIO.setmode(GPIO.BCM)
GPIO.setup(23, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)

auser = getpass.getuser()

var_To_Email_ID = "*****@*****.**"

email = Class_eMail()

plop = 0

lastmotion = datetime.datetime.now()

try:
    print str(lastmotion), " will begin in ten minutes"
    sleep(10)
    while True:
        boop = (datetime.datetime.now() - lastmotion).total_seconds()
        if (boop > 600) and GPIO.input(23):
            print "Motion detected at ", datetime.datetime.now()
            lastmotion = datetime.datetime.now()
            strang = "Motion detected at " + str(lastmotion)
            var_SUBJECT = "Motion detected in hallway"
            var_EMAIL_BODY = "Might wanna take a look."
            email.send_Text_Mail(var_To_Email_ID, var_SUBJECT, var_EMAIL_BODY)
예제 #16
0
def send_error_message(error_message):
    """Send error message upon invocation with invalid argument."""
    email = Class_eMail()
    email.send_Text_Mail('', error_message)
    del email