diff --git a/flexmeasures/api/v3_0/tests/test_sensors_api.py b/flexmeasures/api/v3_0/tests/test_sensors_api.py index d67a3d219..7244be33e 100644 --- a/flexmeasures/api/v3_0/tests/test_sensors_api.py +++ b/flexmeasures/api/v3_0/tests/test_sensors_api.py @@ -127,7 +127,11 @@ def test_patch_sensor(client, setup_api_test_data): @pytest.mark.parametrize( "attribute, value", - [("generic_asset_id", 8), ("entity_address", "ea1.2025-01.io.flexmeasures:fm1.1")], + [ + ("generic_asset_id", 8), + ("entity_address", "ea1.2025-01.io.flexmeasures:fm1.1"), + ("id", 7), + ], ) def test_patch_sensor_for_excluded_attribute( client, setup_api_test_data, attribute, value diff --git a/flexmeasures/data/schemas/sensors.py b/flexmeasures/data/schemas/sensors.py index 5bb7d1421..2826e6413 100644 --- a/flexmeasures/data/schemas/sensors.py +++ b/flexmeasures/data/schemas/sensors.py @@ -26,6 +26,7 @@ class Meta: model = Asset """ + id = ma.auto_field(dump_only=True) name = ma.auto_field(required=True) unit = ma.auto_field(required=True) timezone = ma.auto_field()