set_speed
Set a locomotive's speed as a percentage of its maximum, with optional direction change. Returns actual speed matched to the roster's throttle limit.
Instructions
Set a locomotive's speed as a percentage of its maximum (0-100%).
Args: address: DCC address. Auto-acquires the throttle if needed. speed_percent: 0-100, clamped not rejected. direction: Optional "forward"/"reverse" (case-insensitive) — set together with speed_percent atomically ("avance à 40%") instead of a separate set_direction call. Omit to leave direction untouched. Flips instantly; for a ramped flip use set_speed_ramped instead.
Returns actual speed as % of THIS loco's own configured maximum (roster "Throttle Speed Limit"), matching PanelPro's slider, not the raw decoder ceiling. Includes "direction" only when passed, "system" (command-station name) only when non-default.
Use stop (0%) or emergency_stop (panic) rather than speed_percent=0. For a DURATION use set_speed_ramped(hold_seconds=...) — this tool is immediate only.
No-op (no error, no write) if requested speed already matches current — JMRI sends no confirmation for a redundant command.
Exhibition mode overrides speed_percent/direction with a fixed moderate forward speed — see enter_exhibition_mode.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| address | Yes | ||
| direction | No | ||
| speed_percent | Yes |