Registers reCamera devices, configures AI detection models/rules/schedules, monitors and clears detection events, fetches event snapshots, and runs manual im...
python3 (no external packages)80)~/.recamera/devices.json (created automatically; declared in skill metadata)~/.recamera/devices.json. Protect this file with appropriate permissions (chmod 600) and do not place unrelated secrets there.sk_xxx). Do not reuse tokens shared with cloud services.scripts/. Review them to verify behavior matches your expectations before granting autonomous execution.All scripts live under {baseDir}/scripts and accept one JSON object as CLI argument (optional for detect_local_device and list_devices).
device_manager.py: add/update/remove/list/get device credentials, file downloaddetection_manager.py: models, schedule, rules, events, event-image fetchcapture_manager.py: capture status/start/stop, one-shot image captureFull API signatures and CLI schemas: See REFERENCE.md
device_name (preferred) or inline device.sk_xxx (from Web Console → Device Info → Connection Settings → HTTP/HTTPS Settings).get_detection_models_info, map name → label index, use index in label_filter.get_detection_events every 1–10s; pass start_unix_ms for incremental reads.0); failure = actionable stderr. On error, surface stderr and provide one concrete fix.Copy and track for multi-step tasks:
reCamera Task Progress
- [ ] Resolve device (device_name or inline device)
- [ ] Validate JSON arguments
- [ ] Run CLI command
- [ ] If polling, checkpoint start_unix_ms
- [ ] Handle errors with one fix suggestion
Run from {baseDir}:
python3 scripts/device_manager.py add_device '{"name":"cam1","host":"192.168.1.100","token":"sk_xxxxxxxx"}'
python3 scripts/device_manager.py list_devices
python3 scripts/detection_manager.py get_detection_models_info '{"device_name":"cam1"}'
python3 scripts/detection_manager.py set_detection_model '{"device_name":"cam1","model_id":0}'
python3 scripts/detection_manager.py get_detection_events '{"device_name":"cam1"}'
python3 scripts/detection_manager.py clear_detection_events '{"device_name":"cam1"}'
python3 scripts/detection_manager.py fetch_detection_event_image '{"device_name":"cam1","snapshot_path":"/mnt/.../event.jpg","local_save_path":"./event.jpg"}'
python3 scripts/capture_manager.py capture_image '{"device_name":"cam1","local_save_path":"./capture.jpg"}'
from datetime import datetime, timezone
import sys
sys.path.append("./scripts")
from device_manager import get_device
from detection_manager import get_detection_events
device = get_device("cam1")
events = get_detection_events(device, start_unix_ms=int(datetime.now(timezone.utc).timestamp() * 1000))
Use a loop with checkpointed start_unix_ms for incremental polling.
add_device with host + token.list_devices to verify.get_detection_models_info → map object name to label index.set_detection_model.set_detection_rules with label_filter containing the index.clear_detection_events to start fresh.get_detection_events with start_unix_ms every 1–10s.fetch_detection_event_image.capture_image with local_save_path → returns {capture, saved_path, bytes}.capture_image → persist returned content bytes.fetch_detection_event_image with local_save_path.| Symptom | Fix |
|---|---|
| 401/403 auth error | Re-copy token from Web Console |
| Timeout / connection refused | Verify host, network path, device power |
| Schedule rejected | Use Day HH:MM:SS format |
| Empty rules or events | Enable rule/storage prerequisites; check region filter; poll more frequently |
| Image fetch failed | Use fresh snapshot_path; data may rotate out |
| Import errors in Python mode | Run from {baseDir}; append ./scripts to sys.path |
ZIP package — ready to use