Skip to main content

Target controls specification

Control methods refer to device's control fields which are provided as "controls" in description of unit state. There are several complementing ways how controls can be specified.

  • General control name: "Dimmer", "Slider", "ColorTemperature" (alias "CCT"), "RBG"/"XY" (alias "Color"), "WhiteColorBalance" (alias "ColorBalance"), etc.
  • Indexed typename: dimmer[0..3], slider[0..7], onoff[0..7], pushbutton[0..3].
  • Named custom element: using the "name" property of custom controls from unit state "controls" details.
  • "$reference" name of custom elements as specified in the fixture profile.
  • Control typename (lowercase aliases of advertised controls names): dimmer, slider, onoff, pushbutton, etc.

Multiple examples what may be used in the "targetControls" specification are shown below. Note that for multiple controls of the same base type, the general name/typename affects all of them.

let targetControls = {
// General names:
"Dimmer": {"value": 0.5}, // Dimmer value can be anything from 0 to 1
"Slider": {"value": 45}, // value in the MIN..MAX range of the control
"ColorTemperature": {"value" : 5000}, // value in Kelvin
"Colorsource": {"source": "TW"}, // "RGB" (also for HueSat model), "XY" or "TW"
"RGB": {"hue": 0.5, "sat": 0.5},
"RGB": {"rgb": "rgb(0, 125, 255)"}, // "Color" can be used as more general alias for RGB/HS/XY setters
"XY": {"x": 0.375, "y": 0.425 },
"ColorBalance": {"value": 0.5}, // alias for "WhiteColorBalance"
"OnOff": {"value" : 1.0}, // On/Off
"PushButton": {"value" : 1.0}, // Pressed/Released
...
// Indexed control types:
"dimmer0": {"value": 0.5}, // the first slider
"dimmer1": {"value": 1.0}, // the second slider, etc.
...
"slider4": {"value": 0.5}, // the 5th slider
...
"onoff0": {"value": 0.0}, // the first ON/OFF toggle
...
"pushbutton0": {"value": 1.0}, // PushButton controls
...
// Named custom elements:
"height": {"value": 200.0}, // for a "$height" custom element, the name property is just "height",
"$angle": {"value": 30.0}, // and both ways can be used; the "$" prefix may be needed to disambiguate
};