Files
labFusion/services/service-adapters/routes/frigate.py
glenn schrooyen 8d1755fd52
Some checks failed
API Docs (Node.js Express) / test (16) (push) Failing after 5m29s
API Docs (Node.js Express) / test (18) (push) Failing after 5m25s
API Docs (Node.js Express) / test (20) (push) Failing after 1m4s
API Docs (Node.js Express) / build (push) Has been skipped
API Docs (Node.js Express) / security (push) Has been skipped
LabFusion CI/CD Pipeline / api-gateway (push) Failing after 4m52s
LabFusion CI/CD Pipeline / service-adapters (push) Failing after 5m1s
LabFusion CI/CD Pipeline / api-docs (push) Failing after 5m12s
LabFusion CI/CD Pipeline / frontend (push) Failing after 6m39s
LabFusion CI/CD Pipeline / integration-tests (push) Has been skipped
LabFusion CI/CD Pipeline / security-scan (push) Has been skipped
Docker Build and Push / build-and-push (push) Failing after 34s
Docker Build and Push / security-scan (push) Has been skipped
Integration Tests / integration-tests (push) Failing after 1m33s
Integration Tests / performance-tests (push) Has been skipped
Service Adapters (Python FastAPI) / test (3.1) (push) Failing after 35s
Service Adapters (Python FastAPI) / test (3.11) (push) Failing after 5m20s
Service Adapters (Python FastAPI) / test (3.12) (push) Failing after 5m27s
Service Adapters (Python FastAPI) / test (3.9) (push) Failing after 5m50s
Docker Build and Push / deploy-staging (push) Has been skipped
Service Adapters (Python FastAPI) / build (push) Has been skipped
Service Adapters (Python FastAPI) / security (push) Has been skipped
Docker Build and Push / deploy-production (push) Has been skipped
Refactor API Docs CI workflow to correct ESLint command syntax and enhance Python formatting in CI pipelines; update progress tracking documentation
2025-09-12 17:44:23 +02:00

72 lines
2.1 KiB
Python

from datetime import datetime
from fastapi import APIRouter, HTTPException
from models.schemas import FrigateEvent, FrigateEventsResponse
from services.config import SERVICES
router = APIRouter()
@router.get(
"/frigate/events",
response_model=FrigateEventsResponse,
summary="Get Frigate Events",
description="Retrieve detection events from Frigate NVR",
responses={
200: {"description": "Successfully retrieved events"},
503: {"description": "Frigate integration not configured"},
},
tags=["Frigate"],
)
async def get_frigate_events():
"""Get Frigate detection events including person, vehicle, and object detections"""
if not SERVICES["frigate"]["enabled"]:
raise HTTPException(
status_code=503,
detail="Frigate integration not configured. Please set FRIGATE_TOKEN environment variable.",
)
# This would make actual API calls to Frigate
# For now, return mock data
return FrigateEventsResponse(
events=[
FrigateEvent(
id="event_123",
timestamp=datetime.now().isoformat(),
camera="front_door",
label="person",
confidence=0.95,
)
]
)
@router.get(
"/frigate/cameras",
summary="Get Frigate Cameras",
description="Get list of Frigate cameras",
responses={
200: {"description": "Successfully retrieved cameras"},
503: {"description": "Frigate integration not configured"},
},
tags=["Frigate"],
)
async def get_frigate_cameras():
"""Get list of available Frigate cameras"""
if not SERVICES["frigate"]["enabled"]:
raise HTTPException(
status_code=503,
detail="Frigate integration not configured. Please set FRIGATE_TOKEN environment variable.",
)
# This would make actual API calls to Frigate
# For now, return mock data
return {
"cameras": [
{"name": "front_door", "enabled": True},
{"name": "back_yard", "enabled": True},
{"name": "garage", "enabled": False},
]
}