Announcement

Collapse
No announcement yet.

Checking to see when the script connector is available

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Checking to see when the script connector is available

    Is there a way to see when the script connector client is available?

    I'm starting up a remote MediaPC, then once it has booted up, I want to use the remote script client to do a few tasks on that PC

    #2
    There is an access to an array of script client names:

    Dim clientArray() as String = hs.Plugin("Script Connector").ClientList

    You can also try to exec a remote func, and if the result is null, the script client is not available.
    --
    stipus

    Comment


      #3
      There is also a HomeSeer trigger that is triggered each time a script client is connected or disconnected.

      It should be very simple to use.
      --
      stipus

      Comment


        #4
        Thanks Stipus,

        I tried the events approach, with one event setting a virtual device on when the script connector connected, another to turn the device off when disconnected.

        Both those events work, but then something odd happens, see log:

        <table height="182" border="0" cellpadding="0" cellspacing="2" width="631"><tbody><tr> <td class="LOGDateTime1" nowrap="nowrap" align="left">22/01/2012 18:00:22 </td> <td class="LOGType1" colspan="3" align="left">Network </td> <td class="LOGEntry1" colspan="8" align="left">Remote client connected from: 192.168.0.12</td></tr> <tr> <td class="LOGDateTime0" nowrap="nowrap" align="left">22/01/2012 18:00:22 </td> <td class="LOGType0" colspan="3" align="left">Event </td> <td class="LOGEntry0" colspan="8" align="left">Event Trigger "MediaPC Script Connector connected"</td></tr> <tr> <td class="LOGDateTime1" nowrap="nowrap" align="left">22/01/2012 18:00:22 </td> <td class="LOGType1" colspan="3" align="left">Device Control </td> <td class="LOGEntry1" colspan="8" align="left">Device: Sitting Room MediaPC Script Connector (M5) ON</td></tr> <tr> <td class="LOGDateTime0" nowrap="nowrap" align="left">22/01/2012 18:00:23 </td> <td class="LOGType0" colspan="3" align="left">X10 Received </td> <td class="LOGEntry0" colspan="8" align="left">M5 (Sitting Room MediaPC Script Connector) M On</td></tr> <tr> <td class="LOGDateTime1" nowrap="nowrap" align="left">22/01/2012 18:00:26 </td> <td class="LOGType1" colspan="3" align="left">Network </td> <td class="LOGEntry1" colspan="8" align="left">Remote client connected from: 192.168.0.12</td></tr></tbody></table>So at 18:00:22, the remote PC connects, triggers the event, which turns on M5. Very happy with that, its exactly what is supposed to happen.

        But then at 18:00:26, there is another network event, that switches off M5. Oddly, there isn't anything comes from the M5 logging, but M5 status is now:
        <table border="0" cellpadding="0" cellspacing="1" width="100%"><tbody><tr> <td id="dv880" class="tablecelloff">Off </td> <td class="tableroweven">Sitting Room</td> <td class="tableroweven">MediaPC Script Connector </td> <td class="tableroweven" nowrap="nowrap">M5</td> <td class="tableroweven" nowrap="nowrap">Status Only</td> <td class="tableroweven" nowrap="nowrap">Today 18:00:26 </td></tr></tbody></table>
        The device was turned off at 18:00:26, the exact time that the second networkk event happens. This happens every time, so when I check M5 to see if the connector is there, M5 indicates that it isn't.

        Any thoughts on what might be doing this?

        Comment


          #5
          I also tried the scripting route:

          strResponse = hs.plugin("Script Connector").ExecRemoteSub("MediaPC", "remote_procstat.vb", "ehshell;M4") 'get status of Media Center

          This returns True if it works, False if it doesn't, except the first time I try it, it always returns True even if the script connector isn't there.

          Do you know why it seems to return true that first time? I'm struggling to get a reliable way to see when I can use the script connector

          Comment


            #6
            Dear Michael,

            I don't understand why the event approach didn't work. I don't see what could set the M5 device to OFF.

            For the second approach, you should use ExecRemoteFunc() instead of ExecRemoteSub(), and check if the returned object is null or nil.
            --
            stipus

            Comment


              #7
              Originally posted by stipus View Post
              Dear Michael,

              I don't understand why the event approach didn't work. I don't see what could set the M5 device to OFF.

              For the second approach, you should use ExecRemoteFunc() instead of ExecRemoteSub(), and check if the returned object is null or nil.
              No, I can't understand it either, I wonder if its some negotiating / handshaking going on that makes the event think that the script client is disconnecting. But it is odd that the device logging doesn't show it changing to OFF. It happens every time.

              I'll try the ExecRemoteFunc and see if that is consistent

              Comment


                #8
                Stipus,

                Not sure I have syntax right for this, I'm using:

                strResponse = hs.plugin("Script Connector").ExecRemoteFunc("MediaPC", "remote_procstat.vb", "ehshell;M4")

                strResponse is a string, but it seems to return nothing whether the call is successful or not

                Comment


                  #9
                  You have to be sure that "main" is declared as a function in remote_procstat.vb, and that it returns an object.
                  --
                  stipus

                  Comment

                  Working...
                  X