Announcement

Collapse
No announcement yet.

IP / Serial Plugin for HS3 (by "drule") - Discussion Thread

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

    what do you mean by format?
    The TiVo commands are well documented in many places on the web. just google.

    Comment


      You are correct the commands are documented, but in order to get the commands to work in the PI adding "\r" was necessary. I figured it out.

      Sent from my XT1080 using Tapatalk
      Larry

      Comment


        @drule

        Hi David, how does your plugin determine you have a complete string to send to the script? (partic. for serial).

        I have a serial device that completes a response with <CR>
        I am not sure if there is a <LF> sent - the manual says no...so I suspect not.

        This is then sent to a script to Parse the data.

        I suspect there is an issue with the way your plugin determines the end of the data for this device.

        What does your plugin use to determine the end of line (and so assume it has a complete "string" to send to the script.

        I ask as I am getting incomplete and sometimes concatenated data through on my serial connected Sonance DAB1 amp.

        ie. response from DAB1 is
        Code:
        +ERR<cr>
        +ERR<cr>
        +ERR<cr>
        but your plugin sends things like the following to my script for sometimes "+" and other times "+ERR +ERR +ERR"

        Could you perhaps add the option to specify the termination character or characters in the serial config?

        I added some extra debug code to print th ehex values and interesting you can see there are infact <CR> and <LF> in there (D and A).

        Code:
        Dec-10 12:38:08 AM	 	DAB1_Parse_In	Hex Data Recieved : 2B 56 31 32 33 D A 2B 4F 4B D A 2B 56 31 32 34 D A 2B 4F 4B
        Dec-10 12:38:08 AM	 	DAB1_Parse_In	param(0):DAB1 Data:+V123 +OK +V124 +OK
        Thanks
        Dav

        EDIT: I think I have a work around. I just split the recieved data on <CR><LF> and loop around these in an array.
        The following code seeme to be working - note the function is there as a debug tool so i can see the HEX.

        Code:
        Public Class DAB1_Parse_Inbound
        
            Public Const ScriptName = "DAB1_Parse_In"
        
            Public Function StringToHexString(ByVal text As String) As String
                Dim i As Integer
                Dim out As String = ""
                Dim inp() As Char
        
                inp = text.ToCharArray()
        
                For i = 0 To Len(text) - 1
                    out = out + " " + String.Format("{0,2}", Hex(Asc(inp(i))))
                Next i
        
                Return out
            End Function
        
            Public Sub Main(ByVal param As Object)
                Dim Command As String = ""
                Dim Param1 As String = ""
                Dim Param2 As String = ""
                Dim DeviceName As String = ""
                Dim SetTo As Integer
                Dim DevRef As Integer
        
                Dim Params() As String = Split(param.ToString, Chr(0))
                ' Param(0) is the name of the plugin's connector
                ' Param(1) is the ip address of the remote end
                ' Param(2) is the data received
        
        
                'hs.WriteLog(ScriptName, param(0) + " " + param(1) + " " + param(2))
                'hs.WriteLog(ScriptName, "param(0):" + param.ToString)
                Dim datarecieved As String = param(2)
        
                hs.WriteLog(ScriptName, "param(0):" + param(0) + "Data:" + datarecieved)
                hs.WriteLog(ScriptName, "Hex Data Recieved :" + StringToHexString(datarecieved))
        
                Dim Data() As String = datarecieved.Split(ControlChars.CrLf.ToCharArray(), StringSplitOptions.RemoveEmptyEntries)
        
                For n As Integer = 0 To Data.GetUpperBound(0)
                    hs.WriteLog(ScriptName, "Data(" + Trim(Str(n)) + ") :" + Data(n))
        
                    '    Command = Data(n).Substring(1, 1)
                    '    Param1 = Data(n).Substring(2, 1)
                    '    Param2 = ""
                    '    DeviceName = ""
                    '    hs.WriteLog(ScriptName, "Command " + Command)
                    '    hs.WriteLog(ScriptName, "Param1 " + Param1)
                    'Next
        
                    If ((Data(n) <> "+ERR") And (Data(n) <> "+OK") And ((Data(n).Length = 4) Or (Data(n).Length = 5))) Then
        
                        Command = Data(0).Substring(1, 1)
                        Param1 = Data(0).Substring(2, 1)
                        Param2 = ""
                        DeviceName = ""
                        hs.WriteLog(ScriptName, "Command " + Command)
                        hs.WriteLog(ScriptName, "Param1 " + Param1)
        
                        'datarecieved is the response status from the DAB1
                        'It has a different format depending upon the second character in the response.
                        'eg. zone power is +Zxy (Z = Zone Power, x= zone 1-6, y=1 if On, 0 if Off)
                        '    volume is +Vxy (V = Volume, x= zone 1-6, y= Current Volume 0-60)
                        'Command is the Command part of the string (Z = zone command, V = Volume command etc)
                        'Param1 is always there but has a different meaning depending upon the command
                        'Param2 is only used for some commands is Volume status, which return say a zone value and volume.
        
                        Select Case Command
                            Case "Z" ' Zone On/Off
                                If Data(n).Length = 3 Then
                                    DeviceName = "DAB1 Power"
                                    SetTo = Convert.ToInt32(Param1)
                                Else
                                    Param2 = Data(n).Substring(3, Data(n).Length - 3)
                                    DeviceName = "DAB1 Zone " & Param1 & " Power "
                                    SetTo = Convert.ToInt32(Param2)
                                End If
                            Case "S" 'Source
                                Param2 = Data(n).Substring(3, 1)
                                DeviceName = "DAB1 Zone " & Param1 & " Source"
                                SetTo = Convert.ToInt32(Param2)
                            Case "R"   ' Tuner Memory. Note this can be 0 to 12
                                Param1 = Data(n).Substring(2, Data(n).Length - 2)
                                DeviceName = "DAB1 Tuner"
                                SetTo = Convert.ToInt32(Param1)
                            Case "N"   ' Tuner Band
                                DeviceName = "DAB1 Band"
                                SetTo = Convert.ToInt32(Param1)
                            Case "V" 'Volume
                                Param2 = Data(n).Substring(3, Data(n).Length - 3)
                                DeviceName = "DAB1 Zone " & Param1 & " Volume"
                                SetTo = Convert.ToInt32(Param2)
                            Case "G" 'Page Volume
                                Param2 = Data(n).Substring(3, Data(n).Length - 3)
                                DeviceName = "DAB1 Zone " & Param1 & " Page Volume"
                                SetTo = Convert.ToInt32(Param2)
                            Case "M" 'Mute
                                Param2 = Data(n).Substring(3, 1)
                                DeviceName = "DAB1 Zone " & Param1 & " Mute"
                                SetTo = Convert.ToInt32(Param2)
                            Case "B" 'Balance Note: Param 2 can be -10 to +10
                                Param2 = Data(n).Substring(3, Data(n).Length - 3)
                                DeviceName = "DAB1 Zone " & Param1 & " Balance"
                                SetTo = Convert.ToInt32(Param2)
                            Case "L" 'Bass
                                Param2 = Data(n).Substring(3, Data(n).Length - 3)
                                DeviceName = "DAB1 Zone " & Param1 & " Bass"
                                SetTo = Convert.ToInt32(Param2)
                            Case "H" 'Treble
                                Param2 = Data(n).Substring(3, Data(n).Length - 3)
                                DeviceName = "DAB1 Zone " & Param1 & " Treble"
                                SetTo = Convert.ToInt32(Param2)
                            Case Else
                                hs.WriteLog(ScriptName, "I don't know what to do with: " & Command)
                        End Select
                        hs.WriteLog(ScriptName, "Command " + Command)
                        hs.WriteLog(ScriptName, "Param1 " + Param1)
                        hs.WriteLog(ScriptName, "Param2 " + Param2)
                        hs.WriteLog(ScriptName, "SetTo " + Str(SetTo))
                        hs.WriteLog(ScriptName, "DeviceName:" + DeviceName)
                        DevRef = hs.GetDeviceRefByName(DeviceName)
                        hs.WriteLog(ScriptName, "DevRef:" + Str(DevRef))
                        hs.SetDeviceValueByRef(DevRef, SetTo, True)
                    End If
                Next
        
            End Sub
        
        End Class
        which for +ERR + ERR gives something like this:

        Code:
        Dec-10 1:15:30 AM	 	DAB1_Parse_In	Data(1) :+ERR
        Dec-10 1:15:30 AM	 	DAB1_Parse_In	Data(0) :+ERR
        Dec-10 1:15:30 AM	 	DAB1_Parse_In	Hex Data Recieved : 2B 45 52 52 D A 2B 45 52 52
        Dec-10 1:15:30 AM	 	DAB1_Parse_In	param(0):DAB1Data:+ERR +ERR
        And Volume down...this

        Code:
        Dec-10 1:17:05 AM	 	DAB1_Parse_In	Data(3) :+OK
        Dec-10 1:17:05 AM	 	DAB1_Parse_In	Data(2) :+V118
        Dec-10 1:17:05 AM	 	DAB1_Parse_In	Data(1) :+OK
        Dec-10 1:17:05 AM	 	DAB1_Parse_In	Data(0) :+V119
        Dec-10 1:17:05 AM	 	DAB1_Parse_In	Hex Data Recieved : 2B 56 31 31 39 D A 2B 4F 4B D A 2B 56 31 31 38 D A 2B 4F 4B
        
        Dec-10 1:17:05 AM	 	DAB1_Parse_In	param(0):DAB1Data:+V119 +OK +V118 +OK
        Last edited by davros; December 9, 2016, 08:59 AM.

        Comment


          Hi David,
          I have noticed you posted an updated plugin (v26) with the comment.

          "** New Version - 0.0.0.26 ** [December 8th, 2016]

          Fixes a bug that could cause incoming commands to get repeated in a loop
          "


          I am running v26 and am seeing looping in my inbound serial data.

          I wrote a simple arduino program to test this. I noticed that if I set the delay between serial data to ~1s it works ok, but lower than that and it gets all funky with parts of the data string sent through to the called script and other data concatenating.

          This is the Arduino script.
          Code:
          // the setup routine runs once when you press reset:
          void setup() {
            // initialize serial communication at 9600 bits per second:
            Serial.begin(19200);
            delay(10000);        // delay 10 seconds before sending data to serial port
          
          }
          
          // the loop routine runs over and over again forever:
          long secdelay = 600;
          void loop() {
               for (int i=1; i <= 5; i++){
               Serial.println(i);
               delay(secdelay);        // delay 1s in between writes sp i can see it easily on the screen
               }
               Serial.print("Delay="); Serial.println(secdelay);
               secdelay--;
          }
          It produces this data stream
          Code:
          1
          2
          3
          4
          5
          Delay=600
          1
          2
          3
          4
          5
          Delay=599
          1
          2
          3
          4
          5
          Delay=598
          1
          2
          3
          4
          5
          Delay=597
          1
          2
          3
          4
          5
          and in HEX...
          Code:
          310D0A320D0A330D0A340D0A350D0A44656C61793D3630300D0A310D0A320D0A330D0A340D0A350D0A44656C61793D3539390D0A310D0A320D0A330D0A340D0A350D0A44656C61793D3539380D0A310D0A320D0A330D0A340D0A350D0A44656C61793D3539370D0A310D0A320D0A330D0A340D0A350D0A


          Code:
          Dec-11 3:33:50 PM	 	ArduinIO_In	=============================================================================
          Dec-11 3:33:50 PM	 	ArduinIO_In	Data(0) :2
          Dec-11 3:33:50 PM	 	ArduinIO_In	datarecieved:2
          Dec-11 3:33:50 PM	 	ArduinIO_In	=============================================================================
          Dec-11 3:33:50 PM	 	ArduinIO_In	Data(0) :2
          Dec-11 3:33:50 PM	 	ArduinIO_In	datarecieved:2
          Dec-11 3:33:50 PM	 	ArduinIO_In	=============================================================================
          Dec-11 3:33:49 PM	 	ArduinIO_In	Data(1) :1
          Dec-11 3:33:49 PM	 	ArduinIO_In	Data(0) :Delay=563
          Dec-11 3:33:49 PM	 	ArduinIO_In	datarecieved:Delay=563 1
          Dec-11 3:33:49 PM	 	ArduinIO_In	=============================================================================
          Dec-11 3:33:49 PM	 	ArduinIO_In	Data(1) :1
          Dec-11 3:33:49 PM	 	ArduinIO_In	Data(0) :Delay=563
          Dec-11 3:33:49 PM	 	ArduinIO_In	datarecieved:Delay=563 1
          Dec-11 3:33:49 PM	 	ArduinIO_In	=============================================================================
          Dec-11 3:33:49 PM	 	ArduinIO_In	Data(1) :1
          Dec-11 3:33:49 PM	 	ArduinIO_In	Data(0) :Delay=563
          Dec-11 3:33:49 PM	 	ArduinIO_In	datarecieved:Delay=563 1
          Dec-11 3:33:49 PM	 	ArduinIO_In	=============================================================================
          Dec-11 3:33:49 PM	 	ArduinIO_In	Data(0) :Delay
          Dec-11 3:33:49 PM	 	ArduinIO_In	datarecieved:Delay
          Dec-11 3:33:49 PM	 	ArduinIO_In	=============================================================================
          Dec-11 3:33:49 PM	 	ArduinIO_In	Data(0) :Dela
          Dec-11 3:33:49 PM	 	ArduinIO_In	datarecieved:Dela
          Dec-11 3:33:49 PM	 	ArduinIO_In	=============================================================================
          Dec-11 3:33:49 PM	 	ArduinIO_In	Data(0) :D
          Dec-11 3:33:49 PM	 	ArduinIO_In	datarecieved:D
          Dec-11 3:33:49 PM	 	ArduinIO_In	=============================================================================
          Dec-11 3:33:49 PM	 	ArduinIO_In	Data(0) :5
          Dec-11 3:33:49 PM	 	ArduinIO_In	datarecieved:5
          Dec-11 3:33:49 PM	 	ArduinIO_In	=============================================================================
          Dec-11 3:33:49 PM	 	ArduinIO_In	Data(0) :5
          Dec-11 3:33:49 PM	 	ArduinIO_In	datarecieved:5
          Dec-11 3:33:49 PM	 	ArduinIO_In	=============================================================================
          Dec-11 3:33:49 PM	 	ArduinIO_In	Data(0) :5
          Dec-11 3:33:49 PM	 	ArduinIO_In	datarecieved:5
          Dec-11 3:33:49 PM	 	ArduinIO_In	=============================================================================
          Dec-11 3:33:48 PM	 	ArduinIO_In	Data(0) :4
          Dec-11 3:33:48 PM	 	ArduinIO_In	datarecieved:4
          Dec-11 3:33:48 PM	 	ArduinIO_In	=============================================================================
          Dec-11 3:33:48 PM	 	ArduinIO_In	Data(0) :4
          Dec-11 3:33:48 PM	 	ArduinIO_In	datarecieved:4
          Dec-11 3:33:48 PM	 	ArduinIO_In	=============================================================================
          Dec-11 3:33:47 PM	 	ArduinIO_In	Data(0) :3
          Dec-11 3:33:47 PM	 	ArduinIO_In	datarecieved:3
          Dec-11 3:33:47 PM	 	ArduinIO_In	=============================================================================
          Dec-11 3:33:47 PM	 	ArduinIO_In	Data(0) :3
          Dec-11 3:33:47 PM	 	ArduinIO_In	datarecieved:3
          Dec-11 3:33:47 PM	 	ArduinIO_In	=============================================================================
          Dec-11 3:33:47 PM	 	ArduinIO_In	Data(0) :3
          Dec-11 3:33:47 PM	 	ArduinIO_In	datarecieved:3
          Dec-11 3:33:47 PM	 	ArduinIO_In	=============================================================================
          Dec-11 3:33:47 PM	 	ArduinIO_In	Data(0) :2
          Dec-11 3:33:47 PM	 	ArduinIO_In	datarecieved:2
          Dec-11 3:33:47 PM	 	ArduinIO_In	=============================================================================
          Dec-11 3:33:47 PM	 	ArduinIO_In	Data(0) :2
          Dec-11 3:33:47 PM	 	ArduinIO_In	datarecieved:2
          Dec-11 3:33:47 PM	 	ArduinIO_In	=============================================================================
          Dec-11 3:33:46 PM	 	ArduinIO_In	Data(1) :1
          Dec-11 3:33:46 PM	 	ArduinIO_In	Data(0) :Delay=564
          Dec-11 3:33:46 PM	 	ArduinIO_In	datarecieved:Delay=564 1
          Dec-11 3:33:46 PM	 	ArduinIO_In	=============================================================================
          Dec-11 3:33:46 PM	 	ArduinIO_In	Data(0) :Delay=564
          Dec-11 3:33:46 PM	 	ArduinIO_In	datarecieved:Delay=564
          Dec-11 3:33:46 PM	 	ArduinIO_In	=============================================================================
          Dec-11 3:33:46 PM	 	ArduinIO_In	Data(0) :Delay=564
          Dec-11 3:33:46 PM	 	ArduinIO_In	datarecieved:Delay=564
          Dec-11 3:33:46 PM	 	ArduinIO_In	=============================================================================
          My HS script I am using to test is ...
          Code:
              Public Const ScriptName = "ArduinIO_In"
          
              Public Sub Main(ByVal param As Object)
          
                  Dim Params() As String = Split(param.ToString, Chr(0))
                  ' Param(0) is the name of the plugin's connector
                  ' Param(1) is the ip address of the remote end
                  ' Param(2) is the data received
          
          
                  'hs.WriteLog(ScriptName, param(0) + " " + param(1) + " " + param(2))
          
                  Dim datarecieved As String = param(2)
          
          		
                  hs.WriteLog(ScriptName, "=============================================================================")
                  hs.WriteLog(ScriptName, "datarecieved:" + datarecieved)
          
                  Dim Data() As String = datarecieved.Split(ControlChars.CrLf.ToCharArray(), StringSplitOptions.RemoveEmptyEntries)
          
                  For n As Integer = 0 To Data.GetUpperBound(0)
                      hs.WriteLog(ScriptName, "Data(" + Trim(Str(n)) + ") :" + Data(n))
                  Next
          
              End Sub
          Hope that helps with the debug.
          Attached Files

          Comment


            Originally posted by davros View Post
            Hi David,
            I have noticed you posted an updated plugin (v26) with the comment.

            "** New Version - 0.0.0.26 ** [December 8th, 2016]

            Fixes a bug that could cause incoming commands to get repeated in a loop
            "


            I am running v26 and am seeing looping in my inbound serial data.

            I wrote a simple arduino program to test this. I noticed that if I set the delay between serial data to ~1s it works ok, but lower than that and it gets all funky with parts of the data string sent through to the called script and other data concatenating.

            This is the Arduino script.

            Hope that helps with the debug.
            Thanks. I'll take a look.

            -David

            Comment


              Hello

              I can't understand if this will run on Linux (Raspberry Pi).
              If so how to install? I cant find file "HS3.exe".

              Brg
              Findus

              Comment


                Originally posted by Findus View Post
                Hello

                I can't understand if this will run on Linux (Raspberry Pi).
                If so how to install? I cant find file "HS3.exe".

                Brg
                Findus
                The plugin should run on Linux just fine. Extract HSPI_drhsIpPlugIn.exe from the zip file and copy it to your Homeseer directory. You should also chmod +x to mark it as executable.

                -David

                Comment


                  Thanks David. It would be great if you'd publish the source for this under GPL

                  It is such an important plugin and it would really assist with community debugging. We could also (potentially) assist with updates (ie. user defined line termination character(s) on config screen) or what you added for iRule.

                  Would take a load off your plate too.

                  Does not matter if the code is ugly all code is beutiful.

                  Comment


                    Hi David. Any progress with this issue?

                    Do you need anything more to help debug the issue?

                    Comment


                      Originally posted by davros View Post
                      Hi David. Any progress with this issue?

                      Do you need anything more to help debug the issue?
                      Have been travelling on business this week (my real job getting in the way again!) but have got this repro'd on my laptop so should be able to get to it soon.

                      -David

                      Comment


                        Sweet.

                        Hate it when RL gets in the way of a good coding session

                        Cheers

                        Comment


                          Constantly changing port and Host setup

                          Wonder if anyone could help me out on this please?

                          I'm controlling an Epson projector using the well documented 'PJ LInk' protocol with Escaped 'C' data over TCP.
                          I have a client Connection to the projector and can send it Escaped 'C' commands fine.
                          I cannot however read its responses, although I can see the responses coming in via the plugins debug DOS box
                          e.g. %1POWR=OK6 08:48:08:[drhsIpPlugIn]->Got 19 response bytes from PJLInk: PJLINK 0

                          The projector uses IP 192.168.0.83 on port 4352 for receiving all commands and works fine.
                          Using Wireshark to sniff the comms I can see the commands sent via the plugin fine and I can also see the responses coming back from port 4352 on the projector.

                          The HS3 port the projector responds to however, seems to change with every response!

                          I therefore can't figure out what port to initialise on the HS3 Host machine. I've tried leaving the ports box blank and also many of the different
                          ports that are identified by Wireshark.
                          I also find that sometimes the plugin crashes when I click the enable flag with for example one of the last responded to ports.
                          I then have to disable it, restore the ini and then start again with setting back up the Host connection. Its driving me crazy

                          I may have this wrong but I assume I need two connections Client to send and Host to receive?
                          The Client connection is to the projector(@192.168.0.83) port 4352 - This seems to work fine for sending commands.
                          The Host is my HS3 Win10 box (@192.168.0.58) port however changes with every response. Is this the correct way to set things up?

                          When creating a trigger event I can only select the configured Host so assume I must use that connection.

                          Any ideas how to get the receiving bit working correctly? Also is there any form of wildcard you can use for 'String Received:' just for testing purposes?
                          Last edited by reggs11; December 16, 2016, 05:32 AM.

                          Comment


                            Originally posted by davros View Post
                            Sweet.

                            Hate it when RL gets in the way of a good coding session

                            Cheers
                            I've had a look through my code and can see exactly what is going on here. I've hard-coded a value of one second as the timeout between strings received on a serial port. When a string is received on a serial port, it is immediately sent to the pass-thru script (before any potential event triggers are evaluated). If a second string is received less than one second later, that string is concatenated to the previous string and the concatenated string is sent to the pass-thru script. If more than one second has elapsed, the original string is discarded and the new string is passed through as is.

                            In other words, it's not a bug it's a feature!

                            For incoming TCP connections there is already a user configurable setting for concatenation timeout. I guess the easiest fix will be to replace my hard-coded setting with one that is user selectable. It shouldn't take too long. Will this work for you?

                            Regards
                            -David

                            Comment


                              Originally posted by reggs11 View Post
                              Wonder if anyone could help me out on this please?

                              I'm controlling an Epson projector using the well documented 'PJ LInk' protocol with Escaped 'C' data over TCP.
                              I have a client Connection to the projector and can send it Escaped 'C' commands fine.
                              I cannot however read its responses, although I can see the responses coming in via the plugins debug DOS box
                              e.g. %1POWR=OK6 08:48:08:[drhsIpPlugIn]->Got 19 response bytes from PJLInk: PJLINK 0

                              The projector uses IP 192.168.0.83 on port 4352 for receiving all commands and works fine.
                              Using Wireshark to sniff the comms I can see the commands sent via the plugin fine and I can also see the responses coming back from port 4352 on the projector.

                              The HS3 port the projector responds to however, seems to change with every response!

                              I therefore can't figure out what port to initialise on the HS3 Host machine. I've tried leaving the ports box blank and also many of the different
                              ports that are identified by Wireshark.
                              I also find that sometimes the plugin crashes when I click the enable flag with for example one of the last responded to ports.
                              I then have to disable it, restore the ini and then start again with setting back up the Host connection. Its driving me crazy

                              I may have this wrong but I assume I need two connections Client to send and Host to receive?
                              The Client connection is to the projector(@192.168.0.83) port 4352 - This seems to work fine for sending commands.
                              The Host is my HS3 Win10 box (@192.168.0.58) port however changes with every response. Is this the correct way to set things up?

                              When creating a trigger event I can only select the configured Host so assume I must use that connection.

                              Any ideas how to get the receiving bit working correctly? Also is there any form of wildcard you can use for 'String Received:' just for testing purposes?
                              I'm not familiar with PJLink myself but I believe the correct setup to use it to control your projector with the plugin is to define a TCP Client at 192.168.0.83, port 4352 and to tick the "Persist" checkbox. There shouldn't be a need to create a host connection for responses, the persistent option makes the plugin keep the connection established to the projector and I'd expect to see the projector's responses on that connection. If that doesn't work, can you post some of your Wireshark captures so that I can take a look?

                              Cheers
                              -David

                              Comment


                                Originally posted by drule View Post
                                I'm not familiar with PJLink myself but I believe the correct setup to use it to control your projector with the plugin is to define a TCP Client at 192.168.0.83, port 4352 and to tick the "Persist" checkbox. There shouldn't be a need to create a host connection for responses, the persistent option makes the plugin keep the connection established to the projector and I'd expect to see the projector's responses on that connection. If that doesn't work, can you post some of your Wireshark captures so that I can take a look?

                                Cheers
                                -David
                                Hi David - Thanks for that, I'm finally getting data back from the projector and can parse the text in to a script.
                                I can do that so well that I can even match an MD5 encrypted password and still talk to the projector

                                On further reading of the PJLink protocol however, its unveiled another problem which I guess was always gonna happen

                                After 30 seconds of initiating a TCP connection the Projector forcibly closes the TCP connection if no more commands are sent to it.

                                When the plugin detects the dropped connection, it obviously reestablishes the link and we end up in an endless loop with the connection being closed and opened every 30 seconds forever.

                                This is the relevant bit of the PJLink docs:
                                http://pjlink.jbmia.or.jp/english/da...g_20131210.pdf


                                The projector actually doesn't return to Standby, it just drops the TCP connection which would be fine if the plugin only reestablished the connection if\when I send the next command.

                                So this is what I am seeing (see image) :
                                The initial response as can be seen below is correct :
                                17/12/2016 07:12:37:[drhsIpPlugIn]->Projector - received TCP data from: 192.168.0.83, length: 9, containing: %1POWR=0
                                %1POWR=0 Just means the projector is off (or it can be any other valid state).
                                After 30 seconds or so, if no more commands have been sent, the projector closes the connection.

                                The plugin's watchdog then detects the closed or stalled TCP connection and then opens a new connection.
                                Every response after then is just the projector acknowledging a new connection e.g.
                                [drhsIpPlugIn]->Projector - received TCP data from: 192.168.0.83, length: 9, containing: PJLINK 0

                                This behaviour just repeats forever.

                                Is there any way for the plugin to only wait a few seconds for a valid response that triggers a script and then allows the connection to drop and not remain persistent? I guess something that disables the watchdog for certain connections might work...

                                All I'm really trying to do is get the response to a valid query, parse any received data to my script and then drop the connection until I send another command which may not happen until for example I want to turn the projector off maybe a few hours later.

                                On a side note, another query I had that is not shown in this example is that when using passwords the initial query comes back with "PJLINK " + a 1 digit status + a random 8 digit number. Is there any way to use wildcards somehow for the random number as it changes with every new connection?

                                Cheers,
                                - John
                                Attached Files

                                Comment

                                Working...
                                X