From 27dea902df3c7a5a666f089f67cf19fe17c7c413 Mon Sep 17 00:00:00 2001 From: drdelaney Date: Wed, 15 Nov 2017 23:47:52 -0600 Subject: [PATCH 1/2] Fixing spelling error --- octoprint_RepetierInformer/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/octoprint_RepetierInformer/__init__.py b/octoprint_RepetierInformer/__init__.py index 0bad6d6..4dce00a 100644 --- a/octoprint_RepetierInformer/__init__.py +++ b/octoprint_RepetierInformer/__init__.py @@ -225,7 +225,7 @@ def on_event(self, event, payload): return if event == 'Error': if self._settings.get(['notify','printererror']): -# FIXME + # FIXME #self.sendInformer("Printer Error","Communication error with Printer","{error}",inform_err) self.sendInformer("Printer Error","Communication error with Printer","Communication error with Printer",inform_err) return @@ -255,7 +255,7 @@ def on_event(self, event, payload): self.stopTimer() if self._settings.get(['notify','printcancel']): - self.sendInformer("Printing cancleed","Printng has been canceled","Printing has been cacnceled by user",inform_err) + self.sendInformer("Printing canceled","Printng has been canceled","Printing has been cacnceled by user",inform_err) return if event == 'PrintPaused': if self._settings.get(['notify','printpause']): @@ -275,7 +275,7 @@ def on_event(self, event, payload): return if event == 'MovieFailed': if self._settings.get(['notify','timelapsefailed']): -# FIXME + # FIXME #self.sendInformer("Timelapse failed","Timelapse rendering has failed","{error}",inform_err) self.sendInformer("Timelapse failed","Timelapse rendering has failed","Timelapse rendering has failed",inform_err) return From 690c85e7ce36e69bec5529974b5a54240d0321d4 Mon Sep 17 00:00:00 2001 From: drdelaney Date: Thu, 16 Nov 2017 00:12:50 -0600 Subject: [PATCH 2/2] Some test code to try out #5. Not sure if this will work, need to test on a real printer. --- octoprint_RepetierInformer/__init__.py | 29 +++++++++++++++++++++++--- setup.py | 2 +- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/octoprint_RepetierInformer/__init__.py b/octoprint_RepetierInformer/__init__.py index 4dce00a..ed5df0c 100644 --- a/octoprint_RepetierInformer/__init__.py +++ b/octoprint_RepetierInformer/__init__.py @@ -280,8 +280,29 @@ def on_event(self, event, payload): self.sendInformer("Timelapse failed","Timelapse rendering has failed","Timelapse rendering has failed",inform_err) return - - + def hook_gcode_pause(self, comm_instance, phase, cmd, cmd_type, gcode, *args, **kwargs): + # Return if not enabled + if not self._settings.get(['enabled']): + self._logger.info("Not enabled, will not send.") + return + + # Handle pause/resume gcodes + if gcode and gcode == "M24": + if self._settings.get(['notify','printresume']): + self.sendInformer("Printing resumed","Printng has been resumed","Printing has been resumed via M24",inform_ok) + return + if gcode and gcode == "M25": + if self._settings.get(['notify','printpause']): + self.sendInformer("Printing paused","Printng has been paused","Printing has been paused via M25",inform_pause) + return + if gcode and gcode == "M226": + if self._settings.get(['notify','printpause']): + self.sendInformer("Printing paused","Printng has been paused","Printing has been paused via M226",inform_pause) + return + if gcode and gcode == "M600": + if self._settings.get(['notify','printpause']): + self.sendInformer("Printing paused","Printng has been paused","Printing has been paused via M600",inform_pause) + return # If you want your plugin to be registered within OctoPrint under a different name than what you defined in setup.py @@ -295,6 +316,8 @@ def __plugin_load__(): global __plugin_hooks__ __plugin_hooks__ = { - "octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information + "octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information, + "octoprint.comm.protocol.gcode.sent": __plugin_implementation__.hook_gcode_pause + } diff --git a/setup.py b/setup.py index f4fcded..4878673 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ plugin_name = "Repetier-Informer for OctoPrint" # The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module -plugin_version = "0.1.3" +plugin_version = "0.1.4" # The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin # module