diff --git a/octoprint_octoapp/notifications.py b/octoprint_octoapp/notifications.py index 86edf6c..f0def83 100644 --- a/octoprint_octoapp/notifications.py +++ b/octoprint_octoapp/notifications.py @@ -108,6 +108,7 @@ def on_print_progress(self, storage, path, progress): modulus = config["updatePercentModulus"] highPrecisionStart = config["highPrecisionRangeStart"] highPrecisionEnd = config["highPrecisionRangeEnd"] + minIntervalSecs = config["minIntervalSecs"] time_since_last = time.time() - self.last_progress_update if progress < 100 and progress > 0 and ( (progress % modulus) == 0 @@ -117,7 +118,7 @@ def on_print_progress(self, storage, path, progress): self._logger.debug("NOTIFICATION | Updating progress in main interval %s" % self.last_event) self.send_notification(event=self.EVENT_PRINTING) self.last_progress_update = time.time() - elif time_since_last > 300: + elif time_since_last > minIntervalSecs: self._logger.debug("NOTIFICATION | Over %s sec passed since last progress update, sending low priority update" % int(time_since_last)) self.send_notification(event=self.EVENT_PRINTING, only_activities=True) self.last_progress_update = time.time() @@ -283,7 +284,7 @@ def send_notification_blocking_raw(self, targets, high_priority, apnsData, andro if r.status_code != requests.codes.ok: raise Exception("Unexpected response code %d" % r.status_code) else: - self._logger.info("NOTIFICATION | Send was success") + self._logger.info("NOTIFICATION | Send was success %s" % r.json()) # Delete invalid tokens apps = self.get_apps() diff --git a/octoprint_octoapp/plugin.py b/octoprint_octoapp/plugin.py index e07ae3e..a713213 100644 --- a/octoprint_octoapp/plugin.py +++ b/octoprint_octoapp/plugin.py @@ -32,6 +32,7 @@ def __init__(self): updatePercentModulus=5, highPrecisionRangeStart=5, highPrecisionRangeEnd=5, + minIntervalSecs=300, sendNotificationUrl="https://europe-west1-octoapp-4e438.cloudfunctions.net/sendNotificationV2", ) @@ -41,7 +42,7 @@ def __init__(self): self.last_send_plugin_state = {} # !!! Also update in setup.py !!!! - self.plugin_version = "1.2.2" + self.plugin_version = "1.2.3" notification_plugin = OctoAppNotificationsSubPlugin(self) self.sub_plugins = [ diff --git a/setup.py b/setup.py index 2892981..32f69c2 100755 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ # The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module # !!!! Also update in plugin.py !!!! -plugin_version = "1.2.2" +plugin_version = "1.2.3" # The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin # module