Setup a PiCam to connect to PrusaConnect via python
-
Go to your PrusaConnect Dashboard and click on the "Camera" tab
-
Scroll down to the "Other cameras" section and click "Add new other camera"
-
Connect to your pi, clone the git repo and go into the new created folder
sudo apt install git git clone https://github.com/postpapa/PrusaConnectPiCam cd PrusaConnectPiCam
-
run the setup.py and enter the requested infos
python3 setup.py
4.1 Enter the token. You can find the token below the name of your "Other camera"
4.2 Enter an alternative name for your "Other camera"
4.3 If everything went well you should see "Request was successful." in the terminal
4.3.1 You may need to installpip3
andrequests
libsudo apt update sudo apt install python3-pip sudo pip3 install requests sudo pip3 install picamera
-
Check on the PrusaConnect site if the name of your "Other camera" was changed and the status changed to "Registered"
-
run the "sendscreenshots.py" script to test the uploading part. after a while you should see an image on your PrusaConnect Camera tab
python3 sendscreenshot.py
-
Make
sendscreenshot.py
executeable
chmod +x sendscreenshot.py
-
create the service file and insert the following code
sudo nano /etc/systemd/system/sendscreenshot.service
[Unit] Description=Uploads images to prusacloud After=networking.service [Service] ExecStart=/home/pi/PrusaConnectPiCam/sendscreenshot.py WorkingDirectory=/home/pi/PrusaConnectPiCam Restart=always RestartSec=5 [Install] WantedBy=multi-user.target
2.1 Adjust the
ExecStart
andWorkingDirectory
as needed. You can get the current directory if you enterpwd
in the terminal
2.2 pressctrl + x
followed byy
to save the file -
You can now start/stop the service with the following commands
sudo systemctl start sendscreenshot.service sudo systemctl stop sendscreenshot.service
If you want that the service starts automatically after the pi rebootet type the following line into the terminal
sudo systemctl enable sendscreenshot.service