Announcement

Collapse
No announcement yet.

Help with script

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

    Help with script

    Can one of you VB experts tell me why this simple script doesn't work?

    Sub Main
    hs.NewTimeEvent "This is a test",timevalue(DateAdd("n",1,Now)),datevalue(Now),1,1,1,1,1 ,1,1,"L7:On",true,""
    hs.WriteLog "info","time = " & timevalue(DateAdd("n",1,Now))
    hs.WriteLog "info","date = " & datevalue(Now)
    End Sub

    the log shows:
    12/20/2014 8:17:20 AM Event Event Trigger "test"
    12/20/2014 8:17:20 AM Event Running script in background: myscript.vbs
    12/20/2014 8:17:20 AM info time = 8:18:20 AM
    12/20/2014 8:17:20 AM info date = 12/20/2014


    but L7 does not come on

    #2
    Is NewTimeEvent supported under HS3? I don't see it in the help file.

    Rich posted the following vb.net example to show how create a delayed event:

    Code:
    Sub Main(parm as object)
      ' create a new event
      dim Evref as integer = hs.NewEventEx("wake time", "wake functions", "Auto Wakeup")
    
      ' set the trigger time of the event to 5:00 PM
      dim Ok as Boolean = hs.EventSetTimeTrigger(Evref, "12/5/2014 5:00 pm")
    
      ' set the event to delete itself after it runs
      hs.DeleteAfterTrigger_Set(Evref)
    
    ' add a device action to the event
      dim CC as CAPIControl
      CC = hs.CAPIGetSingleControlByUse(4685, ePairControlUse._Off)
    
      hs.AddDeviceActionToEvent(Evref, CC)
    End Sub
    Hopefully it will help.

    Cheers
    Al
    HS 4.2.8.0: 2134 Devices 1252 Events
    Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

    Comment


      #3
      Thanks for the reply, but I'm still on HS2

      Comment


        #4
        I posted on the HS3 scripting thread because I couldn't find a HS2 scripting thread. Anyway I got my script to work using a "for" loop.

        Comment

        Working...
        X