wvolz / garage-control

Node.js program to control a garage door via a raspberry pi.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Garage

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

Requirements

  • 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

Installation

  1. Checkout code from github into a local directory
  2. Install nodejs: On Debian based systems you can run the following to install node: [sudo] apt-get install nodejs npm
  3. Install node dependencies: npm install
  4. Copy init or systemd service script to the correct place
  5. Copy config.js.sample to config.js and change for your hardware
  6. Start process: service garage-control start
  7. Check process is running: service garage-control status

Configuration

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 string
  • DB_LOG_TABLE - table in the DB used to store door state changes
  • SMTP_SERVER - smtp server to use for emails
  • notify_from - who state change emails should come from (email address/name)
  • notify_to - who state change emails should be sent to

Parts

  • 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

Links

About

Node.js program to control a garage door via a raspberry pi.

License:MIT License


Languages

Language:JavaScript 61.2%Language:Shell 24.4%Language:CSS 9.9%Language:HTML 4.5%