Introduction: Raspberry Pi Google Calendar With Motion Controlled Webcam and Weather

This is an addition to  Piney's awesome directions. I wanted a Google calendar display with a webcam as a motion sensor so that the monitor will only turn on when someone is near it and turns off when nobody is around.  I also added a weather panel to display weather with the calendar. 

Materials needed:
-Raspberry Pi
-Compatible Webcam (list of compatible ones here) I'm using a Logitech C270.
-Powered USB Hub for Webcam (some of them can also be used to power the Raspberry pi as well!) List of compatible powered USB hub.  I'm using a Plugable 7 Port USB from Amazon which I'm using to power the Raspberry pi itself. 

Step 1: Setup Raspberry Pi Google Calendar

Follow Piney's direction's here.

NOTE: Skip the part about powersave/sleep since we are using webcam to control when monitor turns on and off.

Step 2: Setup Webcam / Motion

Setup Motion by following the "Step #3: Setup motion" on Alex Nikolaidi's instructions on how to setup a raspberry pi alarm system.

IMPORTANT: Type the following command into console:

sudo chmod u+s /bin/chvt
This allows motion to turn monitor back on directly from the motion configuration file (this took me 2 hours to figure out..)

Adjust the following settings to motion.conf (find where they are in the file and edit the settings):

gap 40
# This is seconds you like monitor to be on, I'm using 40, you can changes this to your liking.

on_event_start /opt/vc/bin/tvservice -p ; chvt 6; chvt 7
# This turns on the monitor when motion is sensed.

on_event_end /opt/vc/bin/tvservice -p; /opt/vc/bin/tvservice -o
# This turns off the monitor when motion is sensed

ffmpeg_cap_new off
ffmpeg_cap_motion off
output_normal off
output_motion off

# These settings turn off capturing movie and images on each motion detected in the default director (/tmp/motion). This helps so the SD card is not getting constantly written by new images/movies. 

Optional: use a mask file by editing "mask_file" to your liking on the motion.conf. More info about mask file here.

Start the motion daemon and test it make sure monitor turns on when you are in front of the camera and off when you are away form the camera.

Step 3: Optional Weather Side Panel Setup

a) get conky:
sudo apt-get conky

b) Get a weather configuration you like. I used 1a)Accuweather_ConkyWeather_Font from TeoBigusGeekus so the rest of the directions will be specific to this file. However you can modified the instructions to any Conky weather widget you like to use.

c) Follow directions on the 1a_accuweather_conkyweather_font\1a_README_INFO\1a_README.pdf on the expanded tarball you downloaded from TeoBigusGeekus.

d) IMPORTANT: make the following change to .conkyrc_1a_usa (or the international version if you are not in the USA) or else you will not see a window under LXDE:

own_window_type panel
(You can change it to a normal window if you want but I find panel makes the weather widget always on top, I haven't found a way how to set it up so it's always on top without doing a panel)

e) Optional adjust alignment, color and transparency on .conkyrc_1a_usa to your liking, my settings are:
own_window_transparent no
own_window_colour black
alignment bottom_left

f) Finally edit LXDE startup file so conky will autostart
sudo nano /etc/xdg/lxsession/LXDE/autostart
add this line:
@conky -c ~/1a_accuweather_conkyweather_font/.conkyrc_1a_usa


That's it!