PrusaConnect camera with raspberry pi + curl
I'm trying to use this thread as a reference together with the prusa connect camera api reference and to register a camera with curl, but keep getting
{"message": "Missing or invalid security token", "code": "UNAUTHORIZED"}
My request:
curl -X POST \ -H "token: <token from https://connect.prusa3d.com/printer/<my printer uuid>/cameras>" \ -H "fingerprint: <name of the camera in https://connect.prusa3d.com/printer/<my printer uuid>/cameras>" \ https://connect.prusa3d.com/app/printers/<my printer uuid/camera?origin=OTHER
I think I just didn't understand what the token and fingerprint are. These are given here right? I guess the fingerprint is the camera name, and the token is what is given here.
Can you see what I am doing wrong here?
RE: PrusaConnect camera with raspberry pi + curl
never mind, the service seems to be down at the moment...
{"message": "Service is unavailable at this moment. Try again later", "code": "SERVICE_UNAVAILABLE"}
RE: PrusaConnect camera with raspberry pi + curl
I got it to work. The TOKEN is not the same as the QR code it seems, you have to grab that as well from the web app. Here is some code to make it work with rpicam-still:
#!/usr/bin/env bash set -Eeu set -o pipefail shopt -s extdebug FINGERPRINT="changeme" TOKEN="changeme" trap 'declare rc=$?; >&2 echo "Unexpected error (exit-code $rc) executing $BASH_COMMAND at ${BASH_SOURCE[0]} line $LINENO"; exit $rc' ERR main () { while true do if rpicam-still -t 1 -o - \ | curl https://webcam.connect.prusa3d.com/c/snapshot \ -X PUT \ -L --fail-with-body \ -H "Content-Type: image/jpg" \ -H "Fingerprint: $FINGERPRINT" \ -H "Token: $TOKEN" \ --data-binary @- then printf "." else echo echo "?" fi sleep 30 done } main "$@"
RE: PrusaConnect camera with raspberry pi + curl
Just adding here that the camera fingerprint seems to be a generated UUID. `uuidgen` in your shell, or any uuid generator should be able to create one. no need to go through the prusa QR flow.
RE: PrusaConnect camera with raspberry pi + curl
Follow the guide in my project and you should get it working without any problems
https://www.printables.com/model/989624-prusa-enclosure-raspberry-pi-camera-modification-w
RE: PrusaConnect camera with raspberry pi + curl
I had the camera API working from a Raspberry Pi for a while, but the SD card died and when I try to set it up again, I just keep getting the response {"detail":"Invalid fingerprint"} no matter what value I specify for fingerprint. Well, if it's shorter than 16 characters, I get another error message telling me that, but anything more than 16 characters seems to be invalid.
Every search result tells me that this value can be any random string, but then why do I get that error message? There must be something that's not documented about this fingerprint value.
RE: PrusaConnect camera with raspberry pi + curl
Remove camera and register it again, because you cannot change fingerprint after camera registration.
Fingerprint can be vey easily generated by cli tool 'uuidgen'.
See my GitHub and printables.com for some 3d stuff that you may like.
RE: PrusaConnect camera with raspberry pi + curl
I had the camera API working from a Raspberry Pi for a while, but the SD card died and when I try to set it up again, I just keep getting the response {"detail":"Invalid fingerprint"}…
Delete the camera from Prusa Connect, create a new one and use the new API Key and new fingerprint.
My script mentioned above does generate the fingerprint from the device (RPi) so it’s stable between runs, but still (mostly) unique for the board Hardware.