Node.js app to control a garage door opener via a Raspberry Pi. This is based heavily off of Garage Node.
It has the following additional features:
- Realtime state monitoring
- Email notifications of state change
- State changes are logged to a database
- node.js v4.4.x
- systemd or forever to run the script long term (init/service scripts provided)
- Express
- Pug - For the one view template.
- onoff - GPIO access
- socket-io
- database driver of your choice (tested with pg)
- nodemailer
- winston
- Checkout code from github into a local directory
- Install nodejs:
On Debian based systems you can run the following to install node:
[sudo] apt-get install nodejs npm
- Install node dependencies:
npm install
- Copy init or systemd service script to the correct place
- Copy config.js.sample to config.js and change for your hardware
- Start process:
service garage-control start
- Check process is running:
service garage-control status
Configuration is accomplished via a file called 'config.js'. Rename the file 'config.js.sample' to 'config.js' and edit the following variables to get started:
GARAGE_PIN
- GPIO # controlling the relay connected to the garage opener.GARAGE_DOWN
- GPIO # connected to sensor indicating the garage is down.GARAGE_UP
- GPIO # connected to sensor indicating the garage is up.RELAY_ON
- Relay on state.RELAY_OFF
- Relay off state.RELAY_TIMEOUT
- How long the relay should stay on before turning off.DB_CONNECT_STRING
- database connection stringDB_LOG_TABLE
- table in the DB used to store door state changesSMTP_SERVER
- smtp server to use for emailsnotify_from
- who state change emails should come from (email address/name)notify_to
- who state change emails should be sent to
- Raspberry Pi B v2 (or something more current)
- 4-8 GB SDcard with Raspbian "jessie"
- Edimax EW-7811Un (WiFi dongle, b/g/n)
- SainSmart 2-Channel Relay
- Seco-Larm SM-217Q
- Cat 5 cable for wiring (It's what I had on hand)
- Power supply for the Pi