-
Notifications
You must be signed in to change notification settings - Fork 15
Actions
"Actions" are one of the main concepts used by SCOS Sensor. At a high level, they are the things that the sensor owner wants the sensor to be able to do. At a lower level, they are simply Python classes with a special method __call__
. Actions are designed to be discovered programmatically in installed plugins. Plugins are Python packages that are designed to be integrated into SCOS Sensor. The reason for using plugins to install actions is that different actions can be offered depending on the hardware being used. Rather than requiring a modification to the SCOS Sensor as a whole, plugins allow anyone to add additional hardware support and new actions which make use of that hardware.
Common action classes can be re-used by plugins through the SCOS Actions plugin. SCOS Actions is intended to be a dependency for every other plugin, as it contains the actions base class and signals needed to interface with SCOS Sensor. These actions use a common but flexible signal analyzer interface that can be implemented for new types of hardware. This allows for action re-use by passing the measurement parameters to the constructor of the action and supplying the Sensor
instance (including the signal analyzer) to the __call__
method. Alternatively, custom actions that support unique hardware functionality can be added to the plugin.
SCOS Sensor uses the following convention to discover actions offered by plugins: if any Python package begins with scos_
, and contains a dictionary of actions at the Python path package_name.discover.actions
, these actions will automatically be available for scheduling. Similarly, plugins may offer new action types by including a dictionary of action classes at the Python path package_name.discover.action_classes
. SCOS Sensor will load all plugin actions and action classes prior to creating actions defined in YAML files in the configs/actions
directory. In this manner, a plugin may add new action types to SCOS Sensor and those new types may be instantiated/parameterized with YAML config files.
For more information on adding actions, refer to the SCOS Actions documentation.