Hey there, from my research and understanding there is a way to access the live used gcode with the Moonraker API. But with my limited skills in software development, I couldn’t get a script to run. AI didn’t help either.
My attempt was to set up the websocket connection:
import websocket
url = the specific websocket url
def ws_error(ws, error):
"""Callback function to handle WebSocket errors."""
print("Error:", error)
def ws_open(ws):
print("WebSocket connected")
def main():
ws = websocket.WebsocketApp(url,ws_error)
ws.on_open = ws_open
with a setup like this, the Status returns: Error: Handshake status 200 OK
To access the gcode I would use the given example in the Moonraker docs.
https://moonraker.readthedocs.io/en/latest/web_api/
https://moonraker.readthedocs.io/en/latest/printer_objects/
If you have any other ideas on how to solve this please let me know.