Skip to content

Commit

Permalink
fix issue with default value
Browse files Browse the repository at this point in the history
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
  • Loading branch information
victorgarcia98 committed Jan 26, 2024
1 parent 304cd48 commit 43b7f72
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion flexmeasures/cli/data_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,7 @@ def serialize_quantity_or_sensor(qos: Sensor | ur.Quantity) -> dict | str:
"storage_efficiency",
type=QuantityOrSensor("%", default_src_unit="dimensionless"),
required=False,
default=1,
default="100%",
help="Storage efficiency (e.g. 95% or 0.95) to use for the schedule,"
" applied over each time step equal to the sensor resolution."
"This parameter also supports using a reference sensor as 'sensor:<id>' (e.g. sensor:34)."
Expand Down
4 changes: 4 additions & 0 deletions flexmeasures/data/schemas/sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ def _serialize(
)

def convert(self, value, param, ctx, **kwargs):
# case that the click default is defined in numeric values
if not isinstance(value, str):
return super().convert(value, param, ctx, **kwargs)

_value = re.match(r"sensor:(\d+)", value)

if _value is not None:
Expand Down

0 comments on commit 43b7f72

Please sign in to comment.