From d1e556024dd02c059c20271c7da4d986810e7357 Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Mon, 6 Jul 2026 10:25:09 +0200 Subject: [PATCH] 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 Claude-Session: https://claude.ai/code/session_01M2ierBoxW3v7nUbDw3M2pE --- client/brewpi_gui.py | 9 ++++++++- web/app.js | 5 ++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/client/brewpi_gui.py b/client/brewpi_gui.py index b93384e..54193d7 100755 --- a/client/brewpi_gui.py +++ b/client/brewpi_gui.py @@ -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") diff --git a/web/app.js b/web/app.js index b60a284..b5bd249 100644 --- a/web/app.js +++ b/web/app.js @@ -153,7 +153,10 @@ function parseSudDoc(doc) { return { name: doc.Name || '', schedule: schedule, - potMass: pot.mass || 0, + // Falls back to config.json's Pot.mass (via potConfig, set from + // the System message) when the loaded doc doesn't override it - + // mirrors components/sud.py's Sud._parse_data(). + potMass: pot.mass || potConfig.mass || 0, grainMass: pot.grain_mass || 0, waterMass: pot.water_mass || 0, volumen: pot.volumen || 0,