forked from zakaria/zenai-apc-ngoro
4.2 KiB
4.2 KiB
Recounting — Device Connection Checklist (Phase 0)
Topology (ZeroTier 192.168.192.0/24)
| Role | Host | Endpoints |
|---|---|---|
| NanoPi 1 (dashboard + live counter) | 192.168.192.208 |
Dashboard :5000 |
| MotionEye | 192.168.192.251 |
UI :8081, ingest :8090 |
| NanoPi 2 (recount engine) | 192.168.192.16 |
Recount API :8765 |
Checklist
- From NanoPi 1:
ping -c1 192.168.192.251andping -c1 192.168.192.16 - Open MotionEye UI:
http://192.168.192.251:8081— setMOTIONEYE_USER/MOTIONEYE_PASSWORDin.envif needed - SSH to MotionEye as
support(not root):ssh support@192.168.192.251 - Locate media dir (e.g.
/data/media/Camera1). SetMOTIONEYE_MEDIA_DIR,MOTIONEYE_CAMERA_ID=1,MOTIONEYE_SSH_USER=support - Authorize NanoPi 1 key for
supporton ME (/home/support/.ssh/authorized_keys) and for NP2 - Deploy ingest:
bash scripts/deploy-motioneye-ingest.sh - Deploy recount:
bash scripts/deploy-recount-to-nanopi2.sh - Manual test file name:
batch_YYYY-MM-DD-N.mp4in media dir (or upload via ingest) - Set on NanoPi 1
.env:RECOUNT_STUB=false, corrected URLs below
Required .env keys (NanoPi 1)
NANOPI2_URL=http://192.168.192.16:8765
MOTIONEYE_URL=http://192.168.192.251:8081
MOTIONEYE_INGEST_URL=http://192.168.192.251:8090
MOTIONEYE_INGEST_TOKEN=<shared-secret>
MOTIONEYE_MEDIA_DIR=/data/media/Camera1
MOTIONEYE_CAMERA_ID=1
MOTIONEYE_USER=support
MOTIONEYE_SSH_USER=support
BATCH_RECORD_ENABLED=true
BATCH_RECORD_FPS=0
BATCH_RECORD_QUEUE=120
RECOUNT_STUB=false
Status notes (this host)
- MotionEye
:8081HTTP responds (200). - MotionEye SSH user is
support(default in deploy script). - SSH to ME/NP2 with
nanopi_agentkey was not authorized at implementation time. - Local ingest smoke-tested on NanoPi 1 at
:8090writing to/opt/apc-ngoro/motioneye_media/(temporary until ME deploy). - Dashboard
RECOUNT_STUB=falseproxies to NanoPi 2; until recount is deployed, status shows connection refused (expected).
Current status (post-deploy)
- MotionEye ingest: OK (
http://192.168.192.251:8090/health) - NanoPi 2 recount service: running, but first E2E failed with missing model file
- Fix model then retest:
# Option A — copy model only
bash /opt/apc-ngoro/scripts/copy-model-to-nanopi2.sh
# Option B — redeploy recount (now bundles the .rknn)
bash /opt/apc-ngoro/scripts/deploy-recount-to-nanopi2.sh
# Remove deprecated MotionEye-side calendar cleanup, then install new retention cron
bash /opt/apc-ngoro/scripts/deploy-motioneye-cleanup-cron.sh
bash /opt/apc-ngoro/scripts/deploy-retention-cron.sh
# Verify local active-day cron
cat /etc/cron.d/apc-retention
# Dry-run active-day cleanup from NP1
/opt/apc-ngoro/venv/bin/python /opt/apc-ngoro/scripts/retention_active_days.py --dry-run
# Dry-run overlay cleanup on NP2
ssh root@192.168.192.16 'cd /opt/apc-ngoro && /opt/apc-ngoro/venv/bin/python scripts/recount_overlay_cleanup.py --dry-run'
# Retest recount (batch 2026-09-09-19 already has video on ME)
curl -X POST http://127.0.0.1:5000/api/v1/recount/start \
-H 'Content-Type: application/json' \
-d '{"batch_id":"2026-09-09-19"}'
curl -sS http://127.0.0.1:5000/api/v1/recount/status
Next actions for you
- Append
~/.ssh/nanopi_agent.pubtosupport’sauthorized_keyson MotionEye (/home/support/.ssh/authorized_keys) and to NanoPi 2. - On MotionEye, set real
MOTIONEYE_MEDIA_DIR, then run:bash /opt/apc-ngoro/scripts/deploy-motioneye-ingest.sh - On NanoPi 2 (after copying RKNN model to
/opt/models/...), run:bash /opt/apc-ngoro/scripts/deploy-recount-to-nanopi2.sh - Remove deprecated MotionEye cron with
scripts/deploy-motioneye-cleanup-cron.sh, then install the new retention automation withscripts/deploy-retention-cron.sh. Batch files now keep only the last 3 active counting dates (ACTIVE_RETENTION_DAYS=3), while NP2 overlay outputs are deleted after 6 hours (RECOUNT_OVERLAY_TTL_HOURS=6). - Place today’s test file as
batch_YYYY-MM-DD-N.mp4(or upload via ingest) and set that batch’svideo_urlin DB / via live recording. - Restart counter after
.envchanges:systemctl restart apc-ngoro-counter