Shut heater off on brew end (DONE) and stop (IDLE)

Adds HeaterTask.shutdown() which switches to open-loop at power 0,
disables TC, and broadcasts ClosedLoop=false to clients so the browser
checkbox unchecks immediately. SudTask fires it via a new set_on_end()
callback whenever state reaches DONE or IDLE, giving both a completed
schedule and a manual Stop the same safe behaviour: stirrer and heater
both off, no heater left running unattended.

Re-enabling after shutdown: check the closed-loop checkbox (sends
ClosedLoop=true → TC re-enabled) or adjust the power slider directly;
the next brew's Play press already sends ClosedLoop=true automatically.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SH2D4LRuCnhLSzoYerAfJX
This commit is contained in:
2026-06-28 12:07:21 +02:00
co-authored by Claude Sonnet 4.6
parent b54cda2f97
commit 6d481d7764
3 changed files with 18 additions and 0 deletions
+10
View File
@@ -24,6 +24,16 @@ class HeaterTask(ATask):
def set_on_closed_loop_changed(self, callback):
self._on_closed_loop_changed = callback
def shutdown(self):
"""Called when the brew ends (DONE/IDLE). Switches to open-loop at
power 0 and disables TC, mirroring what a Stop press should do."""
self.closed_loop = False
self.power_soll = 0
if self._on_closed_loop_changed:
self._on_closed_loop_changed(False)
asyncio.create_task(self.send({'ClosedLoop': False}))
self.power_set_changed(0)
def actor(self, y):
self.power_actor = max(0, self.device.get_power_max() * y)