vitormhenrique / OctoPrint-Enclosure

OctoPrint Enclosure Plugin
GNU General Public License v3.0
396 stars 202 forks source link

[F/R]: Switch GPIO when webstream is called #238

Open 6ffm70 opened 5 years ago

6ffm70 commented 5 years ago

**Problem: When watching the webstream while it's dark at the printer, I have to manually switch the light on (via the Enclosure plugin). Also, automated sending snapshots from a messenger plugin would require to have the enclosure illumination to be permanently switched on.

**Solution: The plugin shall make use of Octopi's function that the webcam-stream get started, when it is called once or by multiple users. The same trigger can be used to switch a GPIO.

**Bonus Solution: A popular light sensor can be connected to the Raspi, and pause the illumination feature (via the plugin) when it's not dark.

vitormhenrique commented 5 years ago

I need to do some research to see if it is possible.

mark-hahn commented 5 years ago

This would be nice for me and anyone who peeks a look at a print every 15 mins or so. It would save a lot of clicking around.

6ffm70 commented 4 years ago

I need to do some research to see if it is possible.

I'm still keen, Henrique! :)

6ffm70 commented 4 years ago

I was browsing the OctoPrint documentation for clues how to make this possible. There's an event called ClientOpened mentioned here http://docs.octoprint.org/en/master/events/index.html#available-events, which occurs when a client connects to the webserver. Equally, there's an event available for ClientClosed. That's not limited to the webstream tab, but could already minimise the time the camera light is turned on. Could that be easily implemented?