fix: in progress notifs

This commit is contained in:
2026-06-03 10:14:12 -05:00
parent 07a9c2c0c8
commit 9abe2daa8f

View File

@@ -800,6 +800,7 @@ class KobraXBridge:
self._camera_autostarted: bool = False
self.camera_cache: CameraCache = CameraCache()
self._prev_kobra_state: str = ""
self._print_active: bool = False
self._notify_every_minutes: int = 0
self._notify_every_layers: int = 0
self._last_progress_notif_time: float = 0.0
@@ -1061,14 +1062,19 @@ class KobraXBridge:
if kobra_state and kobra_state != self._prev_kobra_state:
_notif_filename = d.get("filename", self._state.get("filename", ""))
if kobra_state == "printing":
self._notify("started", _notif_filename)
self._last_progress_notif_time = time.monotonic()
self._last_progress_notif_layer = self._state.get("curr_layer", 0)
if not self._print_active:
self._print_active = True
self._notify("started", _notif_filename)
self._last_progress_notif_time = time.monotonic()
self._last_progress_notif_layer = self._state.get("curr_layer", 0)
elif kobra_state == "finished":
self._print_active = False
self._notify("finished", _notif_filename)
elif kobra_state == "failed":
self._print_active = False
self._notify("failed", _notif_filename)
elif kobra_state in ("stoped", "canceled"):
self._print_active = False
self._notify("cancelled", _notif_filename)
elif kobra_state == "paused":
self._notify("paused", _notif_filename)
@@ -1138,6 +1144,7 @@ class KobraXBridge:
log.warning(f"Kamera-Autostart fehlgeschlagen: {e}")
elif kobra_state in ("free", "finished", "stoped", "canceled"):
self._camera_autostarted = False
self._print_active = False
if project:
if "filename" in project:
self._state["filename"] = project["filename"]