# Interruptible heat soak

**URL:** <https://klipper.discourse.group/t/interruptible-heat-soak/1552>\
**Category:** Macros\
**Created:** [December 17, 2021, 12:44am UTC](https://klipper.discourse.group/t/interruptible-heat-soak/1552 "2021-12-17T00:44:52Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![SinisterRj](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/sinisterrj/32/6252_2.png) [@SinisterRj](https://klipper.discourse.group/u/SinisterRj)\
**Post date:** [August 28, 2022, 11:08pm UTC](https://klipper.discourse.group/t/interruptible-heat-soak/1552/21 "2022-08-28T23:08:09Z")

</div>

I’m using the min\_temp =0.5\*target\_temp -6, just because it works for me, But 0,85 is to high, considering that the target temperature is the bed temperature and the heatsoak temperature is the chamber one.

Using a array is a solution, but I really think that is too over for this problem. The heat soak process is long. Update faster than 30s really don`t make too much sense for me. And the moving average (the technique that you mentioned) has a small problem in the begining, since you don’t have measurements in t-1. Any way, I really think that just adjusting the sampling rate is enought to solve the problem (it solved for me).

---

<div class="post-metadata">

**Author:** ![garethky](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/garethky/32/956_2.png) [@garethky](https://klipper.discourse.group/u/garethky)\
**Post date:** [September 15, 2022, 3:45am UTC](https://klipper.discourse.group/t/interruptible-heat-soak/1552/22 "2022-09-15T03:45:51Z")

</div>

Ok @SinisterRj, you are getting everything on your wish list, plus some more:

- Smoothing of both the soak temp and soak temp rate are in. Each with a separately tunable smoothing factor in seconds. I’ve tested tested down to 0.1C/m and it seemed to work in my printer. 0.3C/m is the default, at that rate it would take an hour to got up 18 degrees C. The rate is smoothed using least squares to find the slope. I found this to be much better than a simple slope between 2 points in time. Default is a sample of 20 points.
- Smoothing waits for the requested number of data points before computing a temp or rate. The script is not fooled by initial temperature sensor noise and wont quit early.
- `SOAK_TEMP` lets you prolong the soak until the soak temp reaches at least that value.
- `M117` calls and message formats have been combined with logging. Soaking messages now show the temp, rate and timeout information.
- Both heating and soaking phases have separately customizable reporting intervals.
- The loop now evaluates the temps every 1 second. More samples is better for noise suppression and the uncoupled reporting intervals means you wont see any additional messages.
- renamed `CALLBACK` to `CONTINUE` so its less “programmer-speak”
- Added `CANCEL` which allows you to pass the macro to call when the heat soak is canceled. Default on cancel is to take no action. This prevents potential errors when heat soaking before a print and saves you from having to customize the macro.
- [mwu](https://klipper.discourse.group/u/mwu)’s Pause/Resume functionality now only activates if there is a print running. This stops Klipper Screen from thinking a print is paused when heat soaking without a print actually running.
- Apply rounding to temperatures so that small fractions don’t make it look like 90.0 \< 90.0 is true.
- Wrote up a readme file that explains how to use it: [klipper-voron2.4-config/heatsoak.readme.md at mainline · garethky/klipper-voron2.4-config · GitHub](https://github.com/garethky/klipper-voron2.4-config/blob/mainline/printer_data/config/heatsoak.readme.md)

---

<div class="post-metadata">

**Author:** ![garethky](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/garethky/32/956_2.png) [@garethky](https://klipper.discourse.group/u/garethky)\
**Post date:** [September 20, 2022, 7:27pm UTC](https://klipper.discourse.group/t/interruptible-heat-soak/1552/23 "2022-09-20T19:27:06Z")

</div>

The CONTINUE functionality has issues I don’t think I can fix: [[heatsoak] PRINT\_START\_CONTINUE errors out but print continues · Issue #3 · garethky/klipper-voron2.4-config · GitHub](https://github.com/garethky/klipper-voron2.4-config/issues/3)

This topic is also very relevant: [Save/restore gcode state in updated pause/resume macros](https://klipper.discourse.group/t/save-restore-gcode-state-in-updated-pause-resume-macros/1995)

If we RESUME before the CONTINUE macro, things work “as expected”, but if anything goes wrong in the CONTINUE macro it wont stop the print as it should. Not stopping in a crashed state is a deal breaker for me, clearly that’s not safe.

If we RESUME after the CONTINUE macro any state that you built up in the CONTINUE macro is lost, including any probed Z Offset and the current position of the toolhead. RESUME will reset all of this and move the toolhead back to the position it was in at the start of the HEAT\_SOAK. That’s also a deal breaker for me. The whole point of CONTINUE was to do probing after the heat soak.

So option 3 is to remove the CONTINUE functionality and recommend that people split their PRINT\_START up into 2 calls in their slicer like this:

```auto
# Bed heat-up, Nozzle pre-warming, Homing/QGL, park in center, HEAT_SOAK:
PRINT_WARMUP=[first_layer_temperature] BED_TEMP=[first_layer_bed_temperature]
# bed mesh, auto calibrate Z, final nozzle heat up and prime line
PRINT_START=[first_layer_temperature] BED_TEMP=[first_layer_bed_temperature] 

```

I think this will makes the most sense for most users. The Pause state only covers the heat\_soak time, nothing more. No weird syntax for passing a callback etc.

If you have a strong opinion on the CONTINUE functionality staying in or an alternative idea for making it safe to use, I’d love to hear it.

(I was using CONTINUE for macros that printed a test pattern, but I think I can find another way of doing that, like a small .gcode file)

---

<div class="post-metadata">

**Author:** ![garethky](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/garethky/32/956_2.png) [@garethky](https://klipper.discourse.group/u/garethky)\
**Post date:** [October 6, 2022, 6:30pm UTC](https://klipper.discourse.group/t/interruptible-heat-soak/1552/24 "2022-10-06T18:30:05Z")

</div>

Made some updates:

- `CONTINUE` was renamed to `COMPLETE` and the documentation was updated to reflect my view that most people would be better off splitting their `PRINT_START` macro in 2 and calling both parts from their slicer’s gocde.
- Added overrides for `CANCEL_PRINT` and `RESUME`. These wrap any macros you may have and add functionality. Particularly `RESUME` allows you to skip the soaking phase but wont resume the print while heating. This makes buttons in front ends safe to press without weird side effects.

---

<div class="post-metadata">

**Author:** ![Twan74](https://avatars.discourse-cdn.com/v4/letter/t/7cd45c/32.png) [@Twan74](https://klipper.discourse.group/u/Twan74)\
**Post date:** [October 24, 2022, 7:01am UTC](https://klipper.discourse.group/t/interruptible-heat-soak/1552/26 "2022-10-24T07:01:17Z")

</div>

@blalor an off-topic question. Your macro is great bit I would also like the notification in HA. Do you have an example on how to set this in HA

---

<div class="post-metadata">

**Author:** ![blalor](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/blalor/32/175_2.png) [@blalor](https://klipper.discourse.group/u/blalor)\
**Post date:** [October 24, 2022, 9:48am UTC](https://klipper.discourse.group/t/interruptible-heat-soak/1552/27 "2022-10-24T09:48:21Z")

</div>

I’m doing that with node-red and the [moonNode](https://flows.nodered.org/node/node-red-contrib-moonnode) node. I monitor the `stage` variable of the `HEAT_SOAK` macro and send a notification when that changes to `done`. I’m in the middle of a move and my HA setup is offline, otherwise I’d share the full details. You could use HA’s native RESTful integration to poll moonraker’s API and create an entity with that same information, which would allow for creating the notification directly in HA.

---

<div class="post-metadata">

**Author:** ![Twan74](https://avatars.discourse-cdn.com/v4/letter/t/7cd45c/32.png) [@Twan74](https://klipper.discourse.group/u/Twan74)\
**Post date:** [October 25, 2022, 4:13am UTC](https://klipper.discourse.group/t/interruptible-heat-soak/1552/28 "2022-10-25T04:13:21Z")

</div>

@blalor thanks. I will look into the moonNode

---

<div class="post-metadata">

**Author:** ![madorax251](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@madorax251](https://klipper.discourse.group/u/madorax251)\
**Post date:** [October 30, 2022, 7:07pm UTC](https://klipper.discourse.group/t/interruptible-heat-soak/1552/29 "2022-10-30T19:07:16Z")

</div>

i want to ask why gcode heat\_soak can no longer be used? earlier every time i run heat\_soak TARGET=100 DURATION=5 100c for 5 minutes then the heater turns off but now it keeps turning on. i didn’t change any gcode macros. is it related to me updating klipper and fluidd?

---

<div class="post-metadata">

**Author:** ![madorax251](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@madorax251](https://klipper.discourse.group/u/madorax251)\
**Post date:** [November 1, 2022, 10:42pm UTC](https://klipper.discourse.group/t/interruptible-heat-soak/1552/33 "2022-11-01T22:42:55Z")

</div>

I run HEAT\_SOAK TARGET=105 DURATION=5 my toolhead goes home and moves to the middle, but the heater\_bed continues to turn on and doesn’t turn off. Usually after 5 minutes the heater automatically turns off?

---

<div class="post-metadata">

**Author:** ![Dragi2k](https://avatars.discourse-cdn.com/v4/letter/d/65b543/32.png) [@Dragi2k](https://klipper.discourse.group/u/Dragi2k)\
**Post date:** [February 26, 2023, 12:23pm UTC](https://klipper.discourse.group/t/interruptible-heat-soak/1552/34 "2023-02-26T12:23:15Z")

</div>

i like the idea,  
but i would like to use a pwm output pin to choose the heating time

> Blockquote  
> [output\_pin Soak\_Time\_x100]  
> pin: rpi:gpio13  
> pwm: true  
> value: 0.1  
> scale: 0.6

and if i change the time on a 30 minute soak to 2 minutes that it stops the soaking prozess

---

<div class="post-metadata">

**Author:** ![bogustime](https://avatars.discourse-cdn.com/v4/letter/b/e99b99/32.png) [@bogustime](https://klipper.discourse.group/u/bogustime)\
**Post date:** [April 1, 2023, 11:51am UTC](https://klipper.discourse.group/t/interruptible-heat-soak/1552/35 "2023-04-01T11:51:20Z")

</div>

I have recently updated mainsail v2.5.0 to which the periodical updates of the initial macro during the heatsoak process no longer shows under the main status bar but the macro still seems to work. What may be causing this?

 ![image](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/9/9d0b6a6466d38f9a44bad8c6fb397a395bc48e78.png)

---

<div class="post-metadata">

**Author:** ![hcet14](https://avatars.discourse-cdn.com/v4/letter/h/ecd19e/32.png) [@hcet14](https://klipper.discourse.group/u/hcet14)\
**Post date:** [April 1, 2023, 1:20pm UTC](https://klipper.discourse.group/t/interruptible-heat-soak/1552/36 "2023-04-01T13:20:17Z")

</div>

You could open an issue [Issues · mainsail-crew/mainsail · GitHub](https://github.com/mainsail-crew/mainsail/issues)

Good luck, hcet14

---

<div class="post-metadata">

**Author:** ![doublee05](https://avatars.discourse-cdn.com/v4/letter/d/ec9cab/32.png) [@doublee05](https://klipper.discourse.group/u/doublee05)\
**Post date:** [March 12, 2024, 1:35pm UTC](https://klipper.discourse.group/t/interruptible-heat-soak/1552/37 "2024-03-12T13:35:39Z")

</div>

@garethky The links to your github config are no longer there, is there an updated link? This is exactly what I am looking for.

---

<div class="post-metadata">

**Author:** ![theophile](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/theophile/32/31_2.png) [@theophile](https://klipper.discourse.group/u/theophile)\
**Post date:** [March 12, 2024, 6:53pm UTC](https://klipper.discourse.group/t/interruptible-heat-soak/1552/38 "2024-03-12T18:53:31Z")

</div>

Here you go:

> <https://github.com/garethky/klipper-voron2.4-config/blob/mainline/printer_data/config/heatsoak.readme.md>

> <https://github.com/garethky/klipper-voron2.4-config/blob/mainline/printer_data/config/heatsoak.cfg>

---

<div class="post-metadata">

**Author:** ![garethky](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/garethky/32/956_2.png) [@garethky](https://klipper.discourse.group/u/garethky)\
**Post date:** [March 12, 2024, 8:29pm UTC](https://klipper.discourse.group/t/interruptible-heat-soak/1552/39 "2024-03-12T20:29:24Z")

</div>

I think I fixed the broken link

---

<div class="post-metadata">

**Author:** ![Matty3D](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/matty3d/32/5693_2.png) [@Matty3D](https://klipper.discourse.group/u/Matty3D)\
**Post date:** [August 21, 2024, 5:29pm UTC](https://klipper.discourse.group/t/interruptible-heat-soak/1552/40 "2024-08-21T17:29:03Z")

</div>

I’m trying to implement this on my K1 Max (Rooted) and am running in to some issues. I think mostly it’s because I’m not fully understanding and trying to simply C&P the code.

When I try to run a heatsoak as-is, I get

> Error evaluating ‘gcode\_macro HEAT\_SOAK:gcode’: jinja2.exceptions.UndefinedError: ‘extras.gcode\_macro.GetStatusWrapper object’ has no attribute

I’ve been looking through the macros to try and see what may be causing the issue, but I’m coming up short. I suspect I may be missing some global variables in place?

I don’t have a chamber heatsoaker in my printer, just the bed. Though I do have a chamber temp. sensor if that helps any.

---

<div class="post-metadata">

**Author:** ![garethky](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/garethky/32/956_2.png) [@garethky](https://klipper.discourse.group/u/garethky)\
**Post date:** [August 21, 2024, 6:18pm UTC](https://klipper.discourse.group/t/interruptible-heat-soak/1552/41 "2024-08-21T18:18:32Z")

</div>

> [@Matty3D](#):
>
> Error evaluating ‘gcode\_macro HEAT\_SOAK:gcode’: jinja2.exceptions.UndefinedError: ‘extras.gcode\_macro.GetStatusWrapper object’ has no attribute

has no attribute… what was the next bit?

(I don’t have any kind of chamber heater in my printer. Just a top of bed thermistor.)

---

<div class="post-metadata">

**Author:** ![Matty3D](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/matty3d/32/5693_2.png) [@Matty3D](https://klipper.discourse.group/u/Matty3D)\
**Post date:** [August 22, 2024, 12:46am UTC](https://klipper.discourse.group/t/interruptible-heat-soak/1552/42 "2024-08-22T00:46:13Z")

</div>

> [@garethky](#):
>
> n

This is all that comes up on the console, which is why I’m confused. Now, I can’t use normal Klipper. I have to use the workarounds that people have come up with to get the K1 to run as close to stock as we can get it. Could that be part of the issue?

 ![image](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/1/1d8e42e4ddbb5d53ea158276852744cd8b4d61e0.png)

I’m also wondering if I didn’t set something up correctly, maybe.

---

<div class="post-metadata">

**Author:** ![garethky](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/garethky/32/956_2.png) [@garethky](https://klipper.discourse.group/u/garethky)\
**Post date:** [August 22, 2024, 12:57am UTC](https://klipper.discourse.group/t/interruptible-heat-soak/1552/43 "2024-08-22T00:57:07Z")

</div>

I guess that is some property being requested from the macro object but its empty? Maybe one of the required parameters is empty?

---

<div class="post-metadata">

**Author:** ![Matty3D](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/matty3d/32/5693_2.png) [@Matty3D](https://klipper.discourse.group/u/Matty3D)\
**Post date:** [August 22, 2024, 1:00am UTC](https://klipper.discourse.group/t/interruptible-heat-soak/1552/44 "2024-08-22T01:00:00Z")

</div>

Ya, just what variable it needs is the mystery.

The hunt continues.

[Previous page](https://klipper.discourse.group/t/interruptible-heat-soak/1552.md?page=1)

[Next page](https://klipper.discourse.group/t/interruptible-heat-soak/1552.md?page=3)
