Announcement

Collapse
No announcement yet.

HS3 Running event from Command Line

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

  • Mario from Spain
    replied
    Originally posted by jon00 View Post
    Great! It's working! Thank you very much for the link. :-)

    I left it here as an example for others looking into this:

    Code:
    curl -G -v -d "request=controldevicebyvalue&ref=822&value=100" http://192.168.1.57/JSON -u "username:password"
    I tested putting this line in a BAT file and running the BAT and it's working fine (-v parameter is optional, just to have verbose output from curl).

    Leave a comment:


  • jon00
    replied
    Take a look here: https://forums.homeseer.com/forum/de...call-from-curl

    Leave a comment:


  • Mario from Spain
    replied
    If someone comes with a working curl example in Windows (something simple as "http://192.168.1.57/JSON?request=getstatus&ref=550") it could be a good starting point.

    Leave a comment:


  • jon00
    replied
    Curl should work using the Homeseer JSON interface.

    It could also be done with my HS3/HS4 Tray Control using its Windows shortcuts method or wait to see if someone has the MrHappy file.

    Leave a comment:


  • Mario from Spain
    replied
    Originally posted by jon00 View Post

    MrHappy is MIA (last on November 2020)

    What are you trying to do?
    Thank you! I had no idea.

    I want to send some notifications from HS. For example when the 3D printer finish a job I can execute something at the command line.

    Click image for larger version  Name:	image.png Views:	0 Size:	51.9 KB ID:	1569266

    Probably I can do it with Curl but I'm unable to find the correct syntax.

    Thank you!

    Leave a comment:


  • jon00
    replied
    Originally posted by Mario from Spain View Post

    Hi MrHappy.

    Is this utility still available for download? Does it works with HS4? Does it support authentication?

    Thank you! :-)
    MrHappy is MIA (last on November 2020)

    What are you trying to do?

    Leave a comment:


  • Mario from Spain
    replied
    Originally posted by mrhappy View Post
    I have written an app that might be of use to some, it will accept an event name by command line and then try and trigger the event. So you would run it with

    C:\Path\Path\HS3EventRun.exe eventname="Test Event"
    Hi MrHappy.

    Is this utility still available for download? Does it works with HS4? Does it support authentication?

    Thank you! :-)

    Leave a comment:


  • JeffCharger
    replied
    does this method work in HS4?

    Leave a comment:


  • Stuart
    replied
    Does anyone have a link to the Hs3eventrun exe. Guess the links are a no go at this time.
    Stuart

    Leave a comment:


  • lveatch
    replied
    Originally posted by rmuziani View Post
    I am trying to use Rupp method to trigger an event from my desktop. My group is called kitchen and the event in that group is "ceiling light on". I droped RunJSON.exe in my HS3 directory and created a shortcut to it on my desktop. Than I edit the short cut adding "C:\Program Files (x86)\HomeSeer HS3\RunJSON.exe" http://192.168.1.111:5580/JSON?reque...n&name=Ceiling Light on" to the target. What am I missing?
    Thx
    Try putting single quotes around the event name (e.g. name='Ceiling Light on').

    If that doesn't work, you can trigger an event via the event id (request=runevent&id=###). I can't remember if there is an easier way to get the event id's but you can use the json command request=getevents.

    Leave a comment:


  • rmuziani
    replied
    I am trying to use Rupp method to trigger an event from my desktop. My group is called kitchen and the event in that group is "ceiling light on". I droped RunJSON.exe in my HS3 directory and created a shortcut to it on my desktop. Than I edit the short cut adding "C:\Program Files (x86)\HomeSeer HS3\RunJSON.exe" http://192.168.1.111:5580/JSON?reque...n&name=Ceiling Light on" to the target. What am I missing?
    Thx

    Leave a comment:


  • frankc
    replied
    Originally posted by mrhappy View Post
    Does this help at all, this is a forms application that will try and connect to HS (change your IP address), pop up a message box and then if it connects you can press a button and write to the HS log.
    MH...

    Would you post that forms application demo again? I wanted to review it one more time. Thank you!

    Leave a comment:


  • frankc
    replied
    Got It

    Yes. Thank you MH!

    The piece I was missing for using JSON with vb.net is:

    PHP Code:
    Dim req As WebRequest WebRequest.Create(uri)
                
    req.ContentType contentType
                req
    .Method method
    Dim stream 
    req.GetRequestStream()
                    
    stream.Write(jsonDataBytes0jsonDataBytes.Length
    I didn't know enough to use "stream" to send JSON post commands to HS. I pulled that piece out of Rich's JSON example.

    Another step that doesn't seem possible is to attach additional parameters to a JSON command to run an HS3 event such as:

    "Post data: {'action' : 'runevent', 'group' : 'GROUPNAME', 'name' : 'EVENTNAME'}"

    Thank you for the help!

    Leave a comment:


  • mrhappy
    replied
    Originally posted by frankc View Post
    I'm wanting to run an event from a windows vb.net form application. So as soon as I can run an HS3 event from the compiled application, I'll be set. A line similar to the following would be the right way to do it I think. But I'm not sure of the syntax:

    results = System.Diagnostics.Process.Start("C:\Program Files (x86)\Homeseer HS3\HS3EventRun.exe eventname='Test Event'")

    And perhaps a better way to run the event from the compiled program is to include the vb piece of your source code for "HS3EventRun.exe" rather than the .exe app. I think that is what you mean by "embed that code into VB to start with". But I haven't got that piece figured out.

    I know that Rich's JSON/vb.net example accomplishes this goal, but I haven't quite distilled it down far enough to find the appropriate syntax to execute a JSON command from a vb.net compiled program. Most likely your 'HS3EventRun' uses similar source code to Rich's example (??)

    Does that make sense?

    I appreciate the guidance with this MH.
    Does this help at all, this is a forms application that will try and connect to HS (change your IP address), pop up a message box and then if it connects you can press a button and write to the HS log. You should be able to put most of this in your own forms application - sorry I thought I included the source code in my example but guess I forgot or removed it.
    Last edited by mrhappy; December 28, 2016, 03:19 PM.

    Leave a comment:


  • frankc
    replied
    Originally posted by langenet View Post
    I'm further confused - I don't have a RunJSON.exe in my HS3 root directory.
    I haven't ventured with JSON in HS3 yet... Am I missing something?

    Robert
    You can get 'RunJSON.exe from a link within this thread. There is also a second .exe available in this thread. Each of them is just saved to your HS3 root directory.

    JSON allows you to control events and devices from scripts external to HS3. I have done that quite a bit. For example, read the status of lights and turn lights on and off. But what I haven't been able to figure out is how to use JSON commands from within a vb.net compiled program. I'm pretty sure there isn't much to it, but I haven't quite got it figured out. That is what each of the .exe applications do. They use JSON to control HS3 from a compiled vb.net or C# application.

    In another thread, Rich provides an example where he is using JSON from within a vb.net application. And it works great. He includes the source code and you can compile it with VS Community 2015, which is free.

    There are also some other "server" type applications written by HS3 users. I use those as well, but from scripts - not from compiled windows forms vb.net apps.

    Leave a comment:

Working...
X