Documentation
RequestAction
Require: Symcon >= 5.0
bool RequestAction (int $VariableID, mixed $Value)
Parameters
| VariableID | ID of the variable |
| Value | Value for the action |
Returns
If the function succeeds, it returns TRUE, otherwise FALSE.
Description
The function executes the action of the Variable with the ID VariableID with the value Value. It executes the same action as the WebFront or other Visualizations. If a custom Action Script is defined, that PHP script is executed. Otherwise, the default action of an instance variable is executed, if available. If neither a custom nor a default action is defined, the function RequestAction causes an error. Usually, variable actions switch the corresponding parameter of a device and update the variable value accordingly. It is important to ensure that the type of the set value matches the type of the variable. If the variable has the type String, the value should have the type String as well. Furthermore, the System Variable with $_IPS["SENDER"] = Action is available in the script.
If the variable and value types do not match, the value is converted to the type of the variable. The result of this conversion can deviate from the expected result. It is recommended to pass the correct type.
It needs to be ensured, that Action Scripts do not execute RequestAction on themselves. This would cause an infinite loop.
Example
// Switch Boolean variable 29117 to "true"
RequestAction(29117, true);
// Switch Integer variable 46250 to 18
RequestAction(46250, 18);