Announcement

Collapse
No announcement yet.

Controlling HomeSeer Through HTTP Post Commands - Android Example

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

    Controlling HomeSeer Through HTTP Post Commands - Android Example

    Hi, I'm new here and to HomeSeer. I hope this post isn't redundant. If it is, I apologize in advance.

    I just wanted a quick and dirty way to do a few things from my Android devices on my way out of the house, on my way home, and when I’m in my house, and integrate some HS commands with Tasker for Android. The HS3 Touch Android app leaves a lot to be desired. It takes way too many steps to do things, the sounds are annoying, etc. etc. I started writing my own Android App, but quickly realized that the time investment wasn’t worth it, at least until Google releases its own development API.

    I found several posts from people wondering how to control HS3 with HTTP Post commands (it won’t accept get by the way), but turned up a whole bunch of nothing. So, having a lot of networking and web development experience, it didn’t take more than a few minutes to come up with some code to do what I want. So, what I have now is a shortcut on my home screen that loads a quick and dirty web page to run events and control devices. I decided to actually place the HTML file on the devices’ flash memory instead of my Raspberry PI for the moment so the page loads faster. (I know I’ll get more control out of having the page on the Raspberry PI, but at that point I might as well not use HTTP for control.) I then loaded the page in Firefox, and added a shortcut to it on my home screen through Firefox.

    Anyhow, all you have to do is use the web development tools in the desktop version of Firefox and inspect the controls on the HS web pages for whatever it is you want to do.

    To run an event, just post Run_EventID to /Events. So, for example, if your inspection shows that the event ID you want to control is 1234, you would post Run_1234 to /Events. To turn on or off a device, there are three parameters you need to post to /deviceutility. First is ref. This is the id for the device to control. You have to find this by inspection. Second is action, this needs to be set to devicecontrol. Last is CAPIControl. Set this to 0 to turn a device on, 1 to turn a device off. Note that everything here is of course, case sensitive.

    That’s all there is to it. If anyone wants some sample HTML source, let me know.
    Attached Files
    Last edited by Android; December 4, 2014, 08:56 AM.

    #2
    Just an FYI. The last few versions of HS3 includes a JSON interface that already supports these mechanics.
    💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

    Comment


      #3
      Awesome first post! I hope we see more!

      Comment


        #4
        Thanks NeverDie and Rupp.

        I looked at the JSON support. There's so many directions to go with this, it's just finding the time and figuring out what I want to do. Eventually I want to make an Android App that makes running events, controlling devices, and checking device status super quick and easy, but for now I'll settle with a web page. I guess my Android App will also be using the "View" capabilities to load controls off of a web page anyhow, so maybe JSON will be the way to go.

        Comment


          #5
          If you could show an http example or two it would be much appreciated.
          Don

          Comment


            #6
            Here's a sample html file (change the extension to html instead of txt). Just do a find a replace on x.x.x.x with the IP address of your HomeSeer, and change the Run_ id numbers for events, ref values for devices to control, and descriptions to whatever you need. Then put it on your android device somewhere, find it with a file manager, open it, choose open with Firefox. I don't know how other browsers work since I only use Firefox on Android, but if you don't use Firefox, to create a desktop shortcut to the web page, hold down on the URL, then click "Add to Home Screen". To find the IDs or Ref numbers super easily, in the desktop Firefox, go to Tools... Web Developer... Inspector. Then just click on the button that activates the device or event, and check, and look through the source code.

            The HTML / JS is a bit sloppy, but I just wanted to get something whipped together quick.

            Hope this helps.
            Attached Files

            Comment


              #7
              Thanks!
              Don

              Comment


                #8
                This is probably the most unexpected first post I've ever seen! I am looking forward to your future contributions.

                Just curious, have you taken a look at the BLControl plug-in?
                Mike____________________________________________________________ __________________
                HS3 Pro Edition 3.0.0.548, NUC i3

                HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

                Comment


                  #9
                  Downloaded smart watch pro for the pebble can someone show me how to implement this in the companion app? There is also one called home remote but it looks like the http command has to be all in one line. That app looks pretty swell in that you can have iOS widgets in the notification center as well so I'd be really interested in a one line method.

                  Comment


                    #10
                    I know you posted this a couple of years ago, but thank you! You totally helped with my lack of more than basic html skills!

                    Cheers,
                    Duane

                    Comment


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

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

                      Comment

                      Working...
                      X