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 Vodden View Post
    I do not. Nor can I figure out how to create one with that name. Currently using the trial version, does that make a difference? I can't find a homeseer device in the Browse and Import Device page.
    Click on the green + symbol under the devices tab in iRule Builder. It should work with the trial version. You can name it anything you want.

    -David

    Comment


      Originally posted by drule View Post
      Do you have a Homeseer device in your iRule builder?

      [ATTACH]57794[/ATTACH]

      -David
      Once again the forum community saves my hide. This meat stick has it working now!

      Thank You!

      Comment


        Now What?

        So I've got an iRule connection opened, but I'm clueless about what I need to be using for commands. Could someone get me started?

        Turning devices on/off
        Dimming
        Triggering events
        Triggering scenes
        ...

        Thanks again

        Comment


          JSON Call to

          Hi drule, I am having an issue calling this plugin from JSON.

          http://www.homeseer.com/support/home..._with_json.htm

          /JSON?request=pluginfunction&function=FUNCTION_NAME&plugin=PL UGIN_NAME&instance=INSTANCE_NAME&P#-PN=PARAMETER

          Calls a plugin function by name and returns the result. Paramers P1-P# are the parameters to the function. The instance can be left off for single instance plugins. For example, to call the Z-Wave plugin function Configuration_set:

          /JSON?request=pluginfunction&function=Configuration_Set&plugi n=Z-Wave&P1=00129835&P2=3&P3=4&P4=1&P5=30

          Code:
          http://192.168.0.11/JSON?request=pluginfunction&function=Ext_Send_Command&plugin=drhsIpPlugin&P1=Test%20Serial%20Connection&P2=Test%20Command
          returns
          { "Response":"" }

          Are these the correct function names? They work in scripts, but not from JSON.

          Comment


            Originally posted by davros View Post
            Hi drule, I am having an issue calling this plugin from JSON.
            I've never tried calling the plugin from JSON. Will have to look in to this and get back to you.

            -David

            Comment


              A THOUSAND THANKYOU's! <stream of happy emoticons...>

              This is such a critical plugin I am surprised no-one has discovered this? Perhaps I just am not calling it correctly?

              The ability to call this plugin via JSON is essential for my project.

              I have a number of devices that will be controlled and monitored by Homeseer and "externally to HS" via other systems. For example, myhome audio distribution amp. (Sonance DAB1) is controlled via serial port connected to HS via your plugin.

              * It is controlled via Homeseer (turn off all zones when leavung the house etc.)
              * It is controlled via an iPad using CommandFusion iViewer (via JSON calls)

              I send commands (ie. ":V143" = Set Zone 1 Volume to 43) from both HS and CommandFusion via your plugin.

              While in theory, I could use Event Actions to do this, it's not practical as I would need over 1000 Events to cover all values (as json calls do not allow calling of a scipt with parameters (?!?).

              I have a load of other serial devices to interface too...relays, matrix swith, tivo (ethernet but single session), etc.

              This is really important to me.

              THANKYOU.

              PS. Would you consider opensourcing your plugin? I think the community would love to support you in it's development?

              PS. Just thought of another way to skin this cat. I could setup a TCP session (client) in CommandFusion and have this connect to another interface in your plugin and then run a script to relay the commands. Like this

              Code:
              Public Const ScriptName = "DAB1_Relay_Cmd"
              
              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("DAB1",Param(0)+" " +Param(1)+ " " + Param(2))
              
              	Dim datarecieved As String = Param(2)
              
              	Try
              	  hs.WriteLog(ScriptName, "Sending to DAB1 " + datarecieved) 
                    hs.PluginFunction("drhsIpPlugin", "", "Ext_Send_Data", New Object(){"DAB1", datarecieved+"\r\n", "C Escaped"})	   
              	Catch ex As Exception
              	  hs.WriteLog(ScriptName, "Error C: " & ex.Message) 
                  End Try
              
              End Sub
              Code:
              Public Const ScriptName = "DAB1_Parse_In"
              
              Sub Main(ByVal param as Object)
                hs.WriteLog("DAB1ParseIn","Call one of my sub functions please")
              
                  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)
                  Dim Command As String = datarecieved.Substring(1, 1)
                  Dim Param1 As String = datarecieved.Substring(2, 1)
                  Dim Param2 As String
                  Dim DeviceName As String
                  Dim SetTo As Integer
              	Dim DevRef As Integer
              	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 datarecieved.Length = 3 Then
                        DeviceName = "DAB1 Power"
              		  SetTo = Convert.ToInt32(Param1)
                      Else
                        Param2 = datarecieved.Substring(3, datarecieved.Length - 3)
                        DeviceName = "DAB1 Zone " & Param1 & " Power "
                        SetTo = Convert.ToInt32(Param2)
                      End If
                    Case "S" 'Source
                        Param2 = datarecieved.Substring(3, 1)
                        DeviceName="DAB1 Zone " & Param1 & " Source"
              		  SetTo= Convert.ToInt32(Param2)
                    Case "R"   ' Tuner Memory. Note this can be 0 to 12
              	      Param1 = datarecieved.Substring(2, datarecieved.Length - 2)
                        DeviceName= "DAB1 Tuner"
              		  SetTo=Convert.ToInt32(Param1)
                    Case "N"   ' Tuner Band
                        DeviceName= "DAB1 Band"
              		  SetTo=Convert.ToInt32(Param1)
              	  Case "V" 'Volume
                        Param2 = datarecieved.Substring(3, datarecieved.Length - 3)
                        DeviceName = "DAB1 Zone " & Param1 & " Volume"
              		  SetTo=Convert.ToInt32(Param2)
                    Case "G" 'Page Volume
                        Param2 = datarecieved.Substring(3, datarecieved.Length - 3)
                        DeviceName="DAB1 Zone " & Param1 & " Page Volume"
              		  SetTo=Convert.ToInt32(Param2)
                    Case "M" 'Mute
                        Param2 = datarecieved.Substring(3, 1)
                        DeviceName="DAB1 Zone " & Param1 & " Mute"
              		  SetTo=Convert.ToInt32(Param2)
                    Case "B" 'Balance Note: Param 2 can be -10 to +10
                        Param2 = datarecieved.Substring(3, datarecieved.Length - 3)
                        DeviceName="DAB1 Zone " & Param1 & " Balance"
              		  SetTo=Convert.ToInt32(Param2)
                    Case "L" 'Bass
                        Param2 = datarecieved.Substring(3, datarecieved.Length - 3)
                        DeviceName="DAB1 Zone " & Param1 & " Bass"
              		  SetTo=Convert.ToInt32(Param2)
                    Case "H" 'Treble
                        Param2 = datarecieved.Substring(3, datarecieved.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 Sub
              Sweet. The Hercules utility (http://www.hw-group.com/products/hercules/index_en.html) is a fantastic tool for testing out this sort of thing. Invaluable...and free
              Attached Files
              Last edited by davros; November 29, 2016, 06:46 AM.

              Comment


                Originally posted by Vodden View Post
                So I've got an iRule connection opened, but I'm clueless about what I need to be using for commands. Could someone get me started?

                Turning devices on/off
                Dimming
                Triggering events
                Triggering scenes
                ...

                Thanks again
                This is how I do it.

                In irule my commands are raw text.

                I have a connection listening via the plugin

                The I create an event based upon that raw text. The event is tied to the plugin.

                So an example Listen for "theaterlight100". The event will control my upb light switch. When it hears that raw text phrase "theaterlight100" it turns my Theater Lights on to 100%.

                I am not sure this is how it is meant to to it but it works.

                Comment


                  Originally posted by hunter69 View Post
                  This is how I do it.

                  In irule my commands are raw text.

                  I have a connection listening via the plugin

                  The I create an event based upon that raw text. The event is tied to the plugin.

                  So an example Listen for "theaterlight100". The event will control my upb light switch. When it hears that raw text phrase "theaterlight100" it turns my Theater Lights on to 100%.

                  I am not sure this is how it is meant to to it but it works.
                  That's perfect, exactly how I do it too.

                  -David

                  Comment


                    Originally posted by drule View Post
                    That's perfect, exactly how I do it too.

                    -David
                    Now I have been searching hard on how to send feed back from HS3 to Irule. Do you possibly have any instructions on how to do this? I see you talking about feedback but I have not found any instructions.

                    Thanks for any help
                    Bill

                    Comment


                      Originally posted by hunter69 View Post
                      Now I have been searching hard on how to send feed back from HS3 to Irule. Do you possibly have any instructions on how to do this? I see you talking about feedback but I have not found any instructions.

                      Thanks for any help
                      Bill
                      If you go back a few pages there should be a PDF I posted on how to send feedbacks. I'll ask cheeryfool to add it to the first page of the download thread too.

                      -David

                      Comment


                        Originally posted by hunter69 View Post
                        This is how I do it.



                        In irule my commands are raw text.



                        I have a connection listening via the plugin



                        The I create an event based upon that raw text. The event is tied to the plugin.



                        So an example Listen for "theaterlight100". The event will control my upb light switch. When it hears that raw text phrase "theaterlight100" it turns my Theater Lights on to 100%.



                        I am not sure this is how it is meant to to it but it works.


                        I ended up doing it with JSON commands and an HTTP connection. I couldn't seem to get iRule to connect to the TCP server but with the HTTP connection I don't need it anymore.

                        Comment


                          Originally posted by drule View Post
                          If you go back a few pages there should be a PDF I posted on how to send feedbacks. I'll ask cheeryfool to add it to the first page of the download thread too.



                          -David


                          I saw the mention of the PDF but didn't see. I will look for it, thanks


                          Sent from my iPhone using Tapatalk

                          Comment


                            Originally posted by Vodden View Post
                            I ended up doing it with JSON commands and an HTTP connection. I couldn't seem to get iRule to connect to the TCP server but with the HTTP connection I don't need it anymore.


                            If you are interested I would be willing to share my connection settings. Just thought I would offer


                            Sent from my iPhone using Tapatalk

                            Comment


                              Originally posted by hunter69 View Post
                              If you are interested I would be willing to share my connection settings. Just thought I would offer


                              Sent from my iPhone using Tapatalk


                              I will take you up on that Hunter. If you go back 15-20 posts I posted my plug in config as well.

                              Comment


                                I am at work and will post the info when I get home


                                Sent from my iPhone using Tapatalk

                                Comment

                                Working...
                                X