Announcement

Collapse
No announcement yet.

HS3 Running event from Command Line

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

  • 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 28th, 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:


  • frankc
    replied
    Originally posted by mrhappy View Post
    to run that bit of code as a compiled EXE from vb.net you could use the Process.Start call (http://www.dotnetperls.com/process-vbnet) but I would wonder why because you could just embed that code into VB to start with.
    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.

    Leave a comment:


  • langenet
    replied
    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

    Leave a comment:


  • mrhappy
    replied
    Originally posted by frankc View Post
    I need some advice regarding the syntax to be used to execute this 'command line' from within a vb.net script. I've tried several approaches but haven't got it to work yet.

    Thank you
    I'm a bit confused really what you are trying to do - could you elaborate a bit further? I mean to run that bit of code as a compiled EXE from vb.net you could use the Process.Start call (http://www.dotnetperls.com/process-vbnet) but I would wonder why because you could just embed that code into VB to start with.

    Leave a comment:


  • frankc
    replied
    vb.net syntax

    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.
    I need some advice regarding the syntax to be used to execute this 'command line' from within a vb.net script. I've tried several approaches but haven't got it to work yet.

    Thank you

    Leave a comment:


  • frankc
    replied
    While this is an older thread, I still found the contents valuable.

    Mr. Happy's script works fine.

    Rupp's works great too. But I added double quotes around the JSON command in his example:

    Code:
    "C:\Program Files (x86)\HomeSeer HS3\RunJSON.exe" "http://172.17.32.31:81/JSON?request=runevent&group=Speaking&name=SpeakTheTime"

    Leave a comment:


  • dexterdom
    replied
    Originally posted by Rupp View Post
    Attached is a small c# application I wrote a while back that can run the new JSON commands for HS3. It really only works well with triggering events as I just ignore the return value. I dropped the RunJSON.exe in my HS3 directory and created a shortcut to it on my desktop. Then simply edit the short cut adding your JSON command to the end of the target ie
    Code:
    "C:\Program Files (x86)\HomeSeer HS3\RunJSON.exe" http://172.17.32.31:81/JSON?request=runevent&group=Speaking&name=SpeakTheTime

    Hi Rupp, I tried your program on Windows 7 (on both 32 and 64 bit versions) and the program crashes ("Program Stopped Working"). Could this be corrupt?

    Leave a comment:


  • theendisnye
    replied
    Originally posted by mrhappy View Post
    Check that your dll's are up to date in whatever folder you have the hs3eventrun.exe file in, HS make changes to these sometimes which can lead to them being out of date.
    Brilliant thank you that got everything back up and working. Steve

    Leave a comment:


  • Rupp
    replied
    Attached is a small c# application I wrote a while back that can run the new JSON commands for HS3. It really only works well with triggering events as I just ignore the return value. I dropped the RunJSON.exe in my HS3 directory and created a shortcut to it on my desktop. Then simply edit the short cut adding your JSON command to the end of the target ie
    Code:
    "C:\Program Files (x86)\HomeSeer HS3\RunJSON.exe" http://172.17.32.31:81/JSON?request=runevent&group=Speaking&name=SpeakTheTime
    Attached Files

    Leave a comment:

Working...
X