diff --git a/CLAUDE.md b/CLAUDE.md index 842fec1..2ff9524 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -2,7 +2,7 @@ ## Project Overview -3D printing setup and management for two Creality Ender 3 printers, with OctoPrint remote control and IP camera monitoring via a Raspberry Pi proxy. +3D printing setup and management for a Creality Ender 3 V3 SE, with OctoPrint remote control and IP camera monitoring via a Raspberry Pi proxy. ## Hardware @@ -40,10 +40,12 @@ - **URL:** http://octopi.sethpc.xyz (port 5000 on Pi) - **API key:** see `octopi.sethpc.xzy_api_key.md` -### go2rtc (v1.9.14) +### go2rtc on Pi (v1.9.14) Restreams both cameras with H.264 hardware transcoding and MJPEG fallback. -- **API:** http://192.168.0.102:1984 -- **RTSP:** rtsp://192.168.0.102:8554 +- **API:** http://192.168.0.102:1984 — **IMPORTANT: binds to 127.0.0.1 only**, not accessible from other hosts +- **RTSP:** rtsp://192.168.0.102:8554 (binds to all interfaces, works remotely) +- **Config:** `/etc/go2rtc/go2rtc.yaml` +- **Service:** `go2rtc.service` (systemd) - **Streams:** - `cam1` / `cam1_mjpeg` — Camera 1 (192.168.0.100) - `cam2` / `cam2_mjpeg` — Camera 2 (192.168.0.103) @@ -76,18 +78,73 @@ Proxy services (all systemd, auto-restart): - `ipcam2-proxy-onvif.service` — 28081 -> 192.168.0.103:8080 - `ipcam2-proxy-rtsp.service` — 28554 -> 192.168.0.103:554 +## Frigate NVR +- **URL:** https://frigate.sethpc.xyz (port 5000 in CT 241 on node-241) +- **Container:** CT 241 (192.168.0.220) — Docker-in-LXC +- **Config:** `/opt/frigate/config/config.yml` +- **Docker Compose:** `/opt/frigate/docker-compose.yml` +- **Storage:** `/opt/frigate/storage/` +- **Version:** 0.17.0 +- **Streams:** `printer_cam1`, `printer_cam2` (via go2rtc section in config, pulls from Pi socat proxies) +- **Exposed ports:** 5000 (web), 1984 (go2rtc API), 8554 (RTSP), 8555 (WebRTC) +- **Detector:** CPU only (3 threads) — no GPU in this CT +- **Object tracking:** Disabled (`track: []`) — monitoring only, no person/car detection +- **Recording:** 7 days continuous, 14 days motion + +### Frigate Config Gotchas (v0.17) +- `record.retain` is NOT valid — use `record.continuous.days` and `record.motion.days` +- `record.events` is NOT valid — use `record.detections` and `record.alerts` +- Config errors → safe mode (cameras don't start but web UI does) + ## Camera Control Panel - **URL:** http://192.168.0.220:8090 - **Location:** `/opt/cam-control/server.py` on CT 241 (Frigate) - **Service:** `cam-control.service` (systemd, enabled) -- **Features:** Live MJPEG feeds, PTZ D-pad (continuous/step), speed control, flip/mirror toggles +- **Features:** Snapshot-polled live feeds (~5fps), PTZ D-pad (continuous/step), speed control, flip/mirror toggles - **Source:** `./cam-control/server.py` +- **Feeds:** Proxied from Frigate's go2rtc at 127.0.0.1:1984 (frame.jpeg endpoint, not MJPEG stream) +- **PTZ proxy:** Routes commands to cameras via Pi socat HTTP proxies (18080/28080) +- **Threading:** Uses ThreadingMixIn — required because feeds are long-polling ## Gitea - **Repo:** https://git.sethpc.xyz/Seth/3d-printing - **Remote:** `https://Seth:REDACTED_GITEA_TOKEN@git.sethpc.xyz/Seth/3d-printing.git` +## OctoPrint Timelapse Storage +- **Mount:** `/mnt/tank` on Pi → SMB share `//192.168.0.173/tank` (node-173) +- **Credentials file:** `/etc/samba/tank.creds` (username=octoprint, password=octoprint) +- **fstab:** Uses `x-systemd.automount`, `_netdev`, `nofail` +- **Timelapse dir:** `/tank/Timelapses` on node-173 (owned by `octoprint` user) +- **Samba user `octoprint`** exists on node-173 (created 2026-03-24) +- **GOTCHA:** Was originally pointed at pve197 (.197) — updated to node-173 (.173) after tank migration + +## PTZ Camera Control (CGI) +Base URLs from main network (via Pi socat proxies): +- cam1: `http://192.168.0.102:18080` +- cam2: `http://192.168.0.102:28080` + +All CGI commands use HTTP basic auth `admin:admin` at path `/cgi-bin/hi3510/param.cgi`. + +| Command | Parameters | +|---|---| +| Move | `cmd=ptzctrl&-step=0&-act=left/right/up/down` (continuous, send stop) | +| Step | `cmd=ptzctrl&-step=1&-act=left/right/up/down` (auto-stops) | +| Stop | `cmd=ptzctrl&-step=0&-act=stop` | +| Home | `cmd=ptzctrl&-step=0&-act=home` | +| Set speed | `cmd=setptzspeed&-panspeed=N&-tiltspeed=N` (1-5) | +| Get speed | `cmd=getptzspeed` | +| Flip/mirror | `cmd=setimageattr&-flip=on/off&-mirror=on/off` | +| Get image settings | `cmd=getimageattr` | +| Get device info | `cmd=getserverinfo` | + +## Current State (as of 2026-03-26) +- cam2 is flipped 180 (flip=on, mirror=on) +- cam1 is default orientation +- Both cameras at speed 2 + ## Conventions - Camera credentials: admin/admin (default, isolated network only) -- Pi SSH: key-only as `seth`, no password auth +- Pi SSH: key-only as `seth`, no password auth — reach via `ssh seth-pi` from steel141 - Internal password for homelab services: REDACTED_PASSWORD +- Samba user for timelapse storage: octoprint/octoprint on node-173 +- Pi's wlan0 IP (.102) is DHCP — may change after reboot. Check with nmap if unreachable. diff --git a/SESSION.md b/SESSION.md index 0f9887c..4621179 100644 --- a/SESSION.md +++ b/SESSION.md @@ -2,15 +2,13 @@ ## Context Files -- `/root/bin/core_homelab.md` — cluster topology, SSH aliases -- `/root/bin/services_directory.md` — active service IPs and domains -- `/root/bin/SESSION.md` — global session memory -- `./CONTEXT.md` — printer hardware, filament inventory, and accessories +- `./CLAUDE.md` — full project docs (printer, cameras, Pi, Frigate, cam-control, PTZ commands) +- `./CONTEXT.md` — raw hardware purchase inventory (Amazon order data) - `./GITEA_API.md` — Gitea push credentials and commit convention ## Project Summary -3D printing setup and management for a Creality Ender 3 homelab. Covers two printers (Ender 3 V3 SE and Ender 3 S1 Pro), filament inventory across PLA/PETG/ABS in multiple colors, and hardened steel MK8 nozzles. The CONTEXT.md file serves as an inventory of purchased hardware and consumables. +3D printing setup with one Creality Ender 3 V3 SE, remotely managed via OctoPrint on a Raspberry Pi 3 B+. Two TENVIS IP cameras on an isolated router subnet are proxied through the Pi (socat) and fed to Frigate NVR + a custom PTZ control webapp. Timelapses stored on tank (node-173) via SMB. ## Memory Discipline @@ -63,19 +61,48 @@ - [x] Document OctoPrint setup — done, documented in CLAUDE.md - Camera make: TENVIS (both cameras) +### Frigate NVR setup (2026-03-24) +- Added both cameras to Frigate 0.17 on CT 241 (192.168.0.220) +- Config at `/opt/frigate/config/config.yml`, docker-compose at `/opt/frigate/docker-compose.yml` +- Added port 1984 mapping to docker-compose (go2rtc API, needed for cam-control) +- Streams: `printer_cam1`, `printer_cam2` — pulled from Pi socat RTSP proxies +- Object tracking disabled, CPU detector only +- Gotcha: Frigate 0.17 changed record config schema — no `retain.days` or `events`, use `continuous.days`/`motion.days` + ### Camera control panel (2026-03-24) - Built single-page PTZ control webapp (`cam-control/server.py`) - Deployed to Frigate CT 241 at http://192.168.0.220:8090 - systemd service `cam-control.service` enabled and running -- Features: dual MJPEG feeds via go2rtc, PTZ D-pad, speed, flip/mirror +- Features: snapshot-polled live feeds (~5fps), PTZ D-pad, speed, flip/mirror +- Uses Frigate's go2rtc frame.jpeg endpoint (not MJPEG stream — MJPEG proxy through Python urllib doesn't work reliably) +- Must use ThreadingMixIn — single-threaded HTTPServer blocks on stream connections +- cam2 flipped 180 (flip=on, mirror=on) ### OctoPrint timelapse fix (2026-03-24) - Pi fstab pointed to pve197 for tank SMB — updated to node-173 post-migration - Created octoprint Samba user on node-173 (creds: octoprint/octoprint) - Timelapses dir at /tank/Timelapses now accessible, OctoPrint restarted +### Gotchas & Lessons Learned +- Pi's go2rtc API binds to `127.0.0.1` only — not accessible remotely. Use Frigate's go2rtc instead. +- Pi's wlan0 is DHCP (192.168.0.102 last seen) — may change. Use `nmap -sn 192.168.0.0/24 | grep Raspberry` from a node to find it. +- Pi SSH is key-only as `seth` — reachable via `ssh seth-pi` from steel141, or hop through pve197. +- MJPEG streaming through Python urllib is unreliable (0 bytes returned) — use snapshot polling (frame.jpeg) instead. +- Frigate 0.17 config schema differs from older docs online — query the Python schema if unsure: `docker exec frigate python3 -c 'from frigate.config import FrigateConfig; ...'` +- OctoPrint SMB mount must point to wherever tank lives (currently node-173 at .173). If tank moves again, update Pi fstab. +- Caddy config for `octopi.sethpc.xyz` is on CT 600 (192.168.0.185) at `/etc/caddy/Caddyfile` — includes camera stream rewrites at `/cam1.mjpeg`, `/cam2.mjpeg`, `/cam1.jpg`, `/cam2.jpg`. + ### Open threads -- [x] Identified camera: TENVIS, internal model C9F0SeZ0N0P4L0 (Hi3510 SoC), firmware V9.1.6.1.24-20170925 - [ ] Add slicer profiles and recommended print settings per filament type -- [ ] Set up Gitea repo and push project files -- [ ] Change default camera passwords (admin/admin) +- [ ] Change default camera passwords (admin/admin) — update in: go2rtc.yaml (Pi), Frigate config, cam-control server.py +- [ ] Make Pi wlan0 IP static (currently DHCP, could change) +- [ ] Fix Pi's go2rtc to bind to 0.0.0.0 if remote MJPEG streaming is ever needed +- [ ] OctoPrint config location unknown — not at default `/home/seth/.octoprint/`. Find with: `find / -name config.yaml -path '*octoprint*'` — it's at `/home/octoprint/.octoprint/` (runs as `octoprint` user, venv at `/home/octoprint/venv/`) + +### Completed +- [x] Document OctoPrint setup +- [x] Identify cameras: TENVIS, model C9F0SeZ0N0P4L0 (Hi3510 SoC), firmware V9.1.6.1.24-20170925 +- [x] Set up Gitea repo — https://git.sethpc.xyz/Seth/3d-printing +- [x] Add cameras to Frigate NVR +- [x] Build PTZ camera control webapp +- [x] Fix OctoPrint timelapse mount (pve197 → node-173)