Tutorial:
Turn on and off motion detection using IFTTT Do Buttons
Would you like the ability to turn on and off motion detection on your Rpi Cam Web Interface from your phone with just the press of an IFTTT DO button (rather than logging into the camera's website)?
An extra bonus on the iPhone is the ability to add DO button to the home screen widget, so it's really easy to control your camera. Plus it's not limited to motion detection - anything the pipe commands can do (
http://elinux.org/RPi-Cam-Web-Interface#Pipe), the DO button can do too!
Code: Select all
cd ~
git clone https://github.com/andreafabrizi/Dropbox-Uploader.git
cd Dropbox-Uploader/
chmod +x dropbox_uploader.sh
./dropbox_uploader.sh
(Instructions from within dropbox-uploader)
- Open the following URL in your Browser, and log in using your account:
https://www.dropbox.com/developers/apps
- Click on "Create App", then select "Dropbox API app"
- Now go on with the configuration, choosing the app permissions and access restrictions to your DropBox folder
- Enter the "App Name" that you prefer (e.g. MyPiUploader)
- Now, click on the "Create App" button.
- When your new App is successfully created, please click on the Generate button
under the 'Generated access token' section, then copy and paste the new access token here:
# Access token: <paste here>
Code: Select all
cd ~
git clone https://github.com/enkydu/Raspi_Runner
cd Raspi_Runner/
chmod +x raspi_runner.sh
./raspi_runner.sh
What is name of Dropbox folder, for Raspi Runner commands? (i.e. Raspi_Commands): scripts
what is the full path to your Dropbox Uploader? (i.e. /home/pi/Dropbox_Uploader): /home/pi/Dropbox-Uploader
Note - ensure the path has Dropbox-Uploader instead of the default Dropbox_Uploader
Create a text file with the following content and copy to scripts folder in dropbox:
Test by running the command below (it should turn on motion detection - 'md 0' will turn off motion)
Code: Select all
/home/pi/Raspi_Runner/raspi_runner.sh
(it will delete the file created above after executing the echo command)
Optional:
If you've installed raspi_runner on a central Pi server, you can send commands via ssh to remote cameras using the following command in the text file:
On
Code: Select all
echo "md 1" | ssh camserv 'cat > /var/www/html/FIFO'
Off
Code: Select all
echo "md 0" | ssh camserv 'cat > /var/www/html/FIFO'
You will need to set up public/private key authentication between the Pis:
https://www.howtoforge.com/set-up-ssh-w ... ebian-etch
As above, test by running /home/pi/Raspi_Runner/raspi_runner.sh
Set a schedule in cron:
Paste the following line:
Code: Select all
*/2 * * * * /home/pi/Raspi_Runner/raspi_runner.sh > /dev/null 2>&1
And save.
Create Do Button:
(assumes you've created an IFTTT account and linked DropBox to it)
1. Press the Mortar and Pestle button bottom right or find the My Recipes page.
2. Press the + button
3. Select Channels
4. Press Dropbox
5. Press Create a New Recipe
6. Press Create a text file
7. Give your Recipe a
a. Title, e.g. Outside On (Motion)
b. Name, e.g on
c. Content, e.g. echo 'md 1' > /var/www/html/FIFO
d. Dropbox folder path, e.g. scripts
8. Click Add
What's nice about this method is that you can turn off motion detection in the middle of a recording, whereas the website button to turn motion off is greyed out until no more motion is detected.
Based on this guide here:
https://github.com/enkydu/Raspi_Runner