Notifications
Clear all
Image from camera connect api not working in connect
Hello, I have little script that runs on my rpi.
script is simple
#!/bin/bash
# Set default values for environment variables
: "${HTTP_URL:= https://connect.prusa3d.com/c/snapshot }"
: "${DELAY_SECONDS:=10}"
: "${LONG_DELAY_SECONDS:=60}"
# FINGERPRINT can be a random string with at least 16 characters
: "${FINGERPRINT:=fprint}"
# CAMERA_TOKEN generated by the Connect server
: "${CAMERA_TOKEN:=token}"
while true; do
# Grab a frame from libcamera-still with the highest resolution
# that is displayed on Prusa Connect: 1704 x 1278 for a 4:3 image
# Setting the quality to 80 saves almost 50% in file size for
# very little decrease in quality. Set to taste!
# If you need to rotate the image 180° add --rotate 180
# libcamera-still -v 0 --immediate --width 2274 --height 1280 -q 80 -o output.jpg
v4l2-ctl --device /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat=MJPG --stream-mmap --stream-to=/tmp/output.jpg --stream-count=1
IMAGE_SIZE=`wc -c < /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 "content-length: $IMAGE_SIZE" \
-H "fingerprint: $FINGERPRINT" \
-H "token: $CAMERA_TOKEN" \
--data-binary "@/tmp/output.jpg" \
--no-progress-meter \
--compressed
#-v
# Reset delay to the normal value
DELAY=$DELAY_SECONDS
else
echo "libcamera-still returned an error, retrying after ${LONG_DELAY_SECONDS}s..."
# Set delay to the longer value
DELAY=$LONG_DELAY_SECONDS
fi
sleep "$DELAY"
done
scripts is running, i can download image to my pc and its working. But prusa connect show no image 🙁 And its even gets always 204 status code from api. What am I doing wrong?
Best Answer by Attanon:
closing.. connect doesnt process images when printer is offline. After turning on printer, it starts showing images.
Posted : 15/08/2024 8:51 pm
1 people liked
Topic starter
answered:
RE: Image from camera connect api not working in connect
closing.. connect doesnt process images when printer is offline. After turning on printer, it starts showing images.
Posted : 16/08/2024 9:43 am