- Updated Settings interface to use numbers for maxOpenTimeSeconds and triggerDuration - Fixed triggerGate response type to match backend - Updated SettingsDialog to handle numeric inputs correctly |
||
|---|---|---|
| backend | ||
| frontend | ||
| .gitignore | ||
| README.md | ||
| deploy.sh | ||
| requirements.txt | ||
README.md
DLB Gate Keeper
A modern web application for controlling the DLB gate, featuring a beautiful macOS-inspired UI and robust backend.
Features
- Single-button gate control with automatic state detection
- Real-time gate status monitoring
- Event logging for all gate operations
- Configurable settings for gate timing
- Mobile-responsive design with glass morphism effects
- Modern macOS-inspired user interface
Technical Stack
Frontend
- React with TypeScript
- Tailwind CSS for styling
- Modern glass morphism design
- Mobile-first responsive layout
Backend
- FastAPI (Python)
- SQLite for data persistence
- RPi.GPIO for hardware control
- Async operations for improved performance
API Documentation
Endpoints
Gate Control
POST /api/trigger- Toggles the gate state (open/close)
- Response:
{ "success": boolean, "currentStatus": boolean }
Gate Status
GET /api/status- Returns current gate status
- Response:
{ "isOpen": boolean, "lastChanged": string }
Event History
GET /api/events- Returns gate operation history
- Query Parameters:
limit: number (default: 10)
- Response: Array of
{ "id": number, "timestamp": string, "action": string, "source": string, "success": boolean }
Settings
GET /api/settings- Returns current settings
- Response:
{ "maxOpenTimeSeconds": string, "triggerDuration": string }
POST /api/settings- Updates gate settings
- Body:
{ "maxOpenTimeSeconds": string, "triggerDuration": string } - Response:
{ "success": boolean }
Installation
-
Clone the repository:
git clone https://git.athenanetworks.com.au/josh/dlbGatekeeper.git -
Install backend dependencies:
cd backend pip install -r requirements.txt -
Install frontend dependencies:
cd frontend npm install
Development
-
Start the backend:
cd backend python main.py -
Start the frontend development server:
cd frontend npm run dev
Deployment
Use the deployment script:
./deploy.sh
This will:
- Build the frontend
- Package all files
- Deploy to the Raspberry Pi
- Restart the service
Configuration
GPIO Pins
RELAY_1_PIN: 22 (default)RELAY_2_PIN: 5 (default)STATUS_PIN: 4 (default)
Timing Settings
maxOpenTimeSeconds: Maximum time the gate stays open (default: 300 seconds)triggerDuration: Duration of the trigger pulse in milliseconds (default: 500ms)
Status Indicators
- Gate Open: Status LED shows HIGH (3.3V)
- Gate Closed: Status LED shows LOW (0V)
Security
- No authentication required (internal network only)
- CORS enabled for development
- Rate limiting on API endpoints
Contributing
- Create a feature branch
- Make your changes
- Submit a pull request
License
Copyright 2025 DLB. All rights reserved.