After configuring the MQTT plugin, you can setup the MQTT Subscribe plugin. The MQTT Subscribe plugin listens for REST requests on MQTT topics. These REST requests correspond with the OctoPrint REST API. For more information on the OctoPrint REST API, check out the documentation page.

Generate an API Key

Before configuring the plugin, you'll need to generate an API key. Navigate to the MQTT Subscribe tab under the Plugins section. Next to the API KEY box, click on the blue plus sign (+) button. You'll see your API key populate in the box.

Add the Topics

The MQTT topics that MQTT Subscribe will listen to will need to match the Adafruit IO feed format: {Adafruit IO username}/feeds/{feed name}

To add a new topic, click on the plus sign (+) button on the right side of the window. 

This will open a blank MQTT Topic Editor window. You will add six topics to match the CircuitPython code. You'll edit the Topic, Type, REST API and REST Parameters sections for each topic. You can reference the charts below to see how each topic should be setup.

Reboot OctoPrint

Topic:

{Adafruit IO username}/feeds/shutdown

Type:

post

REST API:

/api/system/commands/core/restart

REST Parameters:

{"command":"restart"}

Preheat Printer

Preheats printer hotend to 200°C.

Topic:

{Adafruit IO username}/feeds/heatup

Type:

post

REST API:

/api/printer/tool

REST Parameters:

{
  "command": "target",
  "targets": {
    "tool0": 200
  }
}

Cooldown Printer

Sets printer hotend to 0°C.

Topic:

{Adafruit IO username}/feeds/cooldown

Type:

post

REST API:

/api/printer/tool

REST Parameters:

{
  "command": "target",
  "targets": {
    "tool0": 0
  }
}

Pause Print

Topic:

{Adafruit IO username}/feeds/printpaused

Type:

post

REST API:

/api/job

REST Parameters:

{
  "command": "pause",
  "action": "pause"
}

Resume Print

Topic:

{Adafruit IO username}/feeds/printresumed

Type:

post

REST API

/api/job

REST Parameters:

{
  "command": "pause",
  "action": "resume"
}

Cancel Print

Topic:

{Adafruit IO username}/feeds/printcancelled

Type:

post

REST API:

/api/job

REST Parameters:

{
  "command": "cancel"
}

After setting up the six topics, your MQTT Subscribe plugin window should look similar to this. Once you're finished, click Save in the bottom right-hand corner.

This guide was first published on Feb 08, 2023. It was last updated on Mar 27, 2024.

This page (Configuring the OctoPrint MQTT Subscribe Plugin) was last updated on Mar 08, 2024.

Text editor powered by tinymce.