Module pipettin-piper.piper.rpc_primitives
Functions
def emergency_stop(id=42)-
Expand source code
def emergency_stop(id=42): # rpc_primitives.emergency_stop return {"jsonrpc": "2.0","method": "printer.emergency_stop","id": id} def firmware_restart(id=8463)-
Expand source code
def firmware_restart(id=8463): # rpc_primitives.firmware_restart return { "jsonrpc": "2.0", "method": "printer.firmware_restart", "id": id} def gcode_script(gcode_cmd: str, cmd_id: str)-
Expand source code
def gcode_script(gcode_cmd: str, cmd_id: str): # rpc_primitives.gcode_script return { "jsonrpc": "2.0", "method": "printer.gcode.script", "params": {"script": gcode_cmd}, "id": cmd_id } def printer_info(info_command_id)-
Expand source code
def printer_info(info_command_id): # rpc_primitives.printer_info return {"jsonrpc": "2.0", "method": "printer.info", "id": info_command_id} def query_idle_timeout(id=4654)-
Expand source code
def query_idle_timeout(id=4654): """The 'idle_timeout' object reports the idle state of the printer. See: https://moonraker.readthedocs.io/en/latest/printer_objects/#idle_timeout Example response: { "state": "Idle", "printing_time": 0.0 } state: Can be Idle, Ready, or Printing. The printer will transition to the Printing state whenever a gcode is issued that commands the tool, this includes manual commands. Thus this should not be used to determine if a gcode file print is in progress. It can however be used to determine if the printer is busy. Args: id (int, optional): _description_. Defaults to 4654. """ # A 'null' (None) value will fetch all available attributes for its key. printer_objects = {"idle_timeout": None} return query_objects(objects=printer_objects, id=id)The 'idle_timeout' object reports the idle state of the printer.
See: https://moonraker.readthedocs.io/en/latest/printer_objects/#idle_timeout
Example response: { "state": "Idle", "printing_time": 0.0 }
state: Can be Idle, Ready, or Printing. The printer will transition to the Printing state whenever a gcode is issued that commands the tool, this includes manual commands. Thus this should not be used to determine if a gcode file print is in progress. It can however be used to determine if the printer is busy.
Args
id:int, optional- description. Defaults to 4654.
def query_motion_report(id=None)-
Expand source code
def query_motion_report(id=None): """Get the robots position. See: https://gitlab.com/pipettin-bot/pipettin-bot/-/issues/171#get-position """ # A 'null' (None) value will fetch all available attributes for its key. printer_objects = {"motion_report": None} return query_objects(objects=printer_objects, id=id)Get the robots position. See: https://gitlab.com/pipettin-bot/pipettin-bot/-/issues/171#get-position
def query_objects(objects, id=4654)-
Expand source code
def query_objects(objects, id=4654): """Query Klipper printer objects. See: https://moonraker.readthedocs.io/en/latest/printer_objects/ Example: objects = { "idle_timeout": None, # A 'null' value will fetch all available attributes for its key. "toolhead": ["position", "status"] } """ data = { "jsonrpc": "2.0", "method": "printer.objects.query", "params": {"objects": objects} } if id is not None: data["id"] = id return dataQuery Klipper printer objects.
See: https://moonraker.readthedocs.io/en/latest/printer_objects/
Example
objects = { "idle_timeout": None, # A 'null' value will fetch all available attributes for its key. "toolhead": ["position", "status"] }
def query_toolhead_status(id=None)-
Expand source code
def query_toolhead_status(id=None): """Get the robot's toolhead status, including limits and homed axes. See: - https://moonraker.readthedocs.io/en/latest/printer_objects/?h=position#toolhead - https://gitlab.com/pipettin-bot/pipettin-bot/-/issues/171#skip-homing-if-homed Example response: { "homed_axes": "", "axis_minimum": [-1.0, -1.0, -20.0, -1.0, -1.0, -1.0, null], "axis_maximum": [330.0, 312.0, 150.0, 30.0, 30.0, 30.0, null], "print_time": 0.0, "stalls": 0, "estimated_print_time": 28.381556625, "extruder": null, "position": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], "max_velocity": 5000.0, "max_accel": 1000.0, "minimum_cruise_ratio": 0.5, "square_corner_velocity": 5.0 } """ # A 'null' (None) value will fetch all available attributes for its key. printer_objects = {"toolhead": None} return query_objects(objects=printer_objects, id=id)Get the robot's toolhead status, including limits and homed axes.
See
- https://moonraker.readthedocs.io/en/latest/printer_objects/?h=position#toolhead
- https://gitlab.com/pipettin-bot/pipettin-bot/-/issues/171#skip-homing-if-homed
Example response: { "homed_axes": "", "axis_minimum": [-1.0, -1.0, -20.0, -1.0, -1.0, -1.0, null], "axis_maximum": [330.0, 312.0, 150.0, 30.0, 30.0, 30.0, null], "print_time": 0.0, "stalls": 0, "estimated_print_time": 28.381556625, "extruder": null, "position": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], "max_velocity": 5000.0, "max_accel": 1000.0, "minimum_cruise_ratio": 0.5, "square_corner_velocity": 5.0 }
def rpc_help(id=4645)-
Expand source code
def rpc_help(id=4645): return {"jsonrpc": "2.0", "method": "printer.gcode.help", "id": id}