Introduction

Octoprint is a powerful open-source 3D printer management tool that allows you to control and monitor your 3D printer remotely. Prusa Connect is a cloud-based service that enables you to manage your Prusa printers from anywhere. By connecting OctoPrint to Prusa Connect, you can enhance your 3D printing experience by accessing additional features and functionalities.

Connecting OctoPrint to Prusa Connect

Follow those steps to connect your OctoPrint instance to Prusa Connect:

  • Go to the Cameras section at https://connect.prusa3d.com
  • Add a new camera.
  • Click the QR code link
  • Click “Start Camera”
  • Open your browser’s inspector window and look for the “/snapshot” request.
  • Copy the “Fingerprint” and “Token” headers into the file below.
  • Save prusaconnect_upload_cam.sh from below to /usr/local/bin/prusaconnect_upload_cam.sh:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash

# Set default values for environment variables
: "${HTTP_URL:=https://webcam.connect.prusa3d.com/c/snapshot}"
: "${DELAY_SECONDS:=10}"
: "${LONG_DELAY_SECONDS:=60}"

FINGERPRINT="xxx"
TOKEN="xxx"
SNAPSHOTURL="http://127.0.0.1:8080/?action=snapshot"

while true; do
    # grab from octopi
    curl -s "$SNAPSHOTURL" --output /tmp/output.jpg

    # If no error, upload it.
    if [ $? -eq 0 ]; then
        # POST the image to the HTTP URL using curl
        curl -X PUT "$HTTP_URL" \
            -H "accept: */*" \
            -H "content-type: image/jpg" \
            -H "fingerprint: $FINGERPRINT" \
            -H "token: $TOKEN" \
            --data-binary "@/tmp/output.jpg" \
            --compressed

        # Reset delay to the normal value
        DELAY=$DELAY_SECONDS
    else
        echo "Octopi snapshot returned an error. Retrying after ${LONG_DELAY_SECONDS}s..."

        # Set delay to the longer value
        DELAY=$LONG_DELAY_SECONDS
    fi

    sleep "$DELAY"
done

And make it executable:

1
chmod +x /usr/local/bin/prusaconnect_upload_cam.sh

You can test it by running the script manually:

1
/usr/local/bin/prusaconnect_upload_cam.sh

You should see the camera image being uploaded to Prusa Connect.

Once done, you can move forward and run it in the background, create /etc/systemd/system/prusaconnect_upload_cam.service:

1
2
3
4
5
6
7
8
[Unit]
Description=Octocam to Prusa Connect

[Service]
ExecStart=/usr/local/bin/prusaconnect_upload_cam.sh

[Install]
WantedBy=multi-user.target

and then start and enable it:

1
systemctl enable --now prusaconnect_upload_cam.service

That’s it! You should now see your OctoPrint camera feed in Prusa Connect.

References

Last updated 05 May 2025, 19:06 CEST. history