feat: show status line earlier and count energy without a running Sud

Both clients' status line only showed pot mass/water/energy once a Sud
schedule was loaded and running, leaving it blank/minimal at connect
time and while idle. Show it as early as possible instead, falling back
to config.json's Pot section (mass/water_mass/volumen) when no schedule
is loaded yet; step description/remaining-time still only appear once a
schedule is actually active.

web/app.js: updateStatusLine() now mirrors updatePotVisualization()'s
existing sudEmpty ? potConfig... : sud... pattern, and adds a Volume
figure that was previously only used for the pot-fill visualization.

client/brewpi_gui.py: same treatment, plus new sud_volumen tracking
(the desktop GUI had no volume concept at all before - added by reading
the doc's own pot.volumen with a config fallback, since Sud._parse_data()
doesn't return it). The System message's 'Pot' key now also refreshes
the status label immediately so it doesn't wait for some unrelated
message to trigger a repaint.

tasks/sud.py: energy was only accumulated outside IDLE/DONE, so a
manually-driven heater with no Sud loaded/started never counted toward
the total shown in either client. Now counts in every state except
DONE - IDLE banks into a stable index -1 that's never shown per-step
(Progress tab only covers the schedule's own indices) but is included
in the status line's summed total.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M2ierBoxW3v7nUbDw3M2pE
This commit is contained in:
2026-07-06 10:45:55 +02:00
co-authored by Claude Sonnet 5
parent 57677d7881
commit 6d1429daca
3 changed files with 88 additions and 57 deletions
+10 -5
View File
@@ -653,11 +653,16 @@ class SudTask(ATask):
# wiring), in Watts; dt is this tick's simulated seconds, so
# the product is Joules, accumulated for whichever step is
# current (see on_step_changed()). Counted through every
# non-idle state, WAIT_USER/PAUSED included - the controller
# stays enabled (see on_state_changed()) and may well still
# be actively holding, drawing real power, even though the
# schedule itself isn't progressing.
if self.sud.state not in (SudState.IDLE, SudState.DONE):
# state except DONE, IDLE included - a manually-driven heater
# (no schedule loaded/started yet, e.g. pre-heating strike
# water by hand) still draws real power and should show up in
# the same total; self.sud.index is a stable -1 while IDLE
# (see components/sud.py's _reset_run_state()), so this banks
# into energy_by_step[-1] same as any other step once a real
# Start moves the index on - never shown per-step (Progress
# tab's step-plates only cover the schedule's own indices) but
# still included in the status line's summed total.
if self.sud.state != SudState.DONE:
self.energy_step_accum_j += self.pot.get_power() * self.dt
self._energy_changed.set(self.energy_step_accum_j / 3600.0)
self.sud.tick(self.dt)