I placed your original code in a function. I then added an If at the top of on_event to look to see if the user has enabled snapshot or not. If so we grab an image from the camera, upload to upload.im and send a notification with a picture msg. If at any point in time this fails we fall back on a regular notification.
Twilio requires the image to be uploaded to a public URL. I'm using upload.im for this purpose. Due to this I have strongly warned the user.
I have tested this on my printer and it works OctoPrint 1.3.6 running on OctoPi 0.13.0. I did not get to test failure of third party services like twillio and uploads.im but logic is in place that should deal with it gracefully. Also added logging where it might be needed.
2018-01-14 20:34:32,392 - octoprint.util.comm - INFO - Finished in 0.037 s.
2018-01-14 20:34:32,407 - octoprint.plugins.smsnotifier - INFO - Taking Snapshot.... Say Cheese!
2018-01-14 20:34:33,553 - octoprint.plugins.smsnotifier - INFO - Processing /tmp/tmpsaaPKx.jpg before uploading.
2018-01-14 20:34:41,434 - octoprint.plugins.smsnotifier - INFO - Snapshot uploaded to to http://sk.uploads.im/T1HbB.jpg
2018-01-14 20:34:42,154 - octoprint.plugins.smsnotifier - INFO - Print notification sent to xxxxxxxx
All that is left I think is to increment the version number. Wasn't sure what you wanted. "0.3.0"?
Fixes #2 (request for this feature)
Adds a new requirement for "requests" package.
I placed your original code in a function. I then added an If at the top of on_event to look to see if the user has enabled snapshot or not. If so we grab an image from the camera, upload to upload.im and send a notification with a picture msg. If at any point in time this fails we fall back on a regular notification.
Twilio requires the image to be uploaded to a public URL. I'm using upload.im for this purpose. Due to this I have strongly warned the user.
I have tested this on my printer and it works
OctoPrint 1.3.6 running on OctoPi 0.13.0
. I did not get to test failure of third party services like twillio and uploads.im but logic is in place that should deal with it gracefully. Also added logging where it might be needed.All that is left I think is to increment the version number. Wasn't sure what you wanted. "0.3.0"?