moonraker: send "client_info" after initial connection to Klippy

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2020-08-26 07:34:29 -04:00
parent d021eddb16
commit 5b87c43535
2 changed files with 11 additions and 3 deletions

View File

@ -231,14 +231,17 @@ class Server:
self.moonraker_app.register_remote_handler(ep)
async def _check_ready(self):
send_id = "identified" not in self.init_list
try:
result = await self.klippy_apis.get_klippy_info()
result = await self.klippy_apis.get_klippy_info(send_id)
except ServerError as e:
logging.info(
f"{e}\nKlippy info request error. This indicates that\n"
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")
# Update filemanager fixed paths
fixed_paths = {k: result[k] for k in
['klipper_path', 'python_path',

View File

@ -3,6 +3,7 @@
# Copyright (C) 2020 Eric Callahan <arksine.code@gmail.com>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import utils
INFO_ENDPOINT = "info"
ESTOP_ENDPOINT = "emergency_stop"
@ -98,8 +99,12 @@ class KlippyAPI:
async def emergency_stop(self, default=Sentinel):
return await self._send_klippy_request(ESTOP_ENDPOINT, {}, default)
async def get_klippy_info(self, default=Sentinel):
return await self._send_klippy_request(INFO_ENDPOINT, {}, default)
async def get_klippy_info(self, send_id=False, default=Sentinel):
params = {}
if send_id:
ver = utils.get_software_version()
params = {'client_info': {'program': "Moonraker", 'version': ver}}
return await self._send_klippy_request(INFO_ENDPOINT, params, default)
async def get_object_list(self, default=Sentinel):
result = await self._send_klippy_request(