« Back to Product

Documentation

RequestAction

Require: IP-Symcon >= 5.0

 variant RequestAction (int $VariableID, variant $Value) 

Parameters

VariableID

ID of the variable

Value

Value for the action

Returns

If the command succeeds, it returns TRUE, otherwise FALSE.

Description

The command 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 Scripts 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 Variables with $_IPS["SENDER"] = Action are available.

Warning

If the variable and value types do not match, PHP tries to make the appropriate conversion. The result of this conversion can deviate from the expected result. It is recommended to pass the correct type.

Warning

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);
Any questions?