Made this for my PRUSA MINI with a Raspberry Pi Zero 2W and a Raspi Cam v1.3
Based on the great instructions from Nunos and Joltcans
- Go to the Cameras section at https://connect.prusa3d.com
- Add a new camera "Add new other camera".
- Copy the generated Token
- Set up your Raspberry Pi with simpe Raspian OS and enable the camera with
raspi-config
. - Create a shell script
prusaconnect_upload_cam.sh
and paste the Token into the file below.
- Save
prusaconnect_upload_cam.sh
from below to/usr/local/bin/prusaconnect_upload_cam.sh
and make it executablechmod +x /usr/local/bin/prusaconnect_upload_cam.sh
. - Start the script with
./usr/local/bin/prusaconnect_upload_cam.sh
If It works you should see the images appearing in Prusa Connect every 10 seconds.
To run the script in the background and start it automatically.
- Create
/etc/systemd/system/prusaconnect_upload_cam.service
and paste the content from below. - Start the service:
sudo systemctl start prusaconnect_upload_cam.service
. - Check if the service is running with
sudo systemctl status prusaconnect_upload_cam.service
. - Enable the service:
sudo systemctl enable prusaconnect_upload_cam.service
.
I am running a similar script that takes the webcam image from octoprint.
I'm finding that the script will work for a period of time, but when I look at Prusa Connect after a day or so, the image shows an error that it hasn't updated for over an hour, etc.
When I run systemctl status prusaconnect_upload_cam.service, I'm seeing the service is running, but there's output from the script showing a HTTP error, 503 Service Temporarily Unavailable from the curl command.
My thought is that occasionally the curl command cannot reach the Prusa Connect service for whatever reason, and this 503 HTML page is being sent back from nginx webserver.
I tried putting a --retry 10 in the curl command to get curl to retry up to 10 times. The error output from curl says it will retry in N seconds with N times remaining, but doesn't seem to actually do it.
Restarting the service fixes it, but I'm trying to find a method of making this reliable where it will attempt a new connection later.
The script waits a longer period of time if an error is returned from curl that is non-zero. However, the 503 HTTP error doesn't seem to make curl return non-zero, as it is returning a webpage HTML, just not the expected response.