Sun Dec 09 14:56:14 EST 2018
 

Date Created: 2013-12-09 06:18:24 -0600 (Mon, 09 Dec 2013)

OctoPrint config.yaml Event Subscriptions

Overview

  The config.yaml OctoPrint file has sections to subscribe to and configure printing events.

The OctoPrint documentation shows how to use mpack to send an email from the PrintDone event configuration. This guide shows how to use an alternative message transport method, namely a Java library.

This project came about because the system sendmail configuration I had working stopped working :(

Printing Event Configuration in config.yaml

Here is a sample events section of config.yaml for this project:

  events:
    enabled: true
    subscriptions:
    - event: PrintDone
      command:
      - logger 'PrintDone - {name}'
      - curl -o /tmp/printDone.jpg "http://localhost:8080/?action=snapshot"
      - /usr/bin/java -jar /opt/onebeartoe/email-sendette.jar --to printer-person@gmail.com --subject "Duplicator - PrintDone - {name}" --attachment /tmp/printDone.jpg --smtpUser smtpuser --forceSmtpPassword smtppassword >> /home/pi/workspace/octoprint-command.logs 2>&1
      debug: true
      type: system
    - event: PrintStarted
      command:
      - logger 'PrintStarted - {name}'
      - ls -la /usr/bin/java
      - /usr/bin/java -jar /opt/onebeartoe/email-sendette.jar --to printer-person@gmail.com --subject "Duplicator - PrintStarted - {name}" --smtpUser smtpuser --forceSmtpPassword smtppassword >> /home/pi/workspace/octoprint-command.logs 2>&1
      debug: true
      type: system

Resources