I've managed to pull together some functionality without a lot of coding, adding theme-based sound events to my printer.
- Part of the functionality is delivered natively in the Raspberry Pi 3 computer itself since it has a stereo jack and in Raspbian because it includes the
alsa-utilscollection of sound-related code
- Part of the functionality is delivered via the GCODE System Commands plugin, allowing you to run command-based activities with a newly-assigned (mock) GCODE command
- Part of the functionality is delivered via the extensibility of the Controls tab by editing the
~/.octoprint/config.yamlfile, allowing you to easily add controls to the interface
I've set things up so that I can support multiple themes. Say, when I later add another theme like from the Simpsons or from the J.A.R.V.I.S. character from Iron Man, I'll convert those references from
/home/pi/sounds/r2d2/1.wav, for example, into related symlinks in
/home/pi/sounds/1.wav which merely point to the referenced wav file in the current theme. In this way, one could change themes and keep the same set of GCODE references.
Likewise, I've also setup things so that the same placeholder like "1" always means the same thing, like "I need your attention", perhaps.
The thought would be that you would manually edit your GCODE file to insert the
OCTO801 command or you would use one of the available plugins for action-at-z perhaps or a post-processing script to do the editing.
Having the sounds events available then means that you could set triggers for the existing OctoPrint API events and to throw these commands as well. You could register a high-temperature situation for the Raspberry Pi itself and to alert the user. One very good use might be to prompt for color changes or a filament runout condition.