No announcement yet.

Script fire delay?

  • Filter
  • Time
  • Show
Clear All
new posts

    Script fire delay?

    I'm seeing a 2-4 second delay when running a script vs using the embedded IF-THEN with NO delay. Is this expected behavior?

    I'm brand new to this scripting, so any guidance you could provide would be appreciated. ~Tom

    IF Z-Wave Motion Sensor Kitchen changes and becomes Motion
    THEN Run a Script or Script Command (NO Options checked)
    Sub Main(parms as object)
    Dim eventTime = FormatDateTime(Now, DateFormat.ShortTime)

    If eventTime > "06:01" And eventTime < "22:00" Then

    ' Kitchen Counter Device ID 57
    hs.CAPIControlHandler(hs.CAPIGetSingleControl(57,true,"on",f alse,false))

    ' Large Hutch Device ID 49
    hs.CAPIControlHandler(hs.CAPIGetSingleControl(49,true,"on",f alse,false))

    ' Holiday Light Glass Jar Device ID 62
    hs.CAPIControlHandler(hs.CAPIGetSingleControl(62,true,"on",f alse,false))

    'Bathroom Device ID 46
    hs.CAPIControlHandler(hs.CAPIGetSingleControl(46,true,"on",f alse,false))


    'Bathroom Device ID 46
    hs.CAPIControlHandler(hs.CAPIGetSingleControl(46,false,"20", true,true))

    End If

    End Sub
    Current Date/Time: 10/18/2015 4:53:33 PM
    HomeSeer Version: HS3 ZEE S2 Edition
    Linux version: Linux HomeTrollerZeeS2 3.18.11-v7+ #781 SMP PREEMPT Tue Apr 21 18:07:59 BST 2015 armv7l GNU/Linux System Uptime: 0 Days 2 Hours 29 Minutes 57 Seconds
    IP Address:
    Number of Devices: 40
    Number of Events: 11

    Enabled Plug-Ins HSTouch Server Z-Wave

    OK, I have learned that the first time a script runs its slow. But is then cached and runs quickly after that. I was only trying it after edits. Once I was happy with it and let it alone, it fires quickly.