Guide: Raspberry Zero + Home Assistant as Webcam for PrusaConnect
Hi all,
since I had some trouble to get my Raspberry Pi Zero 2 W working as a webcam for PrusaConnect, I thought I write a guide for you to do better...
This is what you need:
- Raspberry Pi Zero 2 W
- Raspberry Pi Camera Module 2.1 or 3
- Raspberry USB Charger
- SD Card
- Home Assistant server running
This is what you need to do:
Step 1: Get Raspberry Pi Zero 2 W and camera running
- Connect the camera module with Raspberry Pi Zero 2 W
- Install the latest Raspberry Pi OS Light Version on the SD card by using the Raspberry Imager -> https://www.raspberrypi.com/software/
- Check the IP adress of your Raspberry Pi Zero 2 W using a network scanner or your router user interface
- Once the OS is installed you need to enable the legacy camera support using a ssh connection and then the command "sudo raspi-config"
Step 2: Install MJPEG streamer
- Next, you can install the MJPEG streamer using this guide: https://elinux.org/RPi-Cam-Web-Interface
- You will now be able to access your camera by
Settings: http://your-ip/html
Webcam URL: http://your-ip/html/cam_pic_new.php?pDelay=40000
Snapshot URL: http://your-ip/html/cam_pic.php
Step 3: Get token and fingerprint from PRusaConnect
- Login to PrusaConnect, go to camera, add a new camera
- Click on the qr code - use your computer as camera and start the stream
- Now use the developer menu of your browser (recommend: Chrome Browser) to get the token and fingerprint values
Step 4: Use Home Assistant to push still images to PrusaConnect
- You can use your existing Home Assistant server (will not explain this here)
- Go to settings -> add on store -> add "Nodered"
- Once Nodered is installed, you will need to set a password in the configuration tab of Nodered -> then start Nodered. Make sure you selected "Show in tab"
- Go to NoderedCreate a new flow by dragging "timestamp" + "http request" + "http request" to the workspace area and connect the elements.
- Now configure the elements:
timestamp: set the interval to 30 seconds
http request: use method "GET" and enter the snapshot URL
http request: use method "PUT" and enter the URL https://connect.prusa3d.com/c/snapshot
and the headers
token + the token value
fingerprint + the fingerprint value
content-type + image/jpg
Now Home Assistant / Nodered will push a still image every 30 seconds to your PrusaConnect Webcam view...
RE: Guide: Raspberry Zero + Home Assistant as Webcam for PrusaConnect
Nice, I feel that could be used with esp32 as well.
Sounds like Home Assistant is not really used because you use Node-RED to fetch and push image. In that case just installing mqtt server (for example mosquitto) and Node-RED would be sufficient.
See my GitHub and printables.com for some 3d stuff that you may like.
RE:
Step 3: Get token and fingerprint from PRusaConnect
- Login to PrusaConnect, go to camera, add a new camera
- Click on the qr code - use your computer as camera and start the stream
- Now use the developer menu of your browser (recommend: Chrome Browser) to get the token and fingerprint values
Could someone clarify why the fingerprint value isn't more accessible?