moonraker: add "klippy_identified" event

This allows Moonraker to update its paths to Klippy immediately upon a successful response from the info endpoint.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2020-12-30 11:53:16 -05:00
parent 0a7080741c
commit 6bf4ef8b00
2 changed files with 4 additions and 3 deletions

View File

@ -286,10 +286,11 @@ class Server:
f"Klippy may have experienced an error during startup.\n"
f"Please check klippy.log for more information")
return
if send_id:
self.init_list.append("identified")
self.klippy_info = dict(result)
self.klippy_state = result.get('state', "unknown")
if send_id:
self.init_list.append("identified")
self.send_event("server:klippy_identified")
if self.klippy_state == "ready":
await self._verify_klippy_requirements()
logging.info("Klippy ready")

View File

@ -46,7 +46,7 @@ class FileManager:
self.server.register_upload_handler("/api/files/local")
self.server.register_event_handler(
"server:klippy_ready", self._update_fixed_paths)
"server:klippy_identified", self._update_fixed_paths)
# Register Klippy Configuration Path
config_path = config.get('config_path', None)