Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support notifications for other events #1

Open
anoved opened this issue Sep 23, 2015 · 5 comments
Open

Support notifications for other events #1

anoved opened this issue Sep 23, 2015 · 5 comments

Comments

@anoved
Copy link
Owner

anoved commented Sep 23, 2015

Currently notifications are only sent in response to the PrintDone event, but there are many others.

anoved added a commit that referenced this issue Sep 26, 2015
Towards #1. Notification configuration only via config.yaml editing for now.
@anoved
Copy link
Owner Author

anoved commented Sep 27, 2015

@foosel @dcwalmsley I created a multievent branch of this plugin that supports email notifications for arbitrary events as discussed in OctoPrint/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: [email protected]
    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: [email protected]

Unfortunately I haven't figured out how to make a settings template interface for notifications, so it has to be edited manually.

@anoved
Copy link
Owner Author

anoved commented Sep 27, 2015

As an interim interface solution, the Yamlpatcher plugin can be used to add/edit/remove notifications.

Adding an event notification using yaml patch:
yamlpatcher-emailnotifier

Removing an event notification using JSON command:
remove-notification

@anoved
Copy link
Owner Author

anoved commented Sep 28, 2015

Here is a rough static HTML mockup of the settings interface I envision for multiple notifications.

notifiationsettings

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.

@foosel
Copy link
Contributor

foosel commented Sep 28, 2015

@anoved
Copy link
Owner Author

anoved commented Sep 29, 2015

Thanks for the pointers. Perfect example. I will take a shot at it soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants