Plugins
Introduction
This document provides the information necessary to configure a COSMOS plugin. Plugins are how you configure and extend COSMOS.
Plugins are where you define Targets (and their corresponding command and telemetry packet definitions), Interfaces needed to talk to targets, Routers to stream raw data out of COSMOS, Microservices to provide new functionality, Widgets and Tools to add new GUIs, and Script Engines to implement custom script languages.
Plugin Targets must be installed (or re-installed) to update commands, telemetry, conversions, limits responses, microservices, and anything that changes the structure of a packet or contains code (conversions, limits responses, etc). Certain aspects of a Target can be changed through APIs like limits but most require reinstalling the Target. Note that COSMOS also supports Dynamic Packets but this is meant for use during COSMOS plugin initialization rather than while running.
Each plugin is built as a Ruby gem and thus has a plugin.gemspec file which builds it. Plugins have a plugin.txt file which declares all the variables used by the plugin and how to interface to the target(s) it contains.
Concepts
Target
Targets are the external pieces of hardware and/or software that COSMOS communicates with. These are things like Front End Processors (FEPs), ground support equipment (GSE), custom software tools, and pieces of hardware like satellites themselves. A target is anything that COSMOS can send commands to and receive telemetry from.
Interface
Interfaces implement the physical connection to one or more targets. They are typically ethernet connections implemented using TCP or UDP but can be other connections like serial ports. Interfaces send commands to targets and receive telemetry from targets.
Router
Routers flow streams of telemetry packets out of COSMOS and receive streams of commands into COSMOS. The commands are forwarded by COSMOS to associated interfaces. Telemetry comes from associated interfaces.
Widgets
COSMOS Widgets are GUI elements that can be placed on Screens in Telemetry Viewer.
Tool
COSMOS Tools are web-based applications the communicate with the COSMOS APIs to perform takes like displaying telemetry, sending commands, and running scripts.
Microservice
Microservices are persistent running backend code that runs within the COSMOS environment. They can process data and perform other useful tasks.
Script Engines
Script Engines enhance Script Runner by providing the implementation of a new file type and language. The new language must be implemented in either Ruby or Python but can support any custom Domain Specific Language (DSL). For a real example see our CSTOL implementation.
Installation Process
Plugin installation happens in two phases via the Admin Plugins tab or the ./openc3.sh cli load command.
Phase 1: Extract Variables
COSMOS uploads the plugin gem file to an internal gem server and extracts the gem contents to a temporary directory. It then reads and parses the plugin.txt file to extract all VARIABLE definitions along with their descriptions and options. These variables are returned to the Admin Plugins UI where the user can set values before proceeding to Phase 2.
Phase 2: Deploy
Once variables are set, COSMOS registers the plugin model in Redis and installs the Ruby gem. If the plugin contains Python dependencies (pyproject.toml or requirements.txt), COSMOS creates an isolated UV virtual environment for the plugin at /gems/plugin_venvs/<SCOPE>__<plugin name>/.venv and installs the dependencies into it. The plugin name is the installed name, with characters other than A-Z, a-z, 0-9, _ and - replaced by _. For example, openc3-cosmos-gse-1.0.0.gem__20250116214539 installed in the DEFAULT scope gets /gems/plugin_venvs/DEFAULT__openc3-cosmos-gse-1_0_0_gem__20250116214539/.venv. This gives each plugin full dependency isolation — different plugins can require different versions of the same package without conflicts.
Declare a plugin's Python dependencies in pyproject.toml. COSMOS also reads requirements.txt, but that format is deprecated:
pyproject.toml— With auv.lock, COSMOS runsuv sync --frozen, which installs exactly the locked versions. Without auv.lock, or ifuv sync --frozenfails, COSMOS runsuv pip installand resolves against thepypi_urlindex. If that fails, for example because thepyproject.tomlis not a buildable package, COSMOS compiles its declared dependencies into a requirements file and installs from that. A plugin built withoffline_installinstalls from the wheels bundled in its gem instead.requirements.txt(deprecated) — COSMOS still installs it withuv pip install -r requirements.txtso that existing plugins keep working. Do not use it for new plugins. It has no lock file, so each install can resolve different versions, and it cannot useoffline_install. If a plugin ships both files and nouv.lock, COSMOS installs fromrequirements.txt. To move a plugin topyproject.toml:- Copy the
pyproject.tomlfrom a plugin generated withopenc3.sh cli generate plugin <NAME> --python, and set itsname. - Run
uv add -r requirements.txt, thenuv lock. - Delete
requirements.txt, and check that the gemspec packagespyproject.tomlanduv.lock.
- Copy the
Both files are processed with ERB using the plugin variables before installation, so variables can select which dependencies are installed. ERB code can read files shipped next to the dependency file with File.dirname(__FILE__). For example, a requirements.txt that installs only the driver for the selected device:
<%- require 'json' -%>
<%= JSON.parse(File.read(File.join(File.dirname(__FILE__), 'drivers.json')))[device_type].join("\n") %>
A uv.lock is used as-is, so a plugin whose pyproject.toml dependencies depend on variables should not ship a uv.lock.
A plugin venv always uses the Python in the COSMOS image: currently Python 3.13 in the standard images and Python 3.12 in the UBI images. The images set UV_PYTHON_DOWNLOADS=never, so uv cannot download a different Python for a plugin. A plugin's requires-python must therefore accept the image's Python, or its install fails.
System Python packages (those shipped in the COSMOS Docker image) are pre-seeded into the UV download cache, so plugins that depend on those packages reuse them without re-downloading.
COSMOS tries these installs in order and stops at the first one that succeeds:
- Per-plugin venv. COSMOS runs uv to install into the plugin's own venv, unless the
OPENC3_USE_UVenvironment variable isfalseoruvis not onPATH. - Shared folder. If step 1 failed or was skipped, COSMOS installs the dependencies into the shared
/gems/python_packagesfolder, which is on thePYTHONPATHof scripts and plugin microservices. It logs a warning first when step 1 failed. If the shared install fails, COSMOS retries it once with--no-index. A plugin built withoffline_installskips this step: the shared install would need a package index, so COSMOS logs an error instead.
If both fail, COSMOS logs a warning and finishes installing the plugin, so its non-Python parts still work.
List openc3 only in the plugin's dev dependency group, as the generated pyproject.toml does. If a plugin lists openc3 as a runtime dependency, COSMOS removes it from the plugin venv when it installs the plugin, and logs a warning, and the plugin uses the openc3 library shipped in the COSMOS image. A plugin venv comes first on PYTHONPATH, so its own copy would otherwise replace the system library for the plugin's scripts and microservices.
Dependencies are resolved against the pypi_url Admin Console setting, falling back to the PYPI_URL environment variable and then to public PyPI. When that setting names an index other than https://pypi.org, COSMOS treats it as authoritative and passes uv --no-config --no-sources, so a plugin cannot resolve around it using an index declared in its own [tool.uv].index table or a [tool.uv].sources pin. A plugin depending on a package published only to its author's private index therefore fails to install unless your index serves that package too.
This applies only to the paths where uv resolves — requirements.txt plugins, and pyproject.toml plugins with no uv.lock. A plugin shipping a uv.lock installs with uv sync --frozen, which reuses the registry and wheel URLs already recorded in that lock and never consults an index, so a locked plugin still downloads from whatever index its author locked against.
Shipping a uv.lock is still recommended, including for air-gapped deployments. COSMOS first tries uv sync --frozen offline against its seeded package cache. If the URLs recorded in the lock are unreachable, for example because they point at public PyPI from an air-gapped network, COSMOS falls back to resolving the plugin's pyproject.toml against the configured pypi_url index, so the install still succeeds as long as that index serves the packages. This fallback ignores the versions pinned in uv.lock. To keep those pins in an air-gapped deployment, generate the lock against the same mirror, e.g. uv lock --no-config --no-sources --default-index <mirror-url>, so the recorded URLs point at an index the deployment can reach.
Offline installs with bundled wheels
Since Coming SoonA deployment with no index at all can install a plugin's Python dependencies from wheels bundled inside the plugin gem. Opt in from the plugin's pyproject.toml:
[tool.openc3]
offline_install = true
# Optional. By default the wheels target the machine running the build.
python_platforms = ["x86_64-manylinux_2_28", "aarch64-manylinux_2_28"]
python_version = "3.13"
Bundling is opt-in because every wheel adds to the gem's size. A dependency such as torch can add gigabytes, so only enable it when the deployment can't reach PyPI or a mirror.
When the plugin is built, the Rakefile runs cli bundlewheels before gem build. The build needs network access, and it:
- Fails unless
uv.lockexists and matchespyproject.toml(uv lock --check). - Lets uv choose the wheel for every locked runtime dependency on each target platform. uv evaluates environment markers and wheel tags for that platform.
- Downloads exactly those wheels from the URLs recorded in
uv.lockintopython_wheels/and checks each one against the sha256 inuv.lock. It also writespython_wheels/SHA256SUMS. - Installs from
python_wheels/alone, offline, for each target to prove the bundle is complete.
If the build stops, the message names the fix:
| Build error | Fix |
|---|---|
offline_install requires a uv.lock | Run openc3.sh cli lock in the plugin directory. |
uv.lock is out of date with pyproject.toml | pyproject.toml changed after the last lock, for example a dependency was added by hand. Run openc3.sh cli lock to update uv.lock. |
Could not find a compatible wheel for every locked package for <platform> | A dependency publishes no wheel for that platform or Python version (only a source distribution, or no build for that architecture). Pick a version that ships one, or drop that platform from python_platforms. |
offline_install can only bundle packages locked from a package index | A dependency is locked from a URL, git repository or local path, for example name @ https://.... An offline install can only take wheels from the bundle for packages locked from an index, so publish the package to an index or a find-links directory, depend on it by name, and run openc3.sh cli lock. |
Could not download ... HTTP 401 or HTTP 403 | The index that serves the wheels requires credentials. The build downloads the locked wheels without credentials, so it can't bundle from such an index yet. |
python_platforms also needs python_version | Add python_version, set to the deployment's Python, such as "3.13". |
python_version 3.10 is older than the plugin's requires-python | uv.lock only covers the Python versions requires-python in [project] allows. Set python_version to the deployment's Python, such as "3.13". |
python_version must be a Python version such as "3.13" | Give a major and minor version, such as "3.13". |
python3 (3.11 or newer) is required to read .../pyproject.toml | The build ran outside the COSMOS image without a new enough Python. Install Python 3.11 or newer so python3 is on PATH, or build with openc3.sh cli rake build. |
To create or update uv.lock, run openc3.sh cli lock in the plugin directory. It runs uv in the COSMOS image, so you don't need uv installed. Add --build VERSION to rebuild the gem in the same step. Locking needs network access to the package index, just like the build. uv resolves against the index in the plugin's [tool.uv] settings, or else the PYPI_URL the COSMOS image was built with. If you do have uv installed, uv lock and uv add <package> work as well.
Building outside the COSMOS image, for example with a locally installed rake build, needs uv and python3 3.11 or newer on PATH. COSMOS uses python3 to read pyproject.toml. openc3.sh cli rake build already has both.
To check a built gem later, for example against a deployment's platform before shipping it, run cli verifywheels. It prints a per-target report of the wheel serving each package and its hash check.
Updating dependencies
To change a dependency, edit pyproject.toml, then lock and build the next version:
% openc3.sh cli lock --build 1.0.1
Versions already in uv.lock stay as they are unless pyproject.toml no longer allows them. To move to newer versions, add --upgrade-package <name> (repeatable) or --upgrade for every dependency. Then upgrade the plugin in the Admin Console Plugins tab with the new gem.
Converting an existing plugin
A plugin generated before COSMOS supported offline_install needs a few files updated before it can bundle wheels. Compare with a newly generated plugin (openc3.sh cli generate plugin NAME --python) if yours has drifted from the template.
-
List the Python dependencies in
pyproject.toml. A plugin with only arequirements.txtmust move them to thedependencieslist in[project], becauseoffline_installis read frompyproject.tomland the wheels are bundled fromuv.lock. Then add the[tool.openc3]table shown above. -
In the
Rakefile, runopenc3cli bundlewheelsbeforegem build. Run it only whenoffline_installistrue, so the plugin still builds with a COSMOS version that has nobundlewheels:# Bundle the locked Python wheels into python_wheels/ when pyproject.toml sets# [tool.openc3] offline_install = true, so the gem installs on an air-gapped COSMOS.if File.exist?('pyproject.toml') && File.read('pyproject.toml').match?(/^[^#\n]*offline_install\s*=\s*true\b/)sh('openc3cli bundlewheels')endsh('gem', 'build', PLUGIN_NAME) -
In the gemspec, package the lock and the wheels by adding them to
s.files:s.files = Dir.glob("{targets,lib,public,tools,microservices}/**/*") + %w(Rakefile README.md LICENSE.md plugin.txt) +Dir.glob("{pyproject.toml,uv.lock}") + Dir.glob("python_wheels/*")Install rejects an
offline_installgem that lacksuv.lockorpython_wheels/. -
Add
python_wheels/to.gitignore. The build recreates it each time. -
Lock and build, then check the gem against the COSMOS image:
% openc3.sh cli lock --build 1.1.0% openc3.sh cli verifywheels openc3-cosmos-my-plugin-1.1.0.gem -
Upgrade the plugin in the Admin Console Plugins tab with the new gem. Its Python dependencies now install from the bundled wheels.
The gem ships uv.lock next to the wheels, so security scanners that read uv.lock cover every bundled package, and the bundled versions are exactly the locked ones.
At install, COSMOS rejects a gem that sets offline_install but has no uv.lock or python_wheels/. Otherwise it copies the wheels to offline_wheels/ in the shared UV cache (/gems/uv/offline_wheels) and installs with uv pip install --offline --no-index --find-links /gems/uv/offline_wheels --require-hashes, using requirements exported from the gem's uv.lock. Because that directory doesn't change between installs, reinstalling or upgrading the plugin reuses the cached packages instead of unpacking them again. The wheel files stay there after the plugin is uninstalled, so they count against the /gems volume. Any wheel whose hash differs from the lock is rejected. A package missing from the bundle, or built for another platform or Python version, fails the install with uv's message naming it. COSMOS doesn't fall back to an index for these plugins, including when uv is unavailable (OPENC3_USE_UV=false). In that case it logs an error and installs nothing. A failed Python dependency install doesn't stop the plugin install: COSMOS logs the error and still deploys the plugin's targets, microservices and other components, without their Python dependencies. Check the install log in the Admin Console after installing an offline_install plugin. Installing the wheels also adds them to the shared UV cache, so they appear in the Cached section of the Admin Console Packages tab.
Wheels with compiled code only install on the OS, CPU architecture and Python version they were built for. Pure-Python wheels install anywhere. Building with openc3.sh cli rake build runs the build in the COSMOS image, so the default target matches the deployment. When building on another machine, or for a deployment that runs more than one architecture, set python_platforms to uv's --python-platform names for the deployment and python_version to its Python version. python_platforms requires python_version; without it the wheels would match the build machine's Python.
After installing dependencies, COSMOS parses plugin.txt again with ERB variable substitution applied and deploys each component declared in the file: targets, interfaces, routers, microservices, tools, widgets, and script engines.
Target Deployment
When a target is deployed, its files are extracted from the gem's targets/<FOLDER>/ directory and uploaded to the configuration bucket under <SCOPE>/targets/<TARGET_NAME>/. This targets/ path represents the original, read-only target configuration as shipped by the plugin.
COSMOS also creates an archive zip in <SCOPE>/target_archives/<TARGET_NAME>/ which stores versioned snapshots of the target configuration. Each archive is identified by a SHA256 hash so previous versions can be restored.
The <SCOPE>/targets_modified/<TARGET_NAME>/ path stores user-editable modifications to targets. When a user edits screens, scripts, or other target files through the COSMOS UI, those changes are written to targets_modified/ rather than overwriting the originals in targets/. This separation means user customizations survive plugin upgrades — COSMOS reads from targets_modified/ first and falls back to targets/ for unmodified files. When a plugin is upgraded, files that the user has not modified are updated from the new plugin while user modifications in targets_modified/ are preserved.
Target deployment also automatically creates several microservices for each target:
- DECOM — Decommutates raw telemetry packets into individual data items
- COMMANDLOG — Logs raw command packets to the bucket storage
- PACKETLOG — Logs raw telemetry packets to the bucket storage
- CLEANUP — Removes old log files based on the configured retention time
- TSDB — Writes decommutated data to the time series database
- MULTI — Parent microservice that manages child processes for orderly startup and shutdown
DECOM, COMMANDLOG, PACKETLOG, and CLEANUP run as threads in the target's MULTI process. TSDB, and DECOM for a target with LANGUAGE python, run as their own Python processes.
Sharing Processes Between Targets
Each process uses roughly 80 to 100 MB of memory before it does any work, so a plugin with many targets can use a lot of memory. Targets that set MICROSERVICE_GROUP to the same name keep their own microservices but run them in two processes shared by the whole group:
| Microservice | Runs as threads |
|---|---|
<SCOPE>__MULTIGROUP__<GROUP> | Every member's DECOM (Ruby targets), COMMANDLOG, PACKETLOG, CLEANUP |
<SCOPE>__PYMULTIGROUP__<GROUP> | Every member's TSDB, and DECOM for Python targets |
TARGET THERMAL THERMAL
MICROSERVICE_GROUP HOUSEKEEPING
TARGET POWER POWER
MICROSERVICE_GROUP HOUSEKEEPING
Each target keeps its own microservices (for example DEFAULT__DECOM__THERMAL), settings, and status. The demo plugin puts its targets in the DEMO group (set its microservice_group variable to blank to give each target its own processes). Targets in different plugins can share a group. Some things to consider:
- All targets in a group must use the same SHARD and DB_SHARD.
- The decoms in one process share its write queue, which flushes at one interval: the fastest DECOM_UPDATE_INTERVAL of the group's Ruby targets (and separately of its Python targets). A target with a DECOM_UPDATE_INTERVAL of 0 doesn't use the queue and writes directly.
- A group can only have Python targets from one plugin, because its Python process uses that plugin's Python packages.
- MICROSERVICE_GROUP can't be combined with TARGET_MICROSERVICE.
- Installing, upgrading, or removing any target in the group restarts the group's processes, which briefly pauses processing for every target in it.
- The targets in a group share each process's CPU. Python threads in particular share one interpreter lock, so a group's Python process can fall behind sooner than separate processes would. Groups suit stable, low-rate targets. Give high-rate targets their own processes.
Interface and Router Deployment
Interfaces and routers each create a corresponding microservice that the operator starts as a running process. The microservice handles the physical connection (TCP, UDP, serial, etc.) and routes commands and telemetry to the appropriate Valkey pub/sub topics.
Tool Deployment
Tool files (HTML, JavaScript, CSS, fonts) are extracted from the gem's tools/<FOLDER>/ directory and uploaded to the tools bucket. Files are uploaded in dependency order: fonts first, then CSS, then HTML and JavaScript. This ensures assets are available when the tool's page loads. Tools appear in the COSMOS navigation bar after installation.
Widget Deployment
Widget JavaScript files and source maps are extracted and uploaded to the tools bucket. Widgets become available for use in Telemetry Viewer screens after installation.
Microservice Deployment
Custom microservice files are extracted from the gem's microservices/<FOLDER>/ directory and uploaded to the config bucket under <SCOPE>/microservices/<MICROSERVICE_NAME>/. The COSMOS operator watches Redis for new microservice definitions and starts them as running processes.
Uninstallation
When a plugin is uninstalled, COSMOS destroys all its components in dependency order: microservices are stopped first (with a wait period for graceful shutdown), then interfaces, routers, tools, widgets, targets, and script engines are removed. All associated files are deleted from both the configuration and tools buckets, and Redis state is cleaned up.
Shared Resources
Since 7.6.0A shared resource is something, typically expensive hardware, that is defined in several scopes but must only be used by one scope at a time. Add the SHARED_RESOURCE <Name> keyword to the interfaces, routers, microservices, and targets that use it. Everything with the same shared resource name, in any scope, belongs to the same shared resource.
TARGET CHAMBER CHAMBER
SHARED_RESOURCE THERMAL_VAC_CHAMBER
INTERFACE CHAMBER_INT tcpip_client_interface.py chamber 8080 8080 10.0 None
MAP_TARGET CHAMBER
SHARED_RESOURCE THERMAL_VAC_CHAMBER
MICROSERVICE CHAMBER_CTRL chamber_ctrl
TARGET_NAME CHAMBER
CMD python chamber_ctrl.py
SHARED_RESOURCE THERMAL_VAC_CHAMBER
The shared resource is active in one scope at a time:
- The first scope to install the shared resource owns it and it becomes active there.
- In every other scope the plugin installs normally, but the interface, router, and microservice processes are not started.
- Commands to the resource's targets are rejected in scopes where it isn't active, as are
connect_interface,interface_cmd,send_raw, and the router equivalents. The targets' own microservices (decom, logging, and cleanup) keep running in every scope, so telemetry screens,build_cmd,inject_tlm, and historical data still work. - Use switch_shared_resource to move the resource to another scope. Its processes in the old scope are stopped, and only once they have exited are the processes in the new scope started, so the hardware is never used by two scopes at once. Switching requires admin permission in both scopes.
- Use release_shared_resource to stop the resource in every scope.
- Upgrading or reinstalling a plugin keeps the resource active in the same scope. Uninstalling the plugin from the active scope leaves the resource assigned to that scope until it is switched to another scope.
SHARED_RESOURCE can't be used with BRIDGE.
Plugin Directory Structure
COSMOS plugins have a well-defined directory structure described in detail in the Code Generator documentation.
plugin.txt Configuration File
A plugin.txt configuration file is required for any COSMOS plugin. It declares the contents of the plugin and provides variables that allow the plugin to be configured at the time it is initially installed or upgraded. This file follows the standard COSMOS configuration file format of keywords followed by zero or more space separated parameters. The following keywords are supported by the plugin.txt config file:
VARIABLE
Define a configurable variable for the plugin
The VARIABLE keyword defines a variable that will be requested for the user to enter during plugin installation. Variables can be used to handle details of targets that are user defined such as specific IP addresses and ports. Variables should also be used to allow users to rename targets to whatever name they want and support multiple installations of the same target with different names. Variables can be used later in plugin.txt or in any other configuration file included in a plugin using Ruby ERB syntax. The variables are assigned to accessible local variables in the file. At a high level, ERB allows you to run Ruby code in configuration files.
| Parameter | Description | Required |
|---|---|---|
| Variable Name | The name of the variable | True |
| Default Value | Default value of the variable | True |
VARIABLE_DESCRIPTION
Since 7.0.0Add a description to a plugin variable
The VARIABLE_DESCRIPTION keyword adds a human-readable description to a previously defined VARIABLE. This description appears as hint text below the variable input field during plugin installation. Must follow a VARIABLE definition.
| Parameter | Description | Required |
|---|---|---|
| Description | Human-readable description of the variable's purpose | True |
Example Usage:
VARIABLE port 8080
VARIABLE_DESCRIPTION "TCP port for the target connection"
The example in the plugin install dialog:

VARIABLE_LABEL
Since 7.6.0Set the label of a plugin variable in the plugin installation dialog
The VARIABLE_LABEL keyword sets the label shown for the previously defined VARIABLE in the plugin installation dialog instead of the variable name. The variable name is still used in ERB and is shown when hovering over the field. Must follow a VARIABLE definition.
| Parameter | Description | Required |
|---|---|---|
| Label | Label shown in the plugin installation dialog | True |
Example Usage:
VARIABLE port_tgt 8080
VARIABLE_LABEL "Target Port"
The example in the plugin install dialog:

VARIABLE_TYPE
Since 7.6.0Set the input type of a plugin variable in the plugin installation dialog
The VARIABLE_TYPE keyword sets how the previously defined VARIABLE is entered and checked in the plugin installation dialog. BOOLEAN is a switch that sets true or false (and can be cleared to blank unless required). INTEGER and NUMBER must be numbers. PASSWORD hides the value while typing. JSON is a full width monospace field that must hold valid JSON. SECRET picks the name of a COSMOS secret from the scope's secrets, and a new secret can be created from the dialog. TARGET_NAME is the name of a target the plugin installs, which must be a valid target name not used by another target. On a new install, a TARGET_NAME whose default is already taken defaults to the next free name instead (INST_2, INST_3 and so on), so a plugin can be installed more than once. Changing or upgrading an install keeps its name. TEXT is the default. Blank values are allowed unless the variable is required (see VARIABLE_REQUIRED and VARIABLE_STATE_REQUIRED). The plugin installation dialog won't install with invalid values. The value is still passed to ERB as a string. Must follow a VARIABLE definition.
| Parameter | Description | Required |
|---|---|---|
| Type | Input type of the variable Valid Values: TEXT, BOOLEAN, INTEGER, NUMBER, PASSWORD, JSON, SECRET, TARGET_NAME | True |
Example Usage:
VARIABLE hostname localhost
VARIABLE_TYPE TEXT
VARIABLE port 8080
VARIABLE_TYPE INTEGER
VARIABLE poll_rate 0.5
VARIABLE_TYPE NUMBER
VARIABLE use_ssl false
VARIABLE_TYPE BOOLEAN
VARIABLE password ""
VARIABLE_TYPE PASSWORD
VARIABLE options '{"timeout": 5, "retries": 3}'
VARIABLE_TYPE JSON
VARIABLE api_key_secret API_KEY
VARIABLE_TYPE SECRET
VARIABLE inst_target_name INST
VARIABLE_TYPE TARGET_NAME
The example in the plugin install dialog:

VARIABLE_GROUP
Since 7.6.0Show a plugin variable in a titled section of the plugin installation dialog
The VARIABLE_GROUP keyword puts the previously defined VARIABLE in a titled section of the plugin installation dialog, e.g. Connection or Authentication. Variables without a group are shown first, then each group in the order it is first used. VARIABLE_ADVANCED variables are shown in the collapsed Advanced section whatever their group. Must follow a VARIABLE definition.
| Parameter | Description | Required |
|---|---|---|
| Group Name | Title of the section | True |
Example Usage:
VARIABLE hostname localhost
VARIABLE_GROUP Connection
VARIABLE port 8080
VARIABLE_GROUP Connection
VARIABLE username ""
VARIABLE_GROUP Authentication
The example in the plugin install dialog:

VARIABLE_REQUIRED
Since 7.6.0Require a value for a plugin variable in the plugin installation dialog
The VARIABLE_REQUIRED keyword marks the previously defined VARIABLE as required. The plugin installation dialog won't install while the variable is shown and blank. Required variables are marked with *. Use VARIABLE_STATE_REQUIRED to require a variable only while a state is selected. Must follow a VARIABLE definition.
Example Usage:
VARIABLE hostname ""
VARIABLE_REQUIRED
The example in the plugin install dialog:

VARIABLE_PATTERN
Since 7.6.0Check the value of a plugin variable against a regular expression
The VARIABLE_PATTERN keyword gives a regular expression that the whole value of the previously defined VARIABLE must match in the plugin installation dialog. Blank values aren't checked (see VARIABLE_REQUIRED). The plugin installation dialog won't install while a shown variable doesn't match, and shows the error message. The pattern is checked in the browser so use regular expressions that JavaScript supports. Must follow a VARIABLE definition.
| Parameter | Description | Required |
|---|---|---|
| Regular Expression | Regular expression the whole value must match | True |
| Error Message | Message shown when the value doesn't match. Defaults to showing the regular expression. | False |
Example Usage:
VARIABLE inst_target_name INST
VARIABLE_PATTERN "[A-Z][A-Z0-9_]*" "Use capital letters, numbers and underscores"
The example in the plugin install dialog:

VARIABLE_HIDDEN
Since 7.6.0Hide a plugin variable from the plugin installation dialog
The VARIABLE_HIDDEN keyword hides the previously defined VARIABLE in the plugin installation dialog. Its value is set by the VARIABLE_STATE_SET and VARIABLE_DISCOVERY_SET keywords of other variables and can be used in ERB and as a VARIABLE_DISCOVERY parameter, for example to pass per state parameters to a discovery. Since it can't be edited, a hidden variable always takes the values set by the selected states of the installed plugin.txt, including when upgrading. Must follow a VARIABLE definition.
Example Usage:
VARIABLE device shelly
VARIABLE_STATE Shelly shelly
VARIABLE_STATE_SET mdns_types _shelly._tcp.local.
VARIABLE_STATE "Philips Hue" hue
VARIABLE_STATE_SET mdns_types _hue._tcp.local.
VARIABLE mdns_types ""
VARIABLE_HIDDEN
VARIABLE host ""
VARIABLE_DISCOVERY openc3/discovery/zeroconf_discovery.py ${mdns_types}
The example in the plugin install dialog:

VARIABLE_ADVANCED
Since 7.6.0Show a plugin variable in the advanced section of the plugin installation dialog
The VARIABLE_ADVANCED keyword marks the previously defined VARIABLE as advanced. Advanced variables are shown in a section of the plugin installation dialog that is collapsed by default, for settings that normally don't need to change. VARIABLE_STATE_SHOW still controls whether an advanced variable is shown. Must follow a VARIABLE definition.
Example Usage:
VARIABLE host 127.0.0.1
VARIABLE timeout 10
VARIABLE_DESCRIPTION "Connection timeout in seconds"
VARIABLE_ADVANCED
The example in the plugin install dialog:

VARIABLE_MULTIPLE
Since 7.6.0Let the user select any number of a plugin variable's states
The VARIABLE_MULTIPLE keyword makes the previously defined VARIABLE a multi-select of its VARIABLE_STATEs, which are the only values it can have. In ERB its value is an Array of the selected state values, in the order of the states (e.g. <%= sensors.join(',') %>), which is empty when none are selected. The VARIABLE default is the initially selected state values separated by commas, and each must be a VARIABLE_STATE value. The VARIABLE_STATE_SHOW, VARIABLE_STATE_REQUIRED and VARIABLE_TEXT_START of every selected state apply, and the VARIABLE_STATE_SET keywords of a state are applied when it is selected, so two of its states can't set the same variable. A VARIABLE_STATE_SET or VARIABLE_DISCOVERY_SET of another variable selects its states with values separated by commas. VARIABLE_REQUIRED requires at least one state to be selected. It can't be used with VARIABLE_TYPE, VARIABLE_PATTERN, VARIABLE_DISCOVERY, VARIABLE_FILE or VARIABLE_BRIDGE, or as a ${name} parameter of a VARIABLE_DISCOVERY. Must follow a VARIABLE definition.
Example Usage:
VARIABLE sensors TEMP,PRESS
VARIABLE_LABEL Sensors
VARIABLE_MULTIPLE
VARIABLE_STATE Temperature TEMP
VARIABLE_STATE_SHOW temp_rate
VARIABLE_STATE Pressure PRESS
VARIABLE_STATE Humidity HUM
VARIABLE temp_rate 10
<% sensors.each do |sensor| %>
TARGET SENSOR <%= sensor %>
<% end %>
The example in the plugin install dialog:

VARIABLE_BRIDGE
Since 7.6.0Let the user select which bridge the plugin uses
The VARIABLE_BRIDGE keyword defines a variable named bridge_name whose value is selected from the bridges available in COSMOS when the plugin is installed. Bridges connect COSMOS to openc3-cosmos-app running on a host computer, so this chooses which host the plugin's bridged interfaces and VARIABLE_DISCOVERY run on. Use bridge_name in ERB like any other variable, for example with the BRIDGE interface modifier. VARIABLE_DESCRIPTION, VARIABLE_STATE and the other VARIABLE modifiers can follow it. Defining VARIABLE bridge_name in the same plugin.txt is an error.
| Parameter | Description | Required |
|---|---|---|
| Default Bridge Name | Bridge selected by default. Defaults to DEFAULT, the bridge every scope has. | False |
Example Usage:
VARIABLE_BRIDGE
VARIABLE_DESCRIPTION "Bridge to the computer the serial device is connected to"
VARIABLE serial_port /dev/ttyUSB0
VARIABLE_DISCOVERY openc3/discovery/serial_discovery.py
INTERFACE SERIAL_INT serial_interface.py <%= serial_port %> <%= serial_port %> 115200 NONE 1 10.0 nil
BRIDGE <%= bridge_name %>
The example in the plugin install dialog:

