OctoPrintClient.printer
Note
All commands here that interact with the printer (anything that sends a command) will resolve the returned jQuery Promise when the request to the server enqueuing the command has been processed, not when the command was actually sent to or processed by the printer.
See the note here for an explanation why that is the case.
- OctoPrintClient.printer.getFullState(flags, opts)
Retrieves the full printer state, including temperature information, sd state and general printer state.
The
flags
object can be used to specify the data to retrieve further via the following properties:history
: a boolean value to specify whether the temperature history should be included (true
) or not (false
), defaults to it not being includedlimit
: an integer value to specify how many history entries to includeexclude
: a string value of comma-separated fields to exclude from the returned result.
See Retrieve the current printer state for more details.
- Arguments:
flags (
object()
) – Flags that further specify which data to retrieve, see above for detailsopts (
object()
) – Additional options for the request
- Returns Promise:
A jQuery Promise for the request’s response
- OctoPrintClient.printer.getToolState(flags, opts)
Retrieves the current printer extruder state/temperature information, and optionally also the temperature history.
The
flags
object can be used to specify the data to retrieve further via the following properties:history
: a boolean value to specify whether the temperature history should be included (true
) or not (false
), defaults to it not being includedlimit
: an integer value to specify how many history entries to include
See Retrieve the current tool state for more details.
- Arguments:
flags (
object()
) – Flags that further specify which data to retrieve, see above for detailsopts (
object()
) – Additional options for the request
- Returns Promise:
A jQuery Promise for the request’s response
- OctoPrintClient.printer.setToolTargetTemperatures(targets, opts)
Sets the given temperatures on the printer’s extruders.
targets
is expected to be an object mapping tool identifier to target temperature to set.Example:
Set first hotend to 220°C and second to 205°C.
OctoPrint.printer.setToolTargetTemperatures({"tool0": 220, "tool1": 205});
See the
target
command in Issue a tool command for more details.- Arguments:
targets (
object()
) – The targets to setopts (
object()
) – Additional options for the request
- Returns Promise:
A jQuery Promise for the request’s response
- OctoPrintClient.printer.setToolTemperatureOffsets(offsets, opts)
Sets the given temperature offsets for the printer’s extruders.
offsets
is expected to be an object mapping tool identifier to offset to set.Example:
Set the offset for the first hotend’s temperature to +10°C and the offset for the second hotend’s temperature to -5°C.
OctoPrint.printer.setToolTemperatureOffsets({"tool0": 10, "tool1": -5});
See the
offset
command in Issue a tool command for more details.- Arguments:
offsets (
object()
) – The offsets to setopts (
object()
) – Additional options for the request
- Returns Promise:
A jQuery Promise for the request’s response
- OctoPrintClient.printer.selectTool(tool, opts)
Selects the printer’s current extruder.
tool
is the identifier of the extruder to select.Example:
Select the second tool, extrude 5mm of filament, then select the first tool.
OctoPrint.printer.selectTool("tool1") .done(function(response) { OctoPrint.printer.extrude(5.0) .done(function(response) { OctoPrint.printer.selectTool("tool0"); }); });
See the
select
command in Issue a tool command for more details.- Arguments:
tool (
string()
) – The tool identifier of the extruder to selectopts (
object()
) – Additional options for the request
- Returns Promise:
A jQuery Promise for the request’s response
- OctoPrintClient.printer.extrude(amount, opts)
Extrudes or retracts
amount
mm of filament on the currently selected extruder.Example:
Extrude 5mm of filament on the current extruder, then retract 2mm.
OctoPrint.printer.extrude(5.0) .done(function(response) { OctoPrint.printer.extrude(-2.0); });
See the
extrude
command in Issue a tool command for more details.- Arguments:
amount (
float()
) – The amount of filament to extrude/retract.opts (
object()
) – Additional options for the request
- Returns Promise:
A jQuery Promise for the request’s response
- OctoPrintClient.printer.setFlowrate(factor, opts)
Sets the current flowrate multiplier.
factor
is expected to be a integer value >0 representing the new flowrate percentage.See the
flowrate
command in Issue a tool command for more details.- Arguments:
factor (
integer()
) – The flowrate as percentageopts (
object()
) – Additional options for the request
- Returns Promise:
A jQuery Promise for the request’s response
- OctoPrintClient.printer.getBedState(data, opts)
Retrieves the current printer bed state/temperature information, and optionally also the temperature history.
The
flags
object can be used to specify the data to retrieve further via the following properties:history
: a boolean value to specify whether the temperature history should be included (true
) or not (false
), defaults to it not being includedlimit
: an integer value to specify how many history entries to include
See Retrieve the current bed state for more details.
- Arguments:
flags (
object()
) – Flags that further specify which data to retrieve, see above for detailsopts (
object()
) – Additional options for the request
- Returns Promise:
A jQuery Promise for the request’s response
- OctoPrintClient.printer.setBedTargetTemperature(target, opts)
Sets the given temperature on the printer’s heated bed (if available).
target
is expected to be the target temperature as a float value.Example:
Set the bed to 90°C.
OctoPrint.printer.setBedTargetTemperature(90.0);
See the
target
command in Issue a bed command for more details.- Arguments:
target (
float()
) – The target to setopts (
object()
) – Additional options for the request
- Returns Promise:
A jQuery Promise for the request’s response
- OctoPrintClient.printer.setBedTemperatureOffset(offset, opts)
Sets the given temperature offset for the printer’s heated bed (if available).
offset
is expected to be the temperature offset to set.Example:
Set the offset for the bed to -5°C.
OctoPrint.printer.setBedTemperatureOffset(-5);
See the
offset
command in Issue a bed command for more details.- Arguments:
offsets (
object()
) – The offsets to setopts (
object()
) – Additional options for the request
- Returns Promise:
A jQuery Promise for the request’s response
- OctoPrintClient.printer.getChamberState(data, opts)
Retrieves the current printer chamber state/temperature information, and optionally also the temperature history.
The
flags
object can be used to specify the data to retrieve further via the following properties:history
: a boolean value to specify whether the temperature history should be included (true
) or not (false
), defaults to it not being includedlimit
: an integer value to specify how many history entries to include
See Retrieve the current bed state for more details.
- Arguments:
flags (
object()
) – Flags that further specify which data to retrieve, see above for detailsopts (
object()
) – Additional options for the request
- Returns Promise:
A jQuery Promise for the request’s response
- OctoPrintClient.printer.setChamberTargetTemperature(target, opts)
Sets the given temperature on the printer’s heated chamber (if available).
target
is expected to be the target temperature as a float value.Example:
Set the chamber to 50°C.
OctoPrint.printer.setChamberTargetTemperature(50.0);
See the
target
command in Issue a chamber command for more details.- Arguments:
target (
float()
) – The target to setopts (
object()
) – Additional options for the request
- Returns Promise:
A jQuery Promise for the request’s response
- OctoPrintClient.printer.setChamberTemperatureOffset(offset, opts)
Sets the given temperature offset for the printer’s heated chamber (if available).
offset
is expected to be the temperature offset to set.Example:
Set the offset for the chamber to -5°C.
OctoPrint.printer.setChamberTemperatureOffset(-5);
See the
offset
command in Issue a chamber command for more details.- Arguments:
offsets (
object()
) – The offsets to setopts (
object()
) – Additional options for the request
- Returns Promise:
A jQuery Promise for the request’s response
- OctoPrintClient.printer.jog(amounts, opts)
Jogs the specified axes by the specified
amounts
.amounts
is expected to be an object with properties reflecting the axes to be jogged by the specified amount given as value.Example:
Jog X by 10mm.
OctoPrint.printer.jog({"x", 10.0});
Jog Y by -5mm and Z by 0.2mm.
OctoPrint.printer.jog({"y": -5.0, "z": 0.2});
See the
jog
command in Issue a print head command for more details.- Arguments:
amounts (
object()
) – Key-value-pairs of axes to jog and amount to jog it.opts (
object()
) – Additional options for the request
- Returns Promise:
A jQuery Promise for the request’s response
- OctoPrintClient.printer.home(axes, opts)
Homes the specified
axes
.axes
is expected to be an array of strings specifying the axes to home.Example:
Home the X and Y axis.
OctoPrint.printer.home(["x", "y"]);
Home the Z axis.
OctoPrint.printer.home(["z"]);
See the
home
command in Issue a print head command for more details.- Arguments:
axes (
array()
) – List of axes to homeopts (
object()
) – Additional options for the request
- Returns Promise:
A jQuery Promise for the request’s response
- OctoPrintClient.printer.setFeedrate(factor, opts)
Sets the feedrate multiplier to use.
factor
is expected to be a integer value >0 representing the new feedrate percentage.See the
feedrate
command in Issue a print head command for more details.- Arguments:
factor (
integer()
) – The feedrate multiplier as percentageopts (
object()
) – Additional options for the request
- Returns Promise:
A jQuery Promise for the request’s response
- OctoPrintClient.printer.getSdState(opts)
Retrieves the current ready state of the printer’s SD card.
See Retrieve the current SD state for more details.
- Arguments:
opts (
object()
) – Additional options for the request
- Returns Promise:
A jQuery Promise for the request’s response
- OctoPrintClient.printer.initSd(opts)
Instructs the printer to initialize its SD card (if present).
See the
init
command in Issue an SD command for more details.- Arguments:
opts (
object()
) – Additional options for the request
- Returns Promise:
A jQuery Promise for the request’s response
- OctoPrintClient.printer.refreshSd(opts)
Instructs the printer to refresh the list of files on the SD card (if present).
See the
refresh
command in Issue an SD command for more details.- Arguments:
opts (
object()
) – Additional options for the request
- Returns Promise:
A jQuery Promise for the request’s response
- OctoPrintClient.printer.releaseSd(opts)
Instructs the printer to release its SD card (if present).
See the
release
command in Issue an SD command for more details.- Arguments:
opts (
object()
) – Additional options for the request
- Returns Promise:
A jQuery Promise for the request’s response
See also
- REST API: Printer operations
Documentation of the API functionality covered with this client library module.