#5381·OctoPrint

[Request] Allow plugins to send gcode starting with semicolon

Author: jacopotediosiCreated Apr 29, 2026Updated Apr 29, 2026
Labelsrequest

The problem

Currently, plugins have no way (e.g., via octoprint.printer.CommonPrinterMixin.commands) to send commands starting with a semicolon, or more generally to send comments, to printers.

Specifically, MachineCom.sendCommand calls process_gcode_line, which strips comments:

https://github.com/OctoPrint/OctoPrint/blob/43f75b4f3d65faa82e0d5e0956cb789995cf661d/src/octoprint/plugins/serial_connector/serial_comm.py#L1312-L1327

https://github.com/OctoPrint/OctoPrint/blob/43f75b4f3d65faa82e0d5e0956cb789995cf661d/src/octoprint/plugins/serial_connector/serial_comm.py#L6456-L6459

Sending commands starting with a semicolon can be useful in very specific cases. For example, on some Prusa printers, there are "secret" commands to alter the firmware behavior that start with a semicolon.

My PrusaResetMode plugin is currently forced to use the deprecated get_transport() method to send such commands:

python
transport = self._printer.get_transport()
if transport is None:
    return jsonify(
        {
            "error": "Printer transport not available, please check you are connected to your Prusa via a serial connection"
        }
    ), 503

transport.write(semicolonCommand.encode() + b"\n")
self._printer.log_lines(_SEND_LOG_PREFIX + semicolonCommand)

Proposed solution

Add a kwarg to octoprint.printer.CommonPrinterMixin.commands to send commands while skipping processing.

It is worth noting that MachineCom.sendCommand already supports a processed flag to skip processing, but it is not propagated up the chain to the APIs usable by plugins.

Alternative solutions

No response

Additional context

No response