VARIABLE_FILE
Since 7.6.0Let the user upload a file into the plugin when installing it
The VARIABLE_FILE keyword defines a variable whose value is a file the user uploads in the plugin dialog, such as a calibration table, a certificate or an interface control document. The file is stored with the plugin so upgrades keep it, and is copied to the destination path in the plugin before anything is installed from it. In ERB the variable is the destination path, or blank if no file was uploaded, so plugin.txt can include the file conditionally. Uploading a file again replaces it. VARIABLE_DESCRIPTION, VARIABLE_LABEL, VARIABLE_REQUIRED and the other VARIABLE modifiers except VARIABLE_TYPE can follow it. A PRE_INSTALL_SCRIPT can read the file to generate the rest of the plugin. Files can be up to 100 MB. List file extensions after the destination path to only accept files with one of them, e.g. .csv .xlsx. Extensions aren't case sensitive.
| Parameter | Description | Required |
|---|---|---|
| Variable Name | The name of the variable | True |
| Destination Path | Path the uploaded file is copied to, relative to the top of the plugin. It must stay inside the plugin and is created if needed. | True |
| File Extensions | Any number of file extensions the uploaded file must have one of, e.g. .csv .xlsx. The leading dot is optional. Any file is accepted if none are given. | False |
Example Usage:
VARIABLE_FILE icd targets/INST/data/icd.csv .csv
VARIABLE_LABEL "Interface control document"
VARIABLE_REQUIRED
PRE_INSTALL_SCRIPT scripts/generate_target.py <%= icd %>
TARGET INST INST
The example in the plugin install dialog:

