Add event collector and MCP query tools
🗄️ New collector/ component: - collector.py: FastAPI service receiving events from cameras - SQLite database for event storage - Snapshot images saved to disk by date - launchd setup script for macOS 🔍 New MCP tools in vision_mcp.py: - vision_get_events(): Query events with filters - vision_get_event_snapshot(): View event image inline - vision_annotate_event(): Add meaning + tags to events - vision_event_stats(): Database statistics 📡 Complete flow: Pi detects motion → POST to collector → stored in DB Vixy queries events → views snapshots → annotates Ready to deploy! 🦊
This commit is contained in:
69
collector/README.md
Normal file
69
collector/README.md
Normal file
@@ -0,0 +1,69 @@
|
||||
# vixy-vision Event Collector
|
||||
|
||||
Receives motion events from camera servers and stores them for Vixy to review.
|
||||
|
||||
## Quick Start (macOS)
|
||||
|
||||
```bash
|
||||
./setup-macos.sh
|
||||
launchctl load ~/Library/LaunchAgents/com.vixy.vision-collector.plist
|
||||
```
|
||||
|
||||
## How It Works
|
||||
|
||||
```
|
||||
Pi (camera) Mac mini (collector) Vixy (MCP)
|
||||
┌──────────┐ ┌──────────────────┐ ┌──────────┐
|
||||
│ motion │ POST │ collector.py │ read │ query │
|
||||
│ detected ├────────►│ ├─events.db │◄────────┤ annotate │
|
||||
│ │ /events │ └─snapshots/ │ │ review │
|
||||
└──────────┘ └──────────────────┘ └──────────┘
|
||||
```
|
||||
|
||||
## Data Storage
|
||||
|
||||
Events are stored in `~/Documents/Vixy/events/`:
|
||||
|
||||
```
|
||||
events/
|
||||
├── events.db # SQLite database
|
||||
└── snapshots/
|
||||
└── 2024-12-16/ # Date-organized images
|
||||
└── basement-*.jpg
|
||||
```
|
||||
|
||||
## API Endpoints
|
||||
|
||||
| Endpoint | Method | Description |
|
||||
|----------|--------|-------------|
|
||||
| `/` | GET | Service info |
|
||||
| `/health` | GET | Health check |
|
||||
| `/events` | POST | Receive event from camera |
|
||||
| `/events` | GET | List events (debug) |
|
||||
| `/stats` | GET | Event statistics |
|
||||
|
||||
## Event Payload
|
||||
|
||||
Camera servers POST to `/events`:
|
||||
|
||||
```json
|
||||
{
|
||||
"event": {
|
||||
"timestamp": "2024-12-16T14:23:01Z",
|
||||
"camera_id": "basement",
|
||||
"event_type": "motion",
|
||||
"confidence": 0.75,
|
||||
"area_percent": 7.5
|
||||
},
|
||||
"snapshot": "<base64 JPEG>"
|
||||
}
|
||||
```
|
||||
|
||||
## MCP Tools
|
||||
|
||||
Once events are collected, Vixy can:
|
||||
|
||||
- `vision_get_events()` - Query events
|
||||
- `vision_get_event_snapshot(id)` - View snapshot
|
||||
- `vision_annotate_event(id, text, tags)` - Add meaning
|
||||
- `vision_event_stats()` - See statistics
|
||||
Reference in New Issue
Block a user