ca-grow-ops-manager/docs/specs/013_facility_monitoring.md
fullsizemalt 3dad07de03
Some checks failed
Deploy to Production / deploy (push) Failing after 0s
Test / backend-test (push) Failing after 0s
Test / frontend-test (push) Failing after 0s
feat(seed): Add Nutrient Management protocols and Supplies
- Added Front Row Ag 3-2-2 Mixing Task to seed.js
- Added Front Row Ag nutrients and Phoszyme to demo supplies
- Created spec 013 (Facility Monitoring)
- Updated spec 006 (Cultivation) with nutrient protocols
2025-12-11 12:40:03 -08:00

61 lines
2.7 KiB
Markdown

# Spec 013: Facility Monitoring & Security Integration
**Status:** Draft
**Owner:** Engineering Team
**Last Updated:** 2025-12-11
## 1. Overview
This specification details the integration of physical security and monitoring systems (primarily CCTV) into the CA Grow Ops Manager platform. The goal is to provide unauthorized access alerts and real-time visual monitoring of facility operations directly within the application dashboard.
## 2. Scope
* **CCTV Integration:** Display live video feeds from IP cameras (RTSP/ONVIF).
* **Access Control:** Integration with door sensors/smart locks for entry logs (Future Phase).
* **Environmental Monitoring:** (Covered in separate spec, but related visually).
## 3. Architecture
### 3.1 Stream Proxy (go2rtc)
Directly embedding RTSP streams in web browsers is not supported. We will use `go2rtc` (or a similar lightweight media server) as a sidecar container to transcode/remux RTSP streams into WebRTC/MSE for low-latency browser playback.
* **Input:** RTSP streams from NVR or IP Cameras.
* **Output:** WebRTC (preferred for <500ms latency) or MSE (Media Source Extensions).
* **Deployment:** Docker container deployed alongside the application stack.
### 3.2 Backend Integration
* **Device Registry:** Database model to store camera configuration (Name, RTSP URL, Room ID, Location).
* **Proxy Authentication:** The backend will handle authentication with the camera/NVR so credentials are not exposed to the client.
* **Snapshots:** Periodic snapshot generation for "Live View" thumbnails on the dashboard.
## 4. Security
* **Network Isolation:** Cameras should be on a separate VLAN. The `nexus-vector` server needs dual-homing or routed access to this VLAN.
* **Token-Based Access:** Frontend requests for video streams must be authenticated via the main application session.
* **Audit Logging:** All "Watch Live" actions are logged in the Audit Log.
## 5. User Interface
### 5.1 Dashboard Widget
* "Security Overview" widget showing thumbnails of critical cameras (Entry, Veg, Flower).
* Clicking a thumbnail opens a modal with the live WebRTC stream.
### 5.2 Layout Designer Integration
* Cameras can be placed as icons on the Facility Map.
* Hovering over a camera icon shows a live tooltip preview.
## 6. Implementation Plan
1. **Phase 1:** Deploy `go2rtc` on `nexus-vector`.
2. **Phase 2:** Implement `Camera` data model and API routes.
3. **Phase 3:** Create frontend VideoPlayer component (using `webrtc-player` or similar).
4. **Phase 4:** Integrate into Dashboard and Layout Designer.
## 7. Supported Protocols
* **RTSP (Real Time Streaming Protocol):** Primary ingest format.
* **ONVIF (Open Network Video Interface Forum):** For auto-discovery and PTZ control (Future).