Announcement

Collapse
No announcement yet.

Basic HS3 scripting question

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

  • Uncle Michael
    replied
    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".

    Leave a comment:


  • jono
    replied
    Thank you. It works! Much appreciated!

    Leave a comment:


  • joegr
    replied
    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

    Leave a comment:


  • jono
    started a topic Basic HS3 scripting question

    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
Working...
X