« Back to Product

Documentation

IPS_GetVariable

 array IPS_GetVariable (int $VariableID) 

Parameters

VariableID

ID of the variable

Returns

The following information is available as key => value pairs:

Index Type Description
VariableID integer ID of the variable
VariableProfile string Name of the system profile. Empty if no profile is specified
VariableAction integer ID of the instance that is notified about desired changes to the variable. 0 for none or deactivated connection
VariableCustomProfile string Name of the user defined profile. Empty if no profile is specified
VariableCustomAction integer ID of the script that starts on desired changes to the variable from the visualization. If an existing default action is disabled, the non-existent ScriptID 1 (VARIABLE_ACTION_DISABLED) is given. 0 (VARIABLE_ACTION_NONE) if no custom action is set.
VariableUpdated integer Unix timestamp of the most recent variable update
VariableChanged integer Unix timestamp of the most recent variable change
VariablePresentation array System presentation. Empty array if no presentation is specified.
VariableCustomPresentation array User-defined presentation. Empty array if no presentation is specified.
VariableType integer Type of the variable (0 (VARIABLETYPE_BOOLEAN): Boolean, 1 (VARIABLETYPE_INTEGER): Integer, 2 (VARIABLETYPE_FLOAT): Float, 3 (VARIABLETYPE_STRING): String)
VariableValue mixed Current value of the variable. The data type matches VariableType. See also GetValue
VariableIsLocked boolean Indicates if the variable is above the variable limit and thus cannot be written

Description

This function returns an array that contains information about the variable with the ID VariableID.

Example

print_r(IPS_GetVariable(40770));
/* Exemplary output:
Array
(
    [VariableID] => 40770
    [VariableProfile] => ~Switch
    [VariableAction] => 0
    [VariableCustomProfile] =>
    [VariableCustomAction] => 0
    [VariableUpdated] => 1246039629
    [VariableChanged] => 1246039629
    [VariablePresentation] => Array
        (
            [PRESENTATION] => {4153A8D4-5C33-C65F-C1F3-7B61AAF99B1C}
            [PROFILE] => ~Switch
        )

    [VariableCustomPresentation] => Array
        (
        )

    [VariableType] => 0
    [VariableValue] => 1
    [VariableIsLocked] =>
)
*/
Any questions?