In this task, we will discuss setting up an LED to alert a person about an incoming e-mail to refill a prescription or when there is an upcoming doctor's appointment.
Just in case you skipped through Project 6, Raspberry Pi as a Personal Assistant, the python-feedparser
tool and the python-gdata
tool have to be installed:
sudo apt-get install python-feedparser sudo apt-get install python-gdata
This task is similar to the e-mail notifier we set up in Project 5, Internet of Things Example – An E-mail Alert Water Fountain. We will just discuss a minor modification to blink an LED when there is an e-mail in the inbox to refill a prescription.
email = feedparser.parse(proto+username+":"+password+"@"+server+path)
for mail in email.entries: if mail.title == "Walgreens": async_task = AsyncTask() async_task.add_callback() thread = Thread(target=async_task.run, args=()) thread.start()
This is also similar to the event notifier that we discussed in Project 6, Raspberry Pi as a Personal Assistant. Let's assume that all doctor's appointments are saved in the calendar as Doctor's appointment
. It is possible to prominently display all upcoming doctor's appointments as follows:
for i, an_event in enumerate(feed.entry): if an_event.title.text == "Doctor's appointment": print ' %s. %s' % (i, an_event.title.text,)
In the preceding example, we are just printing it to a console. You can perhaps make use of a display, for example, an OLED display that is controlled via a serial port, and display it at a prominent location.
3.140.188.241