-
Notifications
You must be signed in to change notification settings - Fork 3
Printer State
A printer conveys its state in the form of a JSON "Machine Model".
To get a live copy of your own model, browse to...
- Standalone: http://<your_duet>/rr_model?flags=d10
- SBC/DSF: http://<your_sbc>/machine/status
Neither will be formatted nicely but you can use one of the many web-based
JSON formatters or run it through json_pp
or jq
on Linux.
The model structure should be the same regardless of the installation type.
Here's a copy of one from my own Duet3 State Object for RRF 3.2
To use the value of a state object field in your config file, you'd reference it
by enclosing the name in '${}'. For instance, if you wanted to reference
the "atxPower" field, you'd specify it as follows:
"${state.state.atxPower}"
You aren't limited to just using the plain value. Anything specified between
the {
and }
is interpreted as Javascript so let's say you wanted to display
your bed temperature and force it to always have 1 digit after the decimal point.
You could use "${state.heat.heaters[0].current.toFixed(1)}"
. Maybe you wanted to
convert a "0" or "1" to "Off" or "On": "${state.state.atxPower ? 'On' : 'Off'}"
.