MQTT Server - Topics List

Hi all,

I just got MQTT Server working and I was wondering if there's a published list of all the potential topics (e.g. event/Connected, temperature/..., printevent/....) and when/how they're trigger - does that exist?

Second question - I've already made the host mqtt be service on nodered and I'm thinking I will publish nodered select messages to my discord bot. (I'm already doing this with other messages on my selfhosted network.) I'm thinking messages that would tell me something is amiss - so are there topics in the above list that might support that requirement?

Thanks in advance!

The plugin's readme details most of what you need for the what's published question:

Hi Charles,

Do the examples comprise the complete list of potential topics?

Any thoughts on my 2nd question - what events would indicate that there's a potential problem with the print or printer?

Thank you!

Edit #2: It looks like the MQTT Server imports octoprint.events which I'm guessing become the topic text, e.g.

# print/gcode events
POWER_ON = "PowerOn"
POWER_OFF = "PowerOff"
HOME = "Home"
Z_CHANGE = "ZChange"
WAITING = "Waiting"
DWELL = "Dwelling"
COOLING = "Cooling"
ALERT = "Alert"
CONVEYOR = "Conveyor"
EJECT = "Eject"
E_STOP = "EStop"

would become topic (I'm guessing?):

octoprint/progress/print/PowerOn
octoprint/progress/print/PowerOff
octoprint/progress/print/Home
octoprint/progress/print/ZChange

etc.

That's the list I'm looking for - does it exist?

The examples are not definitive. They link to the list of events on docs.octoprint.org - it says in the readme:

OctoPrint will send all events including their payloads to the topic octoprint/event/<event> , where <event> will be the name of the event.

Although I think the base topic is actually octoPrint according to this issue.

No, they would be as above, octoprint/event/<event>, such as octoprint/event/PowerOn The progress ones are for print progress:

The print progress and the slicing progress will also be send to the topic octoprint/progress/printing and octoprint/progress/slicing respectively. The payload will contain the progress as an integer between 0 and 100.

For the temperatures:

The plugin also publishes the temperatures of the tools and the bed to octoprint/temperature/<tool> where <tool> will either be 'bed' or 'toolX' (X is the number of the tool).

Read the whole page I linked above. There is not a definitive list of MQTT topics, but I think there is enough information/links that you can figure out what the possibilities are. It goes through the different types of data one by one, telling you how the topics are formatted.

As for the list of topics indicating a problem, I would say things like Disconected, Error, PrintFailed, EStop, the list could go on with the docs.octoprint.org list - you should be able to find anything else specific to your requirements.

Hi Charles,

Thanks again - um - as a newbie to Octoprint - it is not obvious what's considered an event - so I appreciate your advice to RTFD.

You can't have something like a definitive topic list since plugins create topics and messages, some plugins even enable you to add your own custom topics.

On the other hand it is easy, simply set up an mqtt broker on the raspberry, configure the mqtt plugin to publish to that server and watch what get's published there.

In a bash console on a machine which has the command line clients installed you get a listing of all the incomming messages with a human-readable date (instead of the time stamp) at the front:

mosquitto_sub -v -h MQTT.HOST -u USER -P PASSWORD -t '#' | xargs -d$'\n' -L1 sh -c 'date "+%d.%m.%Y %T $0"'

the output runs as long as messages arrive and is useful to check topics or the format of data.


02.01.2022 19:12:01 octoPrint/event/UserLoggedIn {"username": "dp", "_event": "UserLoggedIn", "_timestamp": 1641147121}
02.01.2022 19:12:02 octoPrint/event/ClientClosed {"remoteAddress": "::ffff:192.168.50.24", "_event": "ClientClosed", "_timestamp": 1641147122}
02.01.2022 19:12:09 octoPrint/event/ClientOpened {"remoteAddress": "::ffff:192.168.50.24", "_event": "ClientOpened", "_timestamp": 1641147129}
02.01.2022 19:12:09 octoPrint/event/UserLoggedIn {"username": "dp", "_event": "UserLoggedIn", "_timestamp": 1641147129}
02.01.2022 19:12:11 octoPrint/event/ClientAuthed {"username": "dp", "remoteAddress": "::ffff:192.168.50.24", "_event": "ClientAuthed", "_timestamp": 1641147131}
02.01.2022 19:12:29 octoPrint/event/Connecting {"_event": "Connecting", "_timestamp": 1641147149}
02.01.2022 19:12:29 octoPrint/event/PrinterStateChanged {"state_id": "DETECT_SERIAL", "state_string": "Detecting serial connection", "_event": "PrinterStateChanged", "_timestamp": 1641147149}

It is rather verbose but letting it run for a while, copy&paste the output into an editor which supports editing in block mode and sorting the lines you'll soon have an accurate list of the topics relevant on your system.

1 Like

Hi @planetar,

Yes, that's what I've ended up doing - just grepping the log file and eventually I'll be able to get a complete list.
:+1: