Announcement

Collapse
No announcement yet.

Little Help converting HS2 script

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

  • Little Help converting HS2 script

    Starting the daunting task of converting my HS2 script, is there a good starting point to understand the differences in the scripting between HS2 and HS3?

    Since hs.exec10 is no longer an option, how can I turn off devices now with a script?

    HS2
    Code:
    Sub Main
    
    hs.execx10 "f1+2+3+4", "Off",0
    hs.execx10 "L2+3+4+5+6+7+8+9+10+11+12+13+14+15+16", "Off",0
    hs.execx10 "M1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16", "Off",0
    
    End Sub
    Last edited by bmora; May 3rd, 2014, 06:51 PM.

  • #2
    CAPI control is the replacement for execX10 but why not simply create an event to do this?
    -Rupp
    sigpic

    Comment


    • #3
      Originally posted by Rupp View Post
      CAPI control is the replacement for execX10 but why not simply create an event to do this?
      Well its much easier to manage that many devices within a script rather then adding each device manually and then having to go back through when things change.

      Comment


      • #4
        Originally posted by bmora View Post
        Well its much easier to manage that many devices within a script rather then adding each device manually and then having to go back through when things change.
        When you see CAPI you may change your mind.
        Regards,
        Michael

        HS3, W10 Home, HSTouch, W800, Z-Stick+

        Comment


        • #5
          This thread is what got me started. I've just started so I'm still new at it.

          http://board.homeseer.com/showthread.php?t=161009

          I've nicknamed CAPI, crapi. It's more work and what they'll probably do someday is provide a wrapper for it elevating the interface to something more suited for scripting.

          There are CAPI objects to obtain information about a device and objects to control the device. What I did first was used CAPI to show me what it knows about each of my devices. Then you can use a CAPI object to control the device by label name or an index number. For instance I discovered that the proper index value to turn my EZFlora irrigation zone on is 0 and off is 1. So here's the steps I use to turn a sprinkler on, delay and then off.

          'Zone ON
          objCAPIControl = hs.CAPIGetControl(intDevRef)(0)
          CallCAPI = hs.CAPIControlHandler(objCAPIControl)

          'wait
          hs.WaitEvents()
          hs.WaitSecs(600)

          ' Zone OFF
          objCAPIControl = hs.CAPIGetControl(intDevRef)(1)
          CallCAPI = hs.CAPIControlHandler(objCAPIControl)
          to get the device reference number use this.
          ' pass in the device name = location and device name
          ' as in Office DeskLamp

          intDevRef = hs.GetDeviceRefByName("Office DeskLamp")
          If intDevRef = -1 Then
          Throw New System.Exception(p(0) & " device not found")
          End If
          I'm using Visual Studio Express 2012 for Desktop and the tenScripting3 project for development. Cudos to tenholde for tenScripting3.

          hope this helps. -phil

          Comment

          Working...
          X