152 lines
6.7 KiB
Markdown
152 lines
6.7 KiB
Markdown
# 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, 192.168.1.99) — Baichuan :9000 ONLY (no RTSP/RTMP/HTTP/ONVIF)
|
||
│
|
||
▼
|
||
neolink (Baichuan → RTSP bridge, serves rtsp://neolink:8554/e1/{mainStream,subStream})
|
||
│ mainStream ──► go2rtc (inside frigate) ──► browser MSE via Caddy
|
||
│ subStream ──► frigate detect (OpenVINO CPU)
|
||
▼
|
||
frigate ──snapshots──► /storage1/labdata/frigate/
|
||
▲
|
||
│ HTTP API (cameras net)
|
||
frigate-notify ──► https://ntfy.ginnoir.com/<topic> (snapshot attached)
|
||
```
|
||
|
||
**The original E1 has no RTSP.** A port probe from valhalla on 2026-10-08 found only 9000
|
||
open (80/443/554/1935/8000 closed), and the app's Server Settings shows only the media port.
|
||
Neolink speaks Reolink's proprietary Baichuan protocol on :9000 and re-serves the streams
|
||
as RTSP. It is the only camera client. go2rtc re-streams neolink, so the E1 sees one
|
||
Baichuan session no matter how many viewers there are.
|
||
|
||
## Components
|
||
|
||
### `stacks/cameras/docker-compose.yml` (new Portainer git stack)
|
||
|
||
- **`neolink`**
|
||
- `quantumentangledandy/neolink:<pinned>` (the maintained fork)
|
||
- Config at `/config/neolink/neolink.toml`: camera `e1`, `address = "192.168.1.99:9000"`,
|
||
username/password, `stream = "both"`
|
||
- Network: `cameras` only. The RTSP output is unauthenticated, but only frigate can reach it
|
||
- **`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`
|
||
- Networks: `cameras` (frigate API :5000) and `edge` (ntfy:80)
|
||
|
||
### `stacks/cameras/stack.env`
|
||
|
||
Var names are exactly what the containers read:
|
||
|
||
- Camera credentials do **not** go here. Neolink's TOML has no env substitution, so they
|
||
live in `stacks/cameras/neolink/neolink.toml` (secrets are versioned in the private repo
|
||
by policy), which is seeded to `/config/neolink/`
|
||
- Only `TZ`. frigate-notify posts to `http://ntfy:80` topic `cameras` over `edge`; ntfy's
|
||
anonymous user has read-write on unlisted topics, so no token is needed
|
||
|
||
### 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` = `rtsp://neolink:8554/e1/mainStream`,
|
||
`e1_sub` = `rtsp://neolink:8554/e1/subStream`
|
||
- `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. ~~Enable RTSP~~: not available on the E1. Neolink replaces it.
|
||
2. Camera credentials: admin account (provided 2026-10-08).
|
||
3. DHCP static reservation in OPNsense for 192.168.1.99 (confirm it is a reservation, not
|
||
just the current lease).
|
||
4. Keep the Reolink app free of other viewers during testing. The E1 allows few
|
||
simultaneous Baichuan sessions.
|
||
5. 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
|
||
|
||
0. `neolink` logs show a login to `e1` and both streams available.
|
||
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`).
|