Documentation
IPS_SetVariableCustomPresentation
Require: Symcon >= 8.0
bool IPS_SetVariableCustomPresentation (int $VariableID, array $Presentation)
Parameters
| VariableID | ID of the variable to which the presentation is to be assigned |
| Presentation | The configuration of the presentation. Details can be found in the section Presentations. |
Returns
If the function could be executed successfully, the result is TRUE, otherwise FALSE.
Description
The function assigns the presentation configured in Presentation to the variable VariableID. If an empty array is passed, the custom presentation is removed.
Example
// Sets the presentation of a variable to Slider with a minimum, maximum and suffix
IPS_SetVariableCustomPresentation(12345, ['PRESENTATION' => VARIABLE_PRESENTATION_SLIDER, 'MIN' => 0, 'MAX' => 100, 'SUFFIX' => ' %']);
// Sets the presentation of a variable to Enumeration with icons and colors.
IPS_SetVariableCustomPresentation(12345, [
'PRESENTATION' => VARIABLE_PRESENTATION_ENUMERATION,
'DISPLAY' => 1 /* Icon */,
'OPTIONS' => json_encode([
['Value' => 1, 'Caption' => 'Automatic', 'IconActive' => true, 'IconValue' => 'circle-a'],
['Value' => 2, 'Caption' => 'Eco', 'IconActive' => true, 'IconValue' => 'circle-e', 'Color' => 40448],
['Value' => 3, 'Caption' => 'Manual', 'IconActive' => true, 'IconValue' => 'circle-m'],
])
]);