diff --git a/documentation/changelog.rst b/documentation/changelog.rst index d972e5621..bc2336832 100644 --- a/documentation/changelog.rst +++ b/documentation/changelog.rst @@ -38,6 +38,7 @@ Bugfixes ----------- * Fix (dev) CLI command for adding a GenericAssetType [see `PR #173 `_] * Fix (dev) CLI command for adding a Sensor [see `PR #176 `_] +* Fix GetDeviceMessage to ensure chronological ordering of values [see `PR #216 `_] Infrastructure / Support ---------------------- diff --git a/flexmeasures/api/v1_3/implementations.py b/flexmeasures/api/v1_3/implementations.py index 42302f9e2..0c47ca73f 100644 --- a/flexmeasures/api/v1_3/implementations.py +++ b/flexmeasures/api/v1_3/implementations.py @@ -149,6 +149,7 @@ def get_device_message_response(generic_asset_name_groups, duration): .filter(Power.data_source_id == scheduler_source.id) .filter(Power.datetime >= schedule_start) .filter(Power.datetime < schedule_start + planning_horizon) + .order_by(Power.datetime.asc()) .all() ) consumption_schedule = pd.Series(