Set of scripts Microservice for controlling my garage door from a Raspberry Pi
Wiring instructions from Idiot’s Guide to a Raspberry Pi Garage Door Opener by Chris Driscoll
Site is currently flagged for malware, link goes to Internet Archive cache.
- Wire up the Raspberry Pi with the guide above
- sudo apt-get install python-pip
- sudo pip install flask
- Copy SSL cert and key to directory or generate a self-signed one:
openssl req -x509 -newkey rsa:4096 -keyout carholekey.pem -out carholecert.pem -days 3650 -nodes
- Edit
config-example
and save asconfig.py
- sudo python carhole.py
The server runs https on port 443
There is a secret key configured in config.py
that must be included in application/x-www-form-urlencoded
content type in each request or the request will return a Invalid Key
error.
A POST
request to /operate
will operate the door.
A POST
request to /checkdoor
will return Open
or Closed
Security Warning!
While this script makes efforts to operate securely, nothing is perfect and new vulnerabilites are discovered all the time, be sure to evaluate and mitigate the potential risks by blocking all, or limiting to only port 443, exposure to the Internet and apply updates to keep all components as new fixes are released.
Example of a Python script to check door status
import requests
r = requests.post('https://YOUR ADDRESS/checkdoor', data={'key':'YOUR KEY'}, verify='YOUR CERTFILE')
print r.text
Using with Home Assistant
Example script and configuration.yaml files for using in conjunction with Home Assistant are included in ./homeassistant
These scripts can be run from the shell independently of carhole.py
Checks state of door, returns Open
or Closed
Operates the door
Task to import into Tasker to operate the door