What can we improve?

Documentation

(Edit)

SelectAction

Requires: IP-Symcon >= 6.0

Creates an input for an action.

Example

If created in the "elements" area, the property name is set to a JSON-coded object, which contains the following parameters:

Parameter Description
actionID Action ID
parameters Action parameters

Parameters

Parameter Description
enabled (optional) (default: true) If true, the selection can be used, otherwise it is displayed as deactivated
environment (optional) (default: "Default") Defines the environment of the action selection, here it can be determined which types of actions are available for selection, see also Actions
highestPriorityOnly (optional) (default: false) If false, the element has a selection of all suitable actions, otherwise the action with the highest priority is automatically selected
includeDefaultEnvironment (optional) (default: true) If false, only actions that support the environment environment are offered for selection; if true, all actions of the "Default" environment are also offered
name (optional) Name of the selection/the property to be set
targetID (optional) (default: -1) With -1 the element has a target selection, otherwise the target with this ID is set as the target
type SelectAction
value (optional) (default: no action selected) The value of the selection - If there is an associated property, this parameter will be overwritten by the property in the elements area
visible (optional) (default: true) If true, the selection is visible, otherwise it is invisible
width (optional) (default: 300px) Fixed width of the input field in pixels or % as a string, e.g. "40%" or "250px"
saveTarget (optional) (default: true) If true, the target is saved as TARGET as part of the parameters
saveEnvironment (optional) (default: true) If true, the environment is saved as ENVIRONMENT as part of the parameters
saveParent (optional) (default: true) If true, the InstanceID is saved as PARENT as part of the parameters

Example 1: Target, Environment and InstanceID are constantly saved as part of the property

By default, all required parameters are saved as a return from SelectAction. This is the easiest way to perform the action.

{ "type": "SelectAction", "name": "PropertyAction", "targetID": 12345 }
 
// PHP code in the module
$action = json_decode($this->ReadPropertyString('PropertyAction'), true);
IPS_RunAction($action['actionID'], $action['parameters']);

Example 2: Target, environment and InstanceID are set dynamically

If the additional parameters are not saved as a return, they have to be added manually. In this way, for example, actions can be exchanged between entities and no redundant data is stored.

{ "type": "SelectAction", "name": "PropertyAction", "targetID": 12345, "saveTarget": false, "saveEnvironment": false, "saveParent": false }
 
// PHP code in the module
$action = json_decode($this->ReadPropertyString('PropertyAction'), true);
$parameters = $action['parameters'];
$parameters['TARGET'] = 12345;
$parameters['ENVIRONMENT'] = 'Default';
$parameters['PARENT'] = $this->InstanceID;
IPS_RunAction($action['actionID'], $action['parameters']);
Deutsche Webseite verfügbar
Go to cart
Any questions?