Better Pause Function in Octoprint

I have used the Pause feature of Octoprint with very little success. I own a Prusa i3 MK3.
So when I want to pause a print, lets say because I am leaving the house and don't want to let the printer unattended with the heaters on.
First problem ist that the nozzle is still hot and burns into the print. That could be solved by lifting the nozzle a few mm with the pause and lower it to the original position if the print is resumed.
Another problem is that the heaters for the heated and the hotted stay on. So the print pauses, but the heaters are still on. Exactly not what I want when I leave the printer alone at home. So would be nice if the temperatures are set to 0 for a pause.
Finally my MK3 turns the heaters off and throws an error if the pause is too long. While this is a nice feature, it makes a resume impossible.
I could also try the filament change for a longer pause, but the beeping is quite annoying.

I wonder if there is a better solution?

Hello @Empusas!

Within the Settings of OctoPrint, there is a section called GCODE Scripts.
There you can add some commands to lift the printhead, lower the temperature and vice versa etc.

P.S.: In this article, you find some code examples.

I have just done it ones on my wanhao, but what I did was to lift the nozzle, turned off the heat in Octoprint. When I came back I heated up everything then move the nozzle down again an started to print.

Here are my scripts, noting that I don't have a heated bed. I only deal with the move-the-hotend-off-the-part aspect of this.

After Print Paused:

M117 Print Paused  ; Comment
G91 Z              ; Set to relative positioning mode
G1 Z15             ; Move hotend away from part by 15mm
G90 Z              ; Set to absolute positioning mode

Before Print Resumed:

M117 Print Resumed ; Comment
G91 Z              ; Set to relative positioning mode
G1 Z-15            ; Return to original position
G90 Z              ; Set to absolute positioning mode

In your case, you might want to also add to the first script something like:

;disable all heaters
{% snippet 'disable_hotends' %}
{% snippet 'disable_bed' %}
;disable fan
M106 S0

And maybe add this to the second script in addition to the move code:

{% for tool in range(printer_profile.extruder.count) %}
    {% if pause_temperature[tool] and pause_temperature[tool]['target'] is not none %}
        {% if tool == 0 and printer_profile.extruder.count == 1 %}
            M109 T{{ tool }} S{{ pause_temperature[tool]['target'] }}
        {% else %}
            M109 S{{ pause_temperature[tool]['target'] }}
        {% endif %}
    {% else %}
        {% if tool == 0 and printer_profile.extruder.count == 1 %}
            M104 T{{ tool }} S0
        {% else %}
            M104 S0
        {% endif %}
    {% endif %}
{% endfor %}

{% if printer_profile.heatedBed %}
    {% if pause_temperature['b'] and pause_temperature['b']['target'] is not none %}
        M190 S{{ pause_temperature['b']['target'] }}
    {% else %}
        M140 S0
    {% endif %}
{% endif %}

Oh... and you should also turn the fan back on if you turn it off.


This is all exactly what I am looking for, but where is the pause_temperature coming from? From what I see you have in your example, that looks like it would be within the printer profile, but I don't believe I have an option to set the pause temps in the printer profile.

No, it's not in the printer profile. To the best of my knowledge it's an available snippet that's available within OctoPrint and you can inject it into your Settings -> Gcode Scripts if you need to. For the two related to pause/resume in that section, you might include it as I've indicated. It should expand into whatever temperature was on the hotend at the moment where you pressed the PAUSE button in the OctoPrint interface.

OK, thank you. I"ll do some digging through the code to confirm the snipped.

Great response, I use your code to enhance my smart filament sensor. Though I do leave the bed heater on so the part does not pop off.