diff --git a/mobileraker/data/dtos/moonraker/printer_snapshot.py b/mobileraker/data/dtos/moonraker/printer_snapshot.py index 518bf1e..e59907c 100644 --- a/mobileraker/data/dtos/moonraker/printer_snapshot.py +++ b/mobileraker/data/dtos/moonraker/printer_snapshot.py @@ -216,3 +216,8 @@ def current_layer(self) -> int: @property def progress(self) -> Optional[int]: return int(self.print_progress_by_fileposition_relative * 100) if self.print_progress_by_fileposition_relative else None + + @property + def is_timelapse_pause(self) -> bool: + return self.print_state == "paused" and self.timelapse_pause is True + diff --git a/mobileraker/mobileraker_companion.py b/mobileraker/mobileraker_companion.py index fe4b389..e13fd1f 100644 --- a/mobileraker/mobileraker_companion.py +++ b/mobileraker/mobileraker_companion.py @@ -181,7 +181,7 @@ def _fulfills_evaluation_threshold(self, snapshot: PrinterSnapshot) -> bool: self._logger.info('No last snapshot available. Evaluating!') return True - if self._last_snapshot.print_state != snapshot.print_state and not snapshot.timelapse_pause and not self._last_snapshot.timelapse_pause: + if self._last_snapshot.print_state != snapshot.print_state and not snapshot.is_timelapse_pause and not self._last_snapshot.is_timelapse_pause: self._logger.info('State changed. Evaluating!') return True @@ -280,7 +280,7 @@ def _state_notification(self, cfg: DeviceNotificationEntry, cur_snap: PrinterSna return None # Ignore paused state caused by timelapse plugin - if cur_snap.timelapse_pause: + if cur_snap.is_timelapse_pause: return None # collect title and body to translate it @@ -467,7 +467,7 @@ async def _update_app_snapshot(self, cfg: DeviceNotificationEntry, printer_snap: progress_live_activity_update = printer_snap.progress updated = last.copy_with( - state=printer_snap.print_state if last.state != printer_snap.print_state and not printer_snap.timelapse_pause else None, + state=printer_snap.print_state if last.state != printer_snap.print_state and not printer_snap.is_timelapse_pause else None, progress=progress_update, progress_live_activity=progress_live_activity_update, m117=printer_snap.m117_hash if last.m117 != printer_snap.m117_hash else None,