Skip to content
Andres Leon edited this page Nov 8, 2016 · 11 revisions

Welcome to the garage-door-controller wiki!

Using Raspberry Pi, Python, MQTT, Home Assistant, a relay, and a magnetic proximity sensor, I open, close, stop, and report the status of my garage door.

Assumptions

Other hardware needed

  • 2 Channel DC 5V Relay Module with Optocoupler (You can use a 1 channel module if you want, but I used a 2 channel because I plan to use the other relay to control a light.)
  • Magnetic proximity switch
  • Tools to secure magnetic switch to garage and support.

Hardware setup and wiring

diagram https://raw.githubusercontent.com/andres-leon/garage-door-controller/master/diagram.png

Update your Pi and then install all needed dependencies

  • sudo apt-get update
  • sudo apt-get upgrade
  • sudo apt-get install build-essential python-dev python-pip
  • sudo pip install paho-mqtt

Use the python files provided in this project as your basis for your own.

  • garagecontroller.py: sends the commands to the door opener via the relay and sends door status changes when a command is received from the mqtt broker.
  • update_garagestatus.py: sends updates of the door status to the mqtt broker.

You will need to provide your own MQTT user name, password, and broker address.

Running scripts

I chose to start the scripts using cron:

  • sudo crontab -e

... and configuring them to start on boot. There may be better ways of handling this.

In your Home Assistant

  • Add the content of the file configuration_for_garage_door_sensor.yaml int your configuarion.yaml.
  • add sensor to your user interface.