Announcement

Collapse
No announcement yet.

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

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

    Originally posted by WinoOutWest View Post
    I also just noticed that the plugin seems to support http commands.
    This would REALLY make my transition to HS easy if I can get it working. Is there a document etc on syntax and settings?

    When I paste this into a browser it sends the command and does what I want it to do:
    http://192.168.2.220/?hdmiPower

    I've attached the connection and command I have setup to test this. It doesn't appear to be sending correctly when I use an event to run the command.
    What am I missing?
    Cheers!
    I haven't used HTTP connections/commands, but try the POST method instead of GET
    cheeryfool

    Comment


      Originally posted by WinoOutWest View Post
      This plugin is AWESOME!
      My wheels are turning: I am having issues with the BLOnkyo plugin as it is not sending the commands to my older Integra receivers that I am controlling via RS232 and an IP-->RS232 device and VSPE. I tested it with a script that I got and it works fine so I am wondering if anyone can help me get one command into this plugin and I will be able to figure out the rest. It will be waaay easier to control it from this plugin than creating a bunch of scripts.

      here is the script that is currently working:
      sub main()
      Dim PortNumber
      PortNumber=4
      hs.OpenComPort PortNumber,"9600,n,8,1",1,"",""
      hs.SendToComPort PortNumber, "!1PWR01" & vbcr
      hs.closeComPort PortNumber
      end sub

      If I can bypass the VSPE and send directly to the IP-->RS232 device then even better!

      Can anyone help me get this command created in this plugin?
      Cheers!
      Darren
      Which IP->Serial device are you using? You can most likely send a C-escaped string "!1PWR01\n\r" to the ipaddress/port of the device as a tcp client.

      -David

      Comment


        Originally posted by cheeryfool View Post
        I haven't used HTTP connections/commands, but try the POST method instead of GET
        Honestly, I didn't fully implement the HTTP part of my plugin because I realized that HomeSeer does a pretty good job of it natively.

        For instance, I control a DirecTV receiver with HTTP commands by having an event whose action is "Run a Script or Script Command" and then I have "Execute immediate script command" ticked and the command is:
        Code:
        &hs.GetURL("192.168.1.1", "/remote/processKey?key=guide&clientAddr=0", True, 8080)
        I suspect that this will do the job for you:
        Code:
        &hs.GetURL("192.168.2.200", "/?hdmiPower", True, 80)
        DirecTV receivers use an HTTP GET command. If you need to send a POST, I use a small script:
        Code:
        Sub Main(parm as String)
            If parm <> "" Then
                Dim WebClient As New System.Net.WebClient
                Dim Result As String = WebClient.UploadValues(parm, "POST", New System.Collections.Specialized.NameValueCollection()).ToString
            End If
        End Sub
        I control a Roku this way by having my event run this script and pass it the following parameter: http://192.168.1.2:8060/keypress/Home

        -David

        Comment


          Originally posted by drule View Post
          Which IP->Serial device are you using? You can most likely send a C-escaped string "!1PWR01\n\r" to the ipaddress/port of the device as a tcp client.

          -David
          DRULE you rule! That worked, I am on my way!. This is way easier than what I had to do with my Vera setup.
          Thank you!

          I have 3 Integra (Onlyo) receivers that I use for audio only so I only really need Power on/off and volume for. The way this plugin works I only have to create the commands once and then send them to different devices as appropriate.

          Thank you so much - Can't tell you how pleased I am to have this work so effortlessly compared to my SNAFU with Vera!

          Comment


            Ok so I am probably abusing my newbie status now but is there a quick way to get feedback into a homeseer variable? Specifically I really only need/would like to have the volume level so that I can display that in my Imperihome. When the BLOnkyo plugin was working I was able to map that value to a generic text sensor in the Imperihome which suited my requirements just fine

            MVLQSTN is the serial query command so presumably "!1MVLQSTN\n\r" would send the query command and get the value from the receiver. How can I capture that so I can display it as a sensor/value?

            Comment


              Originally posted by drule View Post
              I suspect that this will do the job for you:
              Code:
              &hs.GetURL("192.168.2.200", "/?hdmiPower", True, 80)
              -David
              Yes sir that does indeed work for me.
              Thank you (again!)

              I think I am gonna head over and take advantage of the 25% off sale that ends tonight. DRULE and CHEERYFOOL: this single plugin eliminates all my concerns and apprehensions about moving off my Vera. It simplifies my setup, makes it easier to manage and do "stuff" with and with a little luck and more help I will be getting the volume feedback working on my receivers, something I never had managed to get working on my Vera.

              Comment


                Originally posted by WinoOutWest View Post
                Ok so I am probably abusing my newbie status now but is there a quick way to get feedback into a homeseer variable? Specifically I really only need/would like to have the volume level so that I can display that in my Imperihome. When the BLOnkyo plugin was working I was able to map that value to a generic text sensor in the Imperihome which suited my requirements just fine

                MVLQSTN is the serial query command so presumably "!1MVLQSTN\n\r" would send the query command and get the value from the receiver. How can I capture that so I can display it as a sensor/value?
                Hi WinoOutWest,

                This should be fairly easy but you're going to have to dip into a bit of scripting. Presumably your Connection is defined as a TCP Client? If you tick the "Persist" checkbox, this causes the plugin to keep the connection open, rather than open the connection, send data, close the connection. A persistent connection lets you do stuff with data received from the remote device.

                You can either create an event that triggers when a specific message is received, or more powerfully, you can pass all data received into a script.

                Here's a example of a pass-thru script that simply writes data received into Homeseer's log:
                Code:
                Sub Main(param() As Object)
                    Dim ConnectionName As String = param(0)
                    Dim FromIp As String = param(1)
                    Dim AsciiData As String = param(2)
                    Dim BinaryData(UBound(param(3))) As Byte
                    Array.Copy(param(3), BinaryData, BinaryData.Length)
                
                    hs.WriteLog("Pass-thru", ConnectionName)
                    hs.WriteLog("Pass-thru", FromIp)
                    hs.WriteLog("Pass-thru", AsciiData)
                    hs.WriteLog("Pass-thru", "There are " & BinaryData.Length.ToString & " bytes of binary data.")
                
                    For n as Int16 = 0 to UBound(BinaryData)
                        hs.WriteLog("Pass-thru b" & n.ToString, BinaryData(n).ToString)
                    Next
                End Sub
                You could use something like this to parse the response from your Onyko device.

                -David

                Comment


                  Originally posted by drule View Post
                  You can just cut & paste the code straight from remotecentral.com. E.g., for a Samsung TV, the power command hex code would be:
                  Code:
                  0000 006C 0022 0003 00AD 00AD 0016 0041 0016 0041 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 0041 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 0016 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 06FB 00AD 00AD 0016 0016 0016 0E6C
                  Cheers
                  -David
                  I am trying to send a Hex IR command to my iTach. In the event, do I send it as GC or IR trans ?

                  Comment


                    Originally posted by mikee123 View Post
                    I am trying to send a Hex IR command to my iTach. In the event, do I send it as GC or IR trans ?
                    GC

                    Comment


                      Time to ask for help...

                      I've been trying to get a "two way" function working with this script for many months... but, man... I just don't understand scripts.

                      I'm using drhsIpPlugin to control a Rotel preamp via serial through an iTach. The control works. And I've got a virtual device that holds the volume level - but it's based on keeping it in sync, not on getting feedback from the Rotel.

                      I've butchered one of the sample scripts to get it to show the returned data I want in the logs - so I suspect there's a way to parse that into pieces and then use it to set a virtual device.

                      Here's what I'm using:
                      Code:
                      Sub Main(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
                          Dim SplitString() As String = Split(Params(2), Chr(13))
                          For i As Integer = 0 To UBound(SplitString)
                              Select Case SplitString(i)
                                  Case "GC-IRE XXXXXXXX"
                                      ' Do stuff
                                      Exit For
                                  Case "GC-IRE YYYYYYYY"
                                      ' Do other stuff
                                      Exit For
                      
                                  Case Else
                                      hs.WriteLog("drhsIpPlugin", "Volume is now: " & right(SplitString(0),3) & "(originally [" & SplitString(0) & "]")
                              End Select            
                          Next
                      End Sub
                      The first thing I'm trying to get is the actual volume information.

                      Here's what's hitting the logs right now (from the above script - everything hits the "else" condition):
                      Code:
                      Jul-15 6:38:01 PM	 	drhsIpPlugin	Volume is now: 39 (originally [?? VID 3 VOL 39 ]
                      I'm pretty sure I want to do something very different than the "case" thing, but I don't know how to do it. I think what I want is something like: "look for the 'VOL ' (including the space) then grab the two digits that come after the space and use them as a numeric to set the value of the virtual device."

                      FWIW, I also want to grab the "VID 3" portion (other cases are VID 1, VID 2, VID 4, CD, TUNER, TAPE) and use those to set another virtual device.

                      Hoping this is as easy for one of you as it is hard for me. And then I'll learn something... THX!

                      Comment


                        Originally posted by drule View Post
                        I started playing with iRule feedbacks as while ago and got it mostly working but I didn't fully finish it. In iRule, you create a feedback and add it to a page and then using the Send Status/Value action of an event, Homeseer can send values to iRule which will be updated on the page.

                        I'll dig out the example I used for testing if it helps. As I say, I never really finished it 100%, so I'd be happy to hear your ideas for how it might best function.

                        -David
                        @drule

                        I got my iRule controlling HS3, now I'd like to try and get feedback into some of my devices... I had a look but could not see any example. Do you still have that and could you possibly post it ?

                        Comment


                          Originally posted by gregoryx View Post
                          I've been trying to get a "two way" function working with this script for many months... but, man... I just don't understand scripts.

                          I'm using drhsIpPlugin to control a Rotel preamp via serial through an iTach. The control works. And I've got a virtual device that holds the volume level - but it's based on keeping it in sync, not on getting feedback from the Rotel.

                          I've butchered one of the sample scripts to get it to show the returned data I want in the logs - so I suspect there's a way to parse that into pieces and then use it to set a virtual device.

                          Here's what I'm using:
                          Code:
                          Sub Main(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
                              Dim SplitString() As String = Split(Params(2), Chr(13))
                              For i As Integer = 0 To UBound(SplitString)
                                  Select Case SplitString(i)
                                      Case "GC-IRE XXXXXXXX"
                                          ' Do stuff
                                          Exit For
                                      Case "GC-IRE YYYYYYYY"
                                          ' Do other stuff
                                          Exit For
                          
                                      Case Else
                                          hs.WriteLog("drhsIpPlugin", "Volume is now: " & right(SplitString(0),3) & "(originally [" & SplitString(0) & "]")
                                  End Select            
                              Next
                          End Sub
                          The first thing I'm trying to get is the actual volume information.

                          Here's what's hitting the logs right now (from the above script - everything hits the "else" condition):
                          Code:
                          Jul-15 6:38:01 PM	 	drhsIpPlugin	Volume is now: 39 (originally [?? VID 3 VOL 39 ]
                          I'm pretty sure I want to do something very different than the "case" thing, but I don't know how to do it. I think what I want is something like: "look for the 'VOL ' (including the space) then grab the two digits that come after the space and use them as a numeric to set the value of the virtual device."

                          FWIW, I also want to grab the "VID 3" portion (other cases are VID 1, VID 2, VID 4, CD, TUNER, TAPE) and use those to set another virtual device.

                          Hoping this is as easy for one of you as it is hard for me. And then I'll learn something... THX!
                          Hi gregoryx,
                          We should be able to do something with that. It looks like the preamp is returning everything in one line. Do you have a link to any documentation on the protocol the preamp uses? It would be interesting to see if there any non-text bytes in the response. Can you try this example script?
                          Code:
                          Sub Main(param() As Object)
                              Dim ConnectionName As String = param(0)
                              Dim FromIp As String = param(1)
                              Dim AsciiData As String = param(2)
                              Dim BinaryData(UBound(param(3))) As Byte
                              Array.Copy(param(3), BinaryData, BinaryData.Length)
                          
                              hs.WriteLog("Pass-thru", "There are " & BinaryData.Length.ToString & " bytes of binary data.")
                          
                              For n as Int16 = 0 to UBound(BinaryData)
                                  hs.WriteLog("Pass-thru" & n.ToString, BinaryData(n).ToString)
                              Next
                          End Sub
                          -David[/QUOTE]

                          Comment


                            New version to help with iRule feedback

                            I have just posted a new version to the release thread here

                            'drule' will post usage instructions here
                            cheeryfool

                            Comment


                              great news !

                              Comment


                                I threw together a guide for using iRule feedbacks with version 25 of the plugin. Please excuse the poor formatting.

                                -David

                                A quick guide to implementing an iRule feedback with v25 of the plugin.pdf

                                Comment

                                Working...
                                X