Printer Variable Reference¶
Happy Hare exposes its internal state as Klipper "printer variables" - the
printer.mmu.xxx values you read in gcode_macro Jinja templates, in
{% if %} conditions, or from KlipperScreen/Mainsail/Fluidd panels.
If you just want to see live values on your own printer rather than read about them, skip to MMU_DUMP_VARS below.
MMU_DUMP_VARS¶
MMU_DUMP_VARS (a gcode macro, not a Python command) dumps every printer
variable this page describes, straight off the running printer:
MMU_DUMP_VARS
MMU_DUMP_VARS VERBOSE=1 # also include per-stepper and per-LED-segment objects
It works by asking Klipper's own printer object for every top-level name
matching a small set of prefixes - mmu, mmu_machine, mmu_encoder *,
mmu_extruder *, and with VERBOSE=1 also mmu_stepper *, mmu_leds * -
then prints every key inside each as printer['name'].key = value. That
search list is itself the ground truth for which top-level printer objects
Happy Hare registers; see
Directly-registered per-object status
below for what the non-mmu/mmu_machine ones are.
Because it reads printer directly, its output is always exactly correct for
your installed version - use it to check anything below that seems to
disagree with what you actually see.
printer.mmu¶
The main status object. Everything in this section is printer.mmu.<key>
unless noted.
Core state¶
| Variable | Type | Meaning |
|---|---|---|
enabled |
bool | Happy Hare is enabled (MMU ENABLE=1/0) |
num_gates |
int | Total gates across all units |
is_homed |
bool | True only when every unit's selector is homed |
print_state |
string | initialized | standby | idle | started | printing | pause_locked | paused | complete | cancelled | error | ready |
unit |
int | Currently selected unit, -1 if none |
tool |
int | Currently selected tool, -1 unknown, -2 bypass |
gate |
int | Currently selected gate (or the gate about to be selected, mid-toolchange), -1 unknown |
extruder_name |
string | Extruder configured for the selected MMU unit, which can differ from the active toolhead extruder |
active_filament |
dict | filament_name, material, vendor, color, spool_id, temperature, td for the selected gate, reflecting current gate-map edits immediately; saved bypass attributes when bypass is selected, or {} if no metadata is available. td is None when unmeasured |
num_toolchanges |
int | Toolchanges performed so far this print |
last_tool / next_tool |
int | Tool indices either side of an in-progress toolchange |
slicer_purge |
float | Slicer-supplied purge volume for the in-progress toolchange |
toolchange_purge_volume |
float | Suggested purge volume (mm³) for the current toolchange |
purge_change_min_volume |
float | Configured minimum purge volume (mm³); toolchange_purge_volume is never below this |
toolchange_material_purge_volume |
float | Part of toolchange_purge_volume added for a material change (mm³), 0 if the material family is unchanged |
last_toolchange |
string | Short description, similar to the M117 display |
operation |
string | '' | load | unload | toolchange | runout | pause | cancel | complete |
filament |
string | Loaded | Unloaded | Unknown - coarse summary of filament_pos |
filament_position |
float | Filament position in mm along the current move |
filament_pos |
int | Fine-grained filament position, -1 unknown to 10 fully loaded in the extruder (11 named positions in total) |
filament_direction |
int | 1 load, -1 unload, 0 unknown |
pending_spool_id |
int | Spoolman spool ID that will auto-assign to the next filament inserted, -1 if none pending |
pending_td |
float or None | Off-path TD-1 measurement waiting for the next load/preload, None if none pending |
tool_extrusion_multipliers / tool_speed_multipliers |
list[float] | Current M221/M220 multipliers, one per tool |
action |
string | Idle | Loading | Unloading | Loading Ext | Exiting Ext | Forming Tip | Cutting Tip | Heating | Checking | Homing | Selecting | Cutting Filament | Purging | Preload | Unknown |
sync_drive |
bool | Gear stepper currently synced to the extruder |
reason_for_pause |
string | Why the MMU is paused; '' when not paused |
pause_hint |
string | What to do next, when the error knows (the dialog's action line, e.g. which gate to check); '' when not paused or when the error offers no specific advice |
spoolman_support |
string | off | readonly | push | pull |
bowden_progress |
int | 0-100% while a bowden move is in progress, -1 otherwise |
print_start_detection |
bool | Whether Happy Hare auto-detects print start (for slicers/wrappers like Klippain that don't call the MMU print-start hook) |
active_filament describes metadata, not whether filament is loaded. For bypass,
check gate == -2 and filament_pos: 0 is unloaded and 10 is fully loaded.
A loaded bypass with unknown metadata can still have active_filament == {}.
Bypass metadata survives restart and is cleared by bypass unload, MMU_RESET,
or selecting a real gate.
Gate and tool maps¶
All per-gate lists here are indexed by the same global gate number used
everywhere else (contiguous across units, see printer.mmu_machine below).
| Variable | Type | Meaning |
|---|---|---|
ttg_map |
list[int] | Gate assigned to each tool |
endless_spool_groups |
list[int] | EndlessSpool group membership per tool |
endless_spool_enabled |
int | 0 off, 1 on |
gate_status |
list[int] | Per gate: -1 unknown, 0 empty, 1 available, 2 available from buffer |
gate_filament_name |
list[string] | Filament name per gate |
gate_material |
list[string] | Material per gate |
gate_vendor |
list[string] | Filament vendor per gate |
gate_color |
list[string] | Color name per gate |
gate_td |
list[float or None] | Transmission distance per gate, None when unmeasured |
gate_td1_color |
list[string] | Measured RRGGBB color per gate, empty string when unmeasured |
gate_temperature |
list[int] | Print temperature per gate |
gate_spool_id |
list[int] | Spoolman spool ID per gate |
gate_speed_override |
list[int] | Per-gate speed override (%) |
gate_remaining_weight / gate_initial_weight |
list[float] | Remaining / original net filament weight in grams per gate; -1 means unknown |
gate_spool_rfid |
list | Per-gate RFID/NFC tag UID, if read |
gate_color_rgb |
list[tuple] | (r, g, b) floats 0.0-1.0 per gate |
slicer_tool_map |
dict | See below |
slicer_color_rgb |
list[tuple] | (r, g, b) floats 0.0-1.0, slicer-supplied, one per gate |
slicer_tool_map shape:
slicer_tool_map
.tools.<tool_num>
.name {string} filament name
.color {string} "RRGGBB" or "RRGGBBAA", no leading #
.material {string} material type
.temp {int} print temperature
.in_use {bool} referenced by this print
.referenced_tools {list} tool numbers used in this print
.initial_tool {int}
.purge_volumes {list} N×N purge volume matrix
.total_toolchanges {int}
.skip_automap {bool} one-shot: skip automap for this print
Extruder / filament remaining¶
| Variable | Type | Meaning |
|---|---|---|
extruder_filament_remaining |
float | Residual + cut filament left in the extruder, including any configured toolhead_residual_filament |
filament_remaining |
float | Same, without the configured residual constant |
filament_remaining_color |
string | Color of that residual filament, for UI display |
filament_remaining_temp |
int | Saved nozzle temperature (°C) for residual filament in the selected unit's extruder; 0 means unknown. Used for eligible Happy Hare-controlled purges |
filament_remaining_material |
string | Material last loaded and purged into the extruder, used to detect a material change |
Sync feedback, FlowGuard and tangle prevention¶
These keys are present from the first status query, with None for values
that are not available. Sync-feedback values require a buffer and an initialized
controller on the active unit; an encoder alone can supply flowguard status.
| Variable | Type | Meaning |
|---|---|---|
sync_feedback_state |
string | compressed | expanded | neutral | disabled |
sync_feedback_enabled |
bool | Sync feedback currently active |
sync_feedback_bias_raw |
float | Raw sensor bias, rounded to 2dp |
sync_feedback_bias_modelled |
float | Modelled/smoothed bias, rounded to 2dp |
sync_feedback_flow_rate |
float | Flow rate as seen by the buffer |
sync_feedback_rd_correction |
float or None |
Percentage change in tuned gear rotation_distance from the calibrated value used when the gate was synced, rounded to 2 decimal places; None when sync-feedback status is unavailable |
flowguard |
dict | trigger, reason, level, max_clog, max_tangle, active, enabled, and encoder_mode when an encoder is fitted |
tangle_prevention |
dict | enabled, active, boosted, threshold, release |
sync_feedback_rd_correction is calculated as
100 * (tuned_rotation_distance - starting_rotation_distance) / starting_rotation_distance.
For example, tuning from 21.7156 to 22.5000 gives 3.61 (+3.61%). It stays at
0.0 until autotune has a confident result and resets to 0.0 on a gate change.
At print start, the baseline is updated to the saved calibration, including
on machines that stay synced between prints, so a previously saved correction
is not reported again as outstanding.
It uses the tuned value, so temporary two-level speed boosts do not appear as
calibration corrections. A reported correction does not by itself mean the value
has been saved; saving requires autotune_rotation_distance to be enabled.
Sensors¶
sensors is a dict keyed by sensor name, scoped to whichever sensors are
active for the currently selected gate (generic names, no gate suffix):
value is True/False if the sensor is enabled (triggered or not), or
None if the sensor exists but is currently disabled - see Feature:
Sensors for how a sensor gets disabled and what that
means for the rest of Happy Hare.
Encoder¶
encoder is a dictionary when the active unit has an encoder, otherwise None.
The following fields are available for both digital and analog encoders:
| Variable | Type | Meaning |
|---|---|---|
encoder_pos |
float | Encoder position in mm |
detection_length |
float | Clog-detection length |
min_headroom |
float | Closest clog detection came to firing on the current toolchange |
headroom |
float | Current headroom (distance from the trigger point) |
desired_headroom |
float | Configured target headroom |
detection_mode |
int | Clog detection mode |
enabled |
bool | Encoder currently enabled for clog detection |
flow_rate |
int | % flow rate (extruder movement vs. encoder movement) |
Analog encoder fields¶
An analog encoder adds an optional analog
dictionary under printer.mmu.encoder. Digital encoders do not include this
key. The existing encoder fields above keep the same names and types.
| Variable | Type | Meaning |
|---|---|---|
analog.value |
float or None | Latest ADC reading as a fraction of full scale (0.0–1.0); None until the first reading arrives |
analog.count |
int | Cumulative threshold-crossing pulse count since initialization; independent of the position set or reset with MMU_ENCODER POS=... |
analog.max_speed |
float | Estimated sampling-speed limit in mm/s, rounded to one decimal place: current encoder resolution divided by twice analog_report_time. Informational only; does not cap motor speed |
The same optional fields are available on the named encoder object, for example
printer['mmu_encoder unit0'].analog.value. Substitute the configured encoder
name. UI clients and macros should check for the dictionary before reading it:
{% set encoder = printer.mmu.encoder %}
{% if encoder and 'analog' in encoder %}
{% set adc_value = encoder.analog.value %}
{% if adc_value is not none %}
{action_respond_info("Encoder ADC: %.3f" % adc_value)}
{% endif %}
{% endif %}
Readings can arrive in batches, so position and flow-rate updates may be coarser or delayed compared with a digital encoder. See the feature page's sampling and movement limits.
Per-gate arrays merged across every unit¶
| Variable | Type | Meaning |
|---|---|---|
espooler |
list[string] | Per gate: '' | off | rewind | assist | print - gates on a unit with no espooler report '' |
drying_state |
list[string] | Per gate: '' | queued | active | complete | canceled - gates not currently part of a drying cycle report '' |
NFC¶
nfc is a list of per-unit dicts, present only when at least one unit has
an NFC/RFID reader configured. Each entry:
{'unit': <name>, 'polling': <bool>, 'shared': {...}|None, 'gates': {<gate>: {...}}},
where each reader dict is enabled, active, alive, present, uid (the
cached tag from the last read, not a live scan).
TD-1¶
td1 is a flat per-gate list, aggregated across all units: '' (no scanner),
enabled, auto, or disabled. It describes capture policy, not scanner
connectivity. Gate measurements are in gate_td / gate_td1_color above;
live device data is available from Moonraker's /machine/td1/data endpoint.
See Feature: TD-1 Filament Measurement.
printer.mmu_machine¶
The multi-unit aggregation object. is_homed, unit, tool etc. above
already account for multiple units; this object is for enumerating the units
themselves.
| Variable | Type | Meaning |
|---|---|---|
happy_hare_version |
string | Installed Happy Hare version in <major>.<minor>.<point> form, for example 4.0.0 |
num_units |
int | Number of configured mmu_units |
num_gates |
int | Total gates, same value as printer.mmu.num_gates |
unit_0, unit_1, ... |
dict | One entry per unit, see below |
Each unit_N dict:
| Key | Type | Meaning |
|---|---|---|
name, display_name |
string | Config name and human-readable name |
vendor, version |
string | For example ERCF, 1.1sb |
num_gates, first_gate |
int | Gate count and this unit's first global gate number |
selector_type |
string | For example LinearSelector, IndexedSelector, RotarySelector, ServoSelector, VirtualSelector |
is_homed |
bool | This unit's selector only |
variable_rotation_distances, variable_bowden_lengths |
bool | Whether per-gate calibration is used |
require_bowden_move |
bool | Whether this unit's geometry has a bowden move at all |
filament_always_gripped |
bool | True for designs with no release mechanism |
has_bypass |
bool | This unit has a selectable bypass gate |
can_crossload |
bool | Filament can be pushed directly between gates on this unit |
multi_gear |
bool | Unit has one gear motor per gate rather than one shared |
filament_buffer |
bool | Filament (catchment) buffer fitted - catches loose filament on rewind, allowing faster loading speeds |
fan |
string | Shared managed-fan object name; present only when a shared fan is configured |
fans |
list[string] | Gate-aligned managed-fan object names; present only when per-gate fans are configured |
environment_sensor, filament_heater |
string | Shared object names; present only when shared sensor/heater configuration is used |
environment_sensors, filament_heaters |
list[string] | Per-gate object names; present only when per-gate sensor/heater configuration is used |
vent_servo |
string | Shared vent-servo object name; present only when a shared vent servo is configured |
vent_servos |
list[string] | Gate-aligned vent-servo object names (with blanks for gates without a vent servo); present only when per-gate vent servos are configured |
nfc_reader |
string | Shared reader name; present only when configured |
nfc_readers |
list[string] | Per-gate reader names; present only when configured |
td1_device |
string | Off-path TD-1 USB serial; present only when configured |
td1_devices |
list[string] | In-path TD-1 USB serials in local gate order, with blank entries for gates without scanners; present only when configured |
Directly-registered per-object status¶
A handful of components are registered as their own top-level Klipper printer
objects (in addition to being folded into printer.mmu above), named after
their config section - exactly the names MMU_DUMP_VARS searches for:
| Printer object | Config section | Notes |
|---|---|---|
printer['mmu_encoder <name>'] |
[mmu_encoder unit0] |
If fitted |
printer['mmu_extruder <name>'] |
wraps the Klipper extruder it's bound to, e.g. mmu_extruder extruder |
|
printer['mmu_stepper <name>'] |
[mmu_stepper unit0_gear] etc. |
One per gear/selector stepper |
printer['mmu_leds <name>'] |
[mmu_leds unit0] |
If fitted |
Use printer.mmu.encoder for the common case (current unit's encoder, already
resolved); reach for printer['mmu_encoder unit0'] directly only when you
specifically need a different unit's encoder than the one currently active,
since Happy Hare units can have independent, differently-named encoders.
Deprecated variables¶
Still present in printer.mmu, still computed, but superseded.
| Variable | Replaced by |
|---|---|
espooler_active |
espooler (per-gate list) |
runout |
operation == "runout" |
is_paused |
print_state |
is_locked |
print_state (alias of is_paused) |
is_in_print |
print_state |
has_bypass (on printer.mmu) |
printer.mmu_machine.unit_N.has_bypass |
clog_detection |
(removed capability) |
clog_detection_enabled |
(removed capability) |
endless_spool (in the gate-map group) |
endless_spool_enabled |