Announcement

Collapse
No announcement yet.

TCP connection to JVC Projector

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

  • TCP connection to JVC Projector

    I am trying to turn on and off a JVC projector over TCP/IP.

    The required procedure for turning on a JVC projector consists of 4 steps.
    1. establish a TCP connection. It is described as "standard TCP/IP Three-Way Handshake". I believe it is, host send SYN; Projector sens SYN-ACK; host sends ACK.
    2. host sends a string "PJREQ"
    3. host sends a decimal value "115"
    4. host sends a hex string of "21 89 01 50 57 31 0A"

    Can the Big5 plugin do this? I tried but it did not work. I believe the problem is to establish the 3 way handshake. I could not figure out how to do that in your plugin. Also, the message needs to be partially in ASCII partially in HEX, hopefully.

    Can someone let me know if this is possible?

  • #2
    You should be able to do the back and forth handshake by setting up a persistent TCP profile in Big5: (You will also need to know which port number the JVC is using for TCP connections.)

    Before we dive too deep into that though, have you thought about using a Harmony remote to control the JVC? That's the route I chose to go for turning my JVC on/off. It also gives you the ability to change the input and other settings of the JVC. I then use the MeiHarmony plugin to import the JVC controls into Homeseer so that I can use them in events. Your JVC will show up as a Homeseer device along with all available commands. That might be simpler that creating Big5 profiles and events for control, especially if you are already using the Harmony remote.

    --Barry

    Comment


    • #3
      Originally posted by logman View Post
      You should be able to do the back and forth handshake by setting up a persistent TCP profile in Big5: (You will also need to know which port number the JVC is using for TCP connections.)

      Before we dive too deep into that though, have you thought about using a Harmony remote to control the JVC? That's the route I chose to go for turning my JVC on/off. It also gives you the ability to change the input and other settings of the JVC. I then use the MeiHarmony plugin to import the JVC controls into Homeseer so that I can use them in events. Your JVC will show up as a Homeseer device along with all available commands. That might be simpler that creating Big5 profiles and events for control, especially if you are already using the Harmony remote.

      --Barry
      Thank you Barry, I am aware that I could use IR but it is not convenient due to the wiring I would need to do to accomplish this. I already have an Ethernet plug next to the projector and this JVC model has ALL the commands needed through its TCP connection. So, no, I would like to get TCP working.
      Yes, I am of coarse aware of the Port address to communicate with JVC. I have fully tested the functionality using a Windows app called Hercules. But it is a manually operated test app and not a command line or something could use with HomeSeer.
      Regarding persistent profile in Big5, I tried that but that did not work. This was the point of my question here. Is there an example someone can share on how to establish a handshake with TCP using Big5? As I said in original post, the Projector expects a SYN, then it will respond with SYN-ACK, then I will respond with ACK. That is how it shoudl work theoretically. How do you do that with Big5? Please take a look at my original post.

      THank you

      Comment


      • #4
        BTW, I found this code which already does the function needed but its not usable on Windows based HomeSeer. I just thought it would be a good reference for you to see what I am trying to do with Big5. There is github link there that shows code for the functionality needed.

        https://community.home-assistant.io/...mponent/123417

        Please do let me konw if Big5 can be configured to do this. Thank you

        Comment


        • #5
          Originally posted by chubafelix View Post

          Thank you Barry, I am aware that I could use IR but it is not convenient due to the wiring I would need to do to accomplish this. I already have an Ethernet plug next to the projector and this JVC model has ALL the commands needed through its TCP connection. So, no, I would like to get TCP working.
          Yes, I am of coarse aware of the Port address to communicate with JVC. I have fully tested the functionality using a Windows app called Hercules. But it is a manually operated test app and not a command line or something could use with HomeSeer.
          Regarding persistent profile in Big5, I tried that but that did not work. This was the point of my question here. Is there an example someone can share on how to establish a handshake with TCP using Big5? As I said in original post, the Projector expects a SYN, then it will respond with SYN-ACK, then I will respond with ACK. That is how it shoudl work theoretically. How do you do that with Big5? Please take a look at my original post.

          THank you
          Understood. Just wanted to make sure you had explored that option as it would be easier from a Homeseer standpoint and you'd have a more useful setup in the end.

          I'm pretty sure Big5 can do this by having a TCP profile and then multiple TCP events that fire upon receiving responses from the project. You say in your post that you tried using Big5 without success, but you didn't go into detail about what your attempt looked like. That would give us a better idea of where you need the help and where you are getting hung up.

          There are several ways to skin a possum, but I would probably tackle the handshake like this:

          First, open the connection with a TCP action like this (you can replace the manual trigger with a virtual device change):

          Click image for larger version

