« Back to Product

Documentation

Switch

Require: Symcon >= 8.0

Parameters

Information about the visual properties and meanings of the parameters can be found in the Object Presentation.

Name Type Parameter Description
PRESENTATION String The ID of the presentation VARIABLE_PRESENTATION_SWITCH
{60AE6B26-B3E2-BDB1-A3A1-BE232940664B}
USE_ICON_FALSE Boolean Individual icons based on value
ICON_TRUE String Icon for true, also false if USE_ICON_FALSE false Icons
ICON_FALSE String Icon for false if USE_ICON_FALSE true Icons
GLOW_COLOR Integer Color of glow while active
GLOW_INTENSITY Integer Intensity of glow while active
USAGE_TYPE Integer Variable Usage 0: On/Off, 1: Mute Switch, 2: None of these

Examples

// When registering a variable for PHP modules
// A switch that glows green.
$this->RegisterVariableInteger('Status', 'Status', [
    'PRESENTATION' => VARIABLE_PRESENTATION_SWITCH,
    'GLOW_COLOR' => 3210585,
    'GLOW_INTENSITY' => 20,
    'USAGE_TYPE' => 0 /* On/Off */
]);
// A switch with custom icons to mute
$this->RegisterVariableInteger('Mute', 'Mute', [
    'PRESENTATION' => VARIABLE_PRESENTATION_SWITCH,
    'USE_ICON_FALSE' => true,
    'ICON_FALSE' => 'volume',
    'USAGE_TYPE' => 1 /* Mute */,
    'ICON_TRUE' => 'volume-xmark',
]);

// For existing variables via script
// A switch that glows green.
IPS_SetVariableCustomPresentation(12345, [
    'PRESENTATION' => VARIABLE_PRESENTATION_SWITCH,
    'GLOW_COLOR' => 3210585,
    'GLOW_INTENSITY' => 20,
    'USAGE_TYPE' => 0 /* On/Off */
]);
// A switch with custom icons to mute
IPS_SetVariableCustomPresentation(12345, [
    'PRESENTATION' => VARIABLE_PRESENTATION_SWITCH,
    'USE_ICON_FALSE' => true,
    'ICON_FALSE' => 'volume',
    'USAGE_TYPE' => 1 /* Mute */,
    'ICON_TRUE' => 'volume-xmark',
]);
Any questions?