Skip to content

Commit

Permalink
fix notification sent twice bug when printing with octolapse (#13)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
damned-me committed Mar 22, 2024
1 parent d8fa9ac commit bc4483a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion octoprint_telegram/telegramNotifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit bc4483a

Please sign in to comment.