Adding custom commands to octoprint

Adding custom commands to octoprint

To follow on from my last post about controlling a PSU with a transistor on a 3D printer running OctoPrint on a Sanguinololu board I have created a few custom buttons to increase the functionality of the software with these new features.

If not specified via the commandline, the configfile config.yaml for OctoPrint is expected in its settings folder, which is located at ~/.octoprint on Linux, at %APPDATA%/OctoPrint on Windows and at ~/Library/Application Support/OctoPrint on MacOS.

I added the following custom commands:
Turn PSU on
Turn PSU off
Get Position
Set Z10
Goto Z10

Shutdown octoprint, add this to the end of config.yaml and restart octoprint. note that the spacings are important.

- name: Get Position
type: feedback_command
command: M114
regex: "X:([0-9.-]+)Y:([0-9.-]+)Z:([0-9.-]+)E:([0-9.-]+)"
template: "Position: X={0}, Y={1}, Z={2}, E={3}"
- name: Power
type: section
- name: Turn on PSU
type: command
command: M42 S255 P30
- name: Turn off PSU
type: command
command: M42 S0 P30
- name: Z Commands
type: section
- name: Set Z10
type: command
command: G92 Z10
- name: Goto Z10
type: command
command: G0 Z10

Related posts

Leave a Comment