Skip to content

amd989/scrypted-prusa-connect

Repository files navigation

Scrypted Prusa Connect Plugin

This plugin integrates Scrypted camera devices with the Prusa Connect platform, allowing you to monitor your 3D printers with your existing camera setup.

Features

  • Camera Mixin Integration - Extends existing cameras with Prusa Connect functionality
  • Automatic Snapshot Uploads - Configurable interval-based uploads (default: 10 seconds)
  • Manual Sync - "Sync Now" button for on-demand snapshots
  • Multiple Camera Support - Configure each camera independently
  • Auto-Population - Automatically populates camera details (name, model, resolution) on first setup
  • Rate Limit Handling - Gracefully handles Prusa Connect API rate limits
  • Persistent Configuration - Settings are saved per-camera

Installation

  1. Open Scrypted Management Console
  2. Navigate to Plugins
  3. Click "Install Plugin"
  4. Search for "Prusa Connect" or install from local development

Configuration

Plugin Settings

  1. Navigate to the Prusa Connect plugin
  2. Configure global settings:
    • Prusa Connect URL: Default is https://connect.prusa3d.com
    • Upload Interval: How often to upload snapshots in seconds (0 to disable automatic uploads)

Per-Camera Setup

  1. Go to any camera device
  2. Enable the Prusa Connect mixin
  3. In the camera settings, you'll see a new "Prusa Connect" section with:
    • Camera Token: Get this from Prusa Connect (see below)
    • Camera Name: Display name in Prusa Connect
    • Last Sync: Shows when the last upload occurred
    • Sync Now: Button to manually trigger an upload

Getting a Camera Token

Important: You need to manually register your camera in Prusa Connect first.

  1. Log in to Prusa Connect
  2. Go to your printer settings
  3. Add a new camera manually
  4. Copy the generated Camera Token
  5. Paste it into the Scrypted camera's "Camera Token" field

How It Works

This plugin uses Scrypted's MixinProvider pattern to extend camera devices:

  1. Mixin Integration - Adds Prusa Connect functionality to existing cameras without replacing them
  2. Token-Based Authentication - Each camera uses its own token + persistent fingerprint for security
  3. Automatic Info Population - On first token setup, automatically sends camera details (name, model, resolution) to Prusa Connect
  4. Background Uploads - Runs automatic uploads at the configured interval for all cameras with valid tokens
  5. Error Handling - Rate limit errors are handled gracefully without stopping other cameras

Plugin Architecture

  • PrusaConnectProvider - Main plugin that manages global settings and automatic upload timers
  • PrusaConnectMixin - Per-camera mixin that handles individual camera configuration and uploads
  • PrusaConnectClient - API client for communicating with Prusa Connect
  • CameraManager - Handles camera operations and snapshot uploads

Rate Limiting

Prusa Connect enforces rate limits (~10 second minimum between uploads). The plugin handles this by:

  • Logging friendly warnings instead of verbose errors
  • Continuing automatic uploads for other cameras when one gets rate limited
  • Using a default 10-second interval to align with API limits

Troubleshooting

Camera Not Uploading

  1. Check that the camera token is valid in Prusa Connect
  2. Verify the camera can take snapshots in Scrypted
  3. Look for rate limiting messages in logs
  4. Try the "Sync Now" button for manual testing

Settings Not Showing

  1. Ensure the Prusa Connect mixin is enabled on the camera
  2. Check that the camera supports the Camera interface
  3. Look for the "Prusa Connect" section in camera settings (not under "General")

Common Error Messages

  • "Upload rate limited by Prusa Connect" - Normal, uploads will resume automatically
  • "Camera token not set" - Configure the camera token in camera settings
  • "Invalid fingerprint" - Token/fingerprint mismatch, try re-entering the token

Development

Building

npm install
npm run build

Local Deployment

npm run scrypted-deploy-debug

Project Structure

src/
├── main.ts              # Main plugin and mixin classes
├── prusa-connect-client.ts  # API client
└── camera-manager.ts    # Camera operations wrapper

Version History

  • 0.1.5 - Initial release with camera mixin integration, automatic uploads, and camera info auto-population

About

Scrypted plugin for Prusa Connect integration

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published