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
2026-05-22 15:24:05 +00:00

reolink-controller

A companion service for Frigate NVR that listens to Frigate's MQTT stream and triggers actions on Reolink cameras — floodlights, sirens, PTZ presets, IR mode, and OSD timestamp settings — based on configurable automation rules.

Features

  • Automation rules — trigger camera actions on Frigate motion, object detection, alerts, or per-object state topics
  • Web GUI — create and manage cameras and automations in a browser; no config files required
  • Import from Frigate — discover cameras directly from Frigate's config API; host and credentials are pre-filled from RTSP URLs where available
  • Auto-revert — optionally revert an action after a set number of seconds (e.g. turn the floodlight off 30s after turning it on)
  • Time windows — restrict automations to specific hours of the day
  • Event log — view a history of every automation that fired, with status and error details
  • Camera controls supported:
    • Floodlight (on/off + brightness)
    • Siren (on/off)
    • PTZ preset goto
    • IR / night mode (Auto or Off)
    • OSD timestamp (enable, position, time format, date format)

Requirements

  • Docker + Docker Compose
  • A running Frigate NVR instance with MQTT enabled
  • An MQTT broker (Frigate typically uses Mosquitto)
  • One or more Reolink cameras reachable on the network

Quick Start

git clone https://git.enclaveis.com/White_Ghost_Cyber_Systems/reolink-controller.git
cd reolink-controller
cp .env.example .env

Edit .env with your environment:

MQTT_HOST=192.168.1.10           # IP or hostname of your MQTT broker
FRIGATE_NETWORK=frigate_default  # Docker network Frigate is attached to
FRIGATE_API_URL=http://frigate:5000  # Optional — enables camera import

Then start the service:

docker compose up --build -d

Open http://localhost:8080 in your browser.

Setup

1. Add cameras

Option A — Import from Frigate (recommended)

Set FRIGATE_API_URL in your .env (or under Settings → Frigate), then go to Cameras and click Import from Frigate. The service fetches Frigate's config and lists every configured camera. Host and credentials are pre-filled from the RTSP URL where possible — fill in any blanks, check the cameras you want, and click Import Selected.

Note: Frigate supports environment variable substitution in RTSP URLs (e.g. rtsp://{FRIGATE_RTSP_PASSWORD}@...). When substitution is used the credentials cannot be read from the config and must be entered manually.

Option B — Add manually

Go to Cameras → Add Camera and enter the camera's IP address, HTTP port (default 80), and Reolink credentials. Use the Test button to verify connectivity before saving.

2. Create an automation

Go to Automations → Add Automation and configure:

Field Description
Trigger Type motion, event (object detected), review (alert), or object (per-object state topic)
Camera Frigate camera name to watch, or leave blank for any
Object Label e.g. person, car — filters event/object triggers
Min Confidence Minimum detection score (0100%)
Active From / Until Restrict to a time window (e.g. 22:0006:00)
Actions One or more camera commands to execute
Auto-revert after Seconds before the action is reversed (0 = permanent)

3. Configure settings

Go to Settings to adjust:

  • MQTT — broker address, port, credentials, and TLS
  • Frigate — REST API URL for camera discovery
  • Event Log — how many days of history to retain

Environment Variables

Variable Default Description
HTTP_PORT 8080 Web GUI port (host side)
DB_PATH /data/reolink.db SQLite database path inside the container
MQTT_HOST mosquitto MQTT broker hostname or IP
MQTT_PORT 1883 MQTT broker port
MQTT_USERNAME (empty) MQTT username (optional)
MQTT_PASSWORD (empty) MQTT password (optional)
MQTT_USE_TLS false Enable TLS for the MQTT connection
MQTT_CLIENT_ID reolink-controller MQTT client identifier
FRIGATE_TOPIC_PREFIX frigate Frigate MQTT topic prefix
FRIGATE_API_URL (empty) Frigate REST API base URL (e.g. http://frigate:5000) — enables camera import
FRIGATE_NETWORK frigate_default Docker network Frigate is attached to
LOG_LEVEL info Log verbosity: debug, info, warn, error

All of these can also be changed at runtime via the Settings page. Environment variables serve as the initial defaults; values saved through the UI take precedence.

Docker Compose

The provided docker-compose.yml attaches to your existing Frigate Docker network so the service can reach the MQTT broker and Frigate API by container name. If your Frigate network has a different name, set FRIGATE_NETWORK in .env.

To run standalone (without joining an external network), remove the networks section from docker-compose.yml and use IP addresses for MQTT_HOST and FRIGATE_API_URL instead.

# docker-compose.yml excerpt — standalone mode
services:
  reolink-controller:
    environment:
      MQTT_HOST: "192.168.1.10"
      FRIGATE_API_URL: "http://192.168.1.10:5000"
    # remove the networks: key and networks: references

Frigate MQTT Topics

The service subscribes to the following topics (using the configured prefix, default frigate):

Topic Trigger Type
frigate/events event — fires on new object detections
frigate/reviews review — fires on new alert/detection reviews
frigate/<camera>/motion motion — fires when motion starts (ON) or stops (OFF)
frigate/<camera>/<label> object — fires on per-object state changes

Building from Source

go build -o reolink-controller ./cmd/server
./reolink-controller

Requires Go 1.23+. No CGO needed — the SQLite driver is pure Go.

License

GNU Affero General Public License v3.0 — see LICENSE.

S
Description
No description provided
Readme AGPL-3.0 85 KiB
Languages
Go 67.1%
HTML 24.7%
CSS 7.4%
Dockerfile 0.8%