Announcement

Collapse
No announcement yet.

How to Trigger an Event via a Command line?

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

    How to Trigger an Event via a Command line?

    I want to trigger an event via a command line string from a windows command prompt.

    I would think it would be something like this...
    C:\path\homeseer.exe event

    I will then create a .bat file with this string and link it to something else.

    #2
    First, create a .vbs - something like:

    PHP Code:
    set hsi CreateObject("HomeSeer2.application")
    hsi.SetHost("localhost")
    rval hsi.Connect("xxxx""xxxx")

    Set hs=hsi.GetHSRef
    hs
    .triggerEvent "myEvent" 
    Then, create a batch file - something like:

    PHP Code:
    @echo off
    wscript my
    .vbs 
    The key is wscript which will allow you to run a vbs from a command-line

    Hope this helps...
    HS4Pro Running on a Raspberry Pi4
    68 Z-Wave Nodes, 175 Events, 359 Devices
    UPB modules via OMNI plugin/panel
    Plugins: Z-Wave, OMNI, HSTouch, weatherXML, EasyTrigger
    HSTouch Clients: 3 Android, 1 Joggler

    Comment


      #3
      Definately helps, but can you fill in an example what would go in the first 3 lines (red part).

      I think I got the rest. Do I need to have a special program residing on my machine to interpret the script or is it generally pre-installed? I really don't know anything about this.

      Comment


        #4
        I'd really like to use this vbs to trigger a homeseer event from a different machine on the network. I tried it replacing localhost with the ip address of the homeseer computer but it didn't work. Is there anyway I can trigger an event from a remote machine?

        Comment


          #5
          You'd need the speaker client installed on that computer I believe (for the HomeSeer2 and Scheduler DLL's) - try installing it and it should be possible

          Comment


            #6
            I installed the speaker app, and still have the same problem,

            "the message I get is "ActviveX component can't create object: 'homeseer2.application'"

            Also on this computer (Windows 2008 server 64bit) when I try to launch the application I get the error:

            Description:
            Stopped working

            Problem signature:
            Problem Event Name: CLR20r3
            Problem Signature 01: speaker.exe
            Problem Signature 02: 2.5.0.20
            Problem Signature 03: 9
            Problem Signature 04: Speaker
            Problem Signature 05: 2.5.0.20
            Problem Signature 06: 9
            Problem Signature 07: 17
            Problem Signature 08: c6
            Problem Signature 09: System.InvalidOperationException
            OS Version: 6.0.6002.2.2.0.272.7
            Locale ID: 2057

            Read our privacy statement:
            http://go.microsoft.com/fwlink/?link...3&clcid=0x0409


            I'm guessing this is because there is no sound card?

            Comment


              #7
              Pass - but it might be, if thats not working perhaps an asp file on the HS webserver (with the trigger event commands in) and a script to pull that file - would that do?

              Comment


                #8
                yes that could work, so I suppose I'd call a webpage with the code in it, is there a way we could close the page when done. I don't want 2000 copies of ie running on my server

                Comment


                  #9
                  You should be able to 'get' the page from some code in VBScript without the need for IE to run - http://stackoverflow.com/questions/2...ttp-get-in-vbs , I think when the script runs it will dispose of any controls so there should not be any memory build up...

                  Comment


                    #10
                    how would I create a asp file to run and event call "test_event"?

                    Comment


                      #11
                      I just tried this here and it worked. Both PC's are running XP Pro.
                      Code:
                      Set hsi = CreateObject("HomeSeer2.application")
                      hsi.SetHost("wanIpAddress:8742")
                      rval = hsi.Connect("username", "password")
                      If rval <> "" Then
                      MsgBox(rval)
                      End If
                      
                      Set hs = hsi.GetHSRef
                      
                      hs.speak("Hello World")
                      -Rupp
                      sigpic

                      Comment


                        #12
                        I tried that Rupp, but still get the same problem, I'm guessing the windows 2008 64bit is the problem?

                        Comment


                          #13
                          Originally posted by codey View Post
                          I tried that Rupp, but still get the same problem, I'm guessing the windows 2008 64bit is the problem?
                          Yep, more than likely a UAC issue.
                          -Rupp
                          sigpic

                          Comment


                            #14
                            Originally posted by codey View Post
                            how would I create a asp file to run and event call "test_event"?
                            Try this as a vbs file:

                            PHP Code:
                            Set objHTTP CreateObject("Microsoft.XMLHTTP"
                            objHTTP.open "POST""http://homeseerip:port"False  
                            objHTTP
                            .setRequestHeader "Content-Type""application/x-www-form-urlencoded" 
                            objHTTP.send "run_event=test_event" 
                            replace homeseeriport with yours...
                            HS4Pro Running on a Raspberry Pi4
                            68 Z-Wave Nodes, 175 Events, 359 Devices
                            UPB modules via OMNI plugin/panel
                            Plugins: Z-Wave, OMNI, HSTouch, weatherXML, EasyTrigger
                            HSTouch Clients: 3 Android, 1 Joggler

                            Comment


                              #15
                              Here is a good article on how to disable UAC in 2008:

                              http://technet.microsoft.com/en-us/l...9.aspx#BKMK_S3

                              Comment

                              Working...
                              X