Announcement

Collapse
No announcement yet.

Sending command to GC-100-12 Serial Port

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

    Sending command to GC-100-12 Serial Port

    I'm struggling to successfully send a command to the Serial Port of a GC-100-12. The command string I need to send is: \x02\x50\x4F\x4E\x03, which I have validated using the iTest.exe application. I'm trying to configure an Event to send the command, and I'm not sure what value to put in the LED field. I've used a value of 1:1 since the serial port is listed on Module 1 on the device. I've configured the Device in the IR Plugin to point to port 4999. Is there something else that I'm missing?

    Thank you, Mike

    #2
    This plugin only sends IR commands. For HS4 I decided to separate the IR and IP commands that my HS3 plugin supports into two different plugins. I'm still working on the IP plug. Hope to release something soon.

    Comment


      #3
      Got it. I was scratching my head a bit since I had it working under the HS3 plugin. I'm happy to be a beta tester. fyi - I moved everything from windows to Linux now.

      Comment


        #4
        QQ: do you have a version of your old plugin that works with HS4 so that I can at least keep running after my upgrade? Or, I'm comfortable with scripting as well...so do you know if there is a way for me to send the TCP commands over to the GC-100 port 4999?...I don't think I can just send a typical HTTP command. I just need to control a couple of devices via the serial port. Thanks!

        Comment


          #5
          I haven't tried running my HS3 plugin in HS4 but in theory it should work.

          Comment


            #6
            For scripting you could try something like:
            Code:
            Imports System.Net.Sockets
            
            Sub Main()
                Dim IpAddress As String = "192.168.1.1"
                Dim Command As Byte() = {2, 80, 79, 78, 3}
            
                Dim tcpClient As New TcpClient()
                tcpClient.Connect(IpAddress.Parse, 4999)
                Dim networkStream As NetworkStream = tcpClient.GetStream()
                networkStream.Write(Command, 0, Command.Length)
                networkStream.Close
                tcpClient.Close
            End Sub
            NB., I wrote this off the top of my head without actually testing it. It may contain mistakes!

            Comment


              #7
              Thank you David. I'll give it a shot today.

              Comment


                #8
                Originally posted by mjack View Post
                Thank you David. I'll give it a shot today.
                Hi,
                mjack - Did this work for you? Waiting for the IP plugin. Though, I could use this if it works.
                Thanks!

                Comment


                  #9
                  Originally posted by mjack View Post
                  Thank you David. I'll give it a shot today.
                  Unbalanced braces or paren. Should they be braces or paren? Is there an alternative Plugin to the script yet?
                  Thanks!

                  Dim Command As Byte() = {2, 80, 79, 78, 3)

                  Comment


                    #10
                    Originally posted by avpman View Post

                    Unbalanced braces or paren. Should they be braces or paren? Is there an alternative Plugin to the script yet?
                    Thanks!

                    Dim Command As Byte() = {2, 80, 79, 78, 3)
                    It should be braces { }. I'm still working on the ip plugin for HS4

                    Comment


                      #11
                      Originally posted by drule View Post

                      It should be braces { }. I'm still working on the ip plugin for HS4
                      Thanks! I'm using the current IP script (V0.0.0.31) on HS4 for now. Working well so far.

                      Comment


                        #12
                        avpman Did you have any issues getting the plugin installed? When I run the executable, I get an error message that the HomeSeerAPI or one of its dependencies is not available. Also running HS4.

                        Comment


                          #13
                          Originally posted by mjack View Post
                          I'm struggling to successfully send a command to the Serial Port of a GC-100-12. The command string I need to send is: \x02\x50\x4F\x4E\x03, which I have validated using the iTest.exe application. I'm trying to configure an Event to send the command, and I'm not sure what value to put in the LED field. I've used a value of 1:1 since the serial port is listed on Module 1 on the device. I've configured the Device in the IR Plugin to point to port 4999. Is there something else that I'm missing?

                          Thank you, Mike
                          The led field denotes the jacks on the back of the device. So basically LED 1 is jack 1, LED 2 is jack 2.... They are the ports to send to IR 'blinkies'. Also, not that the Global Tech doesn't send out the IR commands to all the ports. You specify to port to send the IR command by 'LED'.

                          Comment


                            #14
                            Originally posted by drule View Post
                            For scripting you could try something like:
                            Code:
                            Imports System.Net.Sockets
                            
                            Sub Main()
                            Dim IpAddress As String = "192.168.1.1"
                            Dim Command As Byte() = {2, 80, 79, 78, 3}
                            
                            Dim tcpClient As New TcpClient()
                            tcpClient.Connect(IpAddress.Parse, 4999)
                            Dim networkStream As NetworkStream = tcpClient.GetStream()
                            networkStream.Write(Command, 0, Command.Length)
                            networkStream.Close
                            tcpClient.Close
                            End Sub
                            NB., I wrote this off the top of my head without actually testing it. It may contain mistakes!
                            Quick question.

                            Does the networkStream needs to be closed immediately or can the NetworkStream pointer be stored somewhere (maybe in a virtual device?) and the port be left open for future sends (new script invocation bypassing the New TcpClient(), etc. And can then the plugin receive on that port, create a trigger and then the script can be called to receive any sent data?

                            I hope it makes sense. Looking for a way to keep a port open and have a script handle a 'conversation' with a target client.

                            thanks

                            Comment


                              #15
                              Originally posted by George View Post

                              Quick question.

                              Does the networkStream needs to be closed immediately or can the NetworkStream pointer be stored somewhere (maybe in a virtual device?) and the port be left open for future sends (new script invocation bypassing the New TcpClient(), etc. And can then the plugin receive on that port, create a trigger and then the script can be called to receive any sent data?

                              I hope it makes sense. Looking for a way to keep a port open and have a script handle a 'conversation' with a target client.

                              thanks
                              You can keep the stream open.

                              Comment

                              Working...
                              X