moonraker: Store info received from initial "info" request to klippy

This allows moonraker plugins to look up the stored info without needing to make an addition "info" request to Klippy.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2020-11-18 07:57:08 -05:00
parent b0469da462
commit df81854f89
1 changed files with 5 additions and 0 deletions

View File

@ -47,6 +47,7 @@ class Server:
'klippy_uds_address', "/tmp/klippy_uds")
self.klippy_connection = KlippyConnection(
self.process_command, self.on_connection_closed)
self.klippy_info = {}
self.init_list = []
self.init_handle = None
self.init_attempts = 0
@ -164,6 +165,9 @@ class Server:
hostname = socket.gethostname()
return hostname, self.port
def get_klippy_info(self):
return dict(self.klippy_info)
# ***** Klippy Connection *****
async def _connect_klippy(self):
if not self.server_running:
@ -283,6 +287,7 @@ class Server:
return
if send_id:
self.init_list.append("identified")
self.klippy_info = result
# Update filemanager fixed paths
fixed_paths = {k: result[k] for k in
['klipper_path', 'python_path',