Can we "post" actions to the Pioreactor?

My friends and I are making an art installation with the pioreactor setup. It’d be really cool if we can make our own simplified UI where people can perform some of the functions (add medium, remove waste, adjust target temperature) without going through the full Pioreactor website interface.

From the API page, it doesn’t look like we can post any of those actions yet. API | Pioreactor Docs Would it be possible to implement that at some point?

Hi @wendiy, that sounds wild!

There’s a “secret” API that we use for these actions. Instead of hitting an endpoint in the web UI, we publish a message to MQTT, and this is sent to the specific Pioreactor and job. For example:

To change the target RPM for stirring

  1. Stirring must be on
  2. Publish the message 500 (for 500 RPM) to the topic:
    pioreactor/{unit}/{experiment}/stirring/target_rpm/set
    

To change the target temperature

  1. thermostat automation must be on
  2. Publish the message 35 (for 35C) to the topic:
    pioreactor/{unit}/{experiment}/temperature_automation/target_temperature/set
    

To change an LED

  1. Publish the message {"B": 50} (for change channel B to 50%) to the topic:
    pioreactor/{unit}/{experiment}/led_intensity/run
    

I’m happy to explain more about how and why we do it this way, and help with implementation on your end.


Dosing can be done a few ways. There’s an “easy” way, but its easy to make the vial overflow. Can I hear more about how you want to handle people arbitrarily adding media? Ex: allow users to add media is small doses, and then automatically remove waste right after?

1 Like

In the future, this may all go through a web endpoint and this post is making me want to do that sooner rather than later! However, that endpoint’s logic would still just do a publish to MQTT.

1 Like

Actually we do have an endpoint for running actions! I don’t know why I missed this, but 3months ago we added the following PATCH endpoint:

/api/workers/<unit>/experiments/<experiment>/jobs/<job>/run

Runs specified job on unit.

The body is passed to the CLI, and should look like:


    {
      "options": {
        "option1": "value1",
        "option2": "value2"
      },
      "args": ["arg1", "arg2"]
    }