Cookbook: Useful Event Hooks - Problem with event

What is the problem?

I am trying to do the email on print event. I have the email part setup and working, but the code to actually fire when a print is finished doesn't work as written in the guide. As it is written, octoprint will not start.

What did you already try to solve it?

Followed guide, tried changing code

Have you tried running in safe mode?

N/A

Did running in safe mode solve the problem?

No

Complete Logs

No logs are created when attempting to run octoprint

Additional information about your setup

Section of code being used

events:
	enabled: true
	subscriptions:
	- event: PrintDone
	command: curl -o /tmp/printDone.jpg "http://127.0.0.1:8080/?action=snapshot" && mpack -s "Print of {file} finished" /tmp/printDone.jpg xxx@gmail.com
	type: system

Please enclose code snippets with the 'Preformatted Text' button, </>, otherwise all the whitespace disappears.

The big question, did you use 4 spaces or 2?

For current OctoPrint versions, it is 4 spaces - look at the rest of the config file to check.

For old ones, and the next version - it is back to 2 spaces, to match all of the guides again.

1 Like

This is my first time messing with this stuff, so I wasn't aware of the spaces part at all - things looked like they were tabbed, so I actually used tab for each line.

I had already wasted hours trying to figure out why the email part didn't work before seeing that ssmtp isn't used anymore.

I just changed each to 4 spaces and now octoprint at least loads when restarted - just have to try a print and see if it will fire now.

Thanks so much!

1 Like

You may also want to look into a newly developed plugin OctoText which can email and text you for events. The author (@stephenwberry) was looking for testers, before (hopefully!) registering it on the repository.

I'm absolutely looking for testers! I'm in no hurry to register it until I'm sure it works for a bunch of people with all kinds of plugins.

1 Like

What we have here is a Catch-22 situation. You are looking for testers before registering and the best way to find testers is to register the plugin.

The only thing that will be "cast in stone" when you register is the name of the plugin (and that too can probably be changed). Everything else can be modified / updated / patched as time goes on.

The infrastructure around OctoPrint plugins is excellent. You can have stable and development branches, notification of updates, statistics about usage, and more.

I think you should go for it and register!

1 Like

@b-morgan Thanks for the advice! I'm still going through the process of trying to break the plugin myself and making sure it doesn't break octoprint in the process. If I can get testers to help out, great, if not then at some point I'll register it.