Announcement

Collapse
No announcement yet.

Virtual field without graphic

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

  • gelessor
    replied
    This works perfectly for a single device. I have VERY limited scripting knowledge and would like to enhance this script to include up to 5 devices. What do I need to add?

    Thanks

    Sub Main(parm as object)
    dim aVal() as string
    dim sVal as string

    sVal = hs.deviceString("[2")
    aVal = split(sVal, ">")
    hs.writelog ("Test",aVal(1))
    ' You can assign the aVal(1) to a virtual device
    hs.setDeviceString("V1", aVal(1))

    End Sub

    Leave a comment:


  • gelessor
    replied
    will do

    Thanks again for you help.

    Leave a comment:


  • Rupp
    replied
    You may have to ask Jim about this one.

    Leave a comment:


  • gelessor
    replied
    tried change status to "any" but it is not triggering...

    Leave a comment:


  • Rupp
    replied
    Does device status change not work?

    Leave a comment:


  • gelessor
    replied
    OK.

    Struggling more with this than I thought...

    I need to run this script each time the status of the device "DooMotion Plugin Last Motion" changes. How do I set the trigger????

    Leave a comment:


  • Rupp
    replied
    You're welcome. Sorry it took so long.

    Leave a comment:


  • gelessor
    replied
    Perfect!

    Thanks Rupp.

    Leave a comment:


  • Rupp
    replied
    Sorry about that.

    Code:
    Sub Main(parm as object)
    dim aVal() as string
    dim sVal as string
    
    sVal = hs.deviceString("[2")
    aVal = split(sVal, ">")
    hs.writelog ("Test",aVal(1))
    ' You can assign the aVal(1) to a virtual device
    hs.setDeviceString("V1", aVal(1))
    
    End Sub

    Leave a comment:


  • gelessor
    replied
    oops...

    I have attached the scrip (.txt was added to load into message board)


    OK changed to .vb and get the following in the log....

    Event Trigger "Last Motion"
    1/10/2010 8:30:16 PM Event Running script in background: xLobby Last Motion.vb
    1/10/2010 8:30:16 PM Error Script compile error: Method arguments must be enclosed in parentheses.on line 22
    1/10/2010 8:30:16 PM SCR Option Strict Offimports Schedulerimports SystemPublic Module scriptcode7#Region "Automatically generated code, do not modify"'Automatically generated code, do not modify'Event Sources Begin Public WithEvents hs As Scheduler.hsapplication Public WithEvents hsp As scheduler.hsp Public WithEvents hssystem As scheduler.phone0'Event Sources End'End of automatically generated code#End RegionSub Main(parm as object)dim aVal() as stringdim sVal as stringsVal = hs.deviceString("[2")aVal = split(sVal, ">")hs.writelog ("Test",aVal(1))' You can assign the aVal(1) to a virtual devicehs.setDeviceString "x20", aVal(1)End SubEnd Module
    Attached Files
    Last edited by gelessor; January 10, 2010, 08:48 PM.

    Leave a comment:


  • Rupp
    replied
    Did you make this a .vb script?

    Leave a comment:


  • gelessor
    replied
    Getting this error in the log....

    1/10/2010 6:17:03 PM Event Event Trigger "Last Motion"
    1/10/2010 6:17:03 PM Event Running script in background: xLobby Last Motion
    1/10/2010 6:17:03 PM Error Running script, script run or compile error in file: xLobby Last Motion1006:Expected ')' in line 1 More info: Expected ')'
    1

    Leave a comment:


  • Rupp
    replied
    Try this.

    Code:
    Sub Main(parm as object)
    dim aVal() as string
    dim sVal as string
    
    sVal = hs.deviceString("[2")
    aVal = split(sVal, ">")
    hs.writelog ("Test",aVal(1))
    ' You can assign the aVal(1) to a virtual device
    hs.setDeviceString "V1", aVal(1)
    
    End Sub
    Try this as it is untested but should be close

    Leave a comment:


  • gelessor
    replied
    OK. Here you go...

    <img alt=""src="/Images/DooMotion/hspi_doomotion.gif align="absmiddle">Kitchen Motion

    Leave a comment:


  • Rupp
    replied
    Try this command. I need to see the actual html and not the image
    Go to the control tab and run this:
    &msgbox(hs.deviceString("[2"))

    Leave a comment:

Working...
X