From c69ded21b02fb2cd79ea65da6e912ee58502120c Mon Sep 17 00:00:00 2001 From: Eric Callahan Date: Sat, 11 Dec 2021 08:44:55 -0500 Subject: [PATCH] job_state: initialize in "klippy_started" event Signed-off-by: Eric Callahan --- moonraker/components/job_state.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/moonraker/components/job_state.py b/moonraker/components/job_state.py index af76cd5..2675091 100644 --- a/moonraker/components/job_state.py +++ b/moonraker/components/job_state.py @@ -24,11 +24,13 @@ class JobState: self.server = config.get_server() self.last_print_stats: Dict[str, Any] = {} self.server.register_event_handler( - "server:klippy_ready", self._handle_ready) + "server:klippy_started", self._handle_started) self.server.register_event_handler( "server:status_update", self._status_update) - async def _handle_ready(self) -> None: + async def _handle_started(self, state: str) -> None: + if state != "ready": + return kapis: KlippyAPI = self.server.lookup_component('klippy_apis') sub: Dict[str, Optional[List[str]]] = {"print_stats": None} try: