websocket: identify the client to moonraker

This commit is contained in:
alfrix 2024-04-30 14:47:32 -03:00
parent ad2df873d3
commit 135e1858a8
2 changed files with 14 additions and 0 deletions

View File

@ -328,3 +328,16 @@ class MoonrakerApi:
return self._ws.send_method(
"printer.firmware_restart"
)
def identify_client(self, version, api_key):
logging.debug("Sending printer.firmware_restart")
return self._ws.send_method(
"server.connection.identify",
{
"client_name": "KlipperScreen",
"version": f"{version}",
"type": "display",
"url": "https://github.com/KlipperScreen/KlipperScreen",
"api_key": f"{api_key}"
},
)

View File

@ -665,6 +665,7 @@ class KlipperScreen(Gtk.Window):
def websocket_connected(self):
logging.debug("### websocket_connected")
self._ws.klippy.identify_client(functions.get_software_version(), self._ws.api_key)
self.reinit_count = 0
self.connecting = False
self.connected_printer = self.connecting_to_printer