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
+2
View File
@@ -145,6 +145,8 @@ if __name__ == '__main__':
tc.set_on_changed("y", heater_task.actor)
# HeaterTask owns TC enable: enabled in closed-loop mode, disabled in open-loop.
heater_task.set_on_closed_loop_changed(tc.set_enabled)
# Brew end (DONE/IDLE): shut heater off and broadcast open-loop/power-0 to clients.
sud_task.set_on_end(heater_task.shutdown)
# Assign temp. sensor readings to tc
sensor_task.set_on_changed("temp", ChangedFloat(tc.set_theta_ist, prec=2).set)