From bc4483ad06ed2806e902911fb6de4e3f9fcf4ad1 Mon Sep 17 00:00:00 2001 From: damned-me <62070968+damned-me@users.noreply.github.com> Date: Fri, 22 Mar 2024 02:50:03 +0100 Subject: [PATCH] fix notification sent twice bug when printing with octolapse (#13) add check to make sure that `new_z` height is always more than zero, this prevents the plugin to send the same notification twice Changes to be committed: modified: octoprint_telegram/telegramNotifications.py --- octoprint_telegram/telegramNotifications.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/octoprint_telegram/telegramNotifications.py b/octoprint_telegram/telegramNotifications.py index 20c0e5c..8518dda 100644 --- a/octoprint_telegram/telegramNotifications.py +++ b/octoprint_telegram/telegramNotifications.py @@ -516,7 +516,7 @@ def is_notification_necessary(self, new_z, old_z): return True zdiff = self.main._settings.get_float(["notification_height"]) if zdiff and zdiff > 0.0: - if old_z is None: + if old_z is None or new_z < 0: return False # check the zdiff if abs(new_z - (old_z or 0.0)) >= 1.0: