Dokumentation
IPS_SetVariableCustomPresentation
Benötigt: Symcon >= 8.0
bool IPS_SetVariableCustomPresentation (int $VariablenID, array $Presentation)
Parameterliste
| VariablenID | ID der Variable, der die Darstellung zugeordnet werden soll |
| Presentation | Die Konfiguration der Darstellung. Details sind unter dem Abschnitt Darstellungen zu finden. |
Rückgabewert
Konnte die Funktion erfolgreich ausgeführt werden, liefert sie als Ergebnis TRUE, andernfalls FALSE.
Beschreibung
Die Funktion vergibt der Variable VariablenID die in Presentation konfigurierte Darstellung. Wird ein leeres Array übergeben, wird die benutzerdefinierte Darstellung entfernt.
Beispiel
// Setzt eine Variable auf die Darstellung Schieberegler mit einem Minimum, Maximum und Suffix
IPS_SetVariableCustomPresentation(12345, [
'PRESENTATION' => VARIABLE_PRESENTATION_SLIDER,
'MIN' => 0,
'MAX' => 100,
'SUFFIX' => ' %'
]);
// Setzt eine Variable auf die Darstellung Aufzählung mit Icons und Farben.
IPS_SetVariableCustomPresentation(12345, [
'PRESENTATION' => VARIABLE_PRESENTATION_ENUMERATION,
'DISPLAY' => 1 /* Icon */,
'OPTIONS' => json_encode([
['Value' => 1, 'Caption' => 'Automatisch', 'IconActive' => true, 'IconValue' => 'circle-a'],
['Value' => 2, 'Caption' => 'Eco', 'IconActive' => true, 'IconValue' => 'circle-e', 'Color' => 40448],
['Value' => 3, 'Caption' => 'Manuell', 'IconActive' => true, 'IconValue' => 'circle-m'],
])
]);