Scripting commands

GetLights

Returns an array of string with all light names
Parameters: none

Syntax:

Dim Lights() as string = hs.PluginFunction("JowiHue", "", "GetLights", Nothing)


GetGroups

Returns an array of string with all group names
Parameters: none

Syntax:

Dim Groups() as string = hs.PluginFunction("JowiHue", "", "GetGroups", Nothing)


GetScenes

Returns an array of string with all scene names
Parameters: none

Syntax:

Dim Scenes() as string = hs.PluginFunction("JowiHue", "", "GetScenes", Nothing)


GetPresets

Returns an array of string with all preset names
Parameters: none

Syntax:

Dim Presets() as string = hs.PluginFunction("JowiHue", "", "GetPresets", Nothing)


GetAnimations

Returns an array of string with all animation names
Parameters: none

Syntax:

Dim Animations() as string = hs.PluginFunction("JowiHue", "", "GetAnimations", Nothing)


ListRunningAnimations

Returns a list with all active animation names
Parameters: none

Syntax:

Dim Animations() as List(of string) = hs.PluginFunction("JowiHue", "", "ListRunningAnimations", Nothing)


SetLightsOff

Switch lights off
Returns a Boolean. True = successful, False = unsuccessful
Parameters: 2
Group : True/False – if True groups will be addressed by this command, otherwise lights.
Name : name of the group or light to be controlled

Syntax:

