Documentation
IPS_GetActions
string IPS_GetActions ()
Returns
A JSON encoded string with an array of all actions. After decoding with json_decode($json, true), each action is an array with the following entries:
| Index | Type | Description |
|---|---|---|
| id | string | GUID of the action (ActionID) |
| caption | string | Caption of the action (English, the translations are in locale) |
| form | array/string | Configuration form of the action: an array of form elements (static form) or PHP code as a string or an array of code lines (dynamic form, see IPS_GetActionForm) |
| action | array/string | PHP code that is run when the action is executed, as a string or an array of code lines |
| restrictions | array | (optional) Restrictions under which the action is offered, see restrictions |
| locale | array | (optional) Translations per language, e.g. de => [English text => translation] |
| category | string | (optional) Category of the action (target, math, set, switch, expert or other) |
| description | string | (optional) Description of the action for the action selection |
| format | string | (optional) Short format of the action with its parameters in ICU syntax, e.g. "Switch to {VALUE, valueFormatted}" |
| priority | integer | (optional) Priority by which the actions are sorted in a selection (higher values first) |
| readable | array/string | (optional) PHP code that returns the action as readable code, see IPS_GetActionReadableCode |
| deprecated | array/string | (optional) Marks the action as deprecated. Contains PHP code that converts the parameters into a successor action (returns actionID and parameters) |
| actionList | string | (optional) Name of the parameter that holds a nested list of actions (e.g. "ACTIONS" for "If ..., then" in flow scripts) |
The entries are exactly those of the action definition. Optional entries are missing if the definition does not specify them.
Description
The function returns all actions known to the system. These are the built-in actions and the actions from the "actions" folder of installed libraries, see Actions. Actions are predefined operations that are executed by events, flow scripts, variable actions as well as IPS_RunAction and IPS_RunActionWait.
The result is a JSON encoded string, not a PHP array, and needs to be decoded with json_decode. The order of the entries is not guaranteed. The list is not filtered and also contains deprecated actions (deprecated). The texts (caption, description, format, form) are English, the translations are in the entry locale.
The actions offered for a specific target object in a specific environment are returned by IPS_GetActionsByEnvironment. IPS_ActionExists checks whether an action exists.
Example
$actions = json_decode(IPS_GetActions(), true);
foreach ($actions as $action) {
echo $action['id'] . ' -> ' . $action['caption'] . PHP_EOL;
}
/* e.g. returns:
{04603AA4-F1B8-3E28-8F31-8BC98C75A04B} -> Multiply with Value of other Variable
{0792E8F6-07B1-C12F-D8C0-7CB048CABFB3} -> Wait for Value
{07DEB4D2-D32C-4226-8371-E8CD1A507D99} -> Switch to Value
...
*/