Announcement

Collapse
No announcement yet.

Setting parameter

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

    Setting parameter

    Hey Folks, I was hoping someone could help me using the parameter field... I am unsure how to get it into the html string:

    Have the parameter fields set to 17|1 as seen here http://board.homeseer.com/showthread.php?t=172106

    Code:
    Sub Main
    dim s
    
            Dim ParmArray() As String
    
    ParmArray = Parms.ToString.Split("|")
    
    const server_url = "http://192.168.1.34:8000/GPIO/(ParmArray(0))/value/(ParmArray(1))"
    const headers="Content-Type: application/x-www-form-urlencoded" 
    const data=""
    
    s = hs.URLAction(server_url, "POST", data, headers)
    End Sub
    Running script, script run or compile error in file: C:/Program Files (x86)/HomeSeer HS3/scripts/PiLight - WebIoPi.txt1025:Expected end of statement in line 4 More info: Expected end of statement


    Thanks in advance!

    #2
    Try:

    Sub Main(ByVal Parms As Object)

    dim s As String
    Dim ParmArray() As String

    ParmArray = Parms.ToString.Split("|")

    Dim server_url As String = "http://192.168.1.34:8000/GPIO/" & ParmArray(0) & "/value/" & ParmArray(1)
    Dim headers As String = "Content-Type: application/x-www-form-urlencoded"
    Dim data As String = ""
    s = hs.URLAction(server_url, "POST", data, headers)

    End Sub
    save it with a .vb extension, not .txt

    Cheers
    Al
    Last edited by sparkman; May 16, 2016, 08:58 PM.
    HS 4.2.8.0: 2134 Devices 1252 Events
    Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

    Comment


      #3
      Thanks Al. Starting to google these errors and wanted to check the end of one line, I tried it with the same error both times :

      Code:
      const server_url = "http://192.168.1.34:8000/GPIO/" & ParmArray(0) & "/value/" & ParmArray(1) & ""
      
      versus
      
      const server_url = "http://192.168.1.34:8000/GPIO/" & ParmArray(0) & "/value/" & ParmArray(1)

      May-16 10:03:53 PM Error Compiling script C:\Program Files (x86)\HomeSeer HS3\scripts\PiLight - WebIoPi.vb: Constant expression is required.
      May-16 10:03:53 PM Error Compiling script C:\Program Files (x86)\HomeSeer HS3\scripts\PiLight - WebIoPi.vb: Constant expression is required.
      May-16 10:03:53 PM Error Compiling script C:\Program Files (x86)\HomeSeer HS3\scripts\PiLight - WebIoPi.vb: Namespace or type specified in the Imports 'System.Core' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.

      Comment


        #4
        I've updated the script above. Give it another try
        HS 4.2.8.0: 2134 Devices 1252 Events
        Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

        Comment


          #5
          Boom! You rock! Just saved me hours of copy and pasting.

          Thank you!
          JG

          Comment


            #6
            Originally posted by jgearinger View Post
            Boom! You rock! Just saved me hours of copy and pasting.

            Thank you!
            JG
            You're welcome, glad to help.
            HS 4.2.8.0: 2134 Devices 1252 Events
            Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

            Comment

            Working...
            X