Uses a HC-SR04 ultrasonic distance sensor hooked up to a Raspberry Pi Zero WiFi to monitor whether my garage door is open. I made this so I don't have to turn around after leaving my house to check if I remembered to close the garage.
Written in python using the Quart framework.
X-Api-Key
header to prevent randos from posting fake data to my server- SSE (server sent events) for live updates
- Remove all assumptions from deployment
- Generate
./config/garage-env
based on.env
- Maybe send text message when opened
- Table of past open events
- Script for downloading new versions of htmx
- Install deps
./run.sh install
- Run local server
./run.sh
- Run simulated sensor
./run.sh fake-sensor
- Run tests
./run.sh tests
- Go to http://localhost:8081/garage/status
.env
exists and has the Env varsPI_USER,PI_SSH_HOST,SERVER_USER,SERVER_SSH_HOST
set- Raspi GPIO libs and python3-httpx are installed on the pi
SERVER_USER
exists onSERVER_SSH_HOST
loginctl enable-linger SERVER_USER
./config/garage-env
exists and has the Env varsGARAGE_API_KEY
./run.sh deploy-sensor
- Copy
sensor.py
and it's systemd service and environment files to the raspberry pi - Stop and reload systemd service
- check status
./run.sh deploy-server
does the following:
- Build
.whl
file for thegarage
package - Copy the
.whl
file and it's systemd service/env files to my VPS - Stop
garage-server.service
systemd service - Clean up any previous virtual environments
- Create fresh venv
- Install build deps (wheel, setuptools) and
.whl
package into venv - Load new service files
systemctl daemon-reload
- Start
garage-server.service
- Check status of
garage-server