diff --git a/documentation/changelog.rst b/documentation/changelog.rst index e6e145bedb..9cc9786c14 100644 --- a/documentation/changelog.rst +++ b/documentation/changelog.rst @@ -35,7 +35,7 @@ Infrastructure / Support Bugfixes ----------- - +* Fix ``StorageScheduler`` crash (``AttributeError: 'NoneType' object has no attribute 'event_resolution'``) when scheduling a site whose asset tree contains non-storage devices with only a ``power-capacity`` in their ``flex-model`` (no ``sensor`` key) [see `issue #2084 `_] v0.31.2 | March 18, 2026 ============================ diff --git a/flexmeasures/data/models/planning/storage.py b/flexmeasures/data/models/planning/storage.py index 2a37cd600e..40ed7552df 100644 --- a/flexmeasures/data/models/planning/storage.py +++ b/flexmeasures/data/models/planning/storage.py @@ -899,7 +899,7 @@ def _prepare(self, skip_validation: bool = False) -> tuple: # noqa: C901 device_constraints[d]["efficiency"] = storage_efficiency[d] # Convert efficiency from sensor resolution to scheduling resolution - if sensor_d.event_resolution != timedelta(0): + if sensor_d is not None and sensor_d.event_resolution != timedelta(0): device_constraints[d]["efficiency"] **= ( resolution / sensor_d.event_resolution )