9

(Elliott) #1

Upgrade your humble letterbox with push notifications


TUTORIAL


pip install https://github.com/nithinmurali/
pygsheets/archive/master.zip
To authenticate with the Google Sheets API, the
script uses OAuth, so be sure the oauth2client is
installed on your system by typing:
pip install --upgrade oauth2client

Once that’s done, you’re ready to install the main
Python script from GitHub:
git clone https://github.com/paulfp/Letterbox-
Push-Notification.git

This will download the script into a new directory
called Letterbox-Push-Notification within the Pi
user’s home directory. Make sure the magnetic
sensor is in the closed state and you can now run
the Python script like this:
cd ~/Letterbox-Push-Notification
python letterbox.py

When you first run the script, there will be a
brief pause whilst it connects to Google. Once
done, you’ll see ‘Letterbox is closed’ printed to the
Terminal. Test it out by moving the magnet away
from the switch and back again. When you do this,

Right
For a less obtrusive
look, pop open the
case to reveal the
magnet, and stick
this to your letterbox
Below
Position the magnet
and switch with
Blu Tack and, once
you’ve confirmed the
distances are correct,
you can use some hot
glue to hold in place

It’s a good idea to set
a static IP on your
network (outside
your router’s DHCP
range), so that
weeks later and after
several reboots,
your Pi will still be
accessible via the
same IP address.

QUICK TIP

Free download pdf