Files
pizzaandcheese cd75bbf5a0 Initial implementation of reolink-controller
- Go + SQLite + HTMX web GUI for managing Reolink camera automations
- Frigate MQTT subscriber for motion, event, review, and object topics
- Automation engine with time-window filtering and auto-revert timers
- Reolink HTTP API client: floodlight, siren, PTZ, IR mode, OSD timestamp
- Camera discovery via Frigate REST API with RTSP credential parsing
- Multi-stage Docker build with docker-compose for Frigate network integration
2026-05-22 11:38:34 -05:00

38 lines
871 B
Go

package api
import (
"context"
"net/http"
)
type dashboardData struct {
Page string
CameraCount int
AutomationCount int
EventCount int
MQTTConnected bool
Logs interface{}
}
func (s *Server) handleDashboard(w http.ResponseWriter, r *http.Request) {
ctx := context.Background()
cameras, _ := s.cameras.List(ctx)
automations, _ := s.automations.List(ctx)
logs, _ := s.eventlog.List(ctx, 50, 0)
s.render(w, "dashboard.html", dashboardData{
Page: "dashboard",
CameraCount: len(cameras),
AutomationCount: len(automations),
EventCount: len(logs),
MQTTConnected: s.engine.MQTTConnected(),
Logs: logs,
})
}
func (s *Server) handleEventLogPartial(w http.ResponseWriter, r *http.Request) {
logs, _ := s.eventlog.List(r.Context(), 50, 0)
s.renderPartial(w, "event_log_rows", logs)
}