VARIABLE_DISCOVERY
Since 7.6.0Discover the possible values of a plugin variable from the host computer
The VARIABLE_DISCOVERY keyword runs a Python discovery class on the host computer paired with COSMOS through openc3-cosmos-app, using the bridge selected by VARIABLE_BRIDGE (or the DEFAULT bridge). The values it finds are added to the dropdown for the previously defined VARIABLE in the plugin installation dialog, after any VARIABLE_STATE options. Discovery runs when the dialog opens and can be refreshed. When installing a new plugin, the first available discovered value is selected automatically unless a value was already chosen. If openc3-cosmos-app is not running the variable can still be typed in by hand. Discovery classes subclass openc3/discovery/discovery.py and implement discover(), or scan() and match(). Parameters can include the value of another variable as ${name}. A variable holding several space separated values passes each as a parameter. The discovery reruns when a referenced variable changes, and is skipped when they are all blank. COSMOS provides openc3/discovery/serial_discovery.py (lists serial ports, optionally limited to USB VID:PID parameters (the PID can be omitted) like 10C4:EA60), openc3/discovery/hid_discovery.py (lists the serial numbers of USB HID devices, optionally limited by Vendor ID and Product ID, and requires the hidapi package on the host), openc3/discovery/zeroconf_discovery.py (lists the IP addresses of devices advertising the mDNS service types given as parameters, each optionally followed by |name=glob or |property=glob filters, e.g. _http._tcp.local.|name=shelly*) and openc3/discovery/bluetooth_discovery.py (lists the addresses of Bluetooth LE devices matching any of the matchers given as parameters, each made of local_name=glob, service_uuid=uuid, service_data_uuid=uuid, manufacturer_id=id or manufacturer_data_start=hex (the start of that manufacturer's data) joined with |). It also provides openc3/discovery/usb_discovery.py (lists USB devices other than hubs by serial number, or by location like 1-2.3 when they have none, matching any of the parameters, each a hex VID:PID (the PID can be omitted) or conditions joined with | from vid=hex, pid=hex, class=hex (the device class or that of any interface, optionally with /subclass and /protocol, e.g. class=0E for cameras or class=FE/03 for USB test instruments), manufacturer=glob, product=glob and serial=glob, and requires the pyusb and libusb-package packages on the host), openc3/discovery/ssdp_discovery.py (lists the IP addresses of network devices advertising themselves with SSDP / UPnP, matching any of the parameters, each key=glob conditions joined with | where the keys are the search response headers st, usn and server and the device description fields devicetype, friendlyname, manufacturer, manufacturerurl, modelname, modelnumber, modeldescription, modelurl, serialnumber, udn, upc and presentationurl, e.g. manufacturer=Sonos*|modelname=Sonos?Era*) and openc3/discovery/neighbor_discovery.py (lists the IP addresses in the host's ARP table, i.e. devices it has recently communicated with, matching any of the parameters, each mac=glob (hex digits with or without separators, e.g. mac=00D02D*), hostname=glob (from reverse DNS) or ip=glob conditions joined with |). Globs are case-insensitive. Use ? for a space in a glob since parameters are separated by spaces. A variable can have multiple VARIABLE_DISCOVERY keywords and their results are combined. Each can be followed by VARIABLE_DISCOVERY_SET keywords that set other variables when a value it found is selected. Discovered values are claimed by the plugin that uses them. Once a plugin is installed, the value it chose for a VARIABLE_DISCOVERY variable (for example a serial port) is no longer offered to other plugins discovering with the same class on the same bridge, and the dialog notes which plugin is using it. The claim is released when the plugin is uninstalled. Upgrading or editing the plugin still offers the values it holds. Must follow a VARIABLE definition.
| Parameter | Description | Required |
|---|---|---|
| Discovery Class Filename or Module | Python filename (e.g. openc3/discovery/serial_discovery.py) or module name (e.g. openc3.discovery.serial_discovery) of the discovery class, relative to the Python path on the host. The class is named after the file, e.g. SerialDiscovery. | True |
| Discovery Parameters | Additional parameters are passed to the discovery class constructor | False |
Example Usage:
VARIABLE serial_port /dev/ttyUSB0
VARIABLE_DISCOVERY openc3/discovery/serial_discovery.py
VARIABLE controller_serial nil
VARIABLE_STATE "First controller found" nil
VARIABLE_DISCOVERY openc3.discovery.hid_discovery 0x054C 0x0CE6
VARIABLE light_host ""
VARIABLE_DISCOVERY openc3/discovery/zeroconf_discovery.py _hue._tcp.local.
The example in the plugin install dialog:

VARIABLE_DISCOVERY_SET
Since 7.6.0Set another plugin variable when a value found by this discovery is selected
The VARIABLE_DISCOVERY_SET keyword applies to the previously defined VARIABLE_DISCOVERY. When the user selects a value in the plugin installation dialog that this discovery found, the named variable is set to the given value. This lets one variable configure others based on the kind of device found, for example the controller model. If several discoveries find the same value, the first one's sets apply. The user can still change the value afterwards. Multiple VARIABLE_DISCOVERY_SET keywords can be used. Must follow a VARIABLE_DISCOVERY definition.
| Parameter | Description | Required |
|---|---|---|
| Variable Name | Name of the variable to set when a value found by this discovery is selected | True |
| Value | Value to set the variable to | True |
Example Usage:
VARIABLE dual_sense_version 5
VARIABLE_STATE 5 5
VARIABLE_STATE 4 4
VARIABLE dual_sense_serial_num None
VARIABLE_DISCOVERY openc3.discovery.hid_discovery 0x054C 0x05C4
VARIABLE_DISCOVERY_SET dual_sense_version 4
VARIABLE_DISCOVERY openc3.discovery.hid_discovery 0x054C 0x0CE6
VARIABLE_DISCOVERY_SET dual_sense_version 5
The example in the plugin install dialog:

VARIABLE_STATE
Since 7.0.0Add a selectable state for a plugin variable
The VARIABLE_STATE keyword defines a selectable state for a previously defined VARIABLE. When states are defined for a variable, it renders as a dropdown/combobox in the plugin installation dialog instead of a text field. Users can still type custom values if needed. Multiple VARIABLE_STATE keywords can be used to define multiple states. The dropdown is searched by typing words in any order, allowing small typos, with the closest matches first. Text left in the field that doesn't name a state is kept as a custom value, unless it was a search that found states without one being picked. That is text with spaces, or any such search when the variable's states show, set or require other variables (or have VARIABLE_TEXT). Enter picks the closest match for those searches. Must follow a VARIABLE definition.
| Parameter | Description | Required |
|---|---|---|
| State Description | Human-readable description of what this state represents. Appears as option in the dropdown. | False |
| State Value | The value that will be used when this state is selected | True |
Example Usage:
VARIABLE log_retain_time 172800
VARIABLE_STATE "24 hours" 86400
VARIABLE_STATE "48 hours" 172800
VARIABLE_STATE 60 # Both description and value are set to 60
The example in the plugin install dialog:

VARIABLE_STATE_SHOW
Since 7.6.0Show other plugin variables when this state is selected
The VARIABLE_STATE_SHOW keyword applies to the previously defined VARIABLE_STATE. The listed variables are only displayed in the plugin installation dialog when this state is selected. Variables listed in any VARIABLE_STATE_SHOW of a variable are hidden unless the selected state lists them, or when the controlling variable is itself hidden. Variables never listed by a VARIABLE_STATE_SHOW are always shown. If a custom value is typed that doesn't match a state, all variables are shown. Hidden variables keep their current values and are still passed to the plugin. Multiple VARIABLE_STATE_SHOW keywords can be used and each can list multiple variables. Must follow a VARIABLE_STATE definition.
| Parameter | Description | Required |
|---|---|---|
| Variable Name | Name of a variable to show when this state is selected. Additional variable names can follow. | True |
Example Usage:
VARIABLE interface_type tcp
VARIABLE_STATE "TCP/IP Client" tcp
VARIABLE_STATE_SHOW hostname port
VARIABLE_STATE "Serial" serial
VARIABLE_STATE_SHOW serial_port baud_rate
VARIABLE_STATE "Simulated" sim # hostname, port, serial_port, baud_rate all hidden
VARIABLE hostname 127.0.0.1
VARIABLE port 8080
VARIABLE serial_port /dev/ttyUSB0
VARIABLE baud_rate 115200
The example in the plugin install dialog:

VARIABLE_STATE_SET
Since 7.6.0Set the value of another plugin variable when this state is selected
The VARIABLE_STATE_SET keyword applies to the previously defined VARIABLE_STATE. When this state is selected in the plugin installation dialog, the named variable is set to the given value. The user can still change the value afterwards. If the variable's new value selects a state that has its own VARIABLE_STATE_SET keywords, those are applied as well. The VARIABLE_STATE_SET values of the initially selected state are applied when the dialog opens, except for variables that already have a value from a previous install. Often used together with VARIABLE_STATE_SHOW. Must follow a VARIABLE_STATE definition.
| Parameter | Description | Required |
|---|---|---|
| Variable Name | Name of the variable to set when this state is selected | True |
| Value | Value to set the variable to | True |
Example Usage:
VARIABLE interface_type tcp
VARIABLE_STATE "TCP/IP Client" tcp
VARIABLE_STATE_SHOW port
VARIABLE_STATE_SET port 8080
VARIABLE_STATE "Serial" serial
VARIABLE_STATE_SHOW port baud_rate
VARIABLE_STATE_SET port /dev/ttyUSB0
VARIABLE_STATE_SET baud_rate 9600
VARIABLE port 8080
VARIABLE baud_rate 115200
The example in the plugin install dialog:

VARIABLE_STATE_DESCRIPTION
Since 7.6.0Describe a VARIABLE_STATE in the plugin installation dialog dropdown
The VARIABLE_STATE_DESCRIPTION keyword adds a line of text below the previously defined VARIABLE_STATE in the plugin installation dialog dropdown. The dropdown can be searched by it as well as the state's text. Must follow a VARIABLE_STATE definition.
| Parameter | Description | Required |
|---|---|---|
| Description | Text shown below the state | True |
Example Usage:
VARIABLE interface_type tcp
VARIABLE_STATE "TCP/IP" tcp
VARIABLE_STATE_DESCRIPTION "Ethernet or Wi-Fi"
VARIABLE_STATE_ICON mdi-lan
VARIABLE_STATE Serial serial
VARIABLE_STATE_DESCRIPTION "RS-232 or USB serial adapter"
VARIABLE_STATE_ICON mdi-serial-port
The example in the plugin install dialog:

VARIABLE_STATE_ICON
Since 7.6.0Show an icon for a VARIABLE_STATE in the plugin installation dialog dropdown
The VARIABLE_STATE_ICON keyword shows an icon beside the previously defined VARIABLE_STATE in the plugin installation dialog dropdown. Use a Material Design Icons name like mdi-lan. Must follow a VARIABLE_STATE definition.
| Parameter | Description | Required |
|---|---|---|
| Icon Name | Material Design Icons name, e.g. mdi-lan | True |
Example Usage:
VARIABLE interface_type tcp
VARIABLE_STATE "TCP/IP" tcp
VARIABLE_STATE_ICON mdi-lan
The example in the plugin install dialog:
![]()
VARIABLE_STATE_REQUIRED
Since 7.6.0Require values for plugin variables while this state is selected
The VARIABLE_STATE_REQUIRED keyword applies to the previously defined VARIABLE_STATE. While this state is selected (and its variable is shown) the listed variables are required in the plugin installation dialog, like VARIABLE_REQUIRED. Useful when a variable is shown by several states but only some need it. Multiple VARIABLE_STATE_REQUIRED keywords can be used. Must follow a VARIABLE_STATE definition.
| Parameter | Description | Required |
|---|---|---|
| Variable Name | Name of a variable required while this state is selected. Multiple names can be given. | True |
Example Usage:
VARIABLE interface_type tcp
VARIABLE_STATE "TCP/IP Client" tcp
VARIABLE_STATE_SHOW hostname port
VARIABLE_STATE_REQUIRED hostname
VARIABLE_STATE "TCP/IP Server" server
VARIABLE_STATE_SHOW hostname port
VARIABLE hostname ""
VARIABLE port 8080
The example in the plugin install dialog:

PLUGIN_TEXT_START
Since 7.6.0Start a block of markdown text shown in the plugin installation dialog
The PLUGIN_TEXT_START keyword begins a block of Markdown that is displayed at the top of the Variables tab in the plugin installation dialog. Use it to explain how to configure the plugin, for example which VARIABLE_STATE to choose for your hardware. All lines up to PLUGIN_TEXT_END are taken as-is (keywords, quotes and markdown headings are not processed as plugin.txt syntax) and the common leading indentation is removed. ERB is not evaluated in the text, but avoid ERB tags since the whole plugin.txt is still processed with ERB at install. Multiple PLUGIN_TEXT_START / PLUGIN_TEXT_END blocks are joined together. The text can be hidden in the dialog, which is remembered for the plugin.
Example Usage:
PLUGIN_TEXT_START
# Power Supply Plugin
Supports both **TCP/IP** and **Serial** power supplies.
1. Choose the `interface_type` for your hardware
2. Fill in the connection settings that appear
PLUGIN_TEXT_END
The example in the plugin install dialog:

PLUGIN_TEXT_END
Since 7.6.0Complete a block of markdown text started by PLUGIN_TEXT_START
VARIABLE_TEXT_START
Since 7.6.0Start a block of markdown text shown when a VARIABLE_STATE is selected
The VARIABLE_TEXT_START keyword begins a block of Markdown that belongs to the previous VARIABLE_STATE. While that state is selected (and its variable is shown) the text is displayed in the plugin installation dialog below the PLUGIN_TEXT (or beside the variables on wide screens), for directions specific to the choice made. The text of each variable's selected state is shown in the order the variables are defined. The lines up to VARIABLE_TEXT_END are taken as-is like PLUGIN_TEXT, and multiple blocks for the same state are joined together. Must follow a VARIABLE_STATE definition.
Example Usage:
VARIABLE interface_type tcp
VARIABLE_STATE "TCP/IP" tcp
VARIABLE_STATE_SHOW hostname port
VARIABLE_TEXT_START
Enter the power supply's **hostname** and **port** from its network settings menu.
VARIABLE_TEXT_END
VARIABLE_STATE Serial serial
VARIABLE_STATE_SHOW serial_port
VARIABLE_TEXT_START
Connect the power supply's RS-232 port and select the **serial_port**.
VARIABLE_TEXT_END
VARIABLE hostname 127.0.0.1
VARIABLE port 8080
VARIABLE serial_port /dev/ttyUSB0
The example in the plugin install dialog:

VARIABLE_TEXT_END
Since 7.6.0Complete a block of markdown text started by VARIABLE_TEXT_START
NEEDS_DEPENDENCIES
Since 5.5.0Indicates the plugin needs dependencies and sets up the Ruby and Python environment of its microservices
If the plugin has a top level lib folder, lists runtime dependencies in the gemspec, or has a pyproject.toml or (deprecated) requirements.txt, NEEDS_DEPENDENCIES is effectively already set. The keyword sets the GEM_HOME environment variable for the plugin's microservices. It also sets up their Python environment. A plugin with a per-plugin venv gets the venv's packages first on PYTHONPATH, and a plugin without one uses the shared /gems/python_packages folder. Without NEEDS_DEPENDENCIES, the plugin's Python microservices get no PYTHONPATH and can only import the packages in the COSMOS image. Note that in Enterprise, having NEEDS_DEPENDENCIES adds the NFS volume mount to the Kubernetes pod.
PRE_INSTALL_SCRIPT
Since 7.6.0Run a script in the plugin before the plugin is installed
The PRE_INSTALL_SCRIPT keyword runs a Ruby (.rb) or Python (.py) script from the plugin after its files (including any VARIABLE_FILE uploads) and Python packages are in place, but before any target, interface or other part of the plugin is installed, so it can generate or change those files. It runs in a copy of the plugin's files with that folder as its working directory. Python scripts use the plugin's Python packages and Ruby scripts can require the plugin's lib folders. The script's environment has OPENC3_SCOPE, OPENC3_PLUGIN_NAME, OPENC3_PLUGIN_PATH (the plugin's folder) and OPENC3_PLUGIN_VARIABLES (the plugin variables as a JSON object). Validating a plugin or checking an upgrade also runs it, with OPENC3_PLUGIN_DRY_RUN set to true, so it should only change files in the plugin's folder then. Its output is logged, and the install fails if it exits with an error or runs longer than 10 minutes. Multiple PRE_INSTALL_SCRIPTs run in the order they appear, wherever they are in plugin.txt.
| Parameter | Description | Required |
|---|---|---|
| Script Path | Path of the .rb or .py script, relative to the top of the plugin | True |
| Arguments | Arguments passed to the script | False |
Example Usage:
PRE_INSTALL_SCRIPT scripts/generate_target.py <%= icd %>
POST_INSTALL_SCRIPT
Since 7.6.0Run a script in the plugin after the plugin is installed
The POST_INSTALL_SCRIPT keyword runs a Ruby (.rb) or Python (.py) script from the plugin after every part of the plugin has been installed, for example to load initial settings. It runs the same way as a PRE_INSTALL_SCRIPT, with the same environment, but not when validating a plugin or checking an upgrade. The install fails if it exits with an error or runs longer than 10 minutes. Multiple POST_INSTALL_SCRIPTs run in the order they appear, wherever they are in plugin.txt.
| Parameter | Description | Required |
|---|---|---|
| Script Path | Path of the .rb or .py script, relative to the top of the plugin | True |
| Arguments | Arguments passed to the script | False |
Example Usage:
POST_INSTALL_SCRIPT scripts/initialize.rb
INTERFACE
Defines a connection to a physical target
Interfaces are what OpenC3 uses to talk to a particular piece of hardware. Interfaces require a Ruby or Python file which implements all the interface methods necessary to talk to the hardware. OpenC3 defines many built in interfaces or you can define your own as long as it implements the interface protocol.
| Parameter | Description | Required |
|---|---|---|
| Interface Name | Name of the interface. This name will appear in the Interfaces tab of the Server and is also referenced by other keywords. The OpenC3 convention is to name interfaces after their targets with '_INT' appended to the name, e.g. INST_INT for the INST target. | True |
| Filename | Ruby or Python file to use when instantiating the interface. Valid Values: tcpip_client_interface, tcpip_server_interface, udp_interface, serial_interface | True |
Additional parameters are required. Please see the Interfaces documentation for more details.
INTERFACE Modifiers
The following keywords must follow a INTERFACE keyword.
MAP_TARGET
Maps a target name to an interface
See Mapping Targets to Interfaces for more information.
| Parameter | Description | Required |
|---|---|---|
| Target Name | Target name to map to this interface | True |
| Enabled State | Initial enabled state of the target on this interface. Defaults to ENABLED. Valid Values: ENABLED, DISABLED | False |
- Python
- Ruby
INTERFACE DATA_INT openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8081 10.0 nil BURST
MAP_TARGET DATA
INTERFACE DATA_INT tcpip_client_interface.rb host.docker.internal 8080 8081 10.0 nil BURST
MAP_TARGET DATA
MAP_CMD_TARGET
Since 5.2.0Maps a target name to an interface for commands only
See Mapping Targets to Interfaces for more information.
| Parameter | Description | Required |
|---|---|---|
| Target Name | Command target name to map to this interface | True |
| Enabled State | Initial enabled state of the command target on this interface. Defaults to ENABLED. Valid Values: ENABLED, DISABLED | False |
- Python
- Ruby
INTERFACE CMD_INT openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8081 10.0 nil BURST
MAP_CMD_TARGET DATA # Only DATA commands go on the CMD_INT interface
INTERFACE CMD_INT tcpip_client_interface.rb host.docker.internal 8080 8081 10.0 nil BURST
MAP_CMD_TARGET DATA # Only DATA commands go on the CMD_INT interface
MAP_TLM_TARGET
Since 5.2.0Maps a target name to an interface for telemetry only
See Mapping Targets to Interfaces for more information.
| Parameter | Description | Required |
|---|---|---|
| Target Name | Telemetry target name to map to this interface | True |
| Enabled State | Initial enabled state of the telemetry target on this interface. Defaults to ENABLED. Valid Values: ENABLED, DISABLED | False |
- Python
- Ruby
INTERFACE TLM_INT openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8081 10.0 nil BURST
MAP_TLM_TARGET DATA # Only DATA telemetry received on TLM_INT interface
INTERFACE TLM_INT tcpip_client_interface.rb host.docker.internal 8080 8081 10.0 nil BURST
MAP_TLM_TARGET DATA # Only DATA telemetry received on TLM_INT interface
DONT_CONNECT
Server will not automatically try to connect to the interface at startup
DONT_RECONNECT
Server will not try to reconnect to the interface if the connection is lost
RECONNECT_DELAY
Reconnect delay in seconds
If DONT_RECONNECT is not present the Server will try to reconnect to an interface if the connection is lost. Reconnect delay sets the interval in seconds between reconnect tries.
| Parameter | Description | Required |
|---|---|---|
| Delay | Delay in seconds between reconnect attempts. The default is 5 seconds. | True |
DISABLE_DISCONNECT
Disable the Disconnect button on the Interfaces tab in the Server
Use this keyword to prevent the user from disconnecting from the interface. This is typically used in a 'production' environment where you would not want the user to inadvertently disconnect from a target.
DONT_LOG
DONT_LOG does nothing and can be removed
Deprecated keyword that has no effect
Accepted for backwards compatibility with older plugins. A warning is logged and the keyword is otherwise ignored.
LOG_STREAM
Since 5.5.2Log all data on the interface exactly as it is sent and received
LOG_STREAM does not add any OpenC3 headers and thus can not be read by OpenC3 tools. It is primarily useful for low level debugging of an interface. You will have to manually parse these logs yourself using a hex editor or other application.
| Parameter | Description | Required |
|---|---|---|
| Cycle Time | Amount of time to wait before cycling the log file. Default is 10 min. If nil refer to Cycle Hour and Cycle Minute. | False |
| Cycle Size | Amount of data to write before cycling the log file. Default is 50MB. | False |
| Cycle Hour | The time at which to cycle the log. Combined with Cycle Minute to cycle the log daily at the specified time. If nil, the log will be cycled hourly at the specified Cycle Minute. Only applies if Cycle Time is nil. | False |
| Cycle Minute | See Cycle Hour. | False |
Example Usage:
INTERFACE EXAMPLE example_interface.rb
# Override the default log time of 600
LOG_STREAM 60
PROTOCOL
Since 4.0.0Protocols modify the interface by processing the data
Protocols can be either READ, WRITE, or READ_WRITE. READ protocols act on the data received by the interface while write acts on the data before it is sent out. READ_WRITE applies the protocol to both reading and writing.
For information on creating your own custom protocol please see Protocols
| Parameter | Description | Required |
|---|---|---|
| Type | Whether to apply the protocol on incoming data, outgoing data, or both Valid Values: READ, WRITE, READ_WRITE | True |
| Protocol Filename or Classname | Ruby or Python filename or class name which implements the protocol | True |
| Protocol specific parameters | Additional parameters used by the protocol | False |
- Python
- Ruby
INTERFACE DATA_INT openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8081 10.0 nil BURST
MAP_TARGET DATA
PROTOCOL READ openc3/interfaces/protocols/ignore_packet_protocol.py INST IMAGE # Drop all INST IMAGE packets
INTERFACE DATA_INT tcpip_client_interface.rb host.docker.internal 8080 8081 10.0 nil nil
MAP_TARGET DATA
# Rather than defining the LENGTH protocol on the INTERFACE line we define it here
PROTOCOL READ LengthProtocol 0 16 0 1 BIG_ENDIAN 4 0xBA5EBA11
OPTION
Set a parameter on an interface
When an option is set the interface class calls the set_option method. Custom interfaces can override set_option to handle any additional options they want.
| Parameter | Description | Required |
|---|---|---|
| Name | The option to set. OpenC3 defines several options on the core provided interfaces. The SerialInterface defines FLOW_CONTROL which can be NONE (default) or RTSCTS and DATA_BITS which changes the data bits of the serial interface. The TcpipServerInterface and HttpServerInterface define LISTEN_ADDRESS which is the IP address to accept connections on (default 0.0.0.0). | True |
| Parameters | One or more parameters to pass to the option | True |
Example Usage:
INTERFACE SERIAL_INT serial_interface.rb COM1 COM1 115200 NONE 1 10.0 nil
OPTION FLOW_CONTROL RTSCTS
OPTION DATA_BITS 8
ROUTER SERIAL_ROUTER tcpip_server_interface.rb 2950 2950 10.0 nil BURST
MAP_TARGET DATA
OPTION LISTEN_ADDRESS 127.0.0.1
SECRET
Since 5.3.0Define a secret needed by this interface
Defines a secret for this interface and optionally assigns its value to an option. For more information see the Secrets guide and Admin Secrets.
| Parameter | Description | Required |
|---|---|---|
| Type | ENV or FILE. ENV will mount the secret into an environment variable. FILE mounts the secret into a file. | True |
| Secret Name | The name of the secret to retrieve from the Admin / Secrets tab. For more information see Admin Secrets. | True |
| Environment Variable or File Path | Environment variable name or file path to store secret. FILE paths must be under /tmp (or the directory set by the OPENC3_SECRET_FILE_DIR environment variable); paths outside of it are rejected. Note that if you use the Option Name to set an option to the secret value, this value doesn't really matter as long as it is unique. | True |
| Option Name | Interface option to pass the secret value. This is the primary way to pass secrets to interfaces. | False |
| Secret Store Name | Name of the secret store for stores with multipart keys | False |
Example Usage:
SECRET ENV USERNAME ENV_USERNAME USERNAME
SECRET FILE KEY "/tmp/DATA/cert" KEY
ENV
Since 5.7.0Sets an environment variable in the microservice.
| Parameter | Description | Required |
|---|---|---|
| Key | Environment variable name | True |
| Value | Environment variable value | True |
Example Usage:
ENV COMPANY OpenC3
WORK_DIR
Since 5.7.0Set the working directory
Working directory to run the microservice CMD in. Can be a path relative to the microservice folder in the plugin, or an absolute path in the container the microservice runs in.
| Parameter | Description | Required |
|---|---|---|
| Directory | Working directory to run the microservice CMD in. Can be a path relative to the microservice folder in the plugin, or an absolute path in the container the microservice runs in. | True |
Example Usage:
WORK_DIR '/openc3/lib/openc3/microservices'
PORT
Since 5.7.0Open port for the microservice
Kubernetes needs a Service to be applied to open a port so this is required for Kubernetes support See Exposing Microservices for more information.
| Parameter | Description | Required |
|---|---|---|
| Number | Port number | True |
| Protocol | Port protocol. Default is TCP. | False |
Example Usage:
PORT 7272
CMD
Since 5.7.0Command line to execute to run the microservice.
Command line to execute to run the microservice.
| Parameter | Description | Required |
|---|---|---|
| Args | One or more arguments to exec to run the microservice. | True |
- Python
- Ruby
CMD python interface_microservice.py DEFAULT__INTERFACE__INT1
CMD ruby interface_microservice.rb DEFAULT__INTERFACE__INT1
CONTAINER
Since 5.7.0Docker Container
Container to execute and run the microservice in. Only used in COSMOS Enterprise.
| Parameter | Description | Required |
|---|---|---|
| Args | Name of the container | True |
ROUTE_PREFIX
Since 5.7.0Prefix of route
Prefix of route to the microservice to expose externally with Traefik
| Parameter | Description | Required |
|---|---|---|
| Route Prefix | Route prefix. Must be unique across all scopes. Something like /myprefix. Made of one or more path segments containing only letters, numbers, underscore and dash. The first segment can't be openc3-api, script-api, tools, files, login, js, css, fonts, icons, img, assets, auth, metrics, grafana or mcp which are used by COSMOS | True |
Example Usage:
ROUTE_PREFIX /interface
SHARD
Since 6.0.0Operator shard to run target microservices on
Operator Shard. Only used if running multiple operator containers typically in Kubernetes
| Parameter | Description | Required |
|---|---|---|
| Shard | Shard number starting from 0 | True |
Example Usage:
SHARD 0
DB_SHARD
Since 7.1.0Database shard for this interface's command and directive streams
DB Shard. Only used if running multiple database shards typically in Kubernetes
| Parameter | Description | Required |
|---|---|---|
| DB Shard | DB Shard number starting from 0 | True |
Example Usage:
DB_SHARD 0
SHARED_RESOURCE
Since 7.6.0Share this interface's resource between scopes so it is only active in one scope at a time
Interfaces, routers, microservices, and targets with the same shared resource name form a shared resource. Each scope that installs one of them becomes a member, but the resource is only active in one scope at a time. The first scope to install the resource owns it. Members in other scopes are installed but their microservices are not started until the resource is switched to their scope with switch_shared_resource. Can not be used with BRIDGE. See Shared Resources.
| Parameter | Description | Required |
|---|---|---|
| Shared Resource Name | Name of the shared resource. Must only contain letters, numbers, and single underscores. | True |
Example Usage:
SHARED_RESOURCE THERMAL_VAC_CHAMBER
BRIDGE
Since 7.4.0Name of the bridge to run this interface on
Run this interface on a bridge host rather than within COSMOS. Note only python is supported.
| Parameter | Description | Required |
|---|---|---|
| Bridge Name | Bridge Name - Typically DEFAULT | True |
Example Usage:
BRIDGE DEFAULT
BRIDGE_PROTOCOL
Since 7.4.0Bridge Protocols modify the bridge interface by processing the data
Protocols can be either READ, WRITE, or READ_WRITE. READ protocols act on the data received by the interface while write acts on the data before it is sent out. READ_WRITE applies the protocol to both reading and writing.
For information on creating your own custom protocol please see Protocols
| Parameter | Description | Required |
|---|---|---|
| Type | Whether to apply the protocol on incoming data, outgoing data, or both Valid Values: READ, WRITE, READ_WRITE | True |
| Protocol Filename or Classname | Ruby or Python filename or class name which implements the protocol | True |
| Protocol specific parameters | Additional parameters used by the protocol | False |
- Python
INTERFACE DATA_INT openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8081 10.0 nil BURST
MAP_TARGET DATA
BRIDGE_PROTOCOL READ openc3/interfaces/protocols/ignore_packet_protocol.py INST IMAGE # Drop all INST IMAGE packets
BRIDGE_OPTION
Since 7.4.0Set a parameter on a bridged interface
When a bridge option is set the bridge interface class calls the set_option method. Custom interfaces can override set_option to handle any additional options they want.
| Parameter | Description | Required |
|---|---|---|
| Name | The option to set. OpenC3 defines several options on the core provided interfaces. The SerialInterface defines FLOW_CONTROL which can be NONE (default) or RTSCTS and DATA_BITS which changes the data bits of the serial interface. The TcpipServerInterface and HttpServerInterface define LISTEN_ADDRESS which is the IP address to accept connections on (default 0.0.0.0). | True |
| Parameters | One or more parameters to pass to the option | True |
Example Usage:
INTERFACE SERIAL_INT serial_interface.rb COM1 COM1 115200 NONE 1 10.0 nil
BRIDGE DEFAULT
BRIDGE_OPTION FLOW_CONTROL RTSCTS
BRIDGE_OPTION DATA_BITS 8
BRIDGE_SECRET
Since 7.4.0Define a bridge secret needed by this bridge interface
Defines a bridge secret for this bridge interface and optionally assigns its value to an option. For more information see Admin Secrets.
| Parameter | Description | Required |
|---|---|---|
| Type | ENV or FILE. ENV will mount the secret into an environment variable. FILE mounts the secret into a file. | True |
| Secret Name | The name of the secret to retrieve from the Admin / Secrets tab. For more information see Admin Secrets. | True |
| Environment Variable or File Path | Environment variable name or file path to store secret. FILE paths must be under /tmp (or the directory set by the OPENC3_SECRET_FILE_DIR environment variable); paths outside of it are rejected. Note that if you use the Option Name to set an option to the secret value, this value doesn't really matter as long as it is unique. | True |
| Option Name | Interface option to pass the secret value. This is the primary way to pass secrets to interfaces. | False |
| Secret Store Name | Name of the secret store for stores with multipart keys | False |
Example Usage:
INTERFACE SERIAL_INT serial_interface.rb COM1 COM1 115200 NONE 1 10.0 nil
BRIDGE DEFAULT
BRIDGE_SECRET ENV USERNAME ENV_USERNAME USERNAME
BRIDGE_SECRET FILE KEY "/tmp/DATA/cert" KEY
ROUTER
Create router to receive commands and output telemetry packets from one or more interfaces
Creates an router which receives command packets from their remote clients and sends them to associated interfaces. They receive telemetry packets from their interfaces and send them to their remote clients. This allows routers to be intermediaries between an external client and an actual device.
| Parameter | Description | Required |
|---|---|---|
| Name | Name of the router | True |
| Filename | Ruby or Python file to use when instantiating the interface. Valid Values: tcpip_client_interface, tcpip_server_interface, udp_interface, serial_interface | True |
Additional parameters are required. Please see the Interfaces documentation for more details.
ROUTER accepts the INTERFACE Modifiers except BRIDGE, BRIDGE_PROTOCOL, BRIDGE_OPTION, BRIDGE_SECRET.
TARGET
Defines a new target
| Parameter | Description | Required |
|---|---|---|
| Folder Name | The target folder | True |
| Name | The target name. While this typically matches the Folder Name it can be different to create multiple targets based on the same target definition. As in the Example Usage, the target folder is KEYSIGHT_N6700 but the target name is PWR_SUPPLY1. To create multiple targets from the same folder, just define multiple TARGET entries with different target names. To make the target definition flexbible, you can use ERB to insert the target name in procedures, libraries, etc via <%= target_name %>. See ERB target_name for more information. | True |
Example Usage:
TARGET KEYSIGHT_N6700 PWR_SUPPLY1
TARGET Modifiers
The following keywords must follow a TARGET keyword.
CMD_BUFFER_DEPTH
Since 5.2.0Number of commands to buffer to ensure logged in order
| Parameter | Description | Required |
|---|---|---|
| Buffer Depth | Buffer depth in packets (Default = 5) | True |
CMD_LOG_CYCLE_TIME
Command binary logs can be cycled on a time interval.
| Parameter | Description | Required |
|---|---|---|
| Time | Maximum time between files in seconds (default = 600) | True |
CMD_LOG_CYCLE_SIZE
Command binary logs can be cycled after a certain log file size is reached.
| Parameter | Description | Required |
|---|---|---|
| Size | Maximum file size in bytes (default = 50_000_000) | True |
CMD_LOG_RETAIN_TIME
How long to keep raw command logs in seconds.
| Parameter | Description | Required |
|---|---|---|
| Time | Number of seconds to keep raw command logs (default = nil = Forever) | True |
TLM_BUFFER_DEPTH
Since 5.2.0Number of telemetry packets to buffer to ensure logged in order
| Parameter | Description | Required |
|---|---|---|
| Buffer Depth | Buffer depth in packets (Default = 60) | True |
TLM_LOG_CYCLE_TIME
Telemetry binary logs can be cycled on a time interval.
| Parameter | Description | Required |
|---|---|---|
| Time | Maximum time between files in seconds (default = 600) | True |
TLM_LOG_CYCLE_SIZE
Telemetry binary logs can be cycled after a certain log file size is reached.
| Parameter | Description | Required |
|---|---|---|
| Size | Maximum file size in bytes (default = 50_000_000) | True |
TLM_LOG_RETAIN_TIME
How long to keep raw telemetry logs in seconds.
| Parameter | Description | Required |
|---|---|---|
| Time | Number of seconds to keep raw telemetry logs (default = nil = Forever) | True |
CMD_DECOM_RETAIN_TIME
Since 7.0.0How long to keep command decommutation records in the TSDB.
Sets the retention time directly on QuestDB tables for automatic data expiration. QuestDB will automatically remove data older than this retention time. Tables are partitioned by day and QuestDB only drops whole partitions, so the effective granularity is one day. Hour values are rounded up to whole days ("1h" becomes 1 day, "25h" becomes 2 days) so data is never dropped early, and data is not removed until the entire day partition is older than the retention time (expect up to a day of extra data). Expiration is evaluated when new data is written to the table, so an idle table is not expired. Changing this value and reinstalling the plugin updates existing tables.
| Parameter | Description | Required |
|---|---|---|
| Time | Retention time value with unit (e.g., "24h" for 24 hours, "30d" for 30 days, "1y" for 1 year). Supported units are h (hours), d (days), w (weeks), M (months), y (years). Default = nil = Forever | True |
TLM_DECOM_RETAIN_TIME
Since 7.0.0How long to keep telemetry decommutation records in the TSDB.
Sets the retention time directly on QuestDB tables for automatic data expiration. QuestDB will automatically remove data older than this retention time. Tables are partitioned by day and QuestDB only drops whole partitions, so the effective granularity is one day. Hour values are rounded up to whole days ("1h" becomes 1 day, "25h" becomes 2 days) so data is never dropped early, and data is not removed until the entire day partition is older than the retention time (expect up to a day of extra data). Expiration is evaluated when new data is written to the table, so an idle table is not expired. Changing this value and reinstalling the plugin updates existing tables.
| Parameter | Description | Required |
|---|---|---|
| Time | Retention time value with unit (e.g., "24h" for 24 hours, "30d" for 30 days, "1y" for 1 year). Supported units are h (hours), d (days), w (weeks), M (months), y (years). Default = nil = Forever | True |
DECOM_FLUSH_PERIOD
Period in seconds between flushing rows to the TSDB. Higher values use less CPU.
| Parameter | Description | Required |
|---|---|---|
| Period | Number of seconds between flushing rows to the TSDB (default = 5.0) | True |
DECOM_UPDATE_INTERVAL
Since 7.6.0Number of seconds the decom microservice waits before writing decommutated packets to Redis
The decom microservice queues the decommutated packet stream and Current Value Table (CVT) writes and flushes them to Redis in a single pipelined batch every update interval. Raising this value reduces processor utilization for high rate data at the cost of slower updates. Lowering it gives faster updates but increases processor utilization. Setting it to 0 disables queuing and writes every packet to Redis immediately. This is the decom equivalent of the interface UPDATE_INTERVAL option.
| Parameter | Description | Required |
|---|---|---|
| Interval | Number of seconds between writes to Redis (default = 0.1, 0 = write immediately) | True |
LOG_RETAIN_TIME
How long to keep all regular telemetry logs in seconds.
| Parameter | Description | Required |
|---|---|---|
| Time | Number of seconds to keep all regular telemetry logs (default = nil = Forever) | True |
CLEANUP_POLL_TIME
Period at which to run the cleanup process.
| Parameter | Description | Required |
|---|---|---|
| Time | Number of seconds between runs of the cleanup process (default = 3600 = 1 hour) | True |
TARGET_MICROSERVICE
Since 5.2.0Breaks a target microservice out into its own process.
Can be used to give more resources to processing that is falling behind. If defined multiple times for the same type, will create multiple processes. Each process can be given specific packets to process with the PACKET keyword.
| Parameter | Description | Required |
|---|---|---|
| Type | The target microservice type. Must be one of DECOM, COMMANDLOG, PACKETLOG, or CLEANUP | True |
MICROSERVICE_GROUP
Since 7.6.0Runs the target's microservices in processes shared with other targets
By default every target runs its decom, logging, and cleanup microservices in its own process and its TSDB microservice in another. Targets that declare the same group name keep their own microservices but run them as threads in two processes shared by the whole group, one for Ruby and one for Python, which uses much less memory when there are many targets. Targets from different plugins can share a group. All targets in a group must use the same SHARD and DB_SHARD, and Python targets in a group must come from one plugin. The decoms in each process share one write queue that flushes at the fastest DECOM_UPDATE_INTERVAL of its targets. Adding or removing a target restarts the group's processes. Cannot be combined with TARGET_MICROSERVICE.
| Parameter | Description | Required |
|---|---|---|
| Group Name | Name of the microservice group | True |
Example Usage:
TARGET THERMAL THERMAL
MICROSERVICE_GROUP HOUSEKEEPING
TARGET POWER POWER
MICROSERVICE_GROUP HOUSEKEEPING
PACKET
Since 5.2.0Packet Name to allocate to the current TARGET_MICROSERVICE.
| Parameter | Description | Required |
|---|---|---|
| Packet Name | The packet name. Does not apply to CLEANUP target microservice type. | True |
DISABLE_ERB
Since 5.12.0Disable ERB processing
Disable ERB processing for the entire target or a set of regular expressions over its filenames
| Parameter | Description | Required |
|---|---|---|
| Regex | Regex to match against filenames. If match, then no ERB processing | False |
SHARD
Since 6.0.0Operator shard to run target microservices on
Operator Shard. Only used if running multiple operator containers typically in Kubernetes
| Parameter | Description | Required |
|---|---|---|
| Shard | Shard number starting from 0 | False |
Example Usage:
SHARD 0
DB_SHARD
Since 7.1.0Shard for target database database if sharding Redis/TSDB
DB Shard. Only used if running multiple database shards typically in Kubernetes
| Parameter | Description | Required |
|---|---|---|
| DB Shard | DB Shard number starting from 0 | True |
Example Usage:
DB_SHARD 0
STORED_LIMITS_MODE
Since 7.2.1Controls how limits are evaluated for stored (non-real-time) telemetry packets
Sets the limits handling policy for packets where the stored flag is true (e.g., packets from file interfaces or historical data replay). PROCESS processes limits normally including logging and reactions. LOG evaluates limits and logs state changes but does not trigger limits reactions or update the current limits state used by the API. DISABLE skips limits processing entirely for stored packets.
| Parameter | Description | Required |
|---|---|---|
| Mode | PROCESS (default), LOG, or DISABLE | True |
Example Usage:
STORED_LIMITS_MODE DISABLE
SHARED_RESOURCE
Since 7.6.0Only accept commands to this target in the scope where its shared resource is active
Commands sent to the target in a scope where the shared resource is not active are rejected. The target's own microservices (decom, logging, cleanup) keep running in every scope so telemetry screens, build_cmd, inject_tlm, and historical data still work. See Shared Resources.
| Parameter | Description | Required |
|---|---|---|
| Shared Resource Name | Name of the shared resource. Must only contain letters, numbers, and single underscores. | True |
Example Usage:
SHARED_RESOURCE THERMAL_VAC_CHAMBER
MICROSERVICE
Defines a new microservice
Defines a microservice that the plugin adds to the OpenC3 system. Microservices are background software processes that perform persistent processing.
| Parameter | Description | Required |
|---|---|---|
| Microservice Folder Name | The exact name of the microservice folder in the plugin. ie. microservices/MicroserviceFolderName | True |
| Microservice Name | The specific name of this instance of the microservice in the OpenC3 system | True |
Example Usage:
MICROSERVICE EXAMPLE openc3-example
MICROSERVICE Modifiers
The following keywords must follow a MICROSERVICE keyword.
ENV
Sets an environment variable in the microservice.
| Parameter | Description | Required |
|---|---|---|
| Key | Environment variable name | True |
| Value | Environment variable value | True |
Example Usage:
MICROSERVICE EXAMPLE openc3-example
ENV COMPANY OpenC3
WORK_DIR
Set the working directory
Working directory to run the microservice CMD in. Can be a path relative to the microservice folder in the plugin, or an absolute path in the container the microservice runs in.
| Parameter | Description | Required |
|---|---|---|
| Directory | Working directory to run the microservice CMD in. Can be a path relative to the microservice folder in the plugin, or an absolute path in the container the microservice runs in. | True |
Example Usage:
MICROSERVICE EXAMPLE openc3-example
WORK_DIR .
PORT
Since 5.0.10Open port for the microservice
Kubernetes needs a Service to be applied to open a port so this is required for Kubernetes support. See Exposing Microservices for more information.
| Parameter | Description | Required |
|---|---|---|
| Number | Port number | True |
| Protocol | Port protocol. Default is TCP. | False |
Example Usage:
MICROSERVICE EXAMPLE openc3-example
PORT 7272
TOPIC
Associate a Redis topic
Redis topic to associate with this microservice. Standard OpenC3 microservices such as decom_microservice use this information to know what packet streams to subscribe to. The TOPIC keyword can be used as many times as necessary to associate all needed topics.
| Parameter | Description | Required |
|---|---|---|
| Topic Name | Redis Topic to associate with the microservice | True |
Example Usage:
MICROSERVICE EXAMPLE openc3-example
# Manually assigning topics is an advanced topic and requires
# intimate knowledge of the internal COSMOS data structures.
TOPIC DEFAULT__openc3_log_messages
TOPIC DEFAULT__TELEMETRY__EXAMPLE__STATUS
TARGET_NAME
Associate a OpenC3 target
OpenC3 target to associate with the microservice. For standard OpenC3 microservices such as decom_microservice this causes the target configuration to get loaded into the container for the microservice.
| Parameter | Description | Required |
|---|---|---|
| Target Name | OpenC3 target to associate with the microservice | True |
Example Usage:
MICROSERVICE EXAMPLE openc3-example
TARGET_NAME EXAMPLE
CMD
Command line to execute to run the microservice.
Command line to execute to run the microservice.
| Parameter | Description | Required |
|---|---|---|
| Args | One or more arguments to exec to run the microservice. | True |
- Python
- Ruby
MICROSERVICE EXAMPLE openc3-example
CMD python example_target.py
MICROSERVICE EXAMPLE openc3-example
CMD ruby example_target.rb
OPTION
Pass an option to the microservice
Generic key/value(s) options to pass to the microservice. These take the form of KEYWORD/PARAMS like a line in a OpenC3 configuration file. Multiple OPTION keywords can be used to pass multiple options to the microservice.
| Parameter | Description | Required |
|---|---|---|
| Option Name | Name of the option | True |
| Option Value(s) | One or more values to associate with the option | True |
CONTAINER
Docker Container
Container to execute and run the microservice in. Only used in COSMOS Enterprise.
| Parameter | Description | Required |
|---|---|---|
| Args | Name of the container | False |
SECRET
Since 5.3.0Define a secret needed by this microservice
Defines a secret for this microservice. For more information see the Secrets guide and Admin Secrets. Note that unlike the INTERFACE SECRET, the microservice SECRET does not take an Option Name parameter, because the secret value is injected directly into the microservice process as an environment variable (Type ENV) or written to a file (Type FILE).
| Parameter | Description | Required |
|---|---|---|
| Type | ENV or FILE. ENV will mount the secret into an environment variable. FILE mounts the secret into a file. | True |
| Secret Name | The name of the secret to retrieve from the Admin / Secrets tab. For more information see Admin Secrets. | True |
| Environment Variable or File Path | Environment variable name or file path to store secret. FILE paths must be under /tmp (or the directory set by the OPENC3_SECRET_FILE_DIR environment variable); paths outside of it are rejected. | True |
| Secret Store Name | Name of the secret store for stores with multipart keys | False |
Example Usage:
SECRET ENV USERNAME ENV_USERNAME
SECRET FILE KEY "/tmp/DATA/cert"
ROUTE_PREFIX
Since 5.5.0Prefix of route
Prefix of route to the microservice to expose externally with Traefik
| Parameter | Description | Required |
|---|---|---|
| Route Prefix | Route prefix. Must be unique across all scopes. Something like /myprefix. Made of one or more path segments containing only letters, numbers, underscore and dash. The first segment can't be openc3-api, script-api, tools, files, login, js, css, fonts, icons, img, assets, auth, metrics, grafana or mcp which are used by COSMOS | True |
Example Usage:
MICROSERVICE CFDP CFDP
ROUTE_PREFIX /cfdp
DISABLE_ERB
Since 5.12.0Disable ERB processing
Disable ERB processing for the entire microservice or a set of regular expressions over its filenames
| Parameter | Description | Required |
|---|---|---|
| Regex | Regex to match against filenames. If match, then no ERB processing | False |
SHARD
Since 6.0.0Operator shard to run target microservices on
Operator Shard. Only used if running multiple operator containers typically in Kubernetes
| Parameter | Description | Required |
|---|---|---|
| Shard | Shard number starting from 0 | True |
Example Usage:
SHARD 0
DB_SHARD
Since 7.1.0Shard for target database database if sharding Redis/TSDB
DB Shard. Only used if running multiple database shards typically in Kubernetes
| Parameter | Description | Required |
|---|---|---|
| DB Shard | DB Shard number starting from 0 | True |
Example Usage:
DB_SHARD 0
STOPPED
Since 6.2.0Initially creates the microservice in a stopped state (not enabled)
Example Usage:
STOPPED
SHARED_RESOURCE
Since 7.6.0Share this microservice's resource between scopes so it is only active in one scope at a time
The microservice only runs in the scope where the shared resource is active. In other scopes it is installed but not started until the resource is switched to their scope with switch_shared_resource. See Shared Resources.
| Parameter | Description | Required |
|---|---|---|
| Shared Resource Name | Name of the shared resource. Must only contain letters, numbers, and single underscores. | True |
Example Usage:
SHARED_RESOURCE THERMAL_VAC_CHAMBER
TOOL
Define a tool
Defines a tool that the plugin adds to the OpenC3 system. Tools are web based applications that make use of the Single-SPA javascript library that allows them to be dynamically added to the running system as independent frontend microservices. Tools are global to the entire COSMOS installation. Regardless of the scope a plugin is installed into, its tools are always installed into the DEFAULT scope and are available in every scope.
| Parameter | Description | Required |
|---|---|---|
| Tool Folder Name | The exact name of the tool folder in the plugin. ie. tools/ToolFolderName | True |
| Tool Name | Name of the tool that is displayed in the OpenC3 Navigation menu | True |
Example Usage:
TOOL DEMO Demo
TOOL Modifiers
The following keywords must follow a TOOL keyword.
URL
Url used to access the tool
The relative url used to access the tool. Defaults to "/tools/ToolFolderName".
| Parameter | Description | Required |
|---|---|---|
| Url | The url. If not given defaults to tools/ToolFolderName. Generally should not be given unless linking to external tools. | True |
INLINE_URL
Internal url to load a tool
The url of the javascript file used to load the tool into single-SPA. Defaults to "main.js".
| Parameter | Description | Required |
|---|---|---|
| Url | The inline url. If not given defaults to main.js. Generally should not be given unless using a non-standard filename. | True |
WINDOW
How to display the tool when navigated to
The window mode used to display the tool. INLINE opens the tool internally without refreshing the page using the Single-SPA framework. IFRAME opens external tools in an Iframe within OpenC3. NEW opens the tool in a new TAB.
| Parameter | Description | Required |
|---|---|---|
| Window Mode | Tool display mode Valid Values: INLINE, IFRAME, NEW | True |
ICON
Set tool icon
Icon shown next to the tool name in the OpenC3 navigation menu.
| Parameter | Description | Required |
|---|---|---|
| Icon Name | Icon to display next to the tool name. Icons come from Font Awesome, Material Design (https://materialdesignicons.com/), and Astro. | True |
CATEGORY
Category for the tool
Associates the tool with a category which becomes a submenu in the Navigation menu.
| Parameter | Description | Required |
|---|---|---|
| Category Name | Category to associate the tool with | True |
SHOWN
Show the tool or not
Whether or not the tool is shown in the Navigation menu. Should generally be true, except for the openc3 base tool.
| Parameter | Description | Required |
|---|---|---|
| Shown | Whether or not the tool is shown. TRUE or FALSE Valid Values: true, false | True |
POSITION
Since 5.0.8Position of the tool in the nav bar
Position of the tool starting at 2 (1 is reserved for Admin Console). Tools without a position are appended to the end as they are installed. All COSMOS Core tools have consecutive integer values for position.
| Parameter | Description | Required |
|---|---|---|
| Position | Numerical position | True |
DISABLE_ERB
Since 5.12.0Disable ERB processing
Disable ERB processing for the entire tool or a set of regular expressions over its filenames
| Parameter | Description | Required |
|---|---|---|
| Regex | Regex to match against filenames. If match, then no ERB processing | False |
IMPORT_MAP_ITEM
Since 6.0.0Add an item to the import map
| Parameter | Description | Required |
|---|---|---|
| key | Import Map Key | True |
| value | Import Map Value | True |
WIDGET
Define a custom widget
Defines a custom widget that can be used in Telemetry Viewer screens.
| Parameter | Description | Required |
|---|---|---|
| Widget Name | The name of the widget will be used to build a path to the widget implementation. For example, WIDGET HELLOWORLD will find the as-built file tools/widgets/HelloworldWidget/HelloworldWidget.umd.min.js. See the Custom Widgets guide for more details. | True |
| Label | The label for the widget that will appear in the Data Viewer component drop down | False |
Example Usage:
WIDGET HELLOWORLD
WIDGET Modifiers
The following keywords must follow a WIDGET keyword.
DISABLE_ERB
Since 5.12.0Disable ERB processing
Disable ERB processing for the entire widget or a set of regular expressions over its filenames
| Parameter | Description | Required |
|---|---|---|
| Regex | Regex to match against filenames. If match, then no ERB processing | False |
PANEL
Since 7.6.0Define a custom Dashboards panel type
Defines a custom panel type that can be used in Dashboards, alongside the built-in panel types.
| Parameter | Description | Required |
|---|---|---|
| Panel Type | The panel type, used in dashboard files as PANEL <Panel Type> .... It is also used to build a path to the panel implementation. For example, PANEL BATTERY will find the as-built file tools/panels/BATTERY/BATTERY.js. Only letters, numbers, '_' and '-' are allowed. See the Custom Panels guide for more details. | True |
Example Usage:
PANEL BATTERY
SCRIPT_ENGINE
Since 6.5.0Define a script engine to add language support to Script Runner
Defines a script engine to add language support to Script Runner. For a realistic example, see our CSTOL plugin.
| Parameter | Description | Required |
|---|---|---|
| Extension | Extension that will use this script engine | True |
| Script Engine Filename | Filename that implements the script engine. Should be in top level lib folder in plugin. | True |
Example Usage:
SCRIPT_ENGINE .print print_script_engine.py