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:
@@ -110,6 +110,7 @@ class SudTask(ATask):
|
||||
# Saved on pause so resume can restore the effective setpoint even
|
||||
# when the current step has temperature=None (inherits from a prior step).
|
||||
self._paused_temp_soll = None
|
||||
self._on_end = None
|
||||
msg_handler.set_recv_handler(self.recv)
|
||||
|
||||
def apply_plant_params(self, grain_mass, water_mass):
|
||||
@@ -217,12 +218,17 @@ class SudTask(ATask):
|
||||
'WaitForUser': step.get('user_wait_for_continue', False) if step else None,
|
||||
}}))
|
||||
|
||||
def set_on_end(self, callback):
|
||||
self._on_end = callback
|
||||
|
||||
def on_state_changed(self, value):
|
||||
asyncio.create_task(self.send({'State': str(value)}))
|
||||
|
||||
if value in (SudState.DONE, SudState.IDLE):
|
||||
self.stirrer.set_duty_cycle(1.0)
|
||||
self.stirrer.set_speed(0)
|
||||
if self._on_end:
|
||||
self._on_end()
|
||||
|
||||
def on_user_message_changed(self, value):
|
||||
asyncio.create_task(self.send({'UserMessage': value}))
|
||||
|
||||
Reference in New Issue
Block a user