Add extruder temperature script to Print Paused/Resumed

@foosel Hi, for the octoprint pause/resume buttons, would it be possible to attain a sample script to cool a hot end for filament change to say 110deg. and On resume then increase temperature to the last temperature (normal extrusion temperature) before the hot end moves from parked position to continue the print.

This would be for an IDEX printer Firmware Klipper or Marlin, Octoprint Version 1.3.9, not sure if this could be applied to whichever tool as active at the time.
I am not a programmer so asking for help to acheive this.

Have found and tested the following script on tool-0 only and it works but have to lower and raise the temperature manually.

=========Use in - After print job is paused==============
{% if pause_position.x is not none %}
; relative XYZE
G91
M83

; retract filament of 0.8 mm up, move Z slightly upwards and
G1 Z+5 E-2.0 F4500

; lower tool temperature if needed
;

; absolute XYZE
M82
G90

; move to a safe rest position, adjust as necessary
G1 X0 Y0
{% endif %}

=========Use in - Before print job is resumed=============
{% if pause_position.x is not none %}
; relative extruder
M83

; prime nozzle
G1 E-0.8 F4500
G1 E2.8 F4500
; G1 E0.8 F4500

; absolute E
M82

; absolute XYZ
G90

; reset E
G92 E{{ pause_position.e }}

M83 ; extruder relative mode

; move back to pause position XYZ
G1 X{{ pause_position.x }} Y{{ pause_position.y }} Z{{ pause_position.z }} F4500

; reset to feed rate before pause if available
{% if pause_position.f is not none %}G1 F{{ pause_position.f }}{% endif %}
{% endif %}

Thanks & regards - bruce

You might look at the last_temperature object which appears to have the target side of that. It could be something like last_temperature.tool0.target perhaps. Also pause_temperature appears to be available.

Hi OutsourcedGuru, thanks for the reply and the link. I know nothing about programming so I made it simple and it works.

; lower tool temperature if needed
M104 S105
and
M104 S210 T0; set extruder temperature
M109 S210 T0; Wait for Hotend Temperature

regards - bruce

You appear to be taking advantage already of the macros. It's possible that the macro you need is also available.