Octoprint server automatic shutdown

What is the problem?

I would like that the Octoprint server (i.e. the raspberry) would automatically shutdown once the print has finished. This will trigger my home automation system and cut off power supply to both the pi and the printer.

If I am not mistaking, all plugins I could find are related to printer shutdown, not the server, right? :thinking:

What did you already try to solve it?

Tried to find a suitable plugin, but nothing available.

There may be many ways to implement something as you describe if writing your own is an option.

  • with the mqtt plugin installed and a mosquitto running somewhere in your LAN you can listen on the configured channel to trigger your action once a print is done and the state goes back to operational.
  • via the api (which is a mighty tool with octoPrint) you can trigger a shutdown in just one line of code.
  • wait a few dozend seconds after pings of the pi fail, a shutdown is not instantenous.A timer object with a span of 1 minute should do.
  • and then you can send the commands to turn the switches off.

Both bash and python have all the things you'll need. Which home automisation system do you use?

Hi @Charlie_Powell

I Shaw this and it Looks abandoned - so I would not go for a solution that might be broken at the next SW update :wink:

Does anybody know if maintaining it is a large task? I have programming experience but Python is not my preferred language…

@planetar

I use OpenHAB and - as you guess - I use the network presence plugin to detect when the Octopi is out of the network to switch off the printer (the latter is connected to a smart plug).

So… my challenge is to turn off the OctoPi. As you mentioned, I would us the MQTT functionality to check when the printing is finished (and perhaps when the nozzle temperature is below a certain value?) to turn off the server through the api you pointed me to :thinking:. I need to look into the docs!

Just looked into the OpenHAB docs and I saw I can use the sendHttpGetRequest() call in a Rule to do exactly what I need :smiley:

It is just programming the rule now :laughing:

1 Like