2828 FuzzyIntRange ,
2929 FuzzyTimeDelta ,
3030 JsonDictParamType ,
31- SelectorParamType ,
31+ TargetComponentParamType ,
3232)
3333from ._client import Client
3434
@@ -79,7 +79,7 @@ async def cli(ctx: click.Context, url: str, key: str) -> None:
7979@cli .command ("list" )
8080@click .pass_context
8181@click .argument ("microgrid-id" , required = True , type = int )
82- @click .option ("--selector " , "-s " , type = SelectorParamType (), multiple = True )
82+ @click .option ("--target " , "-t " , type = TargetComponentParamType (), multiple = True )
8383@click .option ("--start-from" , type = FuzzyDateTime ())
8484@click .option ("--start-to" , type = FuzzyDateTime ())
8585@click .option ("--end-from" , type = FuzzyDateTime ())
@@ -92,11 +92,12 @@ async def list_(ctx: click.Context, /, **filters: Any) -> None:
9292
9393 Lists all dispatches for MICROGRID_ID that match the given filters.
9494
95- The selector option can be given multiple times.
95+ The target option can be given multiple times.
9696 """
97- if "selector" in filters :
98- selector = filters .pop ("selector" )
99- filters ["component_selectors" ] = selector
97+ if "target" in filters :
98+ target = filters .pop ("target" )
99+ # Name of the parameter in client.list()
100+ filters ["target_components" ] = target
100101
101102 num_dispatches = 0
102103 async for page in ctx .obj ["client" ].list (** filters ):
@@ -241,7 +242,7 @@ def validate_reccurance(ctx: click.Context, param: click.Parameter, value: Any)
241242 required = True ,
242243 type = str ,
243244)
244- @click .argument ("selector " , required = True , type = SelectorParamType ())
245+ @click .argument ("target " , required = True , type = TargetComponentParamType ())
245246@click .argument ("start-time" , required = True , type = FuzzyDateTime ())
246247@click .argument ("duration" , required = False , type = FuzzyTimeDelta ())
247248@click .option ("--active" , "-a" , type = bool , default = True )
@@ -260,7 +261,7 @@ async def create(
260261 Creates a new dispatch for MICROGRID_ID of type TYPE running for DURATION seconds
261262 starting at START_TIME.
262263
263- SELECTOR is a comma-separated list of either component categories or component IDs.
264+ TARGET is a comma-separated list of either component categories or component IDs.
264265 Possible component categories: "BATTERY, GRID, METER, INVERTER, EV_CHARGER, CHP".
265266 """
266267 # Remove keys with `None` value
@@ -286,7 +287,7 @@ async def create(
286287@click .option ("--start-time" , type = FuzzyDateTime ())
287288@click .option ("--duration" , type = FuzzyTimeDelta ())
288289@click .option ("--no-duration" , is_flag = True )
289- @click .option ("--selector " , type = SelectorParamType ())
290+ @click .option ("--target " , type = TargetComponentParamType ())
290291@click .option ("--active" , type = bool )
291292@click .option (
292293 "--payload" , "-p" , type = JsonDictParamType (), help = "JSON payload for the dispatch"
0 commit comments