dlbGatekeeper/README.md

73 lines
1.4 KiB
Markdown

# 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:
```bash
cd backend
pip install -r requirements.txt
```
2. Run the development server:
```bash
uvicorn main:app --reload --host 0.0.0.0 --port 3000
```
### Frontend (React)
1. Install Node.js dependencies:
```bash
cd frontend
npm install
```
2. Start the development server:
```bash
npm run dev
```
## Deployment
1. Deploy to Raspberry Pi:
```bash
./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:
```bash
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