No announcement yet.

Case Structure Script Help Needed

  • Filter
  • Time
  • Show
Clear All
new posts

    Case Structure Script Help Needed

    I am attempting to write a script that will set the colour of an RGB Zwave bulb based on what the current month is; I think this lends itself to a Case Structure? ...So my psuedo-code would look something like this:

    Select Case Month

    Case 1 To 2
    Set Bulb Color To White

    Case 3
    Set Bulb Color To Green 'St Paddies

    Case 4
    Set Bulb Colour To Pink 'Easter

    Case 5 To 9
    Set Bulb Colour to White

    Case 10
    Set Bulb Colour to Orange 'Halloween

    Case 11 To 12
    Set Bulb Colour To Red 'Christmas

    End Select

    I'm not sure of syntax re: retrieving current month, or the syntax re: setting the Device Value. The Device I need to change is Living Rm Aeon Labs Bulb Color Control Custom RGB (70), it has a reference ID of 194.

    Any help with this would be greatly appreciated, Thanks.

    I am not sure about the values for the color but here is some code to get you started.

    From a google searches
    dim month as Integer
    month = DateTime.Now.Month
    dim rgbColor as Integer
    Select Case month
         Case 1
             rgbColor = 70
          Case 2
             rgbColor = 80
      End Select
    HS.SetDeviceValueByRef(194, rgbColor, true)
    If you look at the bottom part of the navigation frame you will see scripting on this HS help page.

    find the resource below more helpful

    Running HS 3 on Win10 .


      Mike____________________________________________________________ __________________
      HS3 Pro Edition, NUC i3

      HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti