docs(cameras): design for Reolink E1 → Frigate live view + detection snapshots

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ginnoirandClaude Opus 5.5 committed 2026-10-08 01:11:08 -05:00
1 parent be835cad90
commit 9fd21bf50d
1 file changed
+135
@@ -0,0 +1,135 @@
# Reolink E1 → Frigate on valhalla (live view + detection snapshots)
**Date:** 2026-10-08
**Status:** Approved design, pending implementation plan
## Goal
Watch a Reolink E1 (indoor pan/tilt, WiFi, plug-in power) live from a browser, and keep a
snapshot whenever a person or pet is detected, with an ntfy push. Continuous recording is
explicitly **out of scope**.
## Decisions
| Decision | Choice | Why |
|---|---|---|
| NVR software | Frigate | Object detection + snapshots + built-in go2rtc live view in one container |
| Detector | OpenVINO on CPU | One 640×360 sub-stream at 5 fps is negligible on the R730XD Xeons. Keeps the camera off the P100, which llama-swap fills with hot-swapped models and whose CDI device breaks after every reboot (`nvidia-modeset`, see jellyfin/llama-swap exit 255) |
| Recording | Off (`record.enabled: false`) | User wants live view + snapshots only |
| Tracked objects | `person`, `dog`, `cat` | Person + pet snapshots |
| Snapshot retention | 30 days | Small files; no redundancy needed |
| Notifications | `frigate-notify` sidecar → ntfy | Polls Frigate's API, so no MQTT broker needed |
| Access | `cam.ginnoir.com`, `internal_only` + Authentik forward_auth (Pattern B) | Frigate has no OIDC. Remote access goes over the tailnet |
| Image versions | Frigate + frigate-notify pinned, `com.centurylabs.watchtower.enable=false` | Frigate config schema breaks between minor releases |
## Architecture
```
Reolink E1 (WiFi, RTSP :554)
│ main stream (h264Preview_01_main) ──► go2rtc (inside frigate) ──► browser MSE via Caddy
│ sub stream (h264Preview_01_sub) ──► frigate detect (OpenVINO CPU)
▼
frigate ──snapshots──► /storage1/labdata/frigate/
▲
│ HTTP API (cameras net)
frigate-notify ──► https://ntfy.ginnoir.com/<topic> (snapshot attached)
```
go2rtc re-streams the camera, so the E1 sees one RTSP client no matter how many viewers
there are. The E1 handles few concurrent connections.
## Components
### `stacks/cameras/docker-compose.yml` (new Portainer git stack)
- **`frigate`**
- `ghcr.io/blakeblackshear/frigate:<pinned stable>` (non-GPU image; OpenVINO CPU is built in)
- `env_file: stack.env`, `shm_size: 256mb`, tmpfs `/tmp/cache` (1 GB)
- Binds:
- `/config/frigate:/config` (config.yml + frigate.db)
- `/storage1/labdata/frigate:/media/frigate` (snapshots)
- Networks: `edge` (Caddy) and `cameras` (private, for frigate-notify)
- No published ports. The UI (8971) is reached only through Caddy
- **`frigate-notify`**
- `ghcr.io/0x2142/frigate-notify:<pinned>`
- `env_file: stack.env`
- Config at `/config/frigate-notify/config.yml`
- Network: `cameras`, plus egress to reach ntfy's public URL (same pattern as vigilant)
### `stacks/cameras/stack.env`
Var names are exactly what the containers read:
- `FRIGATE_RTSP_USER`, `FRIGATE_RTSP_PASSWORD`, `FRIGATE_CAMERA_HOST`
- Frigate substitutes `{FRIGATE_*}` into stream URLs, so no credentials end up in config.yml
- frigate-notify ntfy settings: server `https://ntfy.ginnoir.com`, topic, and an ntfy access
token (ntfy has `NTFY_ENABLE_LOGIN=true`)
### Frigate `config.yml`
- Canonical copy at `stacks/cameras/frigate/config.yml`, seeded once to
`/config/frigate/config.yml` on the host
- The bind must be absolute `/config`, because the Portainer checkout doesn't materialize
sibling repo files
- Contents:
- `auth.enabled: false`
- `proxy.header_map.user: x-authentik-username`
- `detectors: ov: {type: openvino, device: CPU}` with the bundled SSDLite model
- `go2rtc.streams.e1` = main stream, `e1_sub` = sub stream
- `cameras.e1`:
- Detect role on `rtsp://127.0.0.1:8554/e1_sub`, 640×360 at 5 fps
- `record.enabled: false`
- `snapshots: {enabled: true, retain: {default: 30}, bounding_box: true}`
- `objects.track: [person, dog, cat]`
- `live.stream_name: e1`
### Caddyfile
```caddy
cam.ginnoir.com {
import internal_only
route {
import authentik_outpost
handle {
import authentik_forward_auth
reverse_proxy frigate:8971
}
}
}
```
### Authentik
- Proxy provider + application `cam` (forward-auth, single application), bound to the
embedded outpost, following the existing Pattern B services
## Camera-side prerequisites (manual, ginnoir)
1. In the Reolink app, enable RTSP: Settings → Network → Advanced → Server Settings.
2. Create a dedicated non-admin camera user if the firmware allows. Otherwise use the
admin credentials.
3. Add a DHCP static reservation in OPNsense, then put that IP in `FRIGATE_CAMERA_HOST`.
4. Make sure the E1 is on a 2.4 GHz SSID with decent signal. WiFi drops show up as Frigate
"no frames" warnings.
## Error handling / operations
- **Camera offline:** Frigate retries ffmpeg on its own. An Uptime Kuma monitor on Frigate's
`/api/version` covers the container, and frigate-notify can alert on camera-offline.
- **Recovering from /storage1 unmount:** `storage1-guard.service` already blocks guests
without a real `/storage1`, so snapshots won't land on the empty virtiofs mountpoint.
- **Upgrades:** bump pinned tags manually after reading Frigate's release notes for config
migrations.
## Verification
1. The `frigate` container stays healthy. Its logs show the `e1` and `e1_sub` streams
connected and the OpenVINO detector loaded on CPU.
2. `https://cam.ginnoir.com` redirects to Authentik on the LAN. After login it shows a
smooth live view (MSE).
3. Walking in front of the camera creates a `person` event with a snapshot under
`/storage1/labdata/frigate/clips/`, and an ntfy push with the image arrives.
4. Frigate's system page shows detector inference time and CPU use in a sane range.
5. An Uptime Kuma monitor exists and is green.
6. `scripts/gen-bookmarks.ps1` regenerated, and the Portainer stack registered with empty
UI env vars (`scripts/check-portainer-stack-env.ps1`).