Accessing info from Raspian

Hi,

I‘d like to add a status display to my raspberry pi. I have several spare OLED displays, which connect to the SPI Interface of the Pi.
I am displaying several data as hostname, Ip address, load user logged on and so on.

Now I would like to add some Octoprint specific information, as temperatures, status and other information. Is there a way to extract this info from a python script running on the Pi?

With the MQTT plugin enabled octoprint is rather verbose. It is not difficult to make a python program listen to the same MQTT broker, subscribe to the topics you're interested in and use it.

If you don't already use mosquitto you can install it with
apt install mosquitto mosquitto-client

You can listen to all the messages on your broker on the console with
mosquitto_sub -v -h broker.host -u user -P secret -t '#' | xargs -d$'\n' -L1 sh -c 'date "+%d.%m.%Y %T $0"'
(the part after the pipe converts timestamps into more readable date - time expressions)

An alternative could be getting values via the API, you'll have to poll for changes then.

If you are running a python script, you are halfway to making your own OctoPrint plugin already! Everything is much easier if you were to create a plugin, no polling the API, no MQTT, but you have direct access to all of OctoPrint's internals. Check out the plugin guides on https://docs.octoprint.org.

That you for replying... I just read the doc on the REST-API, that gives me plenty of info to work with... now I have to select, which info I want to display in my 4 lines... :wink:

thanks for the awesome information.
https://ometv.onl https://chatroulette.top https://omegle.wtf https://bazoocam.cam

I will come back with more info, but in fact my printer is out of order at the moment and I am waiting for spares to be delivered… and to finish this project I need some faceplates for my PIs to be printed :slight_smile: