Is there a way to integrate external MQTT sensor data in octoprint

Hi all, I have some zigbee temperature sensors lying around and would like to get their data into Octoprint (have already zigbee2mqtt set up, which converts the sensor data to mqtt messages).

Is there a way to achieve this? Preferably the data should be added in such a way, that I can reference them as variables in gcode.

I have seen there is the enclosure plugin, which can achieve this with gpio sensors, but I didn't like about this solution, that it requires system modifications outside octoprint, which are not covered by octoprint backup / restore.

Thanks a lot and best regards

There's actually a lot of work going into the enclosure plugin currently to make it more adaptable for different types of sensors and such. There is nothing that I've seen that will integrate the way you want it though in your workflow, being able to reference those in gcode variables, as those are typically all done slicer side. It is possible to create gcode scripts that utilize the jinja templating system as is done in the gcode scripts section of OctoPrint, but don't know any plugins that register MQTT data to that.

1 Like

Thanks a lot for the reply.

ok, maybe that thing about gcode variables was little too much, thought its easier to integrate. But for example, I saw in the Marlin documentation, that there are commands M141 and M191 to set and wait for chamber temperature. And from what I understood those already work with the enclosure plugin? So it would be pretty cool if they could also be extended to MQTT integrations. Would something like this be possible in the current version?

Or is there any other way to accomplish this? Basically I would like to wait for a certain chamber temperature, provided through an mqtt sensor, before I start the print.