Announcement

Collapse
No announcement yet.

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

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

    It looks like all commands sent to a Russound device need to be terminated with a carriage return and all commands received are terminated with carriage return and linefeed. Try changing your "Russound Watch On" command to Type: C Escaped and add \r to the end.

    Comment


      Originally posted by drule View Post
      It looks like all commands sent to a Russound device need to be terminated with a carriage return and all commands received are terminated with carriage return and linefeed. Try changing your "Russound Watch On" command to Type: C Escaped and add \r to the end.
      This worked! I need to learn more about C Escape. Never heard of it before - I have a lot to learn! Thanks.

      Comment


        I am getting the error message "concatenated string exceeds maximum" on some of the commands back from the Russound. I see in this thread that some people adjusted the timeout to have it break the strings up in smaller chunks. I went down to 25 MS but it didn't seem to make much difference. I think it is because the Russound is sending out periodic status elements that are really that long. Is there anyway to increase the size of the incoming data? Here is an example:
        Jul-18 8:30:23 AM drhsIpPlugIn concatenated string exceeds maximum
        Jul-18 8:30:23 AM MPX-1 Connector: Russound | IP Address: 192.168.2.122:9621 | Data: S N C[1].Z[1].name="CHA5" N C[1].Z[1].treble="0" N C[1].Z[1].balance="0" N C[1].Z[1].loudness="ON" N C[1].Z[1].turnOnVolume="40" N C[1].Z[1].doNotDisturb="OFF" N C[1].Z[1].currentSource="1" N C[1].Z[1].volume="25" N C[1].Z[1].sleepTimeDefault="15" N C[1].Z[1].status="ON" N C[1].Z[1].mute="OFF" N C[1].Z[1].partyMode="OFF" N C[1].Z[1].bass="0" N C[1].Z[1].page="OFF" N C[1].Z[1].sharedSource="OFF" N C[1].Z[1].sleepTimeRemaining="0" N C[1].Z[1].lastError="" N S[1].name="Media Streamer" N S[1].type="Russound Media Streamer" N S[1].Support.favoritesV2="TRUE" N S[1].Support.MM.longList="TRUE" N S[1].Support.MM.restoreOption="TRUE" N S[1].Support.availableControls="TRUE" N S[1].Support.trackTime="TRUE" N S[1].Support.playTime="TRUE" N S[1].Support.playerData="TRUE" N S[1].channelName="076 Symphony Hall" N S[1].coverArtURL="" N S[1].channelArtURL="http://pri.art.prod.streaming.siriusxm.com/images/channel/20180725/symphonyhall-1-31-00-180x180.png" N S[1].mode="SiriusXM" N S[1].shuffleMod

        Comment


          The maximum is currently hardcoded to 1024 bytes. I think it is a good idea to have a method to adjust this but as I'm currently working on a native HS4 version of the plugin, I'm not planning on making updates to the HS3 version. That said, it would be simple for me to simply increase the hard maximum to something bigger. PM me with your email address and I'll send you a version with a changed limit.

          Comment


            UPDATE: the problem below was easily solved:
            dim Lastmessage as string = ""
            public sub main(param as object)
            Dim TokenToProcess as string = replace(param(2),Lastmessage,"")
            LastMessage = param(2)
            ...... code to process TokentoProcess

            Lastmessage has to be outside the scope of main so it remains from call to call.
            --------------------------------------------------------------------------------

            Got a problem -- don't think it has appeared in this thread, but I may be wrong .. if so, my apologies. Trying to talk to a Marantz receiver. Everything is good EXCEPT the plugin is sending duplicate messages to my script (TCP persistent connection on Port 23). I don't mind it concatenating messages, if it were to hold the message and send it all. But it is sending the messages when received and if the concatenation timeout has not expired, it simply concatenates the the previous message so I get the first message repeated. I have the concatenation interval all the way down to 2 msec and I still have the same result even though Wireshark says the messages are coming in 4 to 6 milliseconds apart. If I turn that interval down to 0 I get a different problem. It processes the first message and then loses a bunch with an error in the log:
            Jul-23 12:37:00 drhsIpPlugIn Starting Tcp client for Marantz SR5014 at address 192.168.10.24:23
            Jul-23 12:37:00 drhsIpPlugIn Watchdog restarting stalled connection for Marantz SR5014
            I think I can always save the previously message and compare the new message with the old and strip out any repeated portion (pretty simple with 'replace'). Is there some other way to prevent this behavior (again, the concatenated messages are fine, but the repeat is not)

            Here is the Homeseer log with a line printed at the entry to Main() printing the three parameters received from drhsIpplugin
            Jul-23 12:19:35 TCPHandler Main; param(0)=Marantz SR5014; param(1)=192.168.10.24:23; param(2)=DCAUTO
            Jul-23 12:19:35 TCPHandler Main; param(0)=Marantz SR5014; param(1)=192.168.10.24:23; param(2)=MVMAX 85
            Jul-23 12:19:35 TCPHandler Main; param(0)=Marantz SR5014; param(1)=192.168.10.24:23; param(2)=CVFL 50 CVFR 50 CVEND
            Jul-23 12:19:35 TCPHandler Main; param(0)=Marantz SR5014; param(1)=192.168.10.24:23; param(2)=CVFL 50 CVFR 50
            Jul-23 12:19:35 TCPHandler Main; param(0)=Marantz SR5014; param(1)=192.168.10.24:23; param(2)=CVFL 50
            There were, in fact, 5 messages from the Marantz device: "CVFL 50", "CVFR 50", "CVEND", "MVMAX 85", and "DCAUTO" In this case it is not a big deal to process them multiple times (for example the CVFL 50 gets processed three times. But in other cases there are 20 or 30 messages that all get bundled together.

            The attachments are a PDF file of the Wireshark output showing the TELNET packets and also the raw Wireshark capture file (put into a zip fie because it wouldn't let me upload a .pcap file). As you can see the CVFL packet and the CVFR packet are separated by about 5.8 m-sec and then there is 4.5 msec before the CVEND. And then much longer breaks (65 and 95 msec) for the next two packets which are split up by the plugin. Is there a solution (other than my script looking for duplication)? And the timeout I have set for concatenation in the plugin is 2 sec (way down from the default).
            Attached Files

            Comment


              Yes, I think that can be classified as a bug. The plugin does resend the entire message as it grows through concatenation, up until the timeout or max size is reached.

              The native HS4 plugin that I am currently working on will allow you to set different timeout values for each connection. I'll also make it so that no message is sent until the timeout is reached. This should allow messages to concatenate and get sent as one.

              -David

              Comment


                Wondering if someone can help me with this. I have a Control4 C4 amp that I would like to control with HomeSeer. I am thinking I should be able to do this with this plugin but this is a bit over my head so I probably need some help going in the right direction. I found this Home Assistant (python I think) add-on that can control the C4 AMP by UDP commands:

                https://github.com/kmakar89/Home-***...es/__init__.py

                I also stumbled across an old thread which is apparently related where there is some explanation of the commands used by the amp:

                https://community.volumio.org/t/help...l-setup/291/11

                I am trying to figure out how to setup the plugin to send the proper commands via UDP. If anyone can help me decipher how to do this it would be greatly appreciated.

                Thanks!

                Comment


                  Is anyone interested in utilizing drhslpPlugin to control QMotion Blinds? I have 18 QMotion Blinds in my home and ahve been using this Plugin for three years to control them. I learned all the QMotion Control Codes with an IP Monitor on my home network. This Plugin has worked without error for three years!

                  -Mark

                  Comment


                    I am working on sending a Power Off command to my Sony Bluray Player. So I know the Ip Address and Port to send the command. I know the Ip command for Power Off. I am not sure how to setup the command to make it work. Here is the command AAAAAwAAHFoAAAAVAw==
                    Any ideas/help is greatly appreciated.

                    Comment


                      I thought I would reopen the discussion on this error:

                      Code:
                      Running script Russound_MPX_2_Incoming.vb :Exception has been thrown by the target of an invocation.->Does entry point Main exist in script? at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Scheduler.clsRunVBNetScript.ExecuteScript()
                      I know other have had this issue but have not been able to trap it. It happens with almost every call - but does not seem to be interfering with my setup. Valid data is getting through to my script with each command so this looks like it could be some extraneous characters or something.

                      drule - is there any way to get the plugin to log the raw data passing through so I could take a look at what is getting to my script to cause it to fail? Thanks.

                      Comment


                        Originally posted by simonmason View Post
                        Code:
                        Does entry point Main exist in script?
                        Sorry if this is a silly question but does your external script have a Sub Main?

                        Comment


                          Yes, good question, but definitely has a main.

                          Code:
                          Sub Main(Param As Object)
                          The script is running fine the majority of the time.

                          I don't think I am missing anything coming back from the media streamer - although technically I wouldn't know as I don't see what is captured when I get the error.
                          It's a little hard to figure out with the Russound devices as they don't have a well documented list of what comes back from the player when it receives commands. It spits back a ton of information and I have just worked my way through it figuring out what everything is.

                          This was why I was asking if we could get a debug of what is coming from the device and then being handed off to the script. My understanding of how this works is that something is malformed in the procedure call causing it to through this error.

                          Here is what I am doing with the parameters. I am writing out the content string in the script to see what is coming in but it never gets there on the failed attempts.

                          Code:
                          ' 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
                          Dim Params() As String = Split(Param.ToString, Chr(0))
                          connector = Param(0).ToString
                          ip_address = Param(1).ToString
                          content = Param(2).ToString

                          Comment


                            There's nothing in the current plugin that will do exactly what you want. I will probably add a way to dump out to a WireShark style log file in the HS4 plugin (which is some way off still!). If you switch Homeseer into debug mode, the plugin will run in a separate command window where you will see some more information, including I think, a count of bytes received.

                            In your script it would be worth writing out to the log some more info to try to determine where it gets to before it fails. I've resorted to inserting log writes to every other line on some occasions.
                            Code:
                            ' 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("MyTest", "0")
                            Dim Params() As String = Split(Param.ToString, Chr(0))
                            hs.WriteLog("MyTest", "1")
                            connector = Param(0).ToString
                            hs.WriteLog("MyTest", "2")
                            ip_address = Param(1).ToString
                            hs.WriteLog("MyTest", "3")
                            content = Param(2).ToString
                            hs.WriteLog("MyTest", "4")

                            Comment


                              simonmason a few things

                              shouldnt your declarations be - connector = Params(0).ToString - Appears you’re missing the “s”

                              I ran into a similar issue recently when working on a script. Most likely you’re not receiving all parameters. For instance, Params(2) might be nothing.

                              recommend trying the following. Might be good to do this for all declarations.

                              content As String : if Params.getupperbound(0) > 1 orelse Params(2) IsNot “” then content = Params(2)

                              also might be good to do a debug line and print Param to the HS log so you know exactly what was passed in.

                              Comment


                                When I add the s to the statement it errors out. As I said the script is working 2/3 of the time - I get the errors from the script about every 2nd or 3rd time it runs. In between it runs fine.

                                I tried adding writelogs in between each command as suggested, and at the beginning of the script, and it never gets to them - on the times that the script fails.
                                So the plug-in is calling the script and it is failing before the script even gets going. Hence the weird message about the entry point. So I can't write out what is being handed to the script because it is not even getting to the first line of the script.

                                Comment

                                Working...
                                X