Webcam On-Off Option


#1

It would be nice if the admin could have a control to turn the webcam on/off. This would allow control / privacy without having to plug or unplug the webcam from the Pi while still supporting low cost webcams.

Just a simple and intuitive On/Off pair like the Fan buttons in the General section should be easy to implement.


#2

I was thinking it would be nice to have a "Stop Web Streaming" and a "Start MJPG Streamer" in the System Menu. Is that doable @foosel? Or is that something that has to be set up in OctoPi jointly?

More info can be found here on the Webcam setup.


#3

OctoPrint doesn't control the webcam. People might be using an external IP camera, or some other webcam server or whatnot. So adding that stock OctoPrint wouldn't make sense. Shipping a custom config with OctoPi that includes that however would be possible.


#4

I understand that. Shutting down the MJPG Streamer is certainly not as severe as rebooting the whole RasPi. The Script could certainly check to see if others are logged in and using the webcam and give an appropriate warning.

I agree that this could/should be a custom config with OctoPi.
Does OctoPrint installed on a Mac or Windows machine have the "Reboot System" or "Shut Down" menu items or is that specific to the RasPi?

Is this something that could be done thru the "System Command Editor". That plug-in doesn't work on a Mac for some reason. I tried 3 different browsers.


#5

The reboot/shutdown menu items are available (on macOS at least), they're just not preconfigured like on OctoPi. You can set the shell commands for these options manually in the OctoPrint settings under the 'Server' heading.

System Command Editor works for me, Safari 11.1 on 10.12.6 Sierra, albeit with the double scroll bar rendering glitch. Are you using any content blockers or similar?


#6

Like @lbell mentions, if you use system command editor you can set the commands to

sudo service webcamd stop for stopping the webcam service

and

sudo service webcamd start for starting the service.

Of course webcamd in the commands above have to match the name of the service you add. That name is specific to OctoPi.


#7

Hi, It worked for me adding in the system command editor:

turn on: sudo /etc/init.d/webcamd start
turn off: sudo /etc/init.d/webcamd stop

Keep in mind that activating the webcam takes about 30 or 40 seconds to activate the service


#8

Nube here. I get am error when executing these command after I entered them, because sudo is requesting the root password.


#9

And would this be on an OctoPi-imaged OctoPrint on a Raspberry Pi? If so, then Guy would have taken care of all this since his image rocks.

See lines 134-136 for what he did to allow pi to quietly do things like shutdown, for example.


#10

I started over, re-imaged, updated, and now the control commands are working. Very nice. Thank you!.


#11

Is there any way to trigger system commands on events, like the GCODE Scripts section does? I'd like to make the camera automatically turn on when a print is queued and turn off when it's done.


Automatic webcam shutdown after print is done
#12
  1. Take the scripts which jneilliii has provided above
  2. Turn them into Gcode System Commands as, say, 900 and 901
  3. Add the OCTO900 and OCTO901 as appropriate into your OctoPrint Gcode scripts as if they were GCODE

#13

Is it possible to connect xioami Dafang wiwfiweb camera to raspberry pi with octoprint