https://github.com/pioreactor/pioreactor_custom_dosing_automation
An example package of how to build an automation for Pioreactor
https://github.com/pioreactor/pioreactor_custom_dosing_automation
pioreactor-plugin
Last synced: 8 months ago
JSON representation
An example package of how to build an automation for Pioreactor
- Host: GitHub
- URL: https://github.com/pioreactor/pioreactor_custom_dosing_automation
- Owner: Pioreactor
- License: mit
- Created: 2021-05-22T23:21:40.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-08-29T20:18:01.000Z (over 3 years ago)
- Last Synced: 2025-07-11T03:22:31.710Z (11 months ago)
- Topics: pioreactor-plugin
- Language: Python
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## An example of how to include a custom dosing / LED / temperature automation
This is an example repository for creating a custom automation for the [Pioreactor](https://pioreactor.com/). By turning your automation into a repository, it can be installed easier into your Pioreactor cluster, and can be shared with others:
If available on PyPI:
```
pio install-plugin
```
(And also `pios` to install across your entire cluster.)
If avaiable on Github:
```
pio install-plugin --url
```
### Components to make your own automation plugin
#### Python logic
This is the core logic that interacts with the pioreactor software. See the class `MyCustomDosingAutomation` for details. Note the following:
- subclasses from `DosingAutomationJobContrib`, `LEDAutomationJobContrib`, or `TemperatureAutomationJobContrib`
- requires a `automation_name`
- requires an `execute`
There are many other examples of automations in our core [repository](https://github.com/Pioreactor/pioreactor/tree/master/pioreactor/automations)
It's important that the class is imported into the `__init__.py`, as this is how `DosingController` discovers it.
#### `setup.py`
This can be copy-pasted into your project, with the fields updated. The most important field is
```python
entry_points={'pioreactor.plugins': 'pioreactor_custom_dosing_automation = pioreactor_custom_dosing_automation'},
```
This is necessary, and your code should be updated with the correct name of your plugin.
### Adding specific settings to config.ini
Using the file `additional_config.ini` (must be located in the source code's folder), you can add user-editable settings for your automation. This will be merged into the `config.ini`.
### Adding your automation to the UI
You can specify the automation in the automation drop-down in the UI, and specify its fields and default values to be shown to the user.
Create a folder called `ui` in the source code folder. Inside it, create a folder called `contrib`. And inside that, create a folder depending on your automation type: `dosing`, `led`, or `temperature`. See below for example directory structure.
### `MANIFEST.in`
In order for Python to include `ui` and/or `additional_config.ini`, we need to specify them in a `MANIFEST.in` file. Copy-paste the `MANIFEST.in` from this project, and make the appropriate substitutions in its contents.
### Example directory structure for your plugin
```
plugin_name/
__init__.py
other_python_files.py
additional_config.ini
ui/
contrib/
automations/
dosing/
plugin_name.yaml OR
led/
plugin_name.yaml OR
temperature/
plugin_name.yaml
setup.py
MANIFEST.in
```