fix: re-enable closed-loop on Sud start regardless of client
HeaterTask.shutdown() switched the heater to open-loop when a brew
ended, but nothing switched it back when a new Sud was started. The
browser happened to send {ClosedLoop: true} as part of its UI setup,
so its connect-and-start path worked; PyQt (and any other client that
doesn't send that message) left the heater in open-loop and the TC
never drove it.
Add SudTask._on_start / set_on_start() hook, HeaterTask.start_closed_loop()
(mirror of shutdown()), and wire them in brewpi.py so the server
switches to closed-loop and broadcasts the new state to all clients the
moment any client starts a brew.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -34,6 +34,14 @@ class HeaterTask(ATask):
|
||||
asyncio.create_task(self.send({'ClosedLoop': False}))
|
||||
self.power_set_changed(0)
|
||||
|
||||
def start_closed_loop(self):
|
||||
"""Called when a Sud starts. Re-enables closed-loop so the TC drives
|
||||
the heater regardless of which client started the brew."""
|
||||
self.closed_loop = True
|
||||
if self._on_closed_loop_changed:
|
||||
self._on_closed_loop_changed(True)
|
||||
asyncio.create_task(self.send({'ClosedLoop': True}))
|
||||
|
||||
def actor(self, y):
|
||||
self.power_actor = max(0, self.device.get_power_max() * y)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user