Adds support for subscribing and publishing to MQTT topics.

This is an OctoPrint Plugin that adds support for MQTT to OctoPrint.

Out of the box OctoPrint will send all events including their payloads to the topic octoprint/event/<event>, where <event> will be the name of the event. The message payload will be a JSON representation of the event’s payload, with an additional property _event containing the name of the event.


{“_event”: “ClientOpened”, “remoteAddress”: “”}
{“baudrate”: 250000, “_event”: “Connected”, “port”: “VIRTUAL”}
{“origin”: “local”, “_event”: “PrintStarted”, “file”:”/home/pi/.octoprint/uploads/case_bp_3.6.v1.0.gco”, “filename”: “case_bp_3.6.v1.0.gco”}

The plugin however also offers several helpers that allow other plugins to both publish as well as subscribe to MQTT topics, see the README for details and a usage example.


The plugin currently offers no settings dialog, configuration needs to be done by manually editing config.yaml. The following options are available:

            # the broker's url, mandatory, if not configured the plugin will do nothing

            # the broker's port
            #port: 1883

            # the username to use to connect with the broker, if not set no user
            # credentials will be sent
            #username: unset

            # the password to use to connect with the broker, only used if a
            # username is supplied too
            #password: unset

            # the keepalive value for the broker connection
            #keepalive: 60

            # base topic under which to publish OctoPrint's messages
            #baseTopic: octoprint/

            # topic for events, appended to the base topic, '{event}' will
            # be substituted with the event name
            #eventTopic: event/{event}


MQTT messages in MQTT-spy