Dim test As Boolean = hs.PluginFunction("JowiHue", "", "SetLightsOff", {True, "All Lights”})


SetLightsHueSat

Sets lights based on Hue mode
Returns a Boolean. True = successful, False = unsuccessful
Parameters: 6
Group True/False – if True groups will be addressed by this command, otherwise lights.
Name name of the group or light to be controlled
Bright Value of brightness to be set. Value can be between 0 and 255. To keep the current value use ‘Nothing’. Setting Bright to 0 will result in an “off” for the light.
Hue Value of Hue to be set. Value can be between 0 and 65535. To keep the current value use ‘Nothing’
Sat Value of saturation to be set. Value can be between 0 and 255. To keep the current setting use ‘Nothing’
Transition Value for transition time of the new setting. Value is in 1/10 of seconds. To have no transition use ‘Nothing’

Syntax:

Dim test As Boolean = hs.PluginFunction("JowiHue", "", "SetLightsHueSat", {True, "All Lights", Nothing, 65535, 255, 20})


SetLightsKelvin

Sets lights based on color temperature mode (“Whites”)
Returns a Boolean. True = successful, False = unsuccessful
Parameters: 5
Group : True/False – if True groups will be addressed by this command, otherwise lights.
Name : name of the group or light to be controlled
Bright : Value of brightness to be set. Value can be between 0 and 255. To keep the current value use ‘Nothing’. Setting Bright to 0 will result in an “off” for the light.
Kelvin : Value of Kelvin color temperature to be set. Value can be between 2000K and 6500K, the limits of the Hue lights. Value can include or omit the “K” in the value. To keep the current value use ‘Nothing’
Transition : Value for transition time of the new setting. Value is in 1/10 of seconds. To have no transition use ‘Nothing’

Syntax:

Dim test As Boolean = hs.PluginFunction("JowiHue", "", "SetLightsKelvin", {True, "All Lights", Nothing, “3000K”, 20})


SetLightsRGB

Sets lights based on CIE color mode (“xy”)
Returns a Boolean. True = successful, False = unsuccessful
Parameters: 5
Group : True/False – if True groups will be addressed by this command, otherwise lights
Name : name of the group or light to be controlled
Bright : Value of brightness to be set. Value can be between 0 and 255. To use the values from RGB calculation use ‘Nothing’. Setting Bright to 0 will result in an “off” for the light.
RGB : Value of RGB to be set. Value is limited to RGB values “0,0,0” to “255,255,255”. To keep the current value use ‘Nothing’
Transition : Value for transition time of the new setting. Value is in 1/10 of seconds. To have no transition use ‘Nothing’

Syntax:

Dim test As Boolean = hs.PluginFunction("JowiHue", "", "SetLightsRGB", {True, "All Lights", Nothing, “255,255,0”, 20})


IncreaseLevel

Increases the bright, saturation and/or hue and ct level of a light or group of lights. The level of increase will be taken from the values on the configuration page.
Returns a Boolean. True = successful, False = unsuccessful
Parameters: 5
Group : True/False – if True groups will be addressed by this command, otherwise lights
Name : name of the group or light to be controlled
IncBright : True/False - if true, brightness level will be increased, if false, no action will be done on brightness level
IncHue : True/False - if true, Hue level will be increased, if false, no action will be done on Hue level
IncSat : True/False if true, saturation level will be increased, if false, no action will be done on saturation level
IncCT : True/False if true, CT level will be increased, if false, no action will be done on colour temperature level

Syntax:

Dim test As Boolean = hs.PluginFunction("JowiHue", "", "IncreaseLevel", {True, "All Lights", True, False, False, False})

DecreaseLevel

Decreases the bright, saturation and/or hue level of a light or group of lights. The level of decrease will be taken from the values on the configuration page.
Returns a Boolean. True = successful, False = unsuccessful
Parameters: 5
Group : True/False – if True groups will be addressed by this command, otherwise lights.
Name : name of the group or light to be controlled
DecBright : True/False - if true, brightness level will be decreased, if false, no action will be done on brightness level
DecHue : True/False - if true, Hue level will be decreased, if false, no action will be done on Hue level
DecSat : True/False if true, saturation level will be decreased, if false, no action will be done on saturation level
DecCT : True/False if true, CTlevel will be decreased, if false, no action will be done on colour temperature level

Syntax:

Dim test As Boolean = hs.PluginFunction("JowiHue", "", "DecreaseLevel", {True, "All Lights", True, True, True,
True})

SetPreset

Start a preset for the chosen lights
Returns a Boolean. True = successful, False = unsuccessful
Parameters: 3
Name : name of the preset to be set
Lights : Name of lights or groups to be set with the preset. When you need to set more then one light or group add “;” beween the names (“Lamp 1;Lamp 2”)
Transitiontime: transtiontime between quotes to use, or send empty string for default setting(“100” or “”)

Syntax:

Dim test As Boolean = hs.PluginFunction("JowiHue", "", "SetPreset", { "Gold", "TableLight;KithchenLight",""})


SetPresetRandom

Start a random preset for the chosen lights
Returns a Boolean. True = successful, False = unsuccessful
Parameters: 3
Lights : Name of lights or groups to be set with the preset. When you need to set more then one light or group add “;” beween the names (“Lamp 1;Lamp 2”)
PresetGroup: Name of presetgroup to use for the random function. Leave empty whey you want to use all presets available
Transtiontime : transtiontime between quotes to use, or send empty string for default setting(“100” or “”)

Syntax:

Dim test As Boolean = hs.PluginFunction("JowiHue", "", "SetPresetRandom", {"TableLight;KithchenLight","Colorfull",""})


StartScene

Starts a scene
Returns a Boolean. True = successful, False = unsuccessful
Parameters: 1
Name : name of the animation to be started

Syntax:

Dim test As Boolean = hs.PluginFunction("JowiHue", "", "StartAnimation", {"Alert"})

DimScene

Dims a scene
Returns a Boolean. True = successful, False = unsuccessful
Parameters: 2
Name : name of the animation to be started Dim : Relative dim value the scene will be dimmed (60= dim 60% of current setting)

Syntax:

 Dim test As Boolean = hs.PluginFunction("JowiHue", "", "DimScene", {"MyScene", 60})


StartAnimation

Starts an Animation
Returns a Boolean. True = successful, False = unsuccessful
Parameters: 2
Name : name of the animation to be started EndTime : If the animation has stretching enabled this parameter is needed, otherwise ‘Nothing’ should be used. Valid values are “sunrise”, “sunset” and the end time in hours and minutes (seconds will be skipped).

Syntax:

Dim test As Boolean = hs.PluginFunction("JowiHue", "", "StartAnimation", {"Night", "sunrise"})


StopAnimation

Stops an Animation
Returns a Boolean. True = successful, False = unsuccessful
Parameters: 1
Name : name of the animation to be stopped. Use “all” to stop all running animations

Syntax:

Dim test As Boolean = hs.PluginFunction("JowiHue", "", "StopAnimation", {"Night"})


DimAnimation

Dims a animation to a relative value
Returns a Boolean. True = successful, False = unsuccessful
Parameters: 2
Name : name of the animation to be started Or “all” to dim all animations Dim : Relative dim value the animation will be dimmed to (60= dim 60% of current setting per bulb)

Syntax:

Dim test As Boolean = hs.PluginFunction("JowiHue", "", "DimAnimation", {"MyAnimation", 60})


LifetimeReport

Returns an overview of usage per light in the HS3 log. It is helpful to plan this report on at a regular moment so you can filter the log and check on your lifetime usage.
Returns a Boolean. True = successful, False = unsuccessful
Parameters: none

Syntax:

Dim test As Boolean = hs.PluginFunction("JowiHue", "", "LifetimeReport", Nothing)


Sample script

As a simple sample of scripting you can do, I have made a script that starts a random scene. Not sure if it is usable, but as a sample it shows some of the possibilities.
The script does not need any parameters to run.

Sub Main(ByVal Parm As Object)
 
    Dim staticRandomGenerator As New System.Random
    Dim Scenes() As String = hs.PluginFunction("JowiHue", "", "GetScenes", Nothing) 'get the list of scenes

    Dim max As Integer = Scenes.GetUpperBound(0)                    ' get the top of the array (do not subtract 1!)
    Dim i As Integer = staticRandomGenerator.Next(0, max)           ' generate a random number
    Dim Scene As String = Scenes(i)                                 ' get the name of the scene
    If hs.PluginFunction("JowiHue", "", "StartScene", {Scene}) Then 'start it!
        hs.WriteLog("HueScript", "Scene " & Scene & " succesfully started")
    Else
        hs.WriteLog("HueScript", "Scene " & Scene & " did not start, check the log")
    End If
 
End Sub