taxilian / OctoPrint-Twilio

Octoprint plugin for print completion notifications using Twilio (for free w/ trial account)
GNU Affero General Public License v3.0
5 stars 9 forks source link

Stopped sending images after a few days. #6

Closed shadycuz closed 6 years ago

shadycuz commented 6 years ago

So I stopped getting images after a few days.

2018-01-24 11:08:23,635 - octoprint.server.util.sockjs - INFO - Client connection closed: 10.20.30.42
2018-01-24 13:17:41,021 - octoprint.util.comm - INFO - Finished in 10589.761 s.
2018-01-24 13:17:41,028 - octoprint.plugins.smsnotifier - INFO - Taking Snapshot.... Say Cheese!
2018-01-24 13:17:41,201 - octoprint.plugins.smsnotifier - INFO - Processing /tmp/tmp8VIy0p.jpg before uploading.
2018-01-24 13:17:46,392 - octoprint.plugins.smsnotifier - WARNING - Could not send a webcam image, sending only text notification.
2018-01-24 13:17:51,838 - octoprint.plugins.smsnotifier - INFO - Print notification sent to 6144075061
2018-01-24 13:17:51,840 - octoprint.plugins.smsnotifier - WARNING - Could not get a image from the webcam. Is it enabled?

When it was working.

2018-01-22 10:29:02,105 - octoprint.plugins.smsnotifier - INFO - Taking Snapshot.... Say Cheese!
2018-01-22 10:29:03,113 - octoprint.plugins.smsnotifier - INFO - Processing /tmp/tmpXNerJ6.jpg before uploading.
2018-01-22 10:29:08,487 - octoprint.plugins.smsnotifier - INFO - Snapshot uploaded to to http://sk.uploads.im/uZ9IN.jpg
2018-01-22 10:29:17,072 - octoprint.plugins.smsnotifier - INFO - Print notification sent to 61XXXXXXX

I'm going to look into it when I get time.

shadycuz commented 6 years ago

Problem is here

https://github.com/taxilian/OctoPrint-Twilio/blob/646f65ee838bb10bb5b22143d95f97af562aa529/octoprint_smsnotifier/__init__.py#L75

Either we are not getting a 2XX back from the upload or something changed upstream in the requests library. I will look into it.

tedder commented 6 years ago

I'm seeing it too.


2018-01-26 16:17:30,415 - octoprint.plugins.smsnotifier - INFO - Taking Snapshot.... Say Cheese!
2018-01-26 16:17:31,475 - octoprint.plugins.smsnotifier - INFO - Processing /tmp/tmpuGB_G7.jpg before uploading.
2018-01-26 16:17:40,905 - octoprint.plugins.smsnotifier - WARNING - Could not send a webcam image, sending only text notification.
2018-01-26 16:17:42,007 - octoprint.plugins.smsnotifier - INFO - Print notification sent to 7604833337
2018-01-26 16:17:42,008 - octoprint.plugins.smsnotifier - WARNING - Could not get a image from the webcam. Is it enabled?
2018-01-26 16:17:42,024 - octoprint.timelapse - WARNING - Cannot capture image, image number is unset```
shadycuz commented 6 years ago

I feel like they changed the API. I'll have time to investigate tomorrow.

On Jan 26, 2018 11:19 AM, "Ted Timmons" notifications@github.com wrote:

I'm seeing it too.

2018-01-26 16:17:30,415 - octoprint.plugins.smsnotifier - INFO - Taking Snapshot.... Say Cheese! 2018-01-26 16:17:31,475 - octoprint.plugins.smsnotifier - INFO - Processing /tmp/tmpuGB_G7.jpg before uploading. 2018-01-26 16:17:40,905 - octoprint.plugins.smsnotifier - WARNING - Could not send a webcam image, sending only text notification. 2018-01-26 16:17:42,007 - octoprint.plugins.smsnotifier - INFO - Print notification sent to 7604833337 2018-01-26 16:17:42,008 - octoprint.plugins.smsnotifier - WARNING - Could not get a image from the webcam. Is it enabled? 2018-01-26 16:17:42,024 - octoprint.timelapse - WARNING - Cannot capture image, image number is unset```

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/taxilian/OctoPrint-Twilio/issues/6#issuecomment-360830563, or mute the thread https://github.com/notifications/unsubscribe-auth/AQTJtytpeyMZnlbCFkA1TLyCpkM9x2lEks5tOfsngaJpZM4RruEV .

tedder commented 6 years ago

Confirmed it is getting a 500 back: 2018-01-26 20:05:38,037 - octoprint.plugins.smsnotifier - INFO - status code: 500

shadycuz commented 6 years ago

@tedder Cool, Im going to the store, and when I come back I'm going to work on a fix. Upload.im includes a reason in status_txt so if you print(response.status_txt) or print the entire response we should see what went wrong.

shadycuz commented 6 years ago

@tedder Fixed, you can wait on the update or grab it from https://github.com/shadycuz/OctoPrint-Twilio/tree/bugfix/500_from_api

tedder commented 6 years ago

Thanks. How do you set up a plugin so you can develop it in octoprint? I tried cloning the folder to oprint/plugins, tried to oprint/local/lib/python2.7/site-packages/, it barfs because it isn't an egg, so it's missing a PKG-INFO file.

2018-01-27 04:51:36,415 - py.warnings - WARNING - /home/pi/oprint/local/lib/python2.7/site-packages/OctoPrint-1.3.6-py2.7.egg/octoprint/plugin/core.py:1538: UserWarning: No PKG-INFO found for package: octoprint_smsnotifier
  warnings.warn('No PKG-INFO found for package: %s' % self.package_name)
2018-01-27 04:51:36,425 - octoprint.plugin.core - WARNING - Could not locate plugin smsnotifier
shadycuz commented 6 years ago

@tedder Are you trying to develop on a pi? Or on your desktop? I do both. The instructions can be found here http://docs.octoprint.org/en/master/plugins/gettingstarted.html .

If you are just trying to use my branch to get the fix you can. Uninstall the plugin from the Plugins Manager. SSH into your pi.

Run source ~/oprint/bin/activate

Clone my branch anywhere on the pi and cd into that directory. Then run octoprint dev plugin:install and that will install the plugin. I restart the octoprint server in-between code changes and for anything done to setup.py like additional libraries you need to re-install the plugin with the above command.

Make sure you reload your browser cache if you are changing any of the menu options because they wont appear if you dont. Also all your previous setting should remain so you wont have to redo your api keys or anything.

shadycuz commented 6 years ago

Most of the code for the image upload I stole from https://github.com/OctoPrint/OctoPrint-Pushbullet/ so that is a great place to start.

If you are looking for a project 3 things come to mind. We should remove the image we are storing in the tmp directory after the image is sent to cloudinary http://docs.python.org/library/os.html#os.remove.

Also someone asked if they could get snapshots of progress at specific intervals. The pushbullet repo has that functionality as well.

And we don't have a test button in the settings for the plugin but that is a bit harder logic to implement.

tedder commented 6 years ago

I've seen the tutorial for a 'new plugin', I just haven't figured out how to 'overlay' an existing plugin on my working Pi box. I want to make a couple changes to this plugin and also develop one of my own, but I'm hijacking this issue so I can ask you for the help :)

Agree, those are three good starting points to help with this project. uninstalling and dev plugin:install is what I was missing. I'll be back once I have some time to fiddle with it.