Does anyone know how I can toggle the webcam off using octopi? (Octoprint v 1.3.6 from the octopi image and standard Raspberry Pi webcam, rather than a USB camera)
I'm running it on a pi zero and getting a few performance issues when streaming is on, but generally I don't want streaming on all the time. If I disable the webcamd service, performance drastically improves.
From the command line, 'sudo service webcamd stop' will happily start and stop the service, so using visudo, I tried putting the following into my sudoers file:
pi ALL=(ALL) NOPASSWD: /usr/sbin/service webcamd stop
pi ALL=NOPASSWD: /bin/systemctl stop webcamd
I tried making a button using the custom control editor plugin, which placed the following in my config.yaml:
- name: WebCam Off
script: /usr/sbin/service webcamd stop
- name: WebCam Off2
script: /bin/systemctl stop webcamd
Both fail and all I get in octoprint.log is:
2018-03-18 16:22:47,936 - tornado.access - WARNING - 404 POST /api/printer/command (127.0.0.1) 1518.94ms
After struggling for some time, I tried making a C program, setting it suid and putting it in /home/pi/bin. This worked from the command line but not from the custom button, giving the same tornado.access error.
Finally just to see if it would execute any script at all, I tried a short bash script:
date >> /tmp/t.log
whoami >> /tmp/t.log
echo Args=$0 >> /tmp/t.log
then I called that with a button:
- name: WebCam Off
script: /home/pi/bin/doIrun wemcam_off
Still the same tornado.access error. It looks like octoprint can not execute any command or script. Is there any way I can enable this or get any form of useful debugging output to see why the called scripts are failing. Or, taking a step back, is there a better way to allow the toggling of the webcam?