My son often forgets to bring his key with him to school, but he never forgets his cell phone. This gives him a way to open the garage with his phone - just by sending an email like this one:
The idea is to connect a Raspberry Pi GPIO pin to a relay that simulates pressing a physical garage door button by closing the circuit for half a second. This software makes it easy to turn the GPIO pin on and off with a command. I created a shell script at /root/garagedoor.sh with these contents:
#!/bin/sh
gpio mode 3 out
gpio write 3 0
sleep .5
gpio write 3 1
Installing softwareYou'll need to install this software on your Pi before you can run the gpio command: http://wiringpi.com/the-gpio-utility
Once you've got your garage door opening and shutting when you run /root/garagedoor.sh, you'll want to setup your TRIGGERcmd account if you haven't already, then install the Raspberry Pi agent on it. Add an entry to /root/.TRIGGERcmdData/commands.json like this:
{"trigger":"Left Door","command":"\/root\/garagedoor.sh","ground":"background","voice":"door"},
NOTE: The /root/garagedoor.sh path has the backslashes (\) to escape the forward slashes (/). Test running the /root/garagedoor.sh script using the green Trigger button in your www.triggercmd.com account before you setup your IFTTT applet to run it via email.
Once that's working, follow these steps to setup the IFTTT "applet":
Log into your IFTTT account.
Go to https://ifttt.com/create.
Click the "+ this" link.
Type "email" and click Email.
Click Send IFTTT any email.
Click the "+ that" link.
Type "webhooks" and click Maker Webhooks.
Click Connect.
Click "Make a web request".
Paste this whole line into the URL field:
https://www.triggercmd.com/api/IFTTT?trigger={{Subject}}&computer={{Body}}
Change the Method to POST.
Change Content Type to "application/x-www-form-urlencoded".
Change Body to:
token=YourTokenFromTheInstructionsPage
Click Create Action
Click Finish
ConclusionsNow your garage should open when you send an email with these details:
- From: (must be from your IFTTT account email)
- Subject: (the name of your computer record in your TRIGGERcmd account)
- Body: Left Door (the example trigger name above)
The first part of this video gives an overview of how TRIGGERcmd works. Skip to 4:45 for the garage door demo.
Comments
Please log in or sign up to comment.