pi@octopi:~ $ sudo apt install openvpn
pi@octopi:~ $ sudo mv 11.pi3-octoprint.ovpn /etc/openvpn/11.pi3-octoprint.conf
pi@octopi:~ $ sudo systemctl restart openvpn
pi@octopi:~ $ sudo apt install wireguard
pi@octopi:~ $ sudo mv pi3_OCTOPI.conf /etc/wireguard/wg0.conf
pi@octopi:~ $ sudo systemctl enable wg-quick@wg0
pi@octopi:~ $ sudo systemctl start wg-quick@wg0
For debugging (might need to install resolvconf
)
pi@octopi:~ $ sudo wg-quick up wg0
-
In
/root/bin/webcamd
. Carefull with the "-o" parameter quotespushd $MJPGSTREAMER_HOME > /dev/null 2>&1 - echo Running ./mjpg_streamer -o "output_http.so -w $camera_http_webroot $camera_http_options" -i "$input" - LD_LIBRARY_PATH=. ./mjpg_streamer -o "output_http.so -w $camera_http_webroot $camera_http_options" -i "$input" & + echo Running ./mjpg_streamer -o "output_http.so -w $camera_http_webroot $camera_http_options -c username:password" -i "$input" + LD_LIBRARY_PATH=. ./mjpg_streamer -o "output_http.so -w $camera_http_webroot $camera_http_options -c username:password" -i "$input" &
-
OctoPrint Settings > Webcam & Timelapse > Timelapse Recordings > Snapshot URL
..and
Test
it -
Restart the service
pi@octopi:~ $ sudo systemctl restart webcamd.service
-
In
/etc/haproxy/haproxy.cfg
. In the "backend webcam"backend webcam - reqrep ^([^\ :]*)\ /webcam/(.*) \1\ /\2 + reqrep ^([^\ :]*)\ /webcam/123456789/(.*) \1\ /\2
-
Restart the service
pi@octopi:~ $ sudo systemctl restart haproxy.service
-
OctoPrint Settings > Webcam & Timelapse > Stream > Stream URL
/webcam/123456789/?action=stream
..and
Test
it
In the nano ~/.octoprint/config.yaml
in the event hooks
events:
enabled: true
subscriptions:
- event: Startup
command: v4l2-ctl --set-ctrl=power_line_frequency=1
type: system
https://unix.stackexchange.com/a/581939
https://community.octoprint.org/t/b/30389
To check the supported resolutions
pi@octopi:~ $ v4l2-ctl -d /dev/video0 --list-formats-ext
Change it in octopi.txt
pi@octopi:~ $ sudo nano /boot/octopi.txt
Apply the change
pi@octopi:~ $ sudo systemctl restart webcamd.service
Clone and compile the amazing uhubctl
https://github.com/mvp/uhubctl#compiling
Turn pi3 USBs off
pi@octopi:~ $ sudo uhubctl -l 1-1 -p 2 -a 0
Turn pi3 USBs on
pi@octopi:~ $ sudo uhubctl -l 1-1 -p 2 -a 1
Optionally, make it run without
sudo
https://github.com/mvp/uhubctl#linux-usb-permissions Tip: If not sure, execute the command withsudo
and note down whichvid:pid
was controlled. In my raspi3b:SUBSYSTEM=="usb", ATTR{idVendor}=="0424", MODE="0666"
Finally, control everything from the octoprint UI with System Command Editor (it's already in the octoprint repository/plugin manager) https://plugins.octoprint.org/plugins/systemcommandeditor/
Tip: For root commands, example: echo yoursudopassword | sudo -S systemctl restart webcamd.service