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,