A Python-based web and MQTT controller for garage doors, designed for easy integration with Home Assistant and remote operation via a web interface.
- Features
- Hardware & Wiring
- Installation
- Configuration
- Usage
- Web Interface
- MQTT Integration
- Home Assistant Integration
- Remote GPIO with pigpio
- Troubleshooting
- License
- Control your garage door via a web interface or MQTT.
- View logs and update configuration from any device.
- Integrates easily with Home Assistant.
- Supports remote GPIO and multiple safety features.
- Supports remote relay control using pigpio.
- Raspberry Pi Zero W (or compatible Pi)
- 2 or 3 Channel Relay DC 5V
- Rollertec Main Controller (your garage door controller board)
- Jumper wires
- Connect the relay module's VCC to the Pi's 5V pin.
- Connect the relay module's GND to the Pi's GND pin.
- Connect IN1 on the relay to the Pi GPIO pin you set as
open_pin(default: GPIO17). - Connect IN2 on the relay to the Pi GPIO pin you set as
close_pin(default: GPIO27). - (Optional) If using a stop button, connect IN3 to the Pi GPIO pin set as
stop_pin(default: GPIO22).
- The relay's NO (Normally Open) and COM (Common) terminals act as a switch.
- Wire each relay channel's NO and COM in parallel with the corresponding button (Open, Close, Stop) on your Rollertec main controller.
- When the Pi activates a relay, it "presses" the button by closing the circuit.
| Function | Pi GPIO Pin | Relay IN Pin |
|---|---|---|
| Open | 17 | IN1 |
| Close | 27 | IN2 |
| Stop | 22 | IN3 (if used) |
Note: Double-check your relay module's pinout and your Pi's GPIO numbering.
Use female-to-female jumper wires for Pi to relay connections.
- Ensure all wiring is done with the Pi powered off.
- Never connect mains voltage to the relay unless you are qualified to do so.
- The relay only switches the low-voltage circuits of your garage controller.
- Python 3.7+
pip(Python package manager)- Raspberry Pi OS or compatible Linux
- (Optional) MQTT broker (e.g., Mosquitto) for MQTT integration
git clone https://github.com/yourusername/rollertec.git
cd rollertec/RollertecIt is recommended to use a virtual environment:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txtNote:
If you use GPIO, ensure you have the necessary permissions and libraries (e.g., RPi.GPIO).
You may need to run as sudo for GPIO access.
The main configuration file is config.json in the Rollertec directory.
It is created automatically on first run if it does not exist.
Example config.json:
{
"max_log": 5,
"open_pin": 17,
"close_pin": 27,
"stop_pin": 22,
"roller_time": 10,
"press_time": 0.5,
"stop_btn": 0,
"mqtt_broker": "localhost",
"mqtt_port": 1883,
"webserver_host": "0.0.0.0",
"webserver_port": 5000,
"remote_gpio": 0,
"gpio_address": "localhost"
}remote_gpio: Set to1to enable remote GPIO using pigpio.gpio_address: The IP address or hostname of the remote Raspberry Pi running the pigpio daemon.
You can edit this file manually or via the web interface under the Configuration tab.
From the Rollertec directory, run:
python3 main.pyThe web interface will be available at http://<your-pi-ip>:<webserver_port>/ (default: http://localhost:5000/).
- Main Controls: Open, Stop, and Close your garage door.
- Log File: View recent log entries.
- Configuration: Edit settings such as GPIO pins, MQTT, and webserver options.
- About: View this README and project info.
- Accessible from any device on your network.
- Responsive design for mobile and desktop.
- Navigation bar for quick access to controls, logs, configuration, and about page.
Rollertec can publish and receive commands via MQTT for integration with automation systems.
MQTT Settings in config.json:
mqtt_broker: Address of your MQTT broker (e.g.,localhostor IP).mqtt_port: Port for MQTT (default:1883).
MQTT Topics:
- Commands and status are published under the prefix:
homeassistant/cover/rollertec_garage
Example Home Assistant MQTT Discovery:
Rollertec supports Home Assistant MQTT discovery.
You may need to restart Home Assistant or manually add the cover entity.
You can integrate Rollertec with Home Assistant in two ways:
Add the following to your configuration.yaml in Home Assistant:
cover:
- platform: mqtt
name: "Garage Door"
command_topic: "homeassistant/cover/rollertec_garage/set"
state_topic: "homeassistant/cover/rollertec_garage/state"
payload_open: "OPEN"
payload_close: "CLOSE"
payload_stop: "STOP"
state_open: "open"
state_closed: "closed"
optimistic: false
qos: 1Alternatively, you can use the Home Assistant Community Store (HACS) MQTT Integration for easier setup and management.
Note:
- Adjust topics and payloads as needed to match your setup.
- Ensure your MQTT broker is accessible to both Rollertec and Home Assistant.
Rollertec supports controlling GPIO pins on a remote Raspberry Pi using the pigpio library and daemon.
-
On the Remote Raspberry Pi (the one connected to the relay):
- Install pigpio:
sudo apt-get update sudo apt-get install pigpio python3-pigpio
- Start the pigpio daemon:
sudo systemctl enable pigpiod sudo systemctl start pigpiod - Ensure the Pi is on the same network as your Rollertec controller.
- Install pigpio:
-
On the Rollertec Controller Pi:
- In
config.json:- Set
"remote_gpio": 1 - Set
"gpio_address"to the IP address or hostname of the remote Pi running pigpio.
- Set
Example:
{ "remote_gpio": 1, "gpio_address": "192.168.1.42" } - In
-
Restart Rollertec after making these changes.
Note:
When using remote GPIO, the Rollertec software will send relay commands over the network to the remote Pi.
- Webserver not starting: Check for port conflicts or missing dependencies.
- MQTT not working: Verify broker address/port and network connectivity.
- GPIO errors: Ensure you are running as a user with GPIO access (often
sudois required on Raspberry Pi). - Logs not updating: Check file permissions on
rollertec.log. - Relay not switching: Double-check GPIO pin numbers, wiring, and that the Pi is supplying 5V to the relay module.
- Relay fires but door does not open: Try increasing the
press_timevalue in your configuration. Some garage controllers require a longer signal to register a button press. - Remote GPIO not working: Ensure the pigpio daemon (
pigpiod) is running on the remote Pi, and that firewalls are not blocking port 8888.
MIT License.
Project maintained by allanbeth (https://github.com/allanbeth).