Announcement

Collapse
No announcement yet.

Basic HS3 scripting question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Basic HS3 scripting question

    I am trying to convert HS2 scripts to HS3 scripts. I am out of my league on both, but if someone can help me with this simple example I will learn a lot that I can use here and other places.
    I have a script in HS2 that looks at the string for device V18 and if it finds the word "rising" it turns on device V19. If "rising" is not present, V19 is turned off. I am trying to adapt this to HS3. I use it to know when the tide is rising.
    In HS3 my corresponding variables are:
    HS2 V18 = HS3 Reference ID 729
    HS2 V19 = HS3 Reference ID 730

    Here the script is below. Can someone please suggest to me how to modify it so it works in HS3?

    Sub Main(parm as object)
    dim sVal as String

    sVal= hs.deviceString("V18")
    If sVal.ToUpper.Contains("RISING") Then
    hs.Transmit ("V19","on",0,0,False,False)
    else
    hs.Transmit ("V19","off",0,0,False,False)
    End If

    End Sub

  • #2
    If V18's string is being set directly, then this should work.

    Code:
    Sub Main(parm as object)
    dim sVal as String
    
    sVal= hs.deviceString(729)
    If sVal.ToUpper.Contains("RISING") Then
    hs.CAPIControlHandler(hs.CAPIGetSingleControl(730, True, "On", False, False))
    else
    hs.CAPIControlHandler(hs.CAPIGetSingleControl(730, True, "Off", False, False))
    
    End If
    
    End Sub

    Comment


    • #3
      Thank you. It works! Much appreciated!

      Comment


      • #4
        As a FYI aside, with the EasyTrigger plug-in you could skip the script altogether.
        EasyTrigger will (among several powerful options) let give you the option to trigger one event when the device string changes and contains "rising" with the action to turn on your device, and a second event that will turn the device off if the string changes and does not contain "rising".
        Mike____________________________________________________________ __________________
        HS3 Pro Edition 3.0.0.548

        HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF, Rain8Net+ | RFXCOM | QSE100D | Vantage Pro | Green-Eye | X10: XTB-232, -IIR | Edgeport/8 | Way2Call | Ecobee3

        Comment

        Working...
        X