diff --git a/api/src/opentrons/drivers/absorbance_reader/async_byonoy.py b/api/src/opentrons/drivers/absorbance_reader/async_byonoy.py index f9d0f0f39e77..489cb92d4f52 100644 --- a/api/src/opentrons/drivers/absorbance_reader/async_byonoy.py +++ b/api/src/opentrons/drivers/absorbance_reader/async_byonoy.py @@ -11,6 +11,7 @@ AbsorbanceHidInterface as AbsProtocol, ErrorCodeNames, DeviceStateNames, + SlotStateNames, ) from opentrons.drivers.types import ( AbsorbanceReaderLidStatus, @@ -276,17 +277,10 @@ async def get_single_measurement(self, wavelength: int) -> List[float]: ) async def get_plate_presence(self) -> AbsorbanceReaderPlatePresence: - presence = await self._loop.run_in_executor( executor=self._executor, func=self._get_slot_status ) - map = { - AbsProtocol.SlotState.BYONOY_SLOT_STATE_UNKNOWN: AbsorbanceReaderPlatePresence.UNKNOWN, - AbsProtocol.SlotState.BYONOY_SLOT_STATE_EMPTY: AbsorbanceReaderPlatePresence.ABSENT, - AbsProtocol.SlotState.BYONOY_SLOT_STATE_OCCUPIED: AbsorbanceReaderPlatePresence.PRESENT, - AbsProtocol.SlotState.BYONOY_SLOT_UNDETERMINED: AbsorbanceReaderPlatePresence.UNKNOWN, - } - return map[presence] + return self.convert_plate_presence(presence.name) async def get_device_status(self) -> AbsorbanceReaderDeviceState: status = await self._loop.run_in_executor( @@ -306,3 +300,15 @@ def convert_device_state( "BYONOY_DEVICE_STATE_ERROR": AbsorbanceReaderDeviceState.ERROR, } return state_map[device_state] + + @staticmethod + def convert_plate_presence( + slot_state: SlotStateNames, + ) -> AbsorbanceReaderPlatePresence: + state_map: Dict[SlotStateNames, AbsorbanceReaderPlatePresence] = { + "BYONOY_SLOT_UNKNOWN": AbsorbanceReaderPlatePresence.UNKNOWN, + "BYONOY_SLOT_EMPTY": AbsorbanceReaderPlatePresence.ABSENT, + "BYONOY_SLOT_OCCUPIED": AbsorbanceReaderPlatePresence.PRESENT, + "BYONOY_SLOT_UNDETERMINED": AbsorbanceReaderPlatePresence.UNKNOWN, + } + return state_map[slot_state] \ No newline at end of file