fix: thread config.json's Pot.mass into both UI clients' displayed mass

Sud._parse_data() already falls back to config.json's Pot section when
a loaded sud.json doesn't override 'mass', but neither client actually
passed that config through, so displayed pot mass silently read 0 kg
whenever a recipe didn't set its own 'pot.mass'.

client/brewpi_gui.py: capture the System message's 'Pot' key (already
sent by the server, previously ignored) into self.pot_config, and pass
it to Sud._parse_data(doc, self.pot_config).

web/app.js: parseSudDoc()'s potMass now falls back to the module-level
potConfig.mass (already captured from msg.Pot elsewhere, just never
consulted here) before defaulting to 0.

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:25:09 +02:00
co-authored by Claude Sonnet 5
parent 1e7042d906
commit d1e556024d
2 changed files with 12 additions and 2 deletions
+8 -1
View File
@@ -449,6 +449,11 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
self.sud_elapsed_last = None
self.sud_name = ''
self.sud_schedule = []
# Hardware baseline from config.json's Pot section (see
# on_system_changed()) - passed to Sud._parse_data() so a loaded
# sud.json that doesn't override 'mass' still resolves to the real
# kettle mass instead of _parse_data()'s own bare 0 default.
self.pot_config = {}
self.sud_pot_mass = 0
self.sud_grain_mass = 0
self.sud_water_mass = 0
@@ -780,6 +785,8 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
self.btn_pot_reset.setVisible(msg['PlantSim'])
self.label_pot_temp.setVisible(msg['PlantSim'])
self.doubleSpinBox_pot_temp.setVisible(msg['PlantSim'])
elif "Pot" in key:
self.pot_config = msg['Pot']
self.update_status_env_label()
def on_action_pot_reset(self):
@@ -1215,7 +1222,7 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
def update_sud_forecast(self, doc):
try:
name, _, schedule, pot_mass, _, _, _, grain_mass, water_mass = Sud._parse_data(doc)
name, _, schedule, pot_mass, _, _, _, grain_mass, water_mass = Sud._parse_data(doc, self.pot_config)
except (KeyError, TypeError):
return
# A genuinely different schedule (an actual Load, or "New Sud")