Name:	open.png
Views:	46
Size:	22.8 KB
ID:	1338427

          Next, set up a second event that looks like this:

          Click image for larger version

Name:	command.png
Views:	38
Size:	39.6 KB
ID:	1338428

          Uncollapsed, the second event looks like this:

          Click image for larger version

Name:	command_2.png
Views:	38
Size:	443.0 KB
ID:	1338429
          Click image for larger version

Name:	command_3.png
Views:	38
Size:	26.8 KB
ID:	1338430

          I haven't tested this, but this should give you a good place to start testing. The above should turn the projector on. You would set up another event to turn it off.

          --Barry

          Comment


          • #6
            By the way, I don't think it is necessary to send "115" in the command string for TCP control. I believe that is a IR device code and only necessary to send when doing IR emulation. I could be wrong about that though.

            --Barry

            Comment


            • #7
              Originally posted by logman View Post
              By the way, I don't think it is necessary to send "115" in the command string for TCP control. I believe that is a IR device code and only necessary to send when doing IR emulation. I could be wrong about that though.

              --Barry
              You are absolutely right, I got mixed up reading the manual. TCP contains handshake, PJREQ and On Command. that's all. I will try it.

              Comment


              • #8
                Barry, again thanks very much for your efforts.

                I did what you suggested. In fact it was very close to what I originally tired with your plugin, the main difference is the wait for PJ_OK message. I tried this with TCP profile having both Listen and Persistent options on and off. In all cases the second event was never triggered. Here is the log entry.
                Date/Time Pri Type/Error Message/Source
                Nov-08 6:08:42 AM Event Event Trigger "Home Theatre JVC Open Connection"
                Nov-08 6:08:42 AM Event Event Home Theatre JVC Open Connection triggered by the event page 'Run' button.
                Just as a way to give you an understanding of both message correctness and connectivity on my network, I am including a screen shot of a utility called Hercules which works from the same PC where HomeSeer is running and is successfully turning Projector on/off and all other commands.

                Here is what is happening inthe Hercules app. I press the connect button and get a response of PJ_OK (in black). Then manually I press the SEND button with the message PJREQ (in pink), I get a response PJACK (in black). THen manually I press the SEND button with HEX string to turn on projector. YOu can see the ASCII representation in pink. I get an ASCII string back (in black) acknowledging my power on command.

                From this test it seems that plugin is not successfully communicating with my projector. Please let me konw what I can do to determine why.
                Attached Files

                Comment


                • #9
                  For the TCP profile you will need the persistent box checked and the listening box unchecked. Listening means you are setting up a profile that waits for another device to initiate the connection. In other words, your computer would be taking on the role of the projector.

                  For debugging purposes you could combine all steps into 1 event and keep the manual trigger. Put the "wait" period between each step to give the projector time to respond. You can then turn on debug logging for the plugin (at the very bottom of the configuration page) and it will show verbose logs for all outgoing and incoming messages received. That should give you a better picture of what is going on and help with troubleshooting.

                  --Barry

                  Comment


                  • #10
                    Hi Barry, thanks for your help. I made some progress. Instead of turning the projector on, I decided to test using an enquiry command.

                    Enquiry Command (to projector) 3F 89 01 4D 44 0A
                    Response (from projector) 06 89 01 4D 44 0A 40 89 01 4D 44 RR 0A


                    I setup 4 events, each one triggering the next. This way I could see the response from projector in the log. Here are the events. Click image for larger version  Name:	connect.jpg Views:	0 Size:	40.9 KB ID:	1338948
                    Click image for larger version  Name:	pjreq.jpg Views:	0 Size:	52.2 KB ID:	1338949
                    Click image for larger version  Name:	send.jpg Views:	0 Size:	51.0 KB ID:	1338950
                    Click image for larger version  Name:	receive.jpg Views:	0 Size:	54.3 KB ID:	1338951
                    Attached Files

                    Comment


                    • #11
                      On previous post, the last part (attached files) is unintended, don't know how to get rid of. THe test ended on Receive Command.

                      Here is the debug log for this sequence:
                      Nov-10 6:35:51 AM Big5 [TcpConnection] TCP disconnected - TCP hostname 10.0.0.30, port 20554
                      Nov-10 6:35:51 AM Big5 [TcpConnection] TCP disconnected - TCP hostname 10.0.0.30, port 20554
                      Nov-10 6:35:51 AM Big5 [TcpConnection] TCP disconnected - TCP hostname 10.0.0.30, port 20554
                      Nov-10 6:35:51 AM Big5 [TcpConnection] TCP disconnected - TCP hostname 10.0.0.30, port 20554
                      Nov-10 6:35:51 AM Big5 [TcpConnection] TCP disconnected - TCP hostname 10.0.0.30, port 20554
                      Nov-10 6:35:46 AM Big5 [TcpConnection] Reusing existing outgoing TCP connection
                      Nov-10 6:35:46 AM Big5 [TcpConnection] [TCP TCP hostname 10.0.0.30, port 20554 OUT]: 3F 89 01 4D 44 0A
                      Nov-10 6:35:46 AM Big5 [Big5 Plugin] message = 3F 89 01 4D 44 0A
                      Nov-10 6:35:46 AM Big5 [Big5 Plugin] profile = 932520
                      Nov-10 6:35:46 AM Big5 [Big5 Plugin] type = TCP
                      Nov-10 6:35:46 AM Big5 [Big5 Plugin] Debugging dictionary with 3 keys
                      Nov-10 6:35:46 AM Event Event Trigger "Home Theatre BIG5 JVC Projector Send Command"
                      Nov-10 6:35:46 AM Big5 [Big5 Plugin] matchers = [{"type":"matcher_substring","oper":"AND","param1":"0","param 2":"PJACK","matcherIdx":0},{"type":"matcher_create","oper":" AND","param1":"","param2":"","matcherIdx":0}]
                      Nov-10 6:35:46 AM Big5 [Big5 Plugin] profile = 932520
                      Nov-10 6:35:46 AM Big5 [Big5 Plugin] type = TCP
                      Nov-10 6:35:46 AM Big5 [TcpConnection] [TCP TCP hostname 10.0.0.30, port 20554 IN]: PJACK
                      Nov-10 6:35:46 AM Big5 [Big5 Plugin] Debugging dictionary with 3 keys
                      Nov-10 6:35:46 AM Big5 [Big5 Plugin] matchers = [{"type":"matcher_substring","oper":"AND","param1":"0","param 2":"PJACK","matcherIdx":0},{"type":"matcher_create","oper":" AND","param1":"","param2":"","matcherIdx":0}]
                      Nov-10 6:35:46 AM Big5 [Big5 Plugin] profile = 932520
                      Nov-10 6:35:46 AM Big5 [Big5 Plugin] type = TCP
                      Nov-10 6:35:46 AM Big5 [Big5 Plugin] Debugging dictionary with 3 keys
                      Nov-10 6:35:46 AM Big5 [Big5 Plugin] Triggering this:
                      Nov-10 6:35:46 AM Big5 [Big5 Plugin] [TCP TCP hostname 10.0.0.30, port 20554 IN]: PJACK
                      Nov-10 6:35:46 AM Big5 [Big5 Plugin] [Raw message in]: PJACK
                      Nov-10 6:35:46 AM Big5 [TcpConnection] Reusing existing outgoing TCP connection
                      Nov-10 6:35:46 AM Big5 [TcpConnection] [TCP TCP hostname 10.0.0.30, port 20554 OUT]: PJREQ
                      Nov-10 6:35:46 AM Big5 [Big5 Plugin] message = PJREQ
                      Nov-10 6:35:46 AM Big5 [Big5 Plugin] profile = 932520
                      Nov-10 6:35:46 AM Big5 [Big5 Plugin] type = TCP
                      Nov-10 6:35:46 AM Big5 [Big5 Plugin] Debugging dictionary with 3 keys
                      Nov-10 6:35:46 AM Event Event Trigger "Home Theatre BIG5 JVC Projector PJREQ"
                      Nov-10 6:35:46 AM Big5 [Big5 Plugin] matchers = [{"type":"matcher_substring","oper":"AND","param1":"0","param 2":"PJ_OK","matcherIdx":0},{"type":"matcher_create","oper":" AND","param1":"","param2":"","matcherIdx":0}]
                      Nov-10 6:35:46 AM Big5 [Big5 Plugin] profile = 932520
                      Nov-10 6:35:46 AM Big5 [Big5 Plugin] type = TCP
                      Nov-10 6:35:46 AM Big5 [Big5 Plugin] Debugging dictionary with 3 keys
                      Nov-10 6:35:46 AM Big5 [TcpConnection] [TCP TCP hostname 10.0.0.30, port 20554 IN]: PJ_OK
                      Nov-10 6:35:46 AM Big5 [Big5 Plugin] matchers = [{"type":"matcher_substring","oper":"AND","param1":"0","param 2":"PJ_OK","matcherIdx":0},{"type":"matcher_create","oper":" AND","param1":"","param2":"","matcherIdx":0}]
                      Nov-10 6:35:46 AM Big5 [Big5 Plugin] profile = 932520
                      Nov-10 6:35:46 AM Big5 [Big5 Plugin] type = TCP
                      Nov-10 6:35:46 AM Big5 [Big5 Plugin] Debugging dictionary with 3 keys
                      Nov-10 6:35:46 AM Big5 [Big5 Plugin] Triggering this:
                      Nov-10 6:35:46 AM Big5 [Big5 Plugin] [TCP TCP hostname 10.0.0.30, port 20554 IN]: PJ_OK
                      Nov-10 6:35:46 AM Big5 [Big5 Plugin] [Raw message in]: PJ_OK
                      Nov-10 6:35:45 AM Big5 [TcpConnection] Creating outgoing TCP connection
                      Nov-10 6:35:45 AM Big5 [TcpConnection] [TCP TCP hostname 10.0.0.30, port 20554 OUT]:
                      Nov-10 6:35:45 AM Big5 [Big5 Plugin] message =
                      Nov-10 6:35:45 AM Big5 [Big5 Plugin] profile = 932520
                      Nov-10 6:35:45 AM Big5 [Big5 Plugin] type = TCP
                      Nov-10 6:35:45 AM Big5 [Big5 Plugin] Debugging dictionary with 3 keys
                      Nov-10 6:35:45 AM Event Event Trigger "Home Theatre BIG5 JVC Open Connection"
                      Nov-10 6:35:45 AM Event Event Home Theatre BIG5 JVC Open Connection triggered by the event page 'Run' button.
                      Nov-10 6:35:42 AM Big5 [Big5 Plugin] matchers = [{"type":"matcher_substring","oper":"AND","param1":"3","param 2":"MD","matcherIdx":0},{"type":"matcher_create","oper":"AND ","param1":"","param2":"","matcherIdx":0}]
                      Nov-10 6:35:42 AM Big5 [Big5 Plugin] profile = 932520
                      Nov-10 6:35:42 AM Big5 [Big5 Plugin] type = TCP
                      Nov-10 6:35:42 AM Big5 [Big5 Plugin] Debugging dictionary with 3 keys
                      Nov-10 6:35:39 AM Big5 [Big5 Plugin] matchers = [{"type":"matcher_substring","oper":"AND","param1":"3","param 2":"MD","matcherIdx":0},{"type":"matcher_create","oper":"AND ","param1":"","param2":"","matcherIdx":0}]
                      Nov-10 6:35:39 AM Big5 [Big5 Plugin] profile = 932520
                      Nov-10 6:35:39 AM Big5 [Big5 Plugin] type = TCP
                      Nov-10 6:35:39 AM Big5 [Big5 Plugin] Debugging dictionary with 3 keys
                      Nov-10 6:35:39 AM Big5 [Big5 Plugin] addMatcher__12_G0_T0 = matcher_create
                      Nov-10 6:35:39 AM Big5 [Big5 Plugin] matcher_substring_0_1__12_G0_T0 = MD
                      Nov-10 6:35:39 AM Big5 [Big5 Plugin] matcher_substring_0_0__12_G0_T0 = 3
                      Nov-10 6:35:39 AM Big5 [Big5 Plugin] profile__12_G0_T0 = 932520
                      Nov-10 6:35:39 AM Big5 [Big5 Plugin] type__12_G0_T0 = TCP
                      Nov-10 6:35:39 AM Big5 [Big5 Plugin] Debugging dictionary with 5 keys
                      Nov-10 6:35:27 AM Big5 [Big5 Plugin] matchers = [{"type":"matcher_substring","oper":"AND","param1":"2","param 2":"MD","matcherIdx":0},{"type":"matcher_create","oper":"AND ","param1":"","param2":"","matcherIdx":0}]
                      Nov-10 6:35:27 AM Big5 [Big5 Plugin] profile = 932520
                      Nov-10 6:35:27 AM Big5 [Big5 Plugin] type = TCP
                      Nov-10 6:35:27 AM Big5 [Big5 Plugin] Debugging dictionary with 3 keys

                      Comment


                      • #12
                        As you can see in the log, everything worked all the way to receiving hex data. With the last event I wanted to check that my command was received correctly and to do that, I had to receive a HEX string, along with another HEX string which signifies the model number of the Projector. It is likely I do not understand how to receive HEX data from my device. This is where I could use your help. ALso, is there a way to do this in a script so that I don't have to create 4 or 5 events?
                        Looking forward to your reply.
                        Felix

                        Comment


                        • #13
                          There is actually no need for multiple Homeseer events if you want to send multiple messages one after the other using the same TCP profile. You can specify a wait period between each command (in milliseconds). For example, <wait 2000> will cause a 2 second delay before sending the next command.

                          It's hard to tell if the projector received the command and then the plugin failed to parse the response, or if the projector received the command but didn't understand it. If the projector receives a communication it doesn't understand, it will simply drop the connection after 5 seconds (no error message will be sent). Looking at the timeline in the log the connection was closed by the projector exactly 5 seconds after the command was sent, so that makes me think it didn't understand the command.

                          Have you tried sending the test (null) command 21 89 01 00 00 0A? If received correctly the projector should respond with 06 89 01 00 00 0A.

                          What if you send the on or off command... Does the projector turn on or off? If not, then it is not understanding the received commands.

                          If I had to guess, I think the plugin is sending the hex string (i.e. 21 89 01 50 57 31 0A) out as a text string (decimal numbers) while the projector is looking for a pure hex string.

                          A work around could be to try remote emulation and convert the remote codes first from ASCII to decimal and then from decimal to long hex format.

                          The decimal equivalent for "power on" in remote emulation is 115 48 53, which converts to long hex of:

                          Code:
                          0000 006D 0001 0011 0141 00A0 0014 003C 0014 003C 0014 0014 0014 0014 0014 003C 0014 003C 0014 003C 0014 0014 0014 003C 0014 0014 0014 003C 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0336
                          The decimal equivalent for "power off" is 115 48 54, which converts to long hex of:

                          Code:
                          0000 006D 0001 0011 0141 00A0 0014 003C 0014 003C 0014 0014 0014 0014 0014 003C 0014 003C 0014 003C 0014 0014 0014 0014 0014 003C 0014 003C 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0336
                          You will need to send the off command twice with a short delay between each send because the first send will result in a "are you sure" dialog box being sent to the projector screen.

                          Hopefully this might work.

                          --Barry

                          Comment


                          • #14
                            Barry, thanks very much. All this makes sense and I can try the various approaches but one thing I want to understand first.

                            Does your plugin send actual hex values to the projector? When I type in these values "3F 89 01 50 57 0A" into the Send Message of the command event, does it send exactly that? Or does it send an ASCII representation of those value? Or does it send those numbers as an ASCII string without any conversion? There are other 3 options on the send event, besides sending message but, can I assume that send message is the right way to send hex values?

                            How does your plugin receive hex values. When I setup an event and is select IF, where it says message comes in on TCP profile, what exactly should I expect? If the hex string I am expecting is "06 89 01 50 57 0A 40 89 01 50 57 RR 0A", should I expect a "number" 06 at position 0? Or should it be the ASCII version of 06? Or 0006? How do I parse the ack data like this one "06 89 01 50 57 0A 40 89 01 50 57 RR 0A"

                            I don't have an emulator that I could use to see what your plugin actually sends. I am hoping you can just tell me.

                            THank you
                            F

                            Comment


                            • #15
                              Hi Felix,

                              All good questions. But unfortunately I'm not the owner nor author of the plugin. I'm just a fellow user trying to lend a helping hand. Looking at the log you posted above I assume the message is being sent as a plain text string, in which numbers would be encoded in decimal format. But that's a guess on my part.

                              Are you familiar with Node Red? If you can get Node Red set up and running on your machine (it's free), you could use it as a test bed and have much better visibility into what is going on. Node Red has excellent TCP inbound and outbound capabilities (amongst many other things, like UDP, websocket, http, mqtt, etc.).

                              Another suggestion would be to download and install Wireshark (also free) and monitor all TCP communications passing back and forth on port 20554. It's an invaluable tool in the "hackers" toolbox for sniffing local network traffic.

                              --Barry

                              Comment

                              Working...
                              X