Documentation
IPS_RequestAction
bool IPS_RequestAction (int $InstanceID, string $VariableIdent, mixed $Value)
Parameters
| InstanceID | ID of the instance |
| VariableIdent | Ident of the status variable |
| Value | Value for the action |
Returns
If the function succeeds, it returns TRUE, otherwise FALSE.
Description
To switch a variable, RequestAction with the ID of the variable is recommended. RequestAction determines the responsible action by itself: it takes custom actions (action scripts) into account and also works for variables whose action is not provided by the parent instance. IPS_RequestAction bypasses both. The exception are PHP modules: there, IPS_RequestAction calls the module's own RequestAction method, e.g. from the configuration form (onClick/onChange), with an ident that does not have to be a variable.
The function directly calls the RequestAction function of the module of the instance with the ID InstanceID and passes VariableIdent and Value. A custom action of the variable is not executed.
For built-in modules, an object with the ident VariableIdent must exist below the instance, otherwise the function fails with "Object with ident ... could not be found". If the module does not support an action for this variable, it fails with "No action for VariableIdent '...' found".
For PHP modules, VariableIdent is passed to the RequestAction method of the module without any check; whether a variable with this ident exists is up to the module. Errors raised by the module are returned as errors of the function. While Symcon is starting up or shutting down, the method is not called.
Example
// Trigger the action via the instance and the ident
IPS_RequestAction(12345, "Status", true);
// Recommended: trigger the action via the ID of the variable
RequestAction(IPS_GetObjectIDByIdent("Status", 12345), true);