Menu actions
actions.yaml adds items to the menu of a Custom Component, each of which is a button that runs a script once, a toggle that starts and stops a service, or Connect / Disconnect for the main script.
version: "2.3"
menuActions:
- id: connect
displayName: Connect / Disconnect
icon: Start
kind: mainScriptToggle
- id: zero
displayName: Zero Calibration
icon: Play
kind: button
script: scripts/calibrate_zero.py
The upload field is Actions YAML file (Optional). Refer to Custom Component files.
kind |
What the operator gets |
|---|---|
button |
Runs script once when the menu item is chosen |
toggle |
Starts and stops a service script, and publishes that running state on the component |
mainScriptToggle |
Connect / Disconnect for Main Script. The script is the Main Script field on the Scripts tab |
Refer to Main script for the service behind mainScriptToggle.
| Field | Required | Meaning |
|---|---|---|
id |
Yes | Unique name for the entry |
displayName |
Yes | Label on the menu item. The older key name is still accepted |
kind |
Yes | button, toggle, or mainScriptToggle |
script |
For button and toggle |
A path relative to the component folder, such as scripts/calibrate.cs. A path that leaves the component folder is rejected |
icon |
No | A Carbon icon name, such as Play or BatteryCharging. A Profinity name such as Start is still accepted. A file name such as icons/logo.svg is a custom icon. An omitted icon is shown as Custom |
iconPath |
No | An image in the component folder, used instead of icon |
An entry with an unsupported kind, or a button or toggle without a script, fails validation, and the message names the entry, for example Menu action 'zero' has unsupported kind.
profinity-component-pack validate runs the same check.
Refer to Component Pack CLI.
A tag rule can also run an action when a condition fires, which is not this file. Refer to DBC, dashboard, and rules.