From 8c845ed5c5d9a44ca55c8f32bbe125da51c13342 Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Fri, 26 Jun 2026 08:02:53 +0200 Subject: [PATCH] Fix crash: rename shadowing 'pot' variable in forecast closure In estimate()'s on_step_changed closure, the new 'pot = step.get("pot", {})' local variable shadowed the outer 'pot' (Pot plant instance), causing pot.set_plant_params() to be called on a plain dict and crash on load. Renamed to 'step_pot' to avoid the collision. Co-Authored-By: Claude Sonnet 4.6 Claude-Session: https://claude.ai/code/session_01T52JH848ojhXXHn1bAzdC3 --- components/sud_forecast.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/sud_forecast.py b/components/sud_forecast.py index cd8238d..bd6bd27 100644 --- a/components/sud_forecast.py +++ b/components/sud_forecast.py @@ -156,8 +156,8 @@ class SudForecastEstimator: # re-assigns self.step to retrigger it) - only the *first* call # for a given index is its actual start. step_starts.setdefault(sud.index, t[-1]) - pot = step.get('pot', {}) - params = sud.derive_plant_params(pot.get('grain_mass', 0), pot.get('water_mass', 0)) + step_pot = step.get('pot', {}) + params = sud.derive_plant_params(step_pot.get('grain_mass', 0), step_pot.get('water_mass', 0)) pot.set_plant_params(params) tc.set_model_plant_params(params) if sud.state == SudState.RAMPING and step['temperature'] is not None: