Garagedoor Service to drive a Chamberlain-style garage door opener using a Raspberry Pi
Project description
garagedoor-service
This project implements a simple webservice that can be used to open/close a garagedoor with a typical Chamerlain or equivalent motor. It relies on a Raspberry Pi's GPIO pins to drive a (solid-state) relay to short-cirquit the motor terminals that initiate motion. Additionally, two pins are used to detect the garage door being fully opened or closed.
Configuration
The service is configured in config.yaml in the working directory. This path can be
overwritten with the GARAGEDOOR_SERVICE_CONFIG environment variable.
Note that all fields in config.yaml are mandatatory and should contain some sane value.
Operation mode
By setting mode to development, the GPIO interface will not be used and the state will
only be printed to stdout.
mode: development
Set this variable to production if you want to drive the actual GPIO pins. Note, this
will require that the code is run on a Rasberry Pi or analog.
Bind address and port
Define to which host and port uvicorn should bind.
bind:
port: 8000
host: 127.0.0.1
GPIO
This section defines the GPIO pins used for toggling the motor relay, and reading the sensors for the door's position.
gpio:
toggle_pin: 11
open_pin: 21
closed_pin: 22
The numers should match the labeling on the board's GPIO spec. Not the numbers defined by the chipset (which is prone to change between different versions of RPis).
API Keys
Defines a list of API keys that should have access to this service. API keys should be hashed with bcrypt.
api_keys:
- $2y$10$3lHF35DW58Cse5gtU9DBMukIcUkQNNclSk3SDLArd4g2/8xC12Qb2
Routes
The following routes are available:
-
POST /toggle
{ "result": "ok" }
Toggle the door motor. This call requires a valid api-key that should be specified in the
x-api-keyheader. -
GET /state
{ "result": "ok", "state": "closed" }
Get the door's state. This can either be
open,closedorunknown. This call requires a valid api-key that should be specified in thex-api-keyheader. -
GET /healthz GET /readyz
{ "result": "ok" }
Basic health and readiness checks. These require no authentication.
Running
Run this service with the following command.
garagedoor-service
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file garagedoor_service-0.1.0.tar.gz.
File metadata
- Download URL: garagedoor_service-0.1.0.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.19.1 CPython/3.12.6 Linux/6.10.4-linuxkit
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88560be3df7e08190a21c006dbc0b24be28ec4c54d7327ba347f724d9afb3d4c
|
|
| MD5 |
a18823e0bb91c925e7332a833b491e00
|
|
| BLAKE2b-256 |
120b5ef90d8bffdfeab2125124093c9d399e1205b98b93108a4939d07750179e
|
File details
Details for the file garagedoor_service-0.1.0-py3-none-any.whl.
File metadata
- Download URL: garagedoor_service-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.19.1 CPython/3.12.6 Linux/6.10.4-linuxkit
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45fbfce7723322e091bde55735235cfa06a141edec1f48444d6148c387a59eae
|
|
| MD5 |
74159d5370231c60927bca8333bed2e5
|
|
| BLAKE2b-256 |
fffd6d397e24d609e69c9aaf42947c3476252433455ce0425921c33c3e9680e8
|