Open anoved opened 8 years ago
@foosel @dcwalmsley I created a multievent
branch of this plugin that supports email notifications for arbitrary events as discussed in foosel/Octoprint#1070. It is configured with a dict of event names, each with their own notification settings. Any of the event's payload properties can be used in the message template.
Here's an example of what the config looks like now:
emailnotifier:
_config_version: 2
mail_server: smtp.gmail.com
mail_username: jim.devona@gmail.com
notifications:
FileSelected:
body: '{file} selected for printing.'
enabled: true
snapshot: false
title: Selected {filename}
MovieDone:
body: Timelapse of printing {gcode} saved as {movie}.
enabled: true
snapshot: false
title: 'Timelapse rendered: {movie_basename}'
PrintDone:
body: '{file} done in {time}.'
enabled: true
snapshot: true
title: 'Print complete: {file}'
recipient_address: jim@anoved.net
Unfortunately I haven't figured out how to make a settings template interface for notifications
, so it has to be edited manually.
As an interim interface solution, the Yamlpatcher plugin can be used to add/edit/remove notifications.
Adding an event notification using yaml patch:
Removing an event notification using JSON command:
Here is a rough static HTML mockup of the settings interface I envision for multiple notifications.
Clicking Add would add another row to the table. Select from available Event names and edit message templates. I'm not sure how to achieve this, though. Do any existing plugins offer a similar interface? I find the Jinja2/knockout/viewmodel/Javascript documentation a bit too overwhelming to work it out from scratch.
@anoved you could take a look at the temperature profile or the terminal filter configuration pages in the OctoPrint settings, those follow a similar pattern:
Interesting source code locations:
Thanks for the pointers. Perfect example. I will take a shot at it soon.
Currently notifications are only sent in response to the
PrintDone
event, but there are many others.