Announcement

Collapse
No announcement yet.

How to send http command

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

    How to send http command

    I've tried several different ways to get this done...but alas, no joy.


    I've tried &hs.geturl and &hs.urlaction with put and post.


    When I put the url into the browser it changes the profile in blue iris as it should.


    the url looks like... -http://ip : port/admin?profile=1&lock=2&user=xxxx&pw=xxxx





    How do I get it done????

    #2
    Originally posted by wadesready View Post
    I've tried several different ways to get this done...but alas, no joy.


    I've tried &hs.geturl and &hs.urlaction with put and post.


    When I put the url into the browser it changes the profile in blue iris as it should.


    the url looks like... -http://ip : port/admin?profile=1&lock=2&user=xxxx&pw=xxxx





    How do I get it done????
    I'm guessing you want this from an Event?

    Code:
    hs.GetURL(IP, URL, TRUE, PORT)
    So for example you would use it like:

    hs.GetURL("http://localhost","/what/you/want",TRUE,80)

    I stopped using the hs.GetURL and for scripts I use HttpWebRequest (part of System.Net) and for Plugins I use RestSharp...but that's just me.

    Comment


      #3
      Originally posted by jeubanks View Post
      I'm guessing you want this from an Event?

      Code:
      hs.GetURL(IP, URL, TRUE, PORT)
      So for example you would use it like:

      hs.GetURL("http://localhost","/what/you/want",TRUE,80)

      I stopped using the hs.GetURL and for scripts I use HttpWebRequest (part of System.Net) and for Plugins I use RestSharp...but that's just me.

      that got it!!! Thank you very much!!!

      Comment


        #4
        Originally posted by jeubanks View Post
        I stopped using the hs.GetURL and for scripts I use HttpWebRequest (part of System.Net) and for Plugins I use RestSharp...but that's just me.
        Forgive me I'm new but trying to learn, I have been using hs.GetURL for some time and curious on the different ways to approach this and why one is better vs. another.


        Thanks,

        Comment


          #5
          Originally posted by integlikewhoa View Post
          Forgive me I'm new but trying to learn, I have been using hs.GetURL for some time and curious on the different ways to approach this and why one is better vs. another.


          Thanks,
          Well, just my opinion...

          hs.GetURL is great for really simple GET requests from a script. Works fine. For a basic POST that doesn't has too much complications I will use htttWebRequest. For plugins I'm using RestSharp mainly because it's super simple to use works with multiple .NET runtimes and for a lot of JSON parsing it's built in and you don't have to go to NewtonSoft unless your doing more complex things. What I don't like about RestSharp is that it's NOT documented very well. Which leaves you doing a lot of searching or looking inside code at the beginning of using it.

          Comment


            #6
            Big5 is a plug-in for HS3 that supports HTTP

            ​​​​​​​https://forums.homeseer.com/forum/li.../big5-risquare

            Comment


              #7
              Hello all ,

              Chiming in on this thread. Can someone help me please with this?
              I would like to send a http command I tried this:
              Code:
              hs.GetURL("http://192.168.68.20:84/admin?profile=1&user=xxxxx&pw=xxxxxxxxxxxx",TRUE,80)
              But do I have to save it as a vb file or txt file ... or maybe something completely different?
              Click image for larger version

Name:	2019-11-16 20_29_16-Security - TeamViewer - Free license (non-commercial use only).jpg
Views:	664
Size:	52.8 KB
ID:	1340590
              Both using a txt or vb gives me error codes in the log file:
              ov-16 8:22:54 PM Error Running script, script run or compile error in file: C:/Program Files (x86)/HomeSeer HS3/scripts/BI.txt1044:Cannot use parentheses when calling a Sub in line 1 More info: Cannot use parentheses when calling a Sub
              Nov-16 8:22:54 PM Event Running script in background: C:/Program Files (x86)/HomeSeer HS3/scripts/BI.txt
              Nov-16 8:22:54 PM Event Event Trigger "Blue iris Send http command"
              Nov-16 8:22:54 PM Event Event Blue iris Send http command triggered by the event page 'Run' button.
              Nov-16 8:22:29 PM Z-Wave Device: Node 14 Z-Wave Temperature 3 Set to 19.62 (C)
              Nov-16 8:22:29 PM Z-Wave Device: Node 14 Z-Wave Temperature 3 Set to 19.62 (C)
              Nov-16 8:21:22 PM Error Compiling script C:\Program Files (x86)\HomeSeer HS3\scripts\BI.vb: Declaration expected.
              Nov-16 8:21:22 PM Error Compiling script C:\Program Files (x86)\HomeSeer HS3\scripts\BI.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.


              Many thanks,
              Cor

              Comment


                #8
                For a one line script like this, check the box 'Immediate script command', then enter your code line directly in the form field. No file is generated in this case.

                Comment


                  #9
                  zwolfpack : thank you!

                  I just entered this http command in the "immediate script command" with what I think it should be , but I get this error:
                  Nov-16 9:04:24 PM Error Running script(1) &hs.GetURL("http://192.168.68.20:84/admin?profile=1&user=xxxxx&pw=xxxxxxx",TRUE,80), init error: Cannot use parentheses when calling a Sub
                  Anyone has an idea what I am doing wrong?

                  Comment


                    #10
                    Try &nhs rather than &hs. If that still does not work, post a new screenshot.
                    HS 3.0.0.548: 1990 Devices 1172 Events
                    Z-Wave 3.0.1.262: 126 Nodes on one Z-Net

                    Comment


                      #11
                      GetURL requires four parameters rather than three. Try this
                      Code:
                      hs.GetURL("http://192.168.68.20:84","/admin?profile=1&user=xxxxx&pw=xxxxxxxxxxxx",TRUE,80)

                      Comment


                        #12
                        zwolfpack : Now it works , thank you very much!

                        Cor

                        Comment


                          #13
                          zwolfpack

                          Originally posted by zwolfpack View Post
                          GetURL requires four parameters rather than three. Try this
                          Code:
                          hs.GetURL("http://192.168.68.20:84","/admin?profile=1&user=xxxxx&pw=xxxxxxxxxxxx",TRUE,80)
                          All clear. However is it possible part of the URL to be substituted by a HS4 device value
                          like this

                          http://192.168.1.132/power=[val123]

                          where [val123] is the value of HS4 device with ID 123

                          ​​​​​​​Thanks

                          Comment


                            #14
                            Try

                            Code:
                            nhs.GetURL("http://192.168.1.132", "/power=" & hs.DeviceValue(123), True, 80)
                            The last parameter is the server port number.

                            Comment


                              #15
                              zwolfpack

                              ​​​​​​​That works. Thank you.

                              TheDude

                              Comment

                              Working...
                              X