-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Andres Leon edited this page Nov 8, 2016
·
11 revisions
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.
- Home Assistant is already installed and running successfully (https://home-assistant.io/getting-started/)
- You have a MQTT broker configured and already setup.
- Your Home Assistant is already configured to use the same broker (https://home-assistant.io/components/mqtt/).
- You have a Raspberry Pi (2 or 3, but better 3) already configured with Raspbian and able to control GPIO pins.
- 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.
https://raw.githubusercontent.com/andres-leon/garage-door-controller/master/diagram.png
- sudo apt-get update
- sudo apt-get upgrade
- sudo apt-get install build-essential python-dev python-pip
- sudo pip install paho-mqtt
- 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.
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.
- Add the content of the file configuration_for_garage_door_sensor.yaml int your configuarion.yaml.
- add sensor to your user interface.