Skip to content

Cloud storage archive — auto-sync to OneDrive/Google Drive via rclone #35

@mphacker

Description

@mphacker

Cloud storage archive — auto-sync videos to OneDrive/Google Drive

Feature Request

Allow users to automatically archive dashcam footage to cloud storage providers for long-term preservation and off-device access.

Proposed Architecture

Approach: rclone-based sync
rclone is a mature, battle-tested tool that supports 40+ cloud providers including OneDrive, Google Drive, Dropbox, S3, and more. It runs on ARM (Pi Zero 2 W compatible) and handles auth, chunked uploads, and resume.

Implementation Plan:

  1. Config in config.yaml:
cloud_archive:
  enabled: false
  provider: onedrive          # onedrive, gdrive, dropbox, s3, etc.
  remote_path: TeslaUSB/Clips # Path on cloud storage
  sync_on_wifi: true          # Only sync when connected to home WiFi
  sync_folders:               # Which TeslaCam folders to sync
    - SavedClips
    - SentryClips
    - RecentClips
  max_upload_mbps: 5          # Bandwidth limit (Pi has limited upload)
  keep_local_after_upload: true
  1. Setup flow:

    • Install rclone via setup_usb.sh (apt install rclone or ARM binary)
    • Web UI settings page: "Cloud Archive" section with provider selector
    • OAuth flow: rclone generates an auth URL, user visits it on phone/computer, pastes token back
    • Test connection button
  2. Sync triggers:

    • On mode switch to Edit: Sync new clips while drive is mounted RW
    • Scheduled: Timer-based (e.g., every 6 hours if on WiFi)
    • Manual: "Sync Now" button in UI
    • On event detection: Auto-sync clips with detected events (hard brake, sentry)
  3. Sync logic:

    • Track synced files in a local SQLite table (avoid re-uploading)
    • Upload newest files first (most likely to be wanted)
    • Skip files currently being written by Tesla
    • Resume interrupted uploads
    • Bandwidth throttle to avoid saturating home WiFi
  4. UI in Settings:

    • Cloud provider selector + auth status
    • Last sync time + files synced count
    • Manual "Sync Now" button
    • Sync log/history
    • Storage usage on cloud

Considerations

  • Pi Zero 2 W constraints: 512MB RAM, limited upload bandwidth. Must throttle and process one file at a time.
  • WiFi dependency: Can only sync when connected to home WiFi (not Tesla's in-car WiFi)
  • Auth token storage: rclone config stored securely, excluded from git
  • Offline resilience: Queue files for upload, sync when connectivity returns

Alternative Approaches

  • SMB/NFS mount: Mount a NAS share and rsync locally (faster, no cloud dependency)
  • SFTP/SCP: Push to a home server via SSH
  • USB-to-USB: When a second USB drive is connected, copy files to it

Related

See also #34 (preserve older trips from auto-deletion)
Ref #25

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions