dlbGatekeeper/README.md

1.4 KiB

DLB Gate Keeper

A Raspberry Pi-based gate control system with a web interface.

Architecture

  • Backend: Python FastAPI server with direct GPIO control
  • Frontend: React/TypeScript web interface
  • Database: SQLite for event logging and settings
  • Service: Systemd service for automatic startup and monitoring

Development Setup

Backend (Python)

  1. Install Python dependencies:
cd backend
pip install -r requirements.txt
  1. Run the development server:
uvicorn main:app --reload --host 0.0.0.0 --port 3000

Frontend (React)

  1. Install Node.js dependencies:
cd frontend
npm install
  1. Start the development server:
npm run dev

Deployment

  1. Deploy to Raspberry Pi:
./deploy.sh

This will:

  • Build the frontend
  • Package the Python backend
  • Copy files to the Raspberry Pi
  • Install Python dependencies
  • Set up and start the systemd service

GPIO Setup

The application uses GPIO pin 17 (BCM numbering) by default. You can change this by setting the RELAY_PIN environment variable in the systemd service file.

Make sure the gatekeeper user has access to GPIO:

sudo usermod -a -G gpio gatekeeper

API Endpoints

  • POST /api/trigger/{direction} - Trigger gate (direction: "open" or "close")
  • GET /api/events - Get recent gate events
  • GET /api/settings - Get current settings
  • POST /api/settings - Update settings

License

MIT