Announcement

Collapse
No announcement yet.

IP and Serial Plugin

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

    #76
    Just to help anyone else who wants control XBMC with hstouch using this plugin. Here are some of the commands I found useful putting in as a TCP clinet the IP address of my raspberry pi running xbmc and the port 9090.

    XBMC DOWN=C Escaped,request={"jsonrpc":"2.0","method":"Input.Down","id": 1}/r
    XBMC RIGHT=C Escaped,request={"jsonrpc":"2.0","method":"Input.Right","id" :1}/r
    XBMC SELECT=C Escaped,request={"jsonrpc":"2.0","method":"Input.Select","id ":1}/r
    XBMC LEFT=C Escaped,request={"jsonrpc":"2.0","method":"Input.Left","id": 1}/r
    XBMC INFO=C Escaped,request={"jsonrpc":"2.0","method":"Input.Info","id": 1}/r
    XBMC HOME=C Escaped,request={"jsonrpc":"2.0","method":"Input.Home","id": 1}/r
    XBMC UP=C Escaped,request={"jsonrpc":"2.0","method":"Input.Up","id":1}/r
    XBMC ContextMenu=C Escaped,request={"jsonrpc":"2.0","method":"Input.ContextMenu ","id":1}/r
    XBMC 30SecForward=C Escaped,request={"jsonrpc":"2.0","id":1,"method":"Player.See k","params":{"playerid":1,"value":"smallforward"}}/r
    XBMC 30SecBkwd=C Escaped,request={"jsonrpc":"2.0","id":1,"method":"Player.See k","params":{"playerid":1,"value":"smallbackward"}}/r
    XBMC QUIT=C Escaped,request={"jsonrpc":"2.0","method":"Application.Quit" ,"id":1}/r
    XBMC BACK=C Escaped,request={"jsonrpc":"2.0","method":"Input.Back","id": 1}/r
    XBMC PLAYPAUSE=C Escaped,request={"jsonrpc":"2.0","method":"Player.PlayPause" ,"params":{"playerid":1},"id":1}/r
    XBMC STOP=C Escaped,request={"jsonrpc":"2.0","method":"Player.Stop","par ams":{"playerid":1},"id":1}/r
    XBMC SUBTITLENEXT=C Escaped,request={"jsonrpc":"2.0","id":1,"method":"Player.Set Subtitle","params":{"playerid":1,"subtitle":"next"}}
    XBMC SUBTITLEOFF=C Escaped,request={"jsonrpc":"2.0","id":1,"method":"Player.Set Subtitle","params":{"playerid":1,"subtitle":"off"}}
    XBMC SUBTITLEON=C Escaped,request={"jsonrpc":"2.0","id":1,"method":"Player.Set Subtitle","params":{"playerid":1,"subtitle":"off"}}
    XBMC SHOWOSD=C Escaped,request={"jsonrpc":"2.0","method":"Input.ShowOSD","i d":1}/r
    XBMC SETFULLSCREEN=C Escaped,request={"jsonrpc": "2.0", "method": "GUI.SetFullscreen", "params": { "fullscreen": "toggle" }, "id": "1"}
    XBMC MOVIESLIST=C Escaped,request={ "jsonrpc": "2.0", "method": "GUI.ActivateWindow", "params": { "window": "video", "parameters": [ "MovieTitles" ] }, "id": 1 }
    XBMC TVLIST=C Escaped,request={"jsonrpc": "2.0", "method": "GUI.ActivateWindow", "params": { "window": "video", "parameters": [ "TvShowTitles" ] }, "id": 1 }

    Comment


      #77
      Originally posted by dinki
      Hey guys. I'm looking for a solution for tying my wired alarm wires (no panel) to HS. I have a weedertech digital IO board which outputs text when an input on the board changes state via the serial port. For example, if input A changes from open to closed it will output 'A1' as text on the serial port. If it changes back to closed it will output 'A0'. Each input is tied to either a window or multiple windows in a zone or a door.

      I would like to use this in conjunction with BLSecurity. Can the output of my serial port be fed into this plugin and then create devices with on/off states representing different zones/doors that I could then use in BLSecurity? BLSecurity, to the best of my knowledge, can use any HS device as input.
      Hi. Yes, this should be possible. Go to the Connections screen of the plugin config and set up a connection along these lines:
      Name: "Alarm Status" or equivalent
      Type: Serial
      Host/Client: Client
      Address: The numeric COM Port that your IO board is connected to e.g. 2

      Then Save

      Now, create a new Event with a trigger type of "DR IP/Serial Received Triggers". In the Connection drop-down select the connection that you created in the plugin config. Enter the expected string e.g. A1 and (probably) Raw Text as the type. If Raw Text doesn't work, experiment with the other types

      Then setup the action, which could be setting a value on a Virtual Device, or possibly even a direct action for BLSecurity
      cheeryfool

      Comment


        #78
        This plugin is really interesting!
        I'm doing some tests with my serial RFID reader and I can trigger a script or an event.
        Question:
        is possible to set a value to a device with a data from serial?
        example:
        from the serial line comes the data "27.5" --> the device A1 is assigned value "27.5" (A1 value = 27.5).
        Then when a new value arrive from serial line "28.3", the A1 device must to change from old value to new (28.3)?
        In summary: is it possible take the value from a serial interface and assign it to a device?

        Thanks!

        Cris

        Comment


          #79
          Originally posted by khriss75 View Post
          This plugin is really interesting!
          I'm doing some tests with my serial RFID reader and I can trigger a script or an event.
          Question:
          is possible to set a value to a device with a data from serial?
          example:
          from the serial line comes the data "27.5" --> the device A1 is assigned value "27.5" (A1 value = 27.5).
          Then when a new value arrive from serial line "28.3", the A1 device must to change from old value to new (28.3)?
          In summary: is it possible take the value from a serial interface and assign it to a device?

          Thanks!

          Cris
          -Save this as a script in the scripts folder (.vb file extension).
          -Under the plugin connections tab, select the script name in the script drop down box and then click save at the bottom.
          -Have fun. (Disclaimer, code just typed out from my head and not tested)
          Code:
          Public Sub Main(ByVal Params As Object)
               Dim p1 As String = Params.ToString
               'Dim p1() As String = Split(Params.ToString,",")  'Use if the incoming data is delimited (and comment out the line above)
               hs.SetDeviceString("A1",p1)
               'hs.SetDeviceString("A1",p1(0)) 'Use if the incoming data is delimited (and comment out the line above)
          
          End Sub

          Comment


            #80
            Originally posted by Automated View Post
            -Save this as a script in the scripts folder (.vb file extension).
            -Under the plugin connections tab, select the script name in the script drop down box and then click save at the bottom.
            -Have fun. (Disclaimer, code just typed out from my head and not tested)
            Code:
            Public Sub Main(ByVal Params As Object)
                 Dim p1 As String = Params.ToString
                 'Dim p1() As String = Split(Params.ToString,",")  'Use if the incoming data is delimited (and comment out the line above)
                 hs.SetDeviceString("A1",p1)
                 'hs.SetDeviceString("A1",p1(0)) 'Use if the incoming data is delimited (and comment out the line above)
            
            End Sub
            Automate,
            you and David are fantastic! Thanks!!!
            I did some tests and your script works perfectly! I have reached my goal! THANK YOU!

            Now one thing more difficult if this is possible:

            from the serial line: "A1 23.5"
            The device A1 must be set to 23.5

            from the serial line: "A2 25.7"
            The device must be set to 25.7 A2

            from the serial line: "A3 hello!"
            A3 The device must be set to "hello!"

            My question: Is it possible to use the first two or three or X letters to select the device, and the rest of the string is the value to be set to the device?

            Thanks in advance!

            Ciao from Italy!

            Comment


              #81
              Awsome plugin!
              Thanks for the good work, I am using this plugin to control my ETH-RLY16 relay board. Using the plugin, saved me a lot of headache

              Anyhow, is there a way to retrieve the status of the relays (I know the command to sent, but no information is comming into the plugin)

              Thanks in advantage

              *** solved this one in #139 ***
              Last edited by Redbull; March 29, 2013, 08:48 AM.

              Comment


                #82
                Hi
                I am trying to use the flow control RTS/CTS in a serial port, i test in hercules and i can see the feedback, but dont work with this plugin, can someone tell me a way to fix this ?
                Thanks

                Comment


                  #83
                  Hello,

                  I have found 2 bugs:
                  1. I installed 2 TCPIP relay cards and have 2 connections in the setup screen. Saving the config (even if nothing is changed) will restart the interfaces, however they fail both. Resolving this is done by restarting Homeseer.
                  2. I have for both connections 2 VB scrips to return some values of both relay cards (pass through scrips as defined in the setup screen). However a script calling a predefined command on connection1 is firing the passthrough script of connection 2 instead of the one on the first connection.
                  Script to test the return values:
                  Public Sub Main(ByVal Params As Object)
                  Dim IPP As Object = hs.Plugin("DR IP/Serial PlugIn")
                  'IPP.Send("GetRelayStat", "CV Controller 2")
                  IPP.Send("Get Input Voltage", "CV Controller 1")
                  IPP.Send("Get Input Voltage", "CV Controller 2")
                  End Sub

                  Script on connection 2:
                  Public Sub Main(ByVal Params As Object)
                  Dim p1 as String = Params.ToString
                  Dim HexString As String = Asc(p1)
                  'hs.writelog("HH Test","HexString: " & Asc(p1))
                  hs.SetDeviceString("Z2", (Asc(p1)/10) & " V")
                  End Sub

                  Any clues on this or are they really 2 bugs?


                  Kind regards,

                  Hans

                  Comment


                    #84
                    Ok, I finally ran into a need to control a BD 3D player over the LAN rather than getting IR learned and then repeated. After all, the device is already on the LAN with HS, so why not have HS be able to control and/or monitor the player status (for HSTouch screen display for example).

                    Now I am trying to wrap my head around the plug-in. I can blindly send commands to the device and provided it is in an ON state already, it responds to the codes correctly using the C_escaped and appending commands with \r (enter?).

                    What I would like is to send status requests and capture the responses. How does that work?

                    For example, what chapter, what track, index position, firmware revision, general info, BD player model #, and all kinds of commands send responses to indicate success or failure.


                    I'd like to create device codes for HSTouch display/control purposes.

                    I know all these things are possible, but the lack of docs in one consolidated place (rather than trying to figure it out from reading the entire thread in this forum!, which I did), is making it tough to fill in the gaps.

                    It is doing what I need as proof of concept. I had hoped to get this device rolled into UltraJones Pioneer AVR plugin, but this plug-in seems to allow most of the options available in that plug-in, just not so automatic.

                    Thanks again for making it possible. Very well done.
                    Last edited by huggy_d1; April 15, 2013, 08:44 PM.
                    huggy_d1

                    Automating made easy

                    Comment


                      #85
                      great plgin ... just what ive been looking for ... but

                      A few issues ive noted
                      Im trying to connect to Yamaha A2020 using TCP connection
                      (note i can use putty and can sucesfully send commands and recieve status responses
                      using putty TCP connection with raw text)
                      hence have configured plugin with same settings as i use in putty for
                      TCP, IP address, port

                      Issue 1
                      if i select "persistent" .. indeed it continually re establih connection (appears yamaha
                      is timing out? ) and hence i get continual connection closed followed by connection
                      restablish msg in HS log
                      however if i uncheck persistent (and save change) ... it simply continues same behaviour
                      I then disable the plugin ... and log says shutdown ... but the persistent behaviour contonues ... untill i completely close HS .. (then ok) .. and when restart ok (plugin is disabled)
                      it appears that after setting persistent ... this contonues regardless of unchecking and even disabling the plugin
                      Issue 2
                      I cannot get the commands to cause ANY action to or from A2020 (using same commands that work ok
                      from putty)
                      the yamaha command structure specifies to send the command with [CR/LF],
                      im assuming this is automatically inserted by plugin
                      in the HS log, i see it making connection? and the event ive created ("a2020 pwr status") sending the commands text ... but not much else (log entries below with persistent not selected after a restart)

                      in putty i enter the command in simple text
                      eg @MAIN:PWR=?
                      and get a number of responses in similar format (exactly as the yamaha protocol doc states)
                      under commands tab i enter exactly same command that i use for putty and select "raw text" ..

                      there must be something simple that im doing wrong?
                      does the below log look as should be expected?
                      (i am expecting to see a whole bunch responses back similar to putty)
                      ***********
                      25/04/2013 11:11:04 AM DR IP/Serial PlugIn Starting Tcp client for yamaha A2020 at address 192.168.1.102:50000
                      25/04/2013 11:11:04 AM DR IP/Serial PlugIn There are 1 TcpClients for yamaha A2020
                      25/04/2013 11:21:00 AM weatherXML Check for any active daily downloads
                      25/04/2013 11:29:36 AM Event Event Trigger "a2020 pwr status"
                      25/04/2013 11:29:36 AM DR IP/Serial PlugIn Starting Tcp client for yamaha A2020 at address 192.168.1.102:50000
                      25/04/2013 11:29:36 AM DR IP/Serial PlugIn There are 1 TcpClients for yamaha A2020
                      *******

                      .. and finally a suggestion for the plugin
                      in the commands tab , where you enter
                      name, type, data ..... if a button could be added beside each command to "test"
                      this would be enormously helpful when entering commands to check they are correct

                      .. keep up the great work!

                      EDIT
                      issue 2 resolved (from other posts discovered that using C escaped format followed by \r\n
                      Correctly sends the commands ... All ok
                      Issue 1 .. Persistent works ok after enabling plugin and setting for first time ...
                      But if later deselecting .... The plugin goes into some weird behaviour and cycles
                      Between establishing and shutting down connections quite rapidly
                      Requiring the plugin to be shutdown and restarted
                      Last edited by gregy; April 25, 2013, 02:50 AM.

                      Comment


                        #86
                        IP and Serial Plugin

                        I could be wrong but I think the developer may have abandoned this project as these errors have been present for a long time...

                        Comment


                          #87
                          Sorry for the long absence. Glad to see so many people finding my plugin useful.

                          I've started working on an HS3 version.
                          Initially I will port the HS2 to HS3 as closely to like-for-like as I can and then I'll look to add feature requests and fix up any peculiarities that have been reported.

                          Watch this space!

                          -David

                          Comment


                            #88
                            I'm close to being ready to share an alpha version of the plugin for HS3. Currently there's no config page, so you have to copy your inifile from HS2. You can then add events with both triggers and actions. Let me know if you'd like to test.

                            -David

                            Comment


                              #89
                              OK, here it is. There is no config page yet - you have to copy your HS2 config.

                              Copy the contents of your HSPI_DRHSIPPLUGIN.ini file from HS2\Config to drhsIpPlugIn.ini in HS3\Config (Note slightly different filename).

                              Extract HSPI_drhsIpPlugin.exe from the attached zip file to your HS3 directory.

                              Good luck!

                              -David
                              Attached Files

                              Comment


                                #90
                                Thanks, David.

                                I've installed it and I can see the commands from my old INI file as actions.

                                I'm running off a test machine so I've not yet had a chance to test with my actual interfaces, but so far so good!

                                Cheers
                                Nicolai L

                                Comment

                                Working...
                                X