|
5 | 5 | from typing_extensions import Literal
|
6 | 6 |
|
7 | 7 | from opentrons.protocol_engine.state.update_types import StateUpdate
|
| 8 | +from opentrons.protocol_engine.types import LiquidId |
| 9 | +from opentrons.protocol_engine.errors import InvalidLiquidError |
8 | 10 |
|
9 | 11 | from .command import AbstractCommandImpl, BaseCommand, BaseCommandCreate, SuccessData
|
10 | 12 | from ..errors.error_occurrence import ErrorOccurrence
|
|
19 | 21 | class LoadLiquidParams(BaseModel):
|
20 | 22 | """Payload required to load a liquid into a well."""
|
21 | 23 |
|
22 |
| - liquidId: str = Field( |
| 24 | + liquidId: LiquidId = Field( |
23 | 25 | ...,
|
24 |
| - description="Unique identifier of the liquid to load.", |
| 26 | + description="Unique identifier of the liquid to load. If this is the sentinel value EMPTY, all values of volumeByWell must be 0.", |
25 | 27 | )
|
26 | 28 | labwareId: str = Field(
|
27 | 29 | ...,
|
28 | 30 | description="Unique identifier of labware to load liquid into.",
|
29 | 31 | )
|
30 | 32 | volumeByWell: Dict[str, float] = Field(
|
31 | 33 | ...,
|
32 |
| - description="Volume of liquid, in µL, loaded into each well by name, in this labware.", |
| 34 | + description="Volume of liquid, in µL, loaded into each well by name, in this labware. If the liquid id is the sentinel value EMPTY, all volumes must be 0.", |
33 | 35 | )
|
34 | 36 |
|
35 | 37 |
|
@@ -57,6 +59,12 @@ async def execute(self, params: LoadLiquidParams) -> SuccessData[LoadLiquidResul
|
57 | 59 | self._state_view.labware.validate_liquid_allowed_in_labware(
|
58 | 60 | labware_id=params.labwareId, wells=params.volumeByWell
|
59 | 61 | )
|
| 62 | + if params.liquidId == "EMPTY": |
| 63 | + for well_name, volume in params.volumeByWell.items(): |
| 64 | + if volume != 0.0: |
| 65 | + raise InvalidLiquidError( |
| 66 | + 'loadLiquid commands that specify the special liquid "EMPTY" must set volume to be 0.0, but the volume for {well_name} is {volume}' |
| 67 | + ) |
60 | 68 |
|
61 | 69 | state_update = StateUpdate()
|
62 | 70 | state_update.set_liquid_loaded(
|
|
0 commit comments