This Instructable modifies two other guides. Just got a Magnetic Sensor hooked up with door status on page.
Step 1: Do these Instructables First
You need do this Instructable @http://www.instructables.com/id/Raspberry-Pi-Garage-Door-Opener
Then do this one @ http://pimylifeup.com/raspberry-pi-webcam-server/
Next I will show what I changed to make the Video on the same screen as the button.
Step 2: Edit \var\www\style.css next
pi@raspberrypi$ nano /var/www/css/style.css
Replace all the text with this (the paste seems to remove formatting) Replace the IP address with your RasPi.
html,body {
margin:0px;
padding:0px;
background:#263238;
background-image: url(“http://192.168.1.150:8081/videostream.cgi”);
background-size: 980px 735px;
background-repeat: no-repeat;
text-align:left;
}
div.awrap{
position: fixed;
height:150px;
left:110px;
top:792px;
width:760px;
text-align:left;
}
a {
display:inline-block;
border-radius: 15px;
border: 2px solid #263238;
width:760px;
height:150px;
background:#B5B1B1;
-moz-box-shadow: inset 0 0 10px #000000;
-webkit-box-shadow: inset 0 0 10px #000000;
box-shadow: inset 0 0 10px #000000;
-webkit-tap-highlight-color: rgba(255, 255, 255, 0)$
}
a:active {
background:#263238;
-moz-box-shadow: inset 0 0 50px #000000;
-webkit-box-shadow: inset 0 0 50px #000000;
box-shadow: inset 0 0 50px #000000;
}
Step 3: Modify sudo nano /var/www/index.php
Step 4: Modify sudo nano /etc/init.d/garagerelay
#! /bin/bash
# /etc/init.d/garagerelay
# Carry out specific functions when asked to by the system
case “$1” in
start)
echo “Starting Relay”
# Turn 0 on which keeps relay off
/usr/local/bin/gpio write 0 1
#Start Gpio 0 or 17 in BCM out mode
/usr/local/bin/gpio mode 0 out
#Start Gpio 2 or 27 in BCM in mode with pull up (used the pin to the right of BCM 27 for the ground for mag switch)
/usr/local/bin/gpio mode 2 in
/usr/local/bin/gpio mode 2 up
;;
stop)
echo “Stopping gpio”
;;
*)
echo “Usage: /etc/init.d/garagerelay {start|stop}”
exit 1
;;
esac
exit 0
Step 5: Make Motion start at boot
$ sudo nano /etc/init.d/cam_motion
Then paste the blob below
#! /bin/sh
# /etc/init.d/cam_motion
# Carry out specific functions when asked to by the system
case “$1” in
start)
echo “Starting Camera Motion”
nohup /home/pi/mmal/motion -n -c /home/pi/mmal/motion-mmalcam.conf 1>/dev/null 2>&1 ;;
stop)
echo “Stopping Camera Motion”
killall motion
;;
*)
echo “Usage: /etc/init.d/cam_motion {start|stop}”
exit 1
;;
esac
exit 0
crtl o to save
crtl x to exit
Make it executable
$ sudo chmod 777 /etc/init.d/cam_motion
Make it start at boot
$ sudo update-rc.d -f cam_motion start 4
Reboot
For more detail: Raspberry Pi Garage Door Opener with streaming video of door status.