This Python package provides control of AMF rotary valves.
$ pip install amf-rotary-valve
# List available devices
$ python -m amf_rotary_valve
from amf_rotary_valve import AMFDevice
device = AMFDevice(address="COM3")
device = AMFDevice(address="/dev/tty.usbmodem1101")
async with device:
await device.home()
valve_count = await device.get_valve_count()
current_valve = await device.get_valve()
# Rotate to the next valve
await device.rotate(current_valve % valve_count + 1)
for info in AMFDevice.list():
async with info.create() as device:
print(await device.get_unique_id())