Announcement

Collapse
No announcement yet.

Http GET command to change device status

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

    Http GET command to change device status

    Hi,

    I am trying to write a script that will send a http GET command then depending on the result either turn a device on or off. The http page will either have a 0 for off or 1 for on. Any thoughts?

    Thanks,
    Emmett

    #2
    This would be great if it worked with Xively

    Last week I started messing around with Arduino's - they are fantastic - but not much integration with HS - if this could receive and send commands to Xively and or thingsspeak

    It would be good to use an API key for security and id the event you want to change or publish along with a value.

    https://xively.com

    https://www.thingspeak.com

    Comment


      #3
      Http GET command to change device status

      You could create an asp page which links to homeseer, and have variables passed to that asp page which trigger or do something.

      You would have to make this yourself but I do believe there is a tenhsserver script which does something similar

      http://www.tenholder.net/tenWare2/te...r/default.aspx
      HS3 PRO, Win10, WeatherXML, HSTouch, Pushover, UltraGCIR, Heaps of Jon00 Plugins, Just sold and about to move so very slim system.

      Facebook | Twitter | Flickr | Google+ | Website | YouTube

      Comment


        #4
        You can use the command hs.urlaction to do a GET and examine the result (the reply string will be the result), example syntax is in the help file.

        Comment


          #5
          Originally posted by norcoscia View Post
          Last week I started messing around with Arduino's - they are fantastic - but not much integration with HS - if this could receive and send commands to Xively and or thingsspeak

          It would be good to use an API key for security and id the event you want to change or publish along with a value.

          https://xively.com

          https://www.thingspeak.com
          I and others have been doing stuff with Arduinos or other micro controllers in HS for a while (to me that is what HA is all about). I did think of either creating a big project thread with simple example projects of linking them with HS...if you have anything specific I could see about creating a thread with some instructions (if I can do it myself, set myself a challenge now). With stuff like http://www.indiegogo.com/projects/9-...rn-electronics they are very inexpensive way of getting IO into HS.

          Comment


            #6
            Originally posted by mrhappy View Post
            I and others have been doing stuff with Arduinos or other micro controllers in HS for a while (to me that is what HA is all about). I did think of either creating a big project thread with simple example projects of linking them with HS...if you have anything specific I could see about creating a thread with some instructions (if I can do it myself, set myself a challenge now). With stuff like http://www.indiegogo.com/projects/9-...rn-electronics they are very inexpensive way of getting IO into HS.
            Ok thanks! I will try and use the hs.urlaction. I am trying to interface a Raspberry pi and I have magnetic contact sensors connected to GPIOs and would like the status of those to reflect as HomeSeer devices.

            Emmett

            Comment


              #7
              Return Value

              Originally posted by mrhappy View Post
              You can use the command hs.urlaction to do a GET and examine the result (the reply string will be the result), example syntax is in the help file.
              Here is what I currently have.

              Sub Main
              dim s
              dim data
              const website = "http://10.0.0.50:8000/GPIO/23/value"

              s = hs.URLAction(website, "GET", "", "")
              End Sub

              How would the return value be written so if the value = 1 it is on and 0 for off? Where does the hs.URLAction return the value?

              Thank You,

              Emmett

              Comment


                #8
                Originally posted by emmett View Post
                Ok thanks! I will try and use the hs.urlaction. I am trying to interface a Raspberry pi and I have magnetic contact sensors connected to GPIOs and would like the status of those to reflect as HomeSeer devices.

                Emmett
                I did set some outputs from the R-Pi using some python web server script and the MCP23017 (IO expander), inputs were a bit of a pain in the proverbial as there was always a delay on polling them if you relied on HS to do the polling. If you did the polling in a python script you could combine it with the (rather excellent) TextSeer plugin that could respond to a HTTP command into HS and set the devices.

                Comment


                  #9
                  Originally posted by emmett View Post
                  Here is what I currently have.

                  Sub Main
                  dim s
                  dim data
                  const website = "http://10.0.0.50:8000/GPIO/23/value"

                  s = hs.URLAction(website, "GET", "", "")
                  End Sub

                  How would the return value be written so if the value = 1 it is on and 0 for off? Where does the hs.URLAction return the value?

                  Thank You,

                  Emmett
                  below s= hs.URLAction add this line

                  hs.writelog "Test", s

                  and tell me what gets put in the HS log...

                  Comment


                    #10
                    Originally posted by mrhappy View Post
                    I and others have been doing stuff with Arduinos or other micro controllers in HS for a while (to me that is what HA is all about). I did think of either creating a big project thread with simple example projects of linking them with HS...if you have anything specific I could see about creating a thread with some instructions (if I can do it myself, set myself a challenge now). With stuff like http://www.indiegogo.com/projects/9-...rn-electronics they are very inexpensive way of getting IO into HS.
                    heh - I just backed them today for 1 board.
                    HS4Pro on a Raspberry Pi4
                    54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
                    Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI

                    HSTouch Clients: 1 Android

                    Comment


                      #11
                      Originally posted by rmasonjr View Post
                      heh - I just backed them today for 1 board.
                      I'm in the queue for two but might up it another considering he has said that this will be the only run, shame really as it is going to be a good deal but guess you can't make a living out of it.

                      Comment


                        #12
                        Originally posted by mrhappy View Post
                        below s= hs.URLAction add this line

                        hs.writelog "Test", s

                        and tell me what gets put in the HS log...

                        This is the result. It looks to be working. How would I then go about turning my virtual device on or off depending on the result?

                        7/30/2013 5:23:54 PM Test 1

                        Thank You,
                        Emmett

                        Comment


                          #13
                          Originally posted by emmett View Post
                          This is the result. It looks to be working. How would I then go about turning my virtual device on or off depending on the result?

                          7/30/2013 5:23:54 PM Test 1

                          Thank You,
                          Emmett
                          It would be something like

                          s = cint(s) 'this just converts it into an integer

                          if s = 1 then
                          hs.setdevicestatus "C1", 2 'this sets C1 to on, change C1 to suit
                          else
                          hs.setdevicestatus "C1", 3 'this sets it to off
                          end if

                          Comment


                            #14
                            I know it requires hard programming in the Raspberry Pi / Arduino but wouldn't it be better to have it work the other way, e.g. the Device tells the Homeseer server to change the value of a specific device code, rather than have the homeseer server poll the Raspberry Pi / Arduino device every x amount of time. Then you can move away from having to pull the results and have the device push the status when it changes accordingly.

                            Example: Door 1 - 5 Sensors connected to Arduino + Ethernet. When door one is opened after x seconds the Homeseer server pulls the result and determines that it has changed and updates the device status accordingly, if you have a delay of 1 - 5 seconds between then you could miss this and have a pause, whereas if you have the device push its status to homeseer through a URL then as soon as a status changes, it would be updated accordingly.

                            Just my two cents worth, but it would either require you to know the device code, or to have an ASP page where you send the sensor number and in the ASP page then match that to the appropiate devicecode.
                            HS3 PRO, Win10, WeatherXML, HSTouch, Pushover, UltraGCIR, Heaps of Jon00 Plugins, Just sold and about to move so very slim system.

                            Facebook | Twitter | Flickr | Google+ | Website | YouTube

                            Comment


                              #15
                              Originally posted by mrhappy View Post
                              It would be something like

                              s = cint(s) 'this just converts it into an integer

                              if s = 1 then
                              hs.setdevicestatus "C1", 2 'this sets C1 to on, change C1 to suit
                              else
                              hs.setdevicestatus "C1", 3 'this sets it to off
                              end if
                              That worked perfect! Thank you!

                              Emmett

                              Comment

                              Working...